Source for file contentlanguage.php

Documentation is available at contentlanguage.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  HTML
  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.  * Utility class working with content language select lists
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  HTML
  17.  * @since       1.6
  18.  */
  19. abstract class JHtmlContentLanguage
  20. {
  21.     /**
  22.      * Cached array of the content language items.
  23.      *
  24.      * @var    array 
  25.      * @since  1.6
  26.      */
  27.     protected static $items null;
  28.  
  29.     /**
  30.      * Get a list of the available content language items.
  31.      *
  32.      * @param   boolean  $all        True to include All (*)
  33.      * @param   boolean  $translate  True to translate All
  34.      *
  35.      * @return  string 
  36.      *
  37.      * @see     JFormFieldContentLanguage
  38.      * @since   1.6
  39.      */
  40.     public static function existing($all false$translate false)
  41.     {
  42.         if (empty(static::$items))
  43.         {
  44.             // Get the database object and a new query object.
  45.             $db    JFactory::getDbo();
  46.             $query $db->getQuery(true);
  47.  
  48.             // Build the query.
  49.             $query->select('a.lang_code AS value, a.title AS text, a.title_native')
  50.                 ->from('#__languages AS a')
  51.                 ->where('a.published >= 0')
  52.                 ->order('a.title');
  53.  
  54.             // Set the query and load the options.
  55.             $db->setQuery($query);
  56.             static::$items $db->loadObjectList();
  57.  
  58.             if ($all)
  59.             {
  60.                 array_unshift(static::$itemsnew JObject(array('value' => '*''text' => $translate JText::alt('JALL''language''JALL_LANGUAGE')));
  61.             }
  62.         }
  63.  
  64.         return static::$items;
  65.     }
  66. }

Documentation generated on Tue, 19 Nov 2013 14:56:59 +0100 by phpDocumentor 1.4.3