b2evolution PHP Cross Reference Blogging Systems

Source: /inc/widgets/widgets/_coll_avatar.widget.php - 145 lines - 3837 bytes - Summary - Text - Print

Description: This file implements the coll_avatar_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 coll_avatar_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   * Parts of this file are copyright (c)2008 by Daniel HAHLER - {@link http://daniel.hahler.de/}.
  10   *
  11   * {@internal License choice
  12   * - If you have received this file as part of a package, please find the license.txt file in
  13   *   the same folder or the closest folder above for complete license terms.
  14   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  15   *   then you must choose one of the following licenses before using the file:
  16   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  17   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  18   * }}
  19   *
  20   * @package evocore
  21   *
  22   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  23   * @author blueyed: Daniel HAHLER
  24   * @author fplanque: Francois PLANQUE.
  25   *
  26   * @version $Id: _coll_avatar.widget.php 6136 2014-03-08 07:59:48Z manuel $
  27   */
  28  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  29  
  30  load_class( 'widgets/model/_widget.class.php', 'ComponentWidget' );
  31  
  32  /**
  33   * coll_avatar_Widget Class.
  34   *
  35   * This displays the blog owner's avatar.
  36   *
  37   * @package evocore
  38   */
  39  class coll_avatar_Widget extends ComponentWidget
  40  {
  41      /**
  42       * Constructor
  43       */
  44  	function coll_avatar_Widget( $db_row = NULL )
  45      {
  46          // Call parent constructor:
  47          parent::ComponentWidget( $db_row, 'core', 'coll_avatar' );
  48      }
  49  
  50  
  51      /**
  52       * Get name of widget
  53       */
  54  	function get_name()
  55      {
  56          return T_('Profile picture (Avatar)');
  57      }
  58  
  59  
  60      /**
  61       * Get short description
  62       */
  63  	function get_desc()
  64      {
  65          return T_('Display the profile picture of the blog owner.');
  66      }
  67  
  68  
  69      /**
  70       * Get definitions for editable params
  71       *
  72       * @see Plugin::GetDefaultSettings()
  73       * @param array local params
  74       *  - 'size': Size definition, see {@link $thumbnail_sizes}. E.g. 'fit-160x160'.
  75       */
  76  	function get_param_definitions( $params )
  77      {
  78          load_funcs( 'files/model/_image.funcs.php' );
  79  
  80          $r = array_merge( array(
  81              'thumb_size' => array(
  82                      'type' => 'select',
  83                      'label' => T_('Image size'),
  84                      'options' => get_available_thumb_sizes(),
  85                      'note' => sprintf( /* TRANS: %s is a config variable name */ T_('List of available image sizes is defined in %s.'), '$thumbnail_sizes' ),
  86                      'defaultvalue' => 'fit-160x160',
  87                  ),
  88              ), parent::get_param_definitions( $params ) );
  89  
  90          return $r;
  91      }
  92  
  93  
  94      /**
  95       * Display the widget!
  96       *
  97       * @param array MUST contain at least the basic display params
  98       */
  99  	function display( $params )
 100      {
 101          global $cat_modifier;
 102          global $Blog;
 103  
 104          $this->init_display( $params );
 105  
 106          $owner_User = & $Blog->get_owner_User();
 107  
 108          // START DISPLAY:
 109          echo $this->disp_params['block_start'];
 110  
 111          // Display title if requested
 112          $this->disp_title();
 113  
 114          echo $owner_User->get_link( array(
 115                  'link_to'           => 'userpage',  // TODO: make configurable $this->disp_params['link_to']
 116                  'link_text'    => 'avatar',
 117                  'thumb_size'     => $this->disp_params['thumb_size'],
 118              ) );
 119  
 120          echo $this->disp_params['block_end'];
 121  
 122          return true;
 123      }
 124  
 125  
 126      /**
 127       * Maybe be overriden by some widgets, depending on what THEY depend on..
 128       *
 129       * @return array of keys this widget depends on
 130       */
 131  	function get_cache_keys()
 132      {
 133          global $Blog;
 134  
 135          $owner_User = & $Blog->get_owner_User();
 136  
 137          return array(
 138                  'wi_ID'   => $this->ID,                    // Have the widget settings changed ?
 139                  'set_coll_ID' => $Blog->ID,            // Have the settings of the blog changed ? (ex: new owner, new skin)
 140                  'user_ID' => $owner_User->ID,     // Has the owner User changed? (name, avatar, etc..)
 141              );
 142      }
 143  }
 144  
 145  ?>

title

Description

title

Description

title

Description

title

title

Body