b2evolution

Multilingual multiuser multiblog engine

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

Source for file _coll_logo.widget.php

Documentation is available at _coll_logo.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: _coll_logo.widget.php,v 1.10 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 coll_logo_Widget$db_row NULL )
  42.     {
  43.         // Call parent constructor:
  44.         parent::ComponentWidget$db_row'core''coll_logo' );
  45.     }
  46.  
  47.  
  48.     /**
  49.      * Get name of widget
  50.      */
  51.     function get_name()
  52.     {
  53.         return T_('Image / Blog logo');
  54.     }
  55.  
  56.  
  57.     /**
  58.      * Get a very short desc. Used in the widget list.
  59.      *
  60.      * MAY be overriden by core widgets. Example: menu link widget.
  61.      */
  62.     function get_short_desc()
  63.     {
  64.         $this->load_param_array();
  65.         if!empty($this->param_array['logo_file') )
  66.         {
  67.             return $this->param_array['logo_file'];
  68.         }
  69.         else
  70.         {
  71.             return $this->get_name();
  72.         }
  73.     }
  74.  
  75.  
  76.   /**
  77.      * Get short description
  78.      */
  79.     function get_desc()
  80.     {
  81.         return T_('Include an image/logo from the blog\'s file root.');
  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.         $r array_mergearray(
  94.                 'logo_file' => array(
  95.                     'label' => T_('Image filename'),
  96.                     'note' => T_('The image/logo file must be uploaded to the root of the Blog\'s media dir'),
  97.                     'defaultvalue' => 'logo.png',
  98.                     'valid_pattern' => array'pattern'=>'¤^[a-z0-9_\-][a-z0-9_.\-]*$¤i',
  99.                                                                         'error'=>T_('Invalid filename.') ),
  100.                 ),
  101.             )parent::get_param_definitions$params )    );
  102.  
  103.         return $r;
  104.  
  105.     }
  106.  
  107.  
  108.     /**
  109.      * Display the widget!
  110.      *
  111.      * @param array MUST contain at least the basic display params
  112.      */
  113.     function display$params )
  114.     {
  115.         global $Blog;
  116.  
  117.         $this->init_display$params );
  118.  
  119.         // Collection logo:
  120.         echo $this->disp_params['block_start'];
  121.  
  122.         $title '<a href="'.$Blog->get'url''raw' ).'">'
  123.                             .'<img src="'.$Blog->get_media_url().$this->disp_params['logo_file'].'" alt="'.$Blog->dget'name''htmlattr' ).'" />'
  124.                             .'</a>';
  125.         $this->disp_title$title );
  126.  
  127.         echo $this->disp_params['block_end'];
  128.  
  129.         return true;
  130.     }
  131. }
  132.  
  133.  
  134. /*
  135.  * $Log: _coll_logo.widget.php,v $
  136.  * Revision 1.10  2010/02/08 17:54:48  efy-yury
  137.  * copyright 2009 -> 2010
  138.  *
  139.  * Revision 1.9  2009/09/14 13:54:13  efy-arrin
  140.  * Included the ClassName in load_class() call with proper UpperCase
  141.  *
  142.  * Revision 1.8  2009/09/12 11:03:13  efy-arrin
  143.  * Included the ClassName in the loadclass() with proper UpperCase
  144.  *
  145.  * Revision 1.7  2009/03/08 23:57:46  fplanque
  146.  * 2009
  147.  *
  148.  * Revision 1.6  2008/02/13 07:37:55  fplanque
  149.  * renamed Blog Logo widget
  150.  *
  151.  * Revision 1.5  2008/01/21 09:35:37  fplanque
  152.  * (c) 2008
  153.  *
  154.  * Revision 1.4  2007/12/23 17:47:59  fplanque
  155.  * fixes
  156.  *
  157.  * Revision 1.3  2007/12/23 14:14:25  fplanque
  158.  * Enhanced widget name display
  159.  *
  160.  * Revision 1.2  2007/12/22 19:55:00  yabs
  161.  * cleanup from adding core params
  162.  *
  163.  * Revision 1.1  2007/06/25 11:02:11  fplanque
  164.  * MODULES (refactored MVC)
  165.  *
  166.  * Revision 1.3  2007/06/20 21:42:13  fplanque
  167.  * implemented working widget/plugin params
  168.  *
  169.  * Revision 1.2  2007/06/20 00:48:17  fplanque
  170.  * some real life widget settings
  171.  *
  172.  * Revision 1.1  2007/06/18 21:25:47  fplanque
  173.  * one class per core widget
  174.  *
  175.  */
  176. ?>

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