Source for file languages.php

Documentation is available at languages.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_languages
  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.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Languages component helper.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_languages
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * Configure the Linkbar.
  22.      *
  23.      * @param   string  $vName   The name of the active view.
  24.      * @param   int     $client  The client id of the active view. Maybe be 0 or 1
  25.      *
  26.      * @return  void 
  27.      */
  28.     public static function addSubmenu($vName$client 0)
  29.     {
  30.         JHtmlSidebar::addEntry(
  31.             JText::_('COM_LANGUAGES_SUBMENU_INSTALLED_SITE'),
  32.             'index.php?option=com_languages&view=installed&client=0',
  33.             $vName == 'installed' && $client === 0
  34.         );
  35.         JHtmlSidebar::addEntry(
  36.             JText::_('COM_LANGUAGES_SUBMENU_INSTALLED_ADMINISTRATOR'),
  37.             'index.php?option=com_languages&view=installed&client=1',
  38.             $vName == 'installed' && $client === 1
  39.         );
  40.         JHtmlSidebar::addEntry(
  41.             JText::_('COM_LANGUAGES_SUBMENU_CONTENT'),
  42.             'index.php?option=com_languages&view=languages',
  43.             $vName == 'languages'
  44.         );
  45.         JHtmlSidebar::addEntry(
  46.             JText::_('COM_LANGUAGES_SUBMENU_OVERRIDES'),
  47.             'index.php?option=com_languages&view=overrides',
  48.             $vName == 'overrides'
  49.         );
  50.     }
  51.  
  52.     /**
  53.      * Gets a list of the actions that can be performed.
  54.      *
  55.      * @return  JObject 
  56.      */
  57.     public static function getActions()
  58.     {
  59.         $user        JFactory::getUser();
  60.         $result        new JObject;
  61.         $assetName    'com_languages';
  62.  
  63.         $actions JAccess::getActions($assetName);
  64.  
  65.         foreach ($actions as $action)
  66.         {
  67.             $result->set($action->name,    $user->authorise($action->name$assetName));
  68.         }
  69.  
  70.         return $result;
  71.     }
  72.  
  73.     /**
  74.      * Method for parsing ini files
  75.      *
  76.      * @param   string  $filename Path and name of the ini file to parse
  77.      *
  78.      * @return  array   Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned
  79.      *
  80.      * @since   2.5
  81.      */
  82.     public static function parseFile($filename)
  83.     {
  84.         if (!is_file($filename))
  85.         {
  86.             return array();
  87.         }
  88.  
  89.         $contents file_get_contents($filename);
  90.         $contents str_replace('_QQ_''"\""'$contents);
  91.         $strings  @parse_ini_string($contents);
  92.  
  93.         if ($strings === false)
  94.         {
  95.             return array();
  96.         }
  97.  
  98.         return $strings;
  99.     }
  100.  
  101.     /**
  102.      * Filter method for language keys.
  103.      * This method will be called by JForm while filtering the form data.
  104.      *
  105.      * @param       string    $value    The language key to filter
  106.      *
  107.      * @return  string    The filtered language key
  108.      *
  109.      * @since        2.5
  110.      */
  111.     public static function filterKey($value)
  112.     {
  113.         $filter JFilterInput::getInstance(nullnull11);
  114.  
  115.         return strtoupper($filter->clean($value'cmd'));
  116.     }
  117.  
  118.     /**
  119.      * Filter method for language strings.
  120.      * This method will be called by JForm while filtering the form data.
  121.      *
  122.      * @param       string    $value    The language string to filter
  123.      *
  124.      * @return  string    The filtered language string
  125.      *
  126.      * @since        2.5
  127.      */
  128.     public static function filterText($value)
  129.     {
  130.         $filter JFilterInput::getInstance(nullnull11);
  131.  
  132.         return $filter->clean($value);
  133.     }
  134. }

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