Source for file language.php

Documentation is available at language.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_finder
  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('_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. {
  20.     /**
  21.      * Method to return a plural language code for a taxonomy branch.
  22.      *
  23.      * @param   string  $branchName  Branch title.
  24.      *
  25.      * @return  string  Language key code.
  26.      *
  27.      * @since   2.5
  28.      */
  29.     public static function branchPlural($branchName)
  30.     {
  31.         $return preg_replace('/[^a-zA-Z0-9]+/''_'strtoupper($branchName));
  32.  
  33.         return 'PLG_FINDER_QUERY_FILTER_BRANCH_P_' $return;
  34.     }
  35.  
  36.     /**
  37.      * Method to return a singular language code for a taxonomy branch.
  38.      *
  39.      * @param   string  $branchName  Branch name.
  40.      *
  41.      * @return  string  Language key code.
  42.      *
  43.      * @since   2.5
  44.      */
  45.     public static function branchSingular($branchName)
  46.     {
  47.         $return preg_replace('/[^a-zA-Z0-9]+/''_'strtoupper($branchName));
  48.  
  49.         return 'PLG_FINDER_QUERY_FILTER_BRANCH_S_' $return;
  50.     }
  51.  
  52.     /**
  53.      * Method to load Smart Search component language file.
  54.      *
  55.      * @return  void 
  56.      *
  57.      * @since   2.5
  58.      */
  59.     public static function loadComponentLanguage()
  60.     {
  61.         $lang JFactory::getLanguage();
  62.         $lang->load('com_finder'JPATH_SITE);
  63.     }
  64.  
  65.     /**
  66.      * Method to load Smart Search plug-in language files.
  67.      *
  68.      * @return  void 
  69.      *
  70.      * @since   2.5
  71.      */
  72.     public static function loadPluginLanguage()
  73.     {
  74.         static $loaded false;
  75.  
  76.         // If already loaded, don't load again.
  77.         if ($loaded)
  78.         {
  79.             return;
  80.         }
  81.         $loaded true;
  82.  
  83.         // Get array of all the enabled Smart Search plug-in names.
  84.         $db JFactory::getDbo();
  85.         $query $db->getQuery(true)
  86.             ->select('name')
  87.             ->from($db->quoteName('#__extensions'))
  88.             ->where($db->quoteName('type'' = ' $db->quote('plugin'))
  89.             ->where($db->quoteName('folder'' = ' $db->quote('finder'))
  90.             ->where($db->quoteName('enabled'' = 1');
  91.         $db->setQuery($query);
  92.         $plugins $db->loadObjectList();
  93.  
  94.         if (empty($plugins))
  95.         {
  96.             return;
  97.         }
  98.  
  99.         // Load generic language strings.
  100.         $lang JFactory::getLanguage();
  101.         $lang->load('plg_content_finder'JPATH_ADMINISTRATOR);
  102.  
  103.         // Load language file for each plug-in.
  104.         foreach ($plugins as $plugin)
  105.         {
  106.             $lang->load($plugin->nameJPATH_ADMINISTRATOR);
  107.         }
  108.     }
  109. }

Documentation generated on Tue, 19 Nov 2013 15:06:26 +0100 by phpDocumentor 1.4.3