Beispiel #1
0
 /**
  * Loads the params.ini content
  *
  * @param  $gantry
  *
  * @return bool
  */
 protected function loadParamsContent(Gantry &$gantry)
 {
     if ($gantry->isAdmin()) {
         $styleId = JFactory::getApplication()->input->getInt('id', 0);
         if ($styleId == 0) {
             $template = self::getMasterTemplateStyleByName($gantry->templateName);
             $styleId = $template->id;
         }
     } else {
         // TODO:  get style ID from front end
         $site = JFactory::getApplication();
         $template = $site->getTemplate(true);
         $styleId = $template->id;
     }
     $return = false;
     if ($gantry->isAdmin()) {
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_templates/tables');
         $table = JTable::getInstance('Style', 'TemplatesTable', array());
         // Attempt to load the row.
         $return = $table->load($styleId);
         $site = JFactory::getApplication();
         $registry = new GantryRegistry();
         $registry->loadString($table->params);
         if ($registry->get('master') != 'true') {
             $return = $table->load($registry->get('master'));
             $registry = new GantryRegistry();
             $registry->loadString($table->params);
         }
         // Check for a table object error.
         if ($return === false && $table->getError()) {
             $this->setError($table->getError());
             return false;
         }
         $this->_params_content = $table->params;
     } else {
         $site = JFactory::getApplication();
         $template = self::getTemplateById($site->getTemplate(true)->id);
         $master = $template->params->get('master', 'true');
         if ($master !== 'true') {
             $master_params = self::getTemplateParams((int) $master);
             $registry =& $master_params;
             $this->masterParams = $master_params->toString();
             $master_params->merge($template->params);
             $this->_params_content = $master_params->toString();
         } else {
             $registry =& $template->params;
             $this->_params_content = $template->params->toString();
             $this->masterParams = $this->_params_content;
         }
     }
     $this->_params_reg = $registry;
     return true;
 }