b2evolution PHP Cross Reference Blogging Systems

Source: /inc/widgets/widgets/_coll_logo.widget.php - 134 lines - 3348 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: _coll_logo.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 coll_logo_Widget extends ComponentWidget
  38  {
  39      /**
  40       * Constructor
  41       */
  42  	function coll_logo_Widget( $db_row = NULL )
  43      {
  44          // Call parent constructor:
  45          parent::ComponentWidget( $db_row, 'core', 'coll_logo' );
  46      }
  47  
  48  
  49      /**
  50       * Get name of widget
  51       */
  52  	function get_name()
  53      {
  54          return T_('Image / Blog logo');
  55      }
  56  
  57  
  58      /**
  59       * Get a very short desc. Used in the widget list.
  60       *
  61       * MAY be overriden by core widgets. Example: menu link widget.
  62       */
  63  	function get_short_desc()
  64      {
  65          $this->load_param_array();
  66          if( !empty($this->param_array['logo_file'] ) )
  67          {
  68              return $this->param_array['logo_file'];
  69          }
  70          else
  71          {
  72              return $this->get_name();
  73          }
  74      }
  75  
  76  
  77    /**
  78       * Get short description
  79       */
  80  	function get_desc()
  81      {
  82          return T_('Include an image/logo from the blog\'s file root.');
  83      }
  84  
  85  
  86    /**
  87     * Get definitions for editable params
  88     *
  89       * @see Plugin::GetDefaultSettings()
  90       * @param local params like 'for_editing' => true
  91       */
  92  	function get_param_definitions( $params )
  93      {
  94          $r = array_merge( array(
  95                  'logo_file' => array(
  96                      'label' => T_('Image filename'),
  97                      'note' => T_('The image/logo file must be uploaded to the root of the Blog\'s media dir'),
  98                      'defaultvalue' => 'logo.png',
  99                      'valid_pattern' => array( 'pattern'=>'~^[a-z0-9_\-][a-z0-9_.\-]*$~i',
 100                                                                          'error'=>T_('Invalid filename.') ),
 101                  ),
 102              ), parent::get_param_definitions( $params )    );
 103  
 104          return $r;
 105  
 106      }
 107  
 108  
 109      /**
 110       * Display the widget!
 111       *
 112       * @param array MUST contain at least the basic display params
 113       */
 114  	function display( $params )
 115      {
 116          global $Blog;
 117  
 118          $this->init_display( $params );
 119  
 120          // Collection logo:
 121          echo $this->disp_params['block_start'];
 122  
 123          $title = '<a href="'.$Blog->get( 'url', 'raw' ).'">'
 124                              .'<img src="'.$Blog->get_media_url().$this->disp_params['logo_file'].'" alt="'.$Blog->dget( 'name', 'htmlattr' ).'" />'
 125                              .'</a>';
 126          $this->disp_title( $title );
 127  
 128          echo $this->disp_params['block_end'];
 129  
 130          return true;
 131      }
 132  }
 133  
 134  ?>

title

Description

title

Description

title

Description

title

title

Body