本文整理汇总了PHP中ParserOutput::addLanguageLink方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::addLanguageLink方法的具体用法?PHP ParserOutput::addLanguageLink怎么用?PHP ParserOutput::addLanguageLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::addLanguageLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfProfileIn
//.........这里部分代码省略.........
$s .= "{$prefix}[[{$link}|{$text}";
# note: no $trail, because without an end, there *is* no trail
wfProfileOut(__METHOD__ . "-might_be_img");
continue;
}
} else {
# it's not an image, so output it raw
$s .= "{$prefix}[[{$link}|{$text}";
# note: no $trail, because without an end, there *is* no trail
wfProfileOut(__METHOD__ . "-might_be_img");
continue;
}
wfProfileOut(__METHOD__ . "-might_be_img");
}
$wasblank = $text == '';
if ($wasblank) {
$text = $link;
} else {
# Bug 4598 madness. Handle the quotes only if they come from the alternate part
# [[Lista d''e paise d''o munno]] -> <a href="...">Lista d''e paise d''o munno</a>
# [[Criticism of Harry Potter|Criticism of ''Harry Potter'']]
# -> <a href="Criticism of Harry Potter">Criticism of <i>Harry Potter</i></a>
$text = $this->doQuotes($text);
}
# Link not escaped by : , create the various objects
if ($noforce) {
# Interwikis
wfProfileIn(__METHOD__ . "-interwiki");
if ($iw && $this->mOptions->getInterwikiMagic() && $nottalk && Language::fetchLanguageName($iw, null, 'mw')) {
// XXX: the above check prevents links to sites with identifiers that are not language codes
# Bug 24502: filter duplicates
if (!isset($this->mLangLinkLanguages[$iw])) {
$this->mLangLinkLanguages[$iw] = true;
$this->mOutput->addLanguageLink($nt->getFullText());
}
$s = rtrim($s . $prefix);
$s .= trim($trail, "\n") == '' ? '' : $prefix . $trail;
wfProfileOut(__METHOD__ . "-interwiki");
continue;
}
wfProfileOut(__METHOD__ . "-interwiki");
if ($ns == NS_FILE) {
wfProfileIn(__METHOD__ . "-image");
if (!wfIsBadImage($nt->getDBkey(), $this->mTitle)) {
if ($wasblank) {
# if no parameters were passed, $text
# becomes something like "File:Foo.png",
# which we don't want to pass on to the
# image generator
$text = '';
} else {
# recursively parse links inside the image caption
# actually, this will parse them in any other parameters, too,
# but it might be hard to fix that, and it doesn't matter ATM
$text = $this->replaceExternalLinks($text);
$holders->merge($this->replaceInternalLinks2($text));
}
# cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
$s .= $prefix . $this->armorLinks($this->makeImage($nt, $text, $holders)) . $trail;
} else {
$s .= $prefix . $trail;
}
wfProfileOut(__METHOD__ . "-image");
continue;
}
if ($ns == NS_CATEGORY) {
示例2: wfProfileIn
//.........这里部分代码省略.........
$holders->merge($this->replaceInternalLinks2($text));
$s .= "{$prefix}[[{$link}|{$text}";
# note: no $trail, because without an end, there *is* no trail
wfProfileOut(__METHOD__ . "-might_be_img");
continue;
}
} else {
# it's not an image, so output it raw
$s .= "{$prefix}[[{$link}|{$text}";
# note: no $trail, because without an end, there *is* no trail
wfProfileOut(__METHOD__ . "-might_be_img");
continue;
}
wfProfileOut(__METHOD__ . "-might_be_img");
}
$wasblank = $text == '';
if ($wasblank) {
$text = $link;
} else {
# Bug 4598 madness. Handle the quotes only if they come from the alternate part
# [[Lista d''e paise d''o munno]] -> <a href="...">Lista d''e paise d''o munno</a>
# [[Criticism of Harry Potter|Criticism of ''Harry Potter'']]
# -> <a href="Criticism of Harry Potter">Criticism of <i>Harry Potter</i></a>
$text = $this->doQuotes($text);
}
# Link not escaped by : , create the various objects
if ($noforce) {
global $wgContLang;
# Interwikis
if (empty($wgRTEParserEnabled)) {
# wikia
wfProfileIn(__METHOD__ . "-interwiki");
if ($iw && $this->mOptions->getInterwikiMagic() && $nottalk && $wgContLang->getLanguageName($iw)) {
$this->mOutput->addLanguageLink($nt->getFullText());
$s = rtrim($s . $prefix);
$s .= trim($trail, "\n") == '' ? '' : $prefix . $trail;
wfProfileOut(__METHOD__ . "-interwiki");
continue;
}
wfProfileOut(__METHOD__ . "-interwiki");
}
# wikia
if ($ns == NS_FILE) {
wfProfileIn(__METHOD__ . "-image");
if (!wfIsBadImage($nt->getDBkey(), $this->mTitle)) {
if ($wasblank) {
# if no parameters were passed, $text
# becomes something like "File:Foo.png",
# which we don't want to pass on to the
# image generator
$text = '';
} else {
# recursively parse links inside the image caption
# actually, this will parse them in any other parameters, too,
# but it might be hard to fix that, and it doesn't matter ATM
$text = $this->replaceExternalLinks($text);
$holders->merge($this->replaceInternalLinks2($text));
}
# RTE (Rich Text Editor) - begin
# @author: Inez Korczyński
if (!empty($wgRTEParserEnabled)) {
$text = RTEMarker::generate(RTEMarker::IMAGE_DATA, $RTE_wikitextIdx) . $text;
}
# RTE - end
# cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
/** wikia