b2evolution PHP Cross Reference Blogging Systems

Source: /inc/widgets/widgets/_free_html.widget.php - 135 lines - 3221 bytes - Summary - Text - Print

Description: This file implements the xyz Widget class. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the xyz Widget class.
   4   *
   5   * This file is part of the evoCore framework - {@link http://evocore.net/}
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   9   *
  10   * {@internal License choice
  11   * - If you have received this file as part of a package, please find the license.txt file in
  12   *   the same folder or the closest folder above for complete license terms.
  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  14   *   then you must choose one of the following licenses before using the file:
  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  17   * }}
  18   *
  19   * @package evocore
  20   *
  21   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  22   * @author fplanque: Francois PLANQUE.
  23   *
  24   * @version $Id: _free_html.widget.php 6136 2014-03-08 07:59:48Z manuel $
  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  load_class( 'widgets/model/_widget.class.php', 'ComponentWidget' );
  29  
  30  /**
  31   * ComponentWidget Class
  32   *
  33   * A ComponentWidget is a displayable entity that can be placed into a Container on a web page.
  34   *
  35   * @package evocore
  36   */
  37  class free_html_Widget extends ComponentWidget
  38  {
  39      /**
  40       * Constructor
  41       */
  42  	function free_html_Widget( $db_row = NULL )
  43      {
  44          // Call parent constructor:
  45          parent::ComponentWidget( $db_row, 'core', 'free_html' );
  46      }
  47  
  48  
  49      /**
  50       * Get name of widget
  51       */
  52  	function get_name()
  53      {
  54          $title = T_( 'Free HTML' );
  55          return $title;
  56      }
  57  
  58  
  59      /**
  60       * Get a very short desc. Used in the widget list.
  61       *
  62       * @return string The block title, the first 60 characters of the block
  63       *                content or an empty string.
  64       */
  65  	function get_short_desc()
  66      {
  67          if( empty( $this->disp_params['title'] ) )
  68          {
  69              return strmaxlen( $this->disp_params['content'], 60, NULL, /* use htmlspecialchars() */ 'formvalue' );
  70          }
  71  
  72          return format_to_output( $this->disp_params['title'] );
  73      }
  74  
  75  
  76    /**
  77       * Get short description
  78       */
  79  	function get_desc()
  80      {
  81          return T_('Custom text/HTML of your choice.');
  82      }
  83  
  84  
  85    /**
  86     * Get definitions for editable params
  87     *
  88       * @see Plugin::GetDefaultSettings()
  89       * @param local params like 'for_editing' => true
  90       */
  91  	function get_param_definitions( $params )
  92      {
  93          // Demo data:
  94          $r = array_merge( array(
  95                  'title' => array(
  96                      'label' => T_('Block title'),
  97                      'size' => 60,
  98                  ),
  99                  'content' => array(
 100                      'type' => 'html_textarea',
 101                      'label' => T_('Block content'),
 102                      'rows' => 10,
 103                  ),
 104              ), parent::get_param_definitions( $params )    );
 105  
 106          return $r;
 107  
 108      }
 109  
 110  
 111      /**
 112       * Display the widget!
 113       *
 114       * @param array MUST contain at least the basic display params
 115       */
 116  	function display( $params )
 117      {
 118          global $Blog;
 119  
 120          $this->init_display( $params );
 121  
 122          // Collection common links:
 123          echo $this->disp_params['block_start'];
 124  
 125          $this->disp_title( $this->disp_params['title'] );
 126  
 127          echo format_to_output( $this->disp_params['content'] );
 128  
 129          echo $this->disp_params['block_end'];
 130  
 131          return true;
 132      }
 133  }
 134  
 135  ?>

title

Description

title

Description

title

Description

title

title

Body