예제 #1
0
 function getExtension()
 {
     // Load the data
     if (empty($this->_extension)) {
         $query = $this->_db->getQuery(true);
         $query->select('*')->from('#__extensions')->where('state>=0')->where('enabled=1')->where('type=' . $this->_db->quote('sef_ext'))->where('element=' . $this->_db->quote($this->_id));
         $this->_db->setQuery($query);
         $row = $this->_db->loadObject();
         if (is_null($row)) {
             $row = new stdClass();
         }
         $option = str_replace('ext_joomsef4_', 'com_', $this->_id);
         // Try to load language file for this extension
         $langFile = str_replace('com_', 'sef_ext_', $option);
         $lang = JFactory::getLanguage();
         $lang->load($langFile, JPATH_ADMINISTRATOR);
         $row->id = $this->_id;
         $row->description = '';
         $row->name = '';
         $row->version = '';
         $row->params =& SEFTools::getExtParams($option);
         $row->form =& SEFTools::getExtParamsForm($option);
         $row->option = $option;
         $xml = SEFTools::getExtXML($option);
         if ($xml) {
             $version = (string) $xml['version'];
             if ($xml->getName() == 'extension' && version_compare($version, '1.6', '>=') && (string) $xml['type'] == 'sef_ext') {
                 $element = $xml->description;
                 $row->description = $element ? trim((string) $element) : '';
                 $element = $xml->name;
                 $row->name = $element ? trim((string) $element) : '';
                 $element = $xml->version;
                 $row->version = $element ? trim((string) $element) : '';
             }
         }
         // Get the component for this extension
         $model = SEFModel::getInstance('Extensions', 'SEFModel');
         $row->component = $model->_getComponent($option);
         $this->_extension = $row;
     }
     return $this->_extension;
 }
예제 #2
0
 function &getExtension()
 {
     // Load the data
     if (empty($this->_extension)) {
         $row =& $this->getTable();
         if (!$row->load($this->_id)) {
             $row->file = $this->_id;
             $row->title = '';
             $row->params = '';
         }
         $option = substr($row->file, 0, -4);
         $row->description = '';
         $row->name = '';
         $row->version = '';
         $row->params =& SEFTools::getExtParams($option);
         $row->option = $option;
         $xml =& SEFTools::getExtXML($option);
         if ($xml) {
             $root =& $xml->document;
             $version = $root->attributes('version');
             if ($root->name() == 'install' && version_compare($version, '1.5', '>=') && $root->attributes('type') == 'sef_ext') {
                 $element =& $root->getElementByPath('description');
                 $row->description = $element ? trim($element->data()) : '';
                 $element =& $root->getElementByPath('name');
                 $row->name = $element ? trim($element->data()) : '';
                 $element =& $root->getElementByPath('version');
                 $row->version = $element ? trim($element->data()) : '';
             }
         }
         // Get the component for this extension
         $model =& JModel::getInstance('Extensions', 'SEFModel');
         $row->component = $model->_getComponent($option);
         $row->texts = $this->_getDefaultTexts($option);
         $this->_extension = $row;
     }
     return $this->_extension;
 }
예제 #3
0
파일: seftools.php 프로젝트: 01J/bealtine
 /**
  * Returns the JSimpleXMLElement object representing
  * the extension's parameters
  *
  * @param string $option		Extension name
  * @return JSimpleXMLElement	Extension's parameters
  */
 function getExtParamsXML($option)
 {
     static $xmls;
     if (!isset($xmls)) {
         $xmls = array();
     }
     if (!isset($xmls[$option])) {
         $xmls[$option] = null;
         $xml = SEFTools::getExtXML($option);
         if ($xml) {
             $form = $xml->form;
             if (!empty($form)) {
                 $xmls[$option] = $form;
             }
         }
     }
     return $xmls[$option];
 }
예제 #4
0
 /**
  * Returns the JSimpleXMLElement object representing
  * the extension's parameters
  *
  * @param string $option		Extension name
  * @return JSimpleXMLElement	Extension's parameters
  */
 function &getExtParamsXML($option)
 {
     static $xmls;
     if (!isset($xmls)) {
         $xmls = array();
     }
     if (!isset($xmls[$option])) {
         $xmls[$option] = null;
         $xml =& SEFTools::getExtXML($option);
         if ($xml) {
             $document =& $xml->document;
             $xmls[$option] = array();
             if (isset($document->params)) {
                 for ($i = 0, $n = count($document->params); $i < $n; $i++) {
                     if (isset($document->params[$i]->param)) {
                         if ($i == 0) {
                             // Remove the parameters that are duplicate with common ones
                             $hide = array();
                             $hideNames = array('ignoreSource', 'itemid', 'overrideId', 'customNonSef');
                             // Collect elements to remove
                             for ($j = 0, $m = count($document->params[$i]->param); $j < $m; $j++) {
                                 if (in_array($document->params[$i]->param[$j]->attributes('name'), $hideNames)) {
                                     $hide[] =& $document->params[$i]->param[$j];
                                 }
                             }
                             // Remove elements
                             for ($j = 0, $m = count($hide); $j < $m; $j++) {
                                 $document->params[$i]->removeChild($hide[$j]);
                             }
                         }
                         $xmls[$option][] =& $document->params[$i];
                     }
                 }
             }
         }
     }
     return $xmls[$option];
 }