b2evolution PHP Cross Reference Blogging Systems

Source: /inc/widgets/widgets/_coll_common_links.widget.php - 262 lines - 7788 bytes - Summary - Text - Print

Description: This file implements the Common links 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 Common links 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_common_links.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: Common navigation links.
  32   *
  33   * A ComponentWidget is a displayable entity that can be placed into a Container on a web page.
  34   *
  35   * @todo dh> why are "STRONG" tags hardcoded here? can this get dropped/removed? should the style
  36   *           get adjusted to use font-weight:bold then?
  37   * fp> yes but make sure to put the font-weight in a place where it applies to all (existing) skins by default; e-g blog_base.css
  38   *
  39   * @package evocore
  40   */
  41  class coll_common_links_Widget extends ComponentWidget
  42  {
  43      /**
  44       * Constructor
  45       */
  46  	function coll_common_links_Widget( $db_row = NULL )
  47      {
  48          // Call parent constructor:
  49          parent::ComponentWidget( $db_row, 'core', 'coll_common_links' );
  50      }
  51  
  52  
  53      /**
  54       * Get name of widget
  55       */
  56  	function get_name()
  57      {
  58          return T_('Common Navigation Links');
  59      }
  60  
  61  
  62      /**
  63       * Get a very short desc. Used in the widget list.
  64       */
  65  	function get_short_desc()
  66      {
  67          return format_to_output($this->disp_params['title']);
  68      }
  69  
  70  
  71      /**
  72       * Get short description
  73       */
  74  	function get_desc()
  75      {
  76          return T_('Display these links: Recently, Archives, Categories, Latest Comments');
  77      }
  78  
  79  
  80      /**
  81       * Get definitions for editable params
  82       *
  83       * @see Plugin::GetDefaultSettings()
  84       * @param local params like 'for_editing' => true
  85       */
  86  	function get_param_definitions( $params )
  87      {
  88          $r = array_merge( array(
  89                  'title' => array(
  90                      'label' => T_('Block title'),
  91                      'note' => T_( 'Title to display in your skin.' ),
  92                      'size' => 40,
  93                      'defaultvalue' => '',
  94                  ),
  95                  'show_recently' => array(
  96                      'type' => 'checkbox',
  97                      'label' => T_('Show "Recently"'),
  98                      'note' => T_('Go to the most recent posts / the blog\'s home.'),
  99                      'defaultvalue' => 1,
 100                  ),
 101                  'show_search' => array(
 102                      'type' => 'checkbox',
 103                      'label' => T_('Show "Search"'),
 104                      'note' => T_('Go to the search page.'),
 105                      'defaultvalue' => 0,
 106                  ),
 107                  'show_postidx' => array(
 108                      'type' => 'checkbox',
 109                      'label' => T_('Show "Post index"'),
 110                      'note' => T_('Go to the post index.'),
 111                      'defaultvalue' => 0,
 112                  ),
 113                  'show_archives' => array(
 114                      'type' => 'checkbox',
 115                      'label' => T_('Show "Archives"'),
 116                      'note' => T_('Go to the monthly/weekly/daily archive list.'),
 117                      'defaultvalue' => 1,
 118                  ),
 119                  'show_categories' => array(
 120                      'type' => 'checkbox',
 121                      'label' => T_('Show "Categories"'),
 122                      'note' => T_('Go to the category tree.'),
 123                      'defaultvalue' => 1,
 124                  ),
 125                  'show_mediaidx' => array(
 126                      'type' => 'checkbox',
 127                      'label' => T_('Show "Photo index"'),
 128                      'note' => T_('Go to the photo index / contact sheet.'),
 129                      'defaultvalue' => 0,
 130                  ),
 131                  'show_latestcomments' => array(
 132                      'type' => 'checkbox',
 133                      'label' => T_('Show "Latest comments"'),
 134                      'note' => T_('Go to the latest comments.'),
 135                      'defaultvalue' => 1,
 136                  ),
 137                  'show_owneruserinfo' => array(
 138                      'type' => 'checkbox',
 139                      'label' => T_('Show "Owner details"'),
 140                      'note' => T_('Go to user info about the blog owner.'),
 141                      'defaultvalue' => 0,
 142                  ),
 143                  'show_ownercontact' => array(
 144                      'type' => 'checkbox',
 145                      'label' => T_('Show "Contact"'),
 146                      'note' => T_('Go to message form to contact the blog owner.'),
 147                      'defaultvalue' => 0,
 148                  ),
 149                  'show_sitemap' => array(
 150                      'type' => 'checkbox',
 151                      'label' => T_('Show "Site map"'),
 152                      'note' => T_('Go to site map (HTML version).'),
 153                      'defaultvalue' => 0,
 154                  ),
 155              ), parent::get_param_definitions( $params )    );
 156  
 157          return $r;
 158  
 159      }
 160  
 161  
 162      /**
 163       * Display the widget!
 164       *
 165       * @param array MUST contain at least the basic display params
 166       */
 167  	function display( $params )
 168      {
 169          /**
 170          * @var Blog
 171          */
 172          global $Blog;
 173  
 174          $this->init_display( $params );
 175  
 176          // Collection common links:
 177          echo $this->disp_params['block_start'];
 178  
 179          // Display title if requested
 180          $this->disp_title();
 181  
 182          echo $this->disp_params['list_start'];
 183  
 184          if( $this->disp_params['show_recently'] )
 185          {
 186              echo $this->disp_params['item_start'];
 187              echo '<strong><a href="'.$Blog->get('url').'">'.T_('Recently').'</a></strong>';
 188              echo $this->disp_params['item_end'];
 189          }
 190  
 191          if( $this->disp_params['show_search'] )
 192          {
 193              echo $this->disp_params['item_start'];
 194              echo '<strong><a href="'.$Blog->get('searchurl').'">'.T_('Search').'</a></strong>';
 195              echo $this->disp_params['item_end'];
 196          }
 197  
 198          if( $this->disp_params['show_postidx'] )
 199          {
 200              echo $this->disp_params['item_start'];
 201              echo '<strong><a href="'.$Blog->get('postidxurl').'">'.T_('Post index').'</a></strong>';
 202              echo $this->disp_params['item_end'];
 203          }
 204  
 205          if( $this->disp_params['show_archives'] )
 206          {
 207              // fp> TODO: don't display this if archives plugin not installed... or depluginize archives (I'm not sure)
 208              echo $this->disp_params['item_start'];
 209              echo '<strong><a href="'.$Blog->get('arcdirurl').'">'.T_('Archives').'</a></strong>';
 210              echo $this->disp_params['item_end'];
 211          }
 212  
 213          if( $this->disp_params['show_categories'] )
 214          {
 215              echo $this->disp_params['item_start'];
 216              echo '<strong><a href="'.$Blog->get('catdirurl').'">'.T_('Categories').'</a></strong>';
 217              echo $this->disp_params['item_end'];
 218          }
 219  
 220          if( $this->disp_params['show_mediaidx'] )
 221          {
 222              echo $this->disp_params['item_start'];
 223              echo '<strong><a href="'.$Blog->get('mediaidxurl').'">'.T_('Photo index').'</a></strong>';
 224              echo $this->disp_params['item_end'];
 225          }
 226  
 227          if( $this->disp_params['show_latestcomments'] && $Blog->get_setting( 'comments_latest' ) )
 228          { // Display link to latest comments if this feature is enabled for current blog
 229              echo $this->disp_params['item_start'];
 230              echo '<strong><a href="'.$Blog->get('lastcommentsurl').'">'.T_('Latest comments').'</a></strong>';
 231              echo $this->disp_params['item_end'];
 232          }
 233  
 234          if( $this->disp_params['show_owneruserinfo'] )
 235          {
 236              echo $this->disp_params['item_start'];
 237              echo '<strong><a href="'.url_add_param( $Blog->get('userurl'), 'user_ID='.$Blog->owner_user_ID ).'">'.T_('Owner details').'</a></strong>';
 238              echo $this->disp_params['item_end'];
 239          }
 240  
 241          if( $this->disp_params['show_ownercontact'] && $url = $Blog->get_contact_url( true ) )
 242          {    // owner allows contact:
 243              echo $this->disp_params['item_start'];
 244              echo '<strong><a href="'.$url.'">'.T_('Contact').'</a></strong>';
 245              echo $this->disp_params['item_end'];
 246          }
 247  
 248          if( $this->disp_params['show_sitemap'] )
 249          {
 250              echo $this->disp_params['item_start'];
 251              echo '<strong><a href="'.$Blog->get('sitemapurl').'">'.T_('Site map').'</a></strong>';
 252              echo $this->disp_params['item_end'];
 253          }
 254  
 255          echo $this->disp_params['list_end'];
 256          echo $this->disp_params['block_end'];
 257  
 258          return true;
 259      }
 260  }
 261  
 262  ?>

title

Description

title

Description

title

Description

title

title

Body