[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_finder/helpers/ -> language.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.Administrator
   4   * @subpackage  com_finder
   5   *
   6   * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   7   * @license     GNU General Public License version 2 or later; see LICENSE
   8   */
   9  
  10  defined('_JEXEC') or die;
  11  
  12  /**
  13   * Finder language helper class.
  14   *
  15   * @package     Joomla.Administrator
  16   * @subpackage  com_finder
  17   * @since       2.5
  18   */
  19  class FinderHelperLanguage
  20  {
  21      /**
  22       * Method to return a plural language code for a taxonomy branch.
  23       *
  24       * @param   string  Branch title.
  25       *
  26       * @return  string  Language key code.
  27       */
  28  	public static function branchPlural($branchName)
  29      {
  30          $return = preg_replace('/[^a-zA-Z0-9]+/', '_', strtoupper($branchName));
  31  
  32          return 'PLG_FINDER_QUERY_FILTER_BRANCH_P_'.$return;
  33      }
  34  
  35      /**
  36       * Method to return a singular language code for a taxonomy branch.
  37       *
  38       * @param   string  Branch name.
  39       *
  40       * @return  string  Language key code.
  41       */
  42  	public static function branchSingular($branchName)
  43      {
  44          $return = preg_replace('/[^a-zA-Z0-9]+/', '_', strtoupper($branchName));
  45  
  46          return 'PLG_FINDER_QUERY_FILTER_BRANCH_S_'.$return;
  47      }
  48  
  49      /**
  50       * Method to determine if the language filter plugin is enabled.
  51       * This works for both site and administrator.
  52       *
  53       * @return  boolean  True if site is supporting multiple languages; false otherwise.
  54       *
  55       * @since   2.5
  56       * @deprecated  3.0 Use JLanguageMultilang::isEnabled() instead.
  57       */
  58  	public static function isMultiLanguage()
  59      {
  60          JLog::add('FinderHelperLanguage::isMultiLanguage() is deprecated. Use JLanguageMultilang::isEnabled() instead. ', JLog::WARNING, 'deprecated');
  61          return JLanguageMultilang::isEnabled();
  62      }
  63  
  64      /**
  65       * Method to load Smart Search component language file.
  66       *
  67       * @return  void
  68       *
  69       * @since   2.5
  70       */
  71  	public static function loadComponentLanguage()
  72      {
  73          $lang = JFactory::getLanguage();
  74          $lang->load('com_finder', JPATH_SITE);
  75      }
  76  
  77      /**
  78       * Method to load Smart Search plug-in language files.
  79       *
  80       * @return  void
  81       *
  82       * @since   2.5
  83       */
  84  	public static function loadPluginLanguage()
  85      {
  86          static $loaded = false;
  87  
  88          // If already loaded, don't load again.
  89          if ($loaded) {
  90              return;
  91          }
  92          $loaded = true;
  93  
  94          // Get array of all the enabled Smart Search plug-in names.
  95          $db = JFactory::getDbo();
  96          $query = $db->getQuery(true);
  97  
  98          $query->select('name');
  99          $query->from($db->quoteName('#__extensions'));
 100          $query->where($db->quoteName('type') . ' = ' .  $db->quote('plugin'));
 101          $query->where($db->quoteName('folder') . ' = ' .  $db->quote('finder'));
 102          $query->where($db->quoteName('enabled') . ' = 1');
 103          $db->setQuery($query);
 104          $plugins = $db->loadObjectList();
 105  
 106          if (empty($plugins)) {
 107              return;
 108          }
 109  
 110          // Load generic language strings.
 111          $lang = JFactory::getLanguage();
 112          $lang->load('plg_content_finder', JPATH_ADMINISTRATOR);
 113  
 114          // Load language file for each plug-in.
 115          foreach ($plugins as $plugin) {
 116              $lang->load($plugin->name, JPATH_ADMINISTRATOR);
 117          }
 118      }
 119  
 120  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1