本文整理匯總了PHP中ParserOutput::getHeadItems方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParserOutput::getHeadItems方法的具體用法?PHP ParserOutput::getHeadItems怎麽用?PHP ParserOutput::getHeadItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::getHeadItems方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: requireFromParserOutput
/**
* This function takes output requirements as can be found in a given ParserOutput
* object and puts them back in to the internal temporal requirement list from
* which they can be committed to some other output. It is needed when code that
* would normally call SMWOutputs::requireHeadItem() has need to use a full
* independent parser call (Parser::parse()) that produces its own parseroutput.
* If omitted, all output items potentially committed to this parseroutput during
* parsing will not be passed on to higher levels.
*
* Note that this is not required if the $parseroutput is further processed by
* MediaWiki, but there are cases where the output is discarded and only its text
* is used.
*
* @param ParserOutput $parserOutput
*/
public static function requireFromParserOutput(ParserOutput $parserOutput)
{
// Note: we do not attempt to recover which head items where scripts here.
$parserOutputHeadItems = $parserOutput->getHeadItems();
self::$headItems = array_merge((array) self::$headItems, $parserOutputHeadItems);
/// TODO Is the following needed?
if (isset($parserOutput->mModules)) {
foreach ($parserOutput->mModules as $module) {
self::$resourceModules[$module] = $module;
}
}
}
示例2: addParserOutputMetadata
/**
* Add all metadata associated with a ParserOutput object, but without the actual HTML. This
* includes categories, language links, ResourceLoader modules, effects of certain magic words,
* and so on.
*
* @since 1.24
* @param ParserOutput $parserOutput
*/
public function addParserOutputMetadata($parserOutput)
{
$this->mLanguageLinks += $parserOutput->getLanguageLinks();
$this->addCategoryLinks($parserOutput->getCategories());
$this->setIndicators($parserOutput->getIndicators());
$this->mNewSectionLink = $parserOutput->getNewSection();
$this->mHideNewSectionLink = $parserOutput->getHideNewSection();
$this->mParseWarnings = $parserOutput->getWarnings();
if (!$parserOutput->isCacheable()) {
$this->enableClientCache(false);
}
$this->mNoGallery = $parserOutput->getNoGallery();
$this->mHeadItems = array_merge($this->mHeadItems, $parserOutput->getHeadItems());
$this->addModules($parserOutput->getModules());
$this->addModuleScripts($parserOutput->getModuleScripts());
$this->addModuleStyles($parserOutput->getModuleStyles());
$this->addJsConfigVars($parserOutput->getJsConfigVars());
$this->mPreventClickjacking = $this->mPreventClickjacking || $parserOutput->preventClickjacking();
// Template versioning...
foreach ((array) $parserOutput->getTemplateIds() as $ns => $dbks) {
if (isset($this->mTemplateIds[$ns])) {
$this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
} else {
$this->mTemplateIds[$ns] = $dbks;
}
}
// File versioning...
foreach ((array) $parserOutput->getFileSearchOptions() as $dbk => $data) {
$this->mImageTimeKeys[$dbk] = $data;
}
// Hooks registered in the object
$parserOutputHooks = $this->getConfig()->get('ParserOutputHooks');
foreach ($parserOutput->getOutputHooks() as $hookInfo) {
list($hookName, $data) = $hookInfo;
if (isset($parserOutputHooks[$hookName])) {
call_user_func($parserOutputHooks[$hookName], $this, $parserOutput, $data);
}
}
// Link flags are ignored for now, but may in the future be
// used to mark individual language links.
$linkFlags = array();
Hooks::run('LanguageLinks', array($this->getTitle(), &$this->mLanguageLinks, &$linkFlags));
Hooks::run('OutputPageParserOutput', array(&$this, $parserOutput));
}
示例3: requireFromParserOutput
/**
* This function takes output requirements as can be found in a given ParserOutput
* object and puts them back in to the internal temporal requirement list from
* which they can be committed to some other output. It is needed when code that
* would normally call SMWOutputs::requireHeadItem() has need to use a full
* independent parser call (Parser::parse()) that produces its own parseroutput.
* If omitted, all output items potentially committed to this parseroutput during
* parsing will not be passed on to higher levels.
*
* Note that this is not required if the $parseroutput is further processed by
* MediaWiki, but there are cases where the output is discarded and only its text
* is used.
*
* @param ParserOutput $parserOutput
*/
public static function requireFromParserOutput(ParserOutput $parserOutput)
{
// Note: we do not attempt to recover which head items where scripts here.
// ParserOutpt::getHeadItems() was added in MW 1.16
if (is_callable(array($parserOutput, 'getHeadItems'))) {
$parserOutputHeadItems = $parserOutput->getHeadItems();
} else {
$parserOutputHeadItems = (array) $parserOutput->headItems;
}
self::$headItems = array_merge((array) self::$headItems, $parserOutputHeadItems);
/// TODO Is the following needed?
if (isset($parserOutput->mModules)) {
foreach ($parserOutput->mModules as $module) {
self::$resourceModules[$module] = $module;
}
}
}