本文整理汇总了PHP中Extension::extension_configuration方法的典型用法代码示例。如果您正苦于以下问题:PHP Extension::extension_configuration方法的具体用法?PHP Extension::extension_configuration怎么用?PHP Extension::extension_configuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Extension
的用法示例。
在下文中一共展示了Extension::extension_configuration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rebuildConfiguration
public static function rebuildConfiguration($config_pathname = NULL)
{
$doc = new DOMDocument('1.0', 'utf-8');
$doc->formatOutput = true;
$doc->appendChild($doc->createElement('extensions'));
$root = $doc->documentElement;
foreach (new ExtensionIterator() as $extension) {
// TODO: Check if the extension is already present in the config, and retain the version & status if it is
// This ensures that the status of "requires-update" remains intact.
$pathname = self::getPathFromClass(get_class($extension));
$handle = self::getHandleFromPath($pathname);
$element = $doc->createElement('extension');
$element->setAttribute('handle', $handle);
$node = end(self::$extension_configuration->xpath("//extension[@handle='{$handle}'][1]"));
if (!empty($node)) {
$element->setAttribute('version', $node->attributes()->version);
$element->setAttribute('status', $node->attributes()->status);
} else {
$element->setAttribute('version', $extension->about()->version);
$element->setAttribute('status', self::status($handle));
}
$root->appendChild($element);
if (method_exists($extension, 'getSubscribedDelegates')) {
$delegates = $doc->createElement('delegates');
foreach ((array) $extension->getSubscribedDelegates() as $delegate) {
$item = $doc->createElement('item');
$item->setAttribute('page', $delegate['page']);
$item->setAttribute('delegate', $delegate['delegate']);
$item->setAttribute('callback', $delegate['callback']);
$delegates->appendChild($item);
}
$element->appendChild($delegates);
}
}
self::$extension_configuration = simplexml_import_dom($doc);
self::saveConfiguration($config_pathname);
}