本文整理汇总了PHP中OutputPage::addWikiTextWithTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::addWikiTextWithTitle方法的具体用法?PHP OutputPage::addWikiTextWithTitle怎么用?PHP OutputPage::addWikiTextWithTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPage
的用法示例。
在下文中一共展示了OutputPage::addWikiTextWithTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showArticle
/**
* After we've either updated or inserted the article, update
* the link tables and redirect to the new page.
*/
function showArticle($text, $subtitle, $sectionanchor = '')
{
global $wgUseDumbLinkUpdate, $wgAntiLockFlags, $wgOut, $wgUser, $wgLinkCache, $wgEnotif;
global $wgUseEnotif;
$fname = 'Article::showArticle';
wfProfileIn($fname);
$wgLinkCache = new LinkCache();
if (!$wgUseDumbLinkUpdate) {
# Preload links to reduce lock time
if ($wgAntiLockFlags & ALF_PRELOAD_LINKS) {
$wgLinkCache->preFill($this->mTitle);
$wgLinkCache->clear();
}
}
# Parse the text and replace links with placeholders
$wgOut = new OutputPage();
# Pass the current title along in case we're creating a wiki page
# which is different than the currently displayed one (e.g. image
# pages created on file uploads); otherwise, link updates will
# go wrong.
$wgOut->addWikiTextWithTitle($text, $this->mTitle);
if (!$wgUseDumbLinkUpdate) {
# Move the current links back to the second register
$wgLinkCache->swapRegisters();
# Get old version of link table to allow incremental link updates
# Lock this data now since it is needed for an update
$wgLinkCache->forUpdate(true);
$wgLinkCache->preFill($this->mTitle);
# Swap this old version back into its rightful place
$wgLinkCache->swapRegisters();
}
if ($this->isRedirect($text)) {
$r = 'redirect=no';
} else {
$r = '';
}
$wgOut->redirect($this->mTitle->getFullURL($r) . $sectionanchor);
wfProfileOut($fname);
}