Source for file limitbox.php

Documentation is available at limitbox.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  Form
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12.  
  13. /**
  14.  * Field to load a list of posible item count limits
  15.  *
  16.  * @package     Joomla.Libraries
  17.  * @subpackage  Form
  18.  * @since       3.2
  19.  */
  20. {
  21.     /**
  22.      * The form field type.
  23.      *
  24.      * @var    string 
  25.      * @since  3.2
  26.      */
  27.     public $type = 'Limitbox';
  28.  
  29.     /**
  30.      * Cached array of the category items.
  31.      *
  32.      * @var    array 
  33.      * @since  3.2
  34.      */
  35.     protected static $options array();
  36.  
  37.     /**
  38.      * Default options
  39.      *
  40.      * @var  array 
  41.      */
  42.     protected $defaultLimits = array(5101520253050100);
  43.  
  44.     /**
  45.      * Method to get the options to populate to populate list
  46.      *
  47.      * @return  array  The field option objects.
  48.      *
  49.      * @since   3.2
  50.      */
  51.     protected function getOptions()
  52.     {
  53.         // Accepted modifiers
  54.         $hash md5($this->element);
  55.  
  56.         if (!isset(static::$options[$hash]))
  57.         {
  58.             static::$options[$hashparent::getOptions();
  59.  
  60.             $options array();
  61.             $limits $this->defaultLimits;
  62.  
  63.             // Limits manually specified
  64.             if (isset($this->element['limits']))
  65.             {
  66.                 $limits explode(','$this->element['limits']);
  67.             }
  68.  
  69.             // User wants to add custom limits
  70.             if (isset($this->element['append']))
  71.             {
  72.                 $limits array_unique(array_merge($limitsexplode(','$this->element['append'])));
  73.             }
  74.  
  75.             // User wants to remove some default limits
  76.             if (isset($this->element['remove']))
  77.             {
  78.                 $limits array_diff($limitsexplode(','$this->element['remove']));
  79.             }
  80.  
  81.             // Order the options
  82.             asort($limits);
  83.  
  84.             // Add an option to show all?
  85.             $showAll = isset($this->element['showall']($this->element['showall'== "true"true;
  86.  
  87.             if ($showAll)
  88.             {
  89.                 $limits[0;
  90.             }
  91.  
  92.             if (!empty($limits))
  93.             {
  94.                 foreach ($limits as $value)
  95.                 {
  96.                     $options[= (object) array(
  97.                         'value' => $value,
  98.                         'text' => ($value != 0JText::_('J' $valueJText::_('JALL')
  99.                     );
  100.                 }
  101.  
  102.                 static::$options[$hasharray_merge(static::$options[$hash]$options);
  103.             }
  104.         }
  105.  
  106.         return static::$options[$hash];
  107.     }
  108. }

Documentation generated on Tue, 19 Nov 2013 15:07:05 +0100 by phpDocumentor 1.4.3