本文整理汇总了PHP中SEFTools::getExtXML方法的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools::getExtXML方法的具体用法?PHP SEFTools::getExtXML怎么用?PHP SEFTools::getExtXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SEFTools
的用法示例。
在下文中一共展示了SEFTools::getExtXML方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExtension
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: substr
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: getExtParamsXML
/**
* 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: array
/**
* 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];
}