b2evolution

Multilingual multiuser multiblog engine

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

Source for file _coll_common_links.widget.php

Documentation is available at _coll_common_links.widget.php

  1. <?php
  2. /**
  3.  * This file implements the coll_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-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_common_links.widget.php,v 1.16 2010/02/08 17:54:47 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: 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. {
  42.     /**
  43.      * Constructor
  44.      */
  45.     function coll_common_links_Widget$db_row NULL )
  46.     {
  47.         // Call parent constructor:
  48.         parent::ComponentWidget$db_row'core''coll_common_links' );
  49.     }
  50.  
  51.  
  52.     /**
  53.      * Get name of widget
  54.      */
  55.     function get_name()
  56.     {
  57.         return T_('Common Navigation Links');
  58.     }
  59.  
  60.  
  61.     /**
  62.      * Get a very short desc. Used in the widget list.
  63.      */
  64.     function get_short_desc()
  65.     {
  66.         return format_to_output($this->disp_params['title']);
  67.     }
  68.  
  69.  
  70.     /**
  71.      * Get short description
  72.      */
  73.     function get_desc()
  74.     {
  75.         return T_('Display these links: Recently, Archives, Categories, Latest Comments');
  76.     }
  77.  
  78.  
  79.     /**
  80.      * Get definitions for editable params
  81.      *
  82.      * @see Plugin::GetDefaultSettings()
  83.      * @param local params like 'for_editing' => true
  84.      */
  85.     function get_param_definitions$params )
  86.     {
  87.         $r array_mergearray(
  88.                 'title' => array(
  89.                     'label' => T_('Block title'),
  90.                     'note' => T_'Title to display in your skin.' ),
  91.                     'size' => 40,
  92.                     'defaultvalue' => '',
  93.                 ),
  94.                 'show_recently' => array(
  95.                     'type' => 'checkbox',
  96.                     'label' => T_('Show "Recently"'),
  97.                     'note' => T_('Go to the most recent posts / the blog\'s home.'),
  98.                     'defaultvalue' => 1,
  99.                 ),
  100.                 'show_search' => array(
  101.                     'type' => 'checkbox',
  102.                     'label' => T_('Show "Search"'),
  103.                     'note' => T_('Go to the search page.'),
  104.                     'defaultvalue' => 0,
  105.                 ),
  106.                 'show_postidx' => array(
  107.                     'type' => 'checkbox',
  108.                     'label' => T_('Show "Post index"'),
  109.                     'note' => T_('Go to the post index.'),
  110.                     'defaultvalue' => 0,
  111.                 ),
  112.                 'show_archives' => array(
  113.                     'type' => 'checkbox',
  114.                     'label' => T_('Show "Archives"'),
  115.                     'note' => T_('Go to the monthly/weekly/daily archive list.'),
  116.                     'defaultvalue' => 1,
  117.                 ),
  118.                 'show_categories' => array(
  119.                     'type' => 'checkbox',
  120.                     'label' => T_('Show "Categories"'),
  121.                     'note' => T_('Go to the category tree.'),
  122.                     'defaultvalue' => 1,
  123.                 ),
  124.                 'show_mediaidx' => array(
  125.                     'type' => 'checkbox',
  126.                     'label' => T_('Show "Photo index"'),
  127.                     'note' => T_('Go to the photo index / contact sheet.'),
  128.                     'defaultvalue' => 0,
  129.                 ),
  130.                 'show_latestcomments' => array(
  131.                     'type' => 'checkbox',
  132.                     'label' => T_('Show "Latest comments"'),
  133.                     'note' => T_('Go to the latest comments.'),
  134.                     'defaultvalue' => 1,
  135.                 ),
  136.                 'show_owneruserinfo' => array(
  137.                     'type' => 'checkbox',
  138.                     'label' => T_('Show "Owner details"'),
  139.                     'note' => T_('Go to user info about the blog owner.'),
  140.                     'defaultvalue' => 0,
  141.                 ),
  142.                 'show_ownercontact' => array(
  143.                     'type' => 'checkbox',
  144.                     'label' => T_('Show "Contact"'),
  145.                     'note' => T_('Go to message form to contact the blog owner.'),
  146.                     'defaultvalue' => 0,
  147.                 ),
  148.                 'show_sitemap' => array(
  149.                     'type' => 'checkbox',
  150.                     'label' => T_('Show "Site map"'),
  151.                     'note' => T_('Go to site map (HTML version).'),
  152.                     'defaultvalue' => 0,
  153.                 ),
  154.             )parent::get_param_definitions$params )    );
  155.  
  156.         return $r;
  157.  
  158.     }
  159.  
  160.  
  161.     /**
  162.      * Display the widget!
  163.      *
  164.      * @param array MUST contain at least the basic display params
  165.      */
  166.     function display$params )
  167.     {
  168.         /**
  169.         * @var Blog
  170.         */
  171.         global $Blog;
  172.  
  173.         $this->init_display$params );
  174.  
  175.         // Collection common links:
  176.         echo $this->disp_params['block_start'];
  177.  
  178.         // Display title if requested
  179.         $this->disp_title();
  180.  
  181.         echo $this->disp_params['list_start'];
  182.  
  183.         if$this->disp_params['show_recently')
  184.         {
  185.             echo $this->disp_params['item_start'];
  186.             echo '<strong><a href="'.$Blog->get('url').'">'.T_('Recently').'</a></strong>';
  187.             echo $this->disp_params['item_end'];
  188.         }
  189.  
  190.         if$this->disp_params['show_search')
  191.         {
  192.             echo $this->disp_params['item_start'];
  193.             echo '<strong><a href="'.$Blog->get('searchurl').'">'.T_('Search').'</a></strong>';
  194.             echo $this->disp_params['item_end'];
  195.         }
  196.  
  197.         if$this->disp_params['show_postidx')
  198.         {
  199.             echo $this->disp_params['item_start'];
  200.             echo '<strong><a href="'.$Blog->get('postidxurl').'">'.T_('Post index').'</a></strong>';
  201.             echo $this->disp_params['item_end'];
  202.         }
  203.  
  204.         if$this->disp_params['show_archives')
  205.         {
  206.             // fp> TODO: don't display this if archives plugin not installed... or depluginize archives (I'm not sure)
  207.             echo $this->disp_params['item_start'];
  208.             echo '<strong><a href="'.$Blog->get('arcdirurl').'">'.T_('Archives').'</a></strong>';
  209.             echo $this->disp_params['item_end'];
  210.         }
  211.  
  212.         if$this->disp_params['show_categories')
  213.         {
  214.             echo $this->disp_params['item_start'];
  215.             echo '<strong><a href="'.$Blog->get('catdirurl').'">'.T_('Categories').'</a></strong>';
  216.             echo $this->disp_params['item_end'];
  217.         }
  218.  
  219.         if$this->disp_params['show_mediaidx')
  220.         {
  221.             echo $this->disp_params['item_start'];
  222.             echo '<strong><a href="'.$Blog->get('mediaidxurl').'">'.T_('Photo index').'</a></strong>';
  223.             echo $this->disp_params['item_end'];
  224.         }
  225.  
  226.         if$this->disp_params['show_latestcomments')
  227.         {
  228.             echo $this->disp_params['item_start'];
  229.             echo '<strong><a href="'.$Blog->get('lastcommentsurl').'">'.T_('Latest comments').'</a></strong>';
  230.             echo $this->disp_params['item_end'];
  231.         }
  232.  
  233.         if$this->disp_params['show_owneruserinfo')
  234.         {
  235.             echo $this->disp_params['item_start'];
  236.             echo '<strong><a href="'.$Blog->get('userurl').'">'.T_('Owner details').'</a></strong>';
  237.             echo $this->disp_params['item_end'];
  238.         }
  239.  
  240.         if$this->disp_params['show_ownercontact'&& $url $Blog->get_contact_urltrue ) )
  241.         {    // owner allows contact:
  242.             echo $this->disp_params['item_start'];
  243.             echo '<strong><a href="'.$url.'">'.T_('Contact').'</a></strong>';
  244.             echo $this->disp_params['item_end'];
  245.         }
  246.  
  247.         if$this->disp_params['show_sitemap')
  248.         {
  249.             echo $this->disp_params['item_start'];
  250.             echo '<strong><a href="'.$Blog->get('sitemapurl').'">'.T_('Site map').'</a></strong>';
  251.             echo $this->disp_params['item_end'];
  252.         }
  253.  
  254.         echo $this->disp_params['list_end'];
  255.         echo $this->disp_params['block_end'];
  256.  
  257.         return true;
  258.     }
  259. }
  260.  
  261.  
  262. /*
  263.  * $Log: _coll_common_links.widget.php,v $
  264.  * Revision 1.16  2010/02/08 17:54:47  efy-yury
  265.  * copyright 2009 -> 2010
  266.  *
  267.  * Revision 1.15  2010/02/06 23:10:50  sam2kb
  268.  * minor
  269.  *
  270.  * Revision 1.14  2009/12/22 23:13:39  fplanque
  271.  * Skins v4, step 1:
  272.  * Added new disp modes
  273.  * Hooks for plugin disp modes
  274.  * Enhanced menu widgets (BIG TIME! :)
  275.  *
  276.  * Revision 1.13  2009/09/14 13:54:13  efy-arrin
  277.  * Included the ClassName in load_class() call with proper UpperCase
  278.  *
  279.  * Revision 1.12  2009/09/12 11:03:13  efy-arrin
  280.  * Included the ClassName in the loadclass() with proper UpperCase
  281.  *
  282.  * Revision 1.11  2009/09/10 13:44:57  tblue246
  283.  * Translation fixes/update
  284.  *
  285.  * Revision 1.10  2009/05/18 03:59:39  fplanque
  286.  * minor/doc
  287.  *
  288.  * Revision 1.9  2009/04/06 23:19:07  blueyed
  289.  * coll_common_links_Widget: TODO about hardcoded strong tags, doc, indent.
  290.  *
  291.  * Revision 1.8  2009/03/13 02:32:07  fplanque
  292.  * Cleaned up widgets.
  293.  * Removed stupid widget_name param.
  294.  *
  295.  * Revision 1.7  2009/03/08 23:57:46  fplanque
  296.  * 2009
  297.  *
  298.  * Revision 1.6  2008/05/06 23:35:47  fplanque
  299.  * 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.
  300.  *
  301.  * Revision 1.4  2008/01/21 09:35:37  fplanque
  302.  * (c) 2008
  303.  *
  304.  * Revision 1.3  2007/12/23 14:14:25  fplanque
  305.  * Enhanced widget name display
  306.  *
  307.  * Revision 1.2  2007/12/22 19:55:00  yabs
  308.  * cleanup from adding core params
  309.  *
  310.  * Revision 1.1  2007/06/25 11:02:06  fplanque
  311.  * MODULES (refactored MVC)
  312.  *
  313.  * Revision 1.3  2007/06/20 21:42:13  fplanque
  314.  * implemented working widget/plugin params
  315.  *
  316.  * Revision 1.2  2007/06/20 00:48:17  fplanque
  317.  * some real life widget settings
  318.  *
  319.  * Revision 1.1  2007/06/18 21:25:47  fplanque
  320.  * one class per core widget
  321.  *
  322.  */
  323. ?>

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