b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _free_html.widget.php

Documentation is available at _free_html.widget.php

  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-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  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,v 1.22 2010/02/08 17:54:48 efy-yury Exp $
  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. {
  38.     /**
  39.      * Constructor
  40.      */
  41.     function free_html_Widget$db_row NULL )
  42.     {
  43.         // Call parent constructor:
  44.         parent::ComponentWidget$db_row'core''free_html' );
  45.     }
  46.  
  47.  
  48.     /**
  49.      * Get name of widget
  50.      */
  51.     function get_name()
  52.     {
  53.         $title T_'Free HTML' );
  54.         return $title;
  55.     }
  56.  
  57.  
  58.     /**
  59.      * Get a very short desc. Used in the widget list.
  60.      *
  61.      * @return string The block title, the first 60 characters of the block
  62.      *                 content or an empty string.
  63.      */
  64.     function get_short_desc()
  65.     {
  66.         ifempty$this->disp_params['title') )
  67.         {
  68.             return strmaxlen$this->disp_params['content']60NULL/* use htmlspecialchars() */ 'formvalue' );
  69.         }
  70.  
  71.         return format_to_output$this->disp_params['title');
  72.     }
  73.  
  74.  
  75.   /**
  76.      * Get short description
  77.      */
  78.     function get_desc()
  79.     {
  80.         return T_('Custom text/HTML of your choice.');
  81.     }
  82.  
  83.  
  84.   /**
  85.    * Get definitions for editable params
  86.    *
  87.      * @see Plugin::GetDefaultSettings()
  88.      * @param local params like 'for_editing' => true
  89.      */
  90.     function get_param_definitions$params )
  91.     {
  92.         // Demo data:
  93.         $r array_mergearray(
  94.                 'title' => array(
  95.                     'label' => T_('Block title'),
  96.                     'size' => 60,
  97.                 ),
  98.                 'content' => array(
  99.                     'type' => 'html_textarea',
  100.                     'label' => T_('Block content'),
  101.                     'rows' => 10,
  102.                 ),
  103.             )parent::get_param_definitions$params )    );
  104.  
  105.         return $r;
  106.  
  107.     }
  108.  
  109.  
  110.     /**
  111.      * Display the widget!
  112.      *
  113.      * @param array MUST contain at least the basic display params
  114.      */
  115.     function display$params )
  116.     {
  117.         global $Blog;
  118.  
  119.         $this->init_display$params );
  120.  
  121.         // Collection common links:
  122.         echo $this->disp_params['block_start'];
  123.  
  124.         $this->disp_title$this->disp_params['title');
  125.  
  126.         echo format_to_output$this->disp_params['content');
  127.  
  128.         echo $this->disp_params['block_end'];
  129.  
  130.         return true;
  131.     }
  132. }
  133.  
  134.  
  135. /*
  136.  * $Log: _free_html.widget.php,v $
  137.  * Revision 1.22  2010/02/08 17:54:48  efy-yury
  138.  * copyright 2009 -> 2010
  139.  *
  140.  * Revision 1.21  2009/09/29 13:29:58  tblue246
  141.  * Proper security fixes
  142.  *
  143.  * Revision 1.20  2009/09/29 03:29:58  fplanque
  144.  * security fix
  145.  *
  146.  * Revision 1.19  2009/09/27 12:57:29  blueyed
  147.  * strmaxlen: add format param, which is used on the (possibly) cropped string.
  148.  *
  149.  * Revision 1.18  2009/09/14 13:54:13  efy-arrin
  150.  * Included the ClassName in load_class() call with proper UpperCase
  151.  *
  152.  * Revision 1.17  2009/09/12 11:03:13  efy-arrin
  153.  * Included the ClassName in the loadclass() with proper UpperCase
  154.  *
  155.  * Revision 1.16  2009/08/06 16:12:57  tblue246
  156.  * - Make block title field name translatable - again...
  157.  * - Show first 60 chars of block content if block title is empty
  158.  *
  159.  * Revision 1.15  2009/08/06 15:04:25  fplanque
  160.  * internal name is overkill. (too many confusing params not good)
  161.  * (maybe the first chars of content if title is empty ?)
  162.  *
  163.  * Revision 1.14  2009/08/03 14:05:04  tblue246
  164.  * minor
  165.  *
  166.  * Revision 1.13  2009/08/03 12:33:57  tblue246
  167.  * Add "internal name" field to HTML widget and make another field title translatable
  168.  *
  169.  * Revision 1.12  2009/03/13 02:32:07  fplanque
  170.  * Cleaned up widgets.
  171.  * Removed stupid widget_name param.
  172.  *
  173.  * Revision 1.11  2009/03/08 23:57:46  fplanque
  174.  * 2009
  175.  *
  176.  * Revision 1.10  2008/05/06 23:35:47  fplanque
  177.  * The correct way to add linebreaks to widgets is to add them to $disp_params when the container is called, right after the array_merge with defaults.
  178.  *
  179.  * Revision 1.8  2008/01/21 09:35:37  fplanque
  180.  * (c) 2008
  181.  *
  182.  * Revision 1.7  2007/12/23 16:16:18  fplanque
  183.  * Wording improvements
  184.  *
  185.  * Revision 1.6  2007/12/23 14:14:25  fplanque
  186.  * Enhanced widget name display
  187.  *
  188.  * Revision 1.5  2007/12/22 19:55:00  yabs
  189.  * cleanup from adding core params
  190.  *
  191.  * Revision 1.4  2007/12/22 17:02:50  yabs
  192.  * removing obsolete params
  193.  *
  194.  * Revision 1.3  2007/11/28 23:23:18  yabs
  195.  * clarification of params
  196.  *
  197.  * Revision 1.2  2007/11/27 10:02:04  yabs
  198.  * added params
  199.  *
  200.  * Revision 1.1  2007/06/25 11:02:25  fplanque
  201.  * MODULES (refactored MVC)
  202.  *
  203.  * Revision 1.2  2007/06/20 21:42:14  fplanque
  204.  * implemented working widget/plugin params
  205.  *
  206.  * Revision 1.1  2007/06/20 13:19:29  fplanque
  207.  * Free html widget
  208.  *
  209.  */
  210. ?>

Documentation generated on Sat, 06 Mar 2010 04:10:35 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).