예제 #1
0
 /**
  * Translation function, based on a translation key
  *
  * @param string $key The key to translate
  * @return string The translation, or the key of the translation wasn't found
  */
 function _($key)
 {
     static $translations;
     // Load translations on first call
     if (!$translations) {
         // Get local language
         if (!defined('_JEXEC')) {
             global $mosConfig_lang;
             $lang = $mosConfig_lang;
         } else {
             $language =& JFactory::getLanguage();
             $lang = $language->getBackwardLang();
         }
         // Load default language (English)
         $langEnglish = JoomlapackAbstraction::parse_ini_file(JPATH_COMPONENT_ADMINISTRATOR . DS . 'lang' . DS . 'english.ini', false);
         // Load user's language file, if exists
         if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . "/lang/{$lang}.ini")) {
             $langLocal = JoomlapackAbstraction::parse_ini_file(JPATH_COMPONENT_ADMINISTRATOR . DS . 'lang' . DS . "{$lang}.ini", false);
             if (is_array($langLocal)) {
                 $translations = array_merge($langEnglish, $langLocal);
             } else {
                 $translations = $langEnglish;
             }
             // # END FIX 1.2.b2
         } else {
             $translations = $langEnglish;
         }
         unset($langEnglish);
         unset($langLocal);
     }
     if (key_exists($key, $translations)) {
         return $translations[$key];
     } else {
         return $key;
     }
 }
예제 #2
0
 /**
  * Initializes the array of filters. Reads the data of the filter.ini in the
  * classes/filter directory.
  */
 function init()
 {
     // Load the filter.ini
     jpimport('helpers.frameworkabstraction');
     $sourceINI = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'filter' . DS . 'filter.ini';
     $filterArray = JoomlapackAbstraction::parse_ini_file($sourceINI, true);
     // Walk through INI file entries and add them to the filter list
     foreach ($filterArray as $filter) {
         $this->addFilter('classes.filter.' . $filter['include'], $filter['class']);
     }
 }
예제 #3
0
 /**
  * Retrieves an object for the specified engine. It reads the engine.ini in order to do that.
  * It will also call the _addEngineInclude to make sure the included file persists during
  * the backup session.
  *
  * @param string $engine The engine type (lister, dumper, packer)
  * @param string $item The engine class file name (e.g. deafault, jpa, etc)
  */
 function &_getAnEngine($engine, $item)
 {
     // Load engine definitions
     JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "Creating {$engine} engine of type {$item}");
     $sourceINI = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'engine' . DS . $engine . DS . 'engine.ini';
     $engineArray = JoomlapackAbstraction::parse_ini_file($sourceINI, true);
     if (isset($engineArray[$item])) {
         $engineDescriptor = $engineArray[$item];
         $dotted = 'classes.engine.' . $engine . '.' . $engineDescriptor['include'];
         $this->_addEngineInclude($dotted);
         jpimport($dotted);
         $instance = new $engineDescriptor['class']();
         // If we are getting an archiver class, also populate the _archiveExtension field
         if ($engine == 'packer') {
             $this->_archiveExtension = $engineDescriptor['extension'];
         }
         return $instance;
     } else {
         $this->_Error = 'Engine ' . $engine . '.' . $item . ' not found.';
         return false;
     }
 }
예제 #4
0
 function outputEngineSelector($formField, $engine, $selectedValue)
 {
     // Load engine definitions
     $sourceINI = JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'engine' . DS . $engine . DS . 'engine.ini';
     $engineArray = JoomlapackAbstraction::parse_ini_file($sourceINI, true);
     // Create selection list array
     $options = array();
     foreach ($engineArray as $sectionKey => $engineItem) {
         if (!defined('_JEXEC')) {
             $options[] = mosHTML::makeOption($sectionKey, $engineItem['description']);
         } else {
             $options[] = JHTML::_('select.option', $sectionKey, $engineItem['description']);
         }
     }
     // Output the selection list
     if (!defined('_JEXEC')) {
         echo mosHTML::selectList($options, $formField, '', 'value', 'text', $selectedValue);
     } else {
         echo JHTML::_('select.genericlist', $options, $formField, '', 'value', 'text', $selectedValue);
     }
 }