Exemplo n.º 1
0
 public function getItem($id = 'en-GB', $refresh = false, $emptyState = true)
 {
     if (empty($this->_item)) {
         $lang = JLanguage::getInstance($id);
         // Load only site language (Email language costants should be only there)
         $lang->load('com_citruscart', JPATH_ADMINISTRATOR, $id, true);
         $temp_paths = $lang->getPaths('com_citruscart');
         foreach ($temp_paths as $p => $k) {
             $path = $p;
         }
         $result = new JObject();
         $result->name = $lang->getName();
         $result->code = $lang->getTag();
         $result->path = $path;
         $result->strings = array();
         // Load File and Take only the constants that contains "EMAIL_"
         $file = new DSCParameter();
         $file->loadFile($path);
         $strings = $file->toArray();
         $result_strings = array();
         foreach ($strings as $k => $v) {
             // Only if it is a prefix!
             if (stripos($k, $this->email_prefix) === 0) {
                 $result_strings[$k] = $v;
             }
         }
         $result->strings = array('file' => $path, 'strings' => $result_strings);
         JFactory::getApplication()->triggerEvent('onPrepare' . $this->getTable()->get('_suffix'), array(&$result));
         $this->_item = $result;
     }
     return $this->_item;
 }