/**
  * Override getParserOutput, since we require $title to generate our output
  */
 function getParserOutput(Title $title, $revId = null, ParserOptions $otpions = null, $generateHtml = true)
 {
     $po = new ParserOutput();
     if ($generateHtml) {
         $po->setText($this->generateHtml($title));
     }
     return $po;
 }
 public function testGetTemplates()
 {
     $title = Title::makeTitle(NS_TEMPLATE, 'Cite_news');
     $parserOutput = new ParserOutput();
     $parserOutput->addTemplate($title, 10, 100);
     $searchDataExtractor = new ParserOutputSearchDataExtractor();
     $this->assertEquals(['Template:Cite news'], $searchDataExtractor->getTemplates($parserOutput));
 }
示例#3
0
/**
 * @param OutputPage $out
 * @param ParserOutput $parserOutput
 * @return bool
 */
function wfWikiAnswersPageTitle(&$out, $parserOutput)
{
    $answerObj = Answer::newFromTitle($out->getTitle());
    if ($answerObj->isQuestion()) {
        $parserOutput->setTitleText($parserOutput->getTitleText() . wfMsg('?'));
    }
    return true;
}
 /**
  * Set the HTML and add the appropriate styles
  *
  *
  * @param Title $title
  * @param int $revId
  * @param ParserOptions $options
  * @param bool $generateHtml
  * @param ParserOutput $output
  */
 protected function fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 {
     if ($generateHtml) {
         $output->setText($this->objectTable($this->getJsonData()));
         $output->addModuleStyles('mediawiki.content.json');
     } else {
         $output->setText('');
     }
 }
 public function __construct(Title $title, ParserOutput $stableOutput)
 {
     $this->title = $title;
     # Stable version links
     $this->sLinks = $stableOutput->getLinks();
     $this->sTemplates = $stableOutput->getTemplates();
     $this->sImages = $stableOutput->getImages();
     $this->sCategories = $stableOutput->getCategories();
 }
 /**
  * Set the HTML and add the appropriate styles
  *
  *
  * @param Title $title
  * @param int $revId
  * @param ParserOptions $options
  * @param bool $generateHtml
  * @param ParserOutput $output
  */
 protected function fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 {
     if ($generateHtml) {
         $html = Html::element('pre', array('class' => 'mw-code mw-yaml', 'dir' => 'ltr'), $this->getNativeData());
         $output->setText($html);
     } else {
         $output->setText('');
     }
 }
 protected function fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 {
     // FIXME: WikiPage::doEditContent generates parser output before validation.
     // As such, native data may be invalid (though output is discarded later in that case).
     if ($generateHtml && $this->isValid()) {
         $output->setText($this->renderNotebook($this->getNativeData()));
     } else {
         $output->setText('error');
     }
 }
 /**
  * OutputPageParserOutput hook handler
  * @param OutputPage $out
  * @param ParserOutput $parserOutput
  * @return type 
  */
 public static function outputPageParserOutput(OutputPage &$out, ParserOutput $parserOutput)
 {
     $out->addModuleStyles('ext.articleEmblems');
     if (isset($parserOutput->articleEmblems)) {
         $emblems = array();
         foreach ($parserOutput->articleEmblems as $emblem) {
             $emblems[] = '<li class="articleEmblem">' . $emblem . '</li>';
         }
         $parserOutput->setText('<ul id="articleEmblems" class="noprint">' . implode($emblems) . '</ul>' . $parserOutput->getText());
     }
     return true;
 }
 /**
  * @covers ParserOutput::setExtensionData
  * @covers ParserOutput::getExtensionData
  */
 public function testExtensionData()
 {
     $po = new ParserOutput();
     $po->setExtensionData("one", "Foo");
     $this->assertEquals("Foo", $po->getExtensionData("one"));
     $this->assertNull($po->getExtensionData("spam"));
     $po->setExtensionData("two", "Bar");
     $this->assertEquals("Foo", $po->getExtensionData("one"));
     $this->assertEquals("Bar", $po->getExtensionData("two"));
     $po->setExtensionData("one", null);
     $this->assertNull($po->getExtensionData("one"));
     $this->assertEquals("Bar", $po->getExtensionData("two"));
 }
示例#10
0
 /**
  * @dataProvider getParserOutputVars
  */
 public function testMergeExternalParserOutputVars($sourceVars, $externalVars, $expectedVars)
 {
     $parserOutputSource = new ParserOutput();
     $parserOutputExternal = new ParserOutput();
     foreach ($parserOutputSource::$varsToMerge as $var) {
         $parserOutputSource->{$var} = $sourceVars[$var];
         $parserOutputExternal->{$var} = $externalVars[$var];
     }
     $parserOutputSource->mergeExternalParserOutputVars($parserOutputExternal);
     foreach ($parserOutputSource::$varsToMerge as $var) {
         $this->assertSame($expectedVars[$var], $parserOutputSource->{$var});
     }
 }
示例#11
0
 /**
  * Constructor
  *
  * @param Title $title Title of the page we're updating
  * @param ParserOutput $parserOutput Output from a full parse of this page
  * @param bool $recursive Queue jobs for recursive updates?
  */
 function LinksUpdate($title, $parserOutput, $recursive = true)
 {
     global $wgAntiLockFlags;
     if ($wgAntiLockFlags & ALF_NO_LINK_LOCK) {
         $this->mOptions = array();
     } else {
         $this->mOptions = array('FOR UPDATE');
     }
     $this->mDb = wfGetDB(DB_MASTER);
     if (!is_object($title)) {
         throw new MWException("The calling convention to LinksUpdate::LinksUpdate() has changed. " . "Please see Article::editUpdates() for an invocation example.\n");
     }
     $this->mTitle = $title;
     $this->mId = $title->getArticleID();
     $this->mParserOutput = $parserOutput;
     $this->mLinks = $parserOutput->getLinks();
     $this->mImages = $parserOutput->getImages();
     $this->mTemplates = $parserOutput->getTemplates();
     $this->mExternals = $parserOutput->getExternalLinks();
     $this->mCategories = $parserOutput->getCategories();
     $this->mProperties = $parserOutput->getProperties();
     # Convert the format of the interlanguage links
     # I didn't want to change it in the ParserOutput, because that array is passed all
     # the way back to the skin, so either a skin API break would be required, or an
     # inefficient back-conversion.
     $ill = $parserOutput->getLanguageLinks();
     $this->mInterlangs = array();
     foreach ($ill as $link) {
         list($key, $title) = explode(':', $link, 2);
         $this->mInterlangs[$key] = $title;
     }
     $this->mRecursive = $recursive;
     $this->mTouchTmplLinks = false;
     wfRunHooks('LinksUpdateConstructed', array(&$this));
 }
 /**
  * @covers ParserOutput::setProperty
  * @covers ParserOutput::getProperty
  * @covers ParserOutput::unsetProperty
  * @covers ParserOutput::getProperties
  */
 public function testProperties()
 {
     $po = new ParserOutput();
     $po->setProperty('foo', 'val');
     $properties = $po->getProperties();
     $this->assertEquals($po->getProperty('foo'), 'val');
     $this->assertEquals($properties['foo'], 'val');
     $po->setProperty('foo', 'second val');
     $properties = $po->getProperties();
     $this->assertEquals($po->getProperty('foo'), 'second val');
     $this->assertEquals($properties['foo'], 'second val');
     $po->unsetProperty('foo');
     $properties = $po->getProperties();
     $this->assertEquals($po->getProperty('foo'), false);
     $this->assertArrayNotHasKey('foo', $properties);
 }
示例#13
0
 /**
  * This does all the heavy lifting for outputWikitext, except it returns the parser
  * output instead of sending it straight to $wgOut. Makes things nice and simple for,
  * say, embedding thread pages within a discussion system (LiquidThreads)
  *
  * @param $text string
  * @param $cache boolean
  * @param $parserOptions parsing options, defaults to false
  * @return ParserOutput
  */
 public function getOutputFromWikitext($text, $cache = true, $parserOptions = false)
 {
     global $wgParser, $wgEnableParserCache, $wgUseFileCache;
     if (!$parserOptions) {
         $parserOptions = $this->mPage->getParserOptions();
     }
     $time = -wfTime();
     $this->mParserOutput = $wgParser->parse($text, $this->getTitle(), $parserOptions, true, true, $this->getRevIdFetched());
     $time += wfTime();
     # Timing hack
     if ($time > 3) {
         wfDebugLog('slow-parse', sprintf("%-5.2f %s", $time, $this->getTitle()->getPrefixedDBkey()));
     }
     if ($wgEnableParserCache && $cache && $this->mParserOutput->isCacheable()) {
         $parserCache = ParserCache::singleton();
         $parserCache->save($this->mParserOutput, $this, $parserOptions);
     }
     // Make sure file cache is not used on uncacheable content.
     // Output that has magic words in it can still use the parser cache
     // (if enabled), though it will generally expire sooner.
     if (!$this->mParserOutput->isCacheable() || $this->mParserOutput->containsOldMagic()) {
         $wgUseFileCache = false;
     }
     if ($this->isCurrent()) {
         $this->mPage->doCascadeProtectionUpdates($this->mParserOutput);
     }
     return $this->mParserOutput;
 }
 public function testUpdate_pagelinks()
 {
     list($t, $po) = $this->makeTitleAndParserOutput("Testing", 111);
     $po->addLink(Title::newFromText("Foo"));
     $po->addLink(Title::newFromText("Special:Foo"));
     // special namespace should be ignored
     $po->addLink(Title::newFromText("linksupdatetest:Foo"));
     // interwiki link should be ignored
     $po->addLink(Title::newFromText("#Foo"));
     // hash link should be ignored
     $this->assertLinksUpdate($t, $po, 'pagelinks', 'pl_namespace, pl_title', 'pl_from = 111', array(array(NS_MAIN, 'Foo')));
     $po = new ParserOutput();
     $po->setTitleText($t->getPrefixedText());
     $po->addLink(Title::newFromText("Bar"));
     $this->assertLinksUpdate($t, $po, 'pagelinks', 'pl_namespace, pl_title', 'pl_from = 111', array(array(NS_MAIN, 'Bar')));
 }
示例#15
0
 /**
  * Update links table freshness
  */
 protected function updateLinksTimestamp()
 {
     if ($this->mId) {
         // The link updates made here only reflect the freshness of the parser output
         $timestamp = $this->mParserOutput->getCacheTime();
         $this->mDb->update('page', array('page_links_updated' => $this->mDb->timestamp($timestamp)), array('page_id' => $this->mId), __METHOD__);
     }
 }
示例#16
0
 public function getAsJobSpecification()
 {
     if ($this->user) {
         $userInfo = array('userId' => $this->user->getId(), 'userName' => $this->user->getName());
     } else {
         $userInfo = false;
     }
     return array('wiki' => $this->mDb->getWikiID(), 'job' => new JobSpecification('refreshLinksPrioritized', array('rootJobTimestamp' => $this->mParserOutput->getCacheTime(), 'useRecursiveLinksUpdate' => $this->mRecursive, 'triggeringUser' => $userInfo), array('removeDuplicates' => true), $this->getTitle()));
 }
function egOgmcParserOutputApplyValues(OutputPage $out, ParserOutput $parserOutput, $data)
{
    wfProfileIn(__METHOD__);
    global $wgTitle;
    $articleId = $wgTitle->getArticleID();
    $titleImage = $titleDescription = null;
    wfRunHooks('OpenGraphMeta:beforeCustomFields', array($articleId, &$titleImage, &$titleDescription));
    // Get description from ArticleService
    if (is_null($titleDescription)) {
        $DESC_LENGTH = 500;
        $articleService = new ArticleService($wgTitle);
        $titleDescription = $articleService->getTextSnippet($DESC_LENGTH);
    }
    if (!empty($titleDescription)) {
        $parserOutput->setProperty('description', $titleDescription);
        $out->mDescription = $parserOutput->getProperty('description');
    }
    wfProfileOut(__METHOD__);
}
 /**
  * Set template and image versions from parsing a revision
  * @param Title $title
  * @param int $revId
  * @param ParserOutput $rev
  * @return void
  */
 public static function setRevIncludes(Title $title, $revId, ParserOutput $pOut)
 {
     global $wgMemc;
     $key = self::getCacheKey($title, $revId);
     # Get the template/file versions used...
     $versions = array($pOut->getTemplateIds(), $pOut->getFileSearchOptions());
     # Save to cache (check cache expiry for dynamic elements)...
     $data = FlaggedRevs::makeMemcObj($versions);
     $wgMemc->set($key, $data, $pOut->getCacheExpiry());
 }
示例#19
0
 public function getAsJobSpecification()
 {
     if ($this->user) {
         $userInfo = ['userId' => $this->user->getId(), 'userName' => $this->user->getName()];
     } else {
         $userInfo = false;
     }
     if ($this->mRevision) {
         $triggeringRevisionId = $this->mRevision->getId();
     } else {
         $triggeringRevisionId = false;
     }
     return ['wiki' => $this->getDB()->getWikiID(), 'job' => new JobSpecification('refreshLinksPrioritized', ['rootJobTimestamp' => $this->mParserOutput->getCacheTime(), 'useRecursiveLinksUpdate' => $this->mRecursive, 'triggeringUser' => $userInfo, 'triggeringRevisionId' => $triggeringRevisionId], ['removeDuplicates' => true], $this->getTitle())];
 }
示例#20
0
    /**
     * @covers ParserOutput::addLink
     */
    public function testUpdate_pagelinks()
    {
        /** @var Title $t */
        /** @var ParserOutput $po */
        list($t, $po) = $this->makeTitleAndParserOutput("Testing", self::$testingPageId);
        $po->addLink(Title::newFromText("Foo"));
        $po->addLink(Title::newFromText("Special:Foo"));
        // special namespace should be ignored
        $po->addLink(Title::newFromText("linksupdatetest:Foo"));
        // interwiki link should be ignored
        $po->addLink(Title::newFromText("#Foo"));
        // hash link should be ignored
        $update = $this->assertLinksUpdate($t, $po, 'pagelinks', 'pl_namespace,
			pl_title', 'pl_from = ' . self::$testingPageId, [[NS_MAIN, 'Foo']]);
        $this->assertArrayEquals([Title::makeTitle(NS_MAIN, 'Foo')], $update->getAddedLinks());
        $po = new ParserOutput();
        $po->setTitleText($t->getPrefixedText());
        $po->addLink(Title::newFromText("Bar"));
        $po->addLink(Title::newFromText("Talk:Bar"));
        $update = $this->assertLinksUpdate($t, $po, 'pagelinks', 'pl_namespace,
			pl_title', 'pl_from = ' . self::$testingPageId, [[NS_MAIN, 'Bar'], [NS_TALK, 'Bar']]);
        $this->assertArrayEquals([Title::makeTitle(NS_MAIN, 'Bar'), Title::makeTitle(NS_TALK, 'Bar')], $update->getAddedLinks());
        $this->assertArrayEquals([Title::makeTitle(NS_MAIN, 'Foo')], $update->getRemovedLinks());
    }
 /**
  * @return bool
  */
 public function doWork()
 {
     global $wgUseFileCache;
     // @todo several of the methods called on $this->page are not declared in Page, but present
     //        in WikiPage and delegated by Article.
     $isCurrent = $this->revid === $this->page->getLatest();
     if ($this->content !== null) {
         $content = $this->content;
     } elseif ($isCurrent) {
         // XXX: why use RAW audience here, and PUBLIC (default) below?
         $content = $this->page->getContent(Revision::RAW);
     } else {
         $rev = Revision::newFromTitle($this->page->getTitle(), $this->revid);
         if ($rev === null) {
             $content = null;
         } else {
             // XXX: why use PUBLIC audience here (default), and RAW above?
             $content = $rev->getContent();
         }
     }
     if ($content === null) {
         return false;
     }
     // Reduce effects of race conditions for slow parses (bug 46014)
     $cacheTime = wfTimestampNow();
     $time = -microtime(true);
     $this->parserOutput = $content->getParserOutput($this->page->getTitle(), $this->revid, $this->parserOptions);
     $time += microtime(true);
     // Timing hack
     if ($time > 3) {
         // TODO: Use Parser's logger (once it has one)
         $logger = MediaWiki\Logger\LoggerFactory::getInstance('slow-parse');
         $logger->info('{time} {title}', array('time' => number_format($time, 2), 'title' => $this->page->getTitle()->getPrefixedDBkey()));
     }
     if ($this->cacheable && $this->parserOutput->isCacheable() && $isCurrent) {
         ParserCache::singleton()->save($this->parserOutput, $this->page, $this->parserOptions, $cacheTime, $this->revid);
     }
     // Make sure file cache is not used on uncacheable content.
     // Output that has magic words in it can still use the parser cache
     // (if enabled), though it will generally expire sooner.
     if (!$this->parserOutput->isCacheable()) {
         $wgUseFileCache = false;
     }
     if ($isCurrent) {
         $this->page->triggerOpportunisticLinksUpdate($this->parserOutput);
     }
     return true;
 }
示例#22
0
 /**
  * @return bool
  */
 public function doWork()
 {
     global $wgUseFileCache;
     // @todo several of the methods called on $this->page are not declared in Page, but present
     //        in WikiPage and delegated by Article.
     $isCurrent = $this->revid === $this->page->getLatest();
     if ($this->content !== null) {
         $content = $this->content;
     } elseif ($isCurrent) {
         // XXX: why use RAW audience here, and PUBLIC (default) below?
         $content = $this->page->getContent(Revision::RAW);
     } else {
         $rev = Revision::newFromTitle($this->page->getTitle(), $this->revid);
         if ($rev === null) {
             $content = null;
         } else {
             // XXX: why use PUBLIC audience here (default), and RAW above?
             $content = $rev->getContent();
         }
     }
     if ($content === null) {
         return false;
     }
     // Reduce effects of race conditions for slow parses (bug 46014)
     $cacheTime = wfTimestampNow();
     $time = -microtime(true);
     $this->parserOutput = $content->getParserOutput($this->page->getTitle(), $this->revid, $this->parserOptions);
     $time += microtime(true);
     // Timing hack
     if ($time > 3) {
         wfDebugLog('slow-parse', sprintf("%-5.2f %s", $time, $this->page->getTitle()->getPrefixedDBkey()));
     }
     if ($this->cacheable && $this->parserOutput->isCacheable() && $isCurrent) {
         ParserCache::singleton()->save($this->parserOutput, $this->page, $this->parserOptions, $cacheTime, $this->revid);
     }
     // Make sure file cache is not used on uncacheable content.
     // Output that has magic words in it can still use the parser cache
     // (if enabled), though it will generally expire sooner.
     if (!$this->parserOutput->isCacheable() || $this->parserOutput->containsOldMagic()) {
         $wgUseFileCache = false;
     }
     if ($isCurrent) {
         $this->page->doCascadeProtectionUpdates($this->parserOutput);
     }
     return true;
 }
示例#23
0
 /**
  * @return Array
  */
 function getTemplates()
 {
     if ($this->preview || $this->section != '') {
         $templates = array();
         if (!isset($this->mParserOutput)) {
             return $templates;
         }
         foreach ($this->mParserOutput->getTemplates() as $ns => $template) {
             foreach (array_keys($template) as $dbk) {
                 $templates[] = Title::makeTitle($ns, $dbk);
             }
         }
         return $templates;
     } else {
         return $this->mArticle->getUsedTemplates();
     }
 }
 function reportLimitData(ParserOutput $output)
 {
     try {
         $this->load();
     } catch (Exception $e) {
         return;
     }
     if ($this->initialStatus) {
         $status = $this->interpreter->getStatus();
         $output->setLimitReportData('scribunto-limitreport-timeusage', array(sprintf("%.3f", $status['time'] / $this->getClockTick()), sprintf("%.3f", $this->options['cpuLimit'])));
         $output->setLimitReportData('scribunto-limitreport-virtmemusage', array($status['vsize'], $this->options['memoryLimit']));
         $output->setLimitReportData('scribunto-limitreport-estmemusage', $status['vsize'] - $this->initialStatus['vsize']);
     }
     $logs = $this->getLogBuffer();
     if ($logs !== '') {
         $output->addModules('ext.scribunto.logs');
         $output->setLimitReportData('scribunto-limitreport-logs', $logs);
     }
 }
 /**
  * OutputPageParserOutput hook handler
  * Disables TOC in output before it grabs HTML
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageParserOutput
  *
  * @param OutputPage $outputPage
  * @param ParserOutput $po
  * @return bool
  */
 public static function onOutputPageParserOutput($outputPage, ParserOutput $po)
 {
     global $wgMFWikibaseImageCategory;
     $context = MobileContext::singleton();
     $isBeta = $context->isBetaGroupMember();
     $mfUseWikibaseDescription = $context->getMFConfig()->get('MFUseWikibaseDescription');
     if ($context->shouldDisplayMobileView()) {
         $outputPage->enableTOC(false);
         $outputPage->setProperty('MinervaTOC', $po->getTOCHTML() !== '');
         if ($mfUseWikibaseDescription && $isBeta) {
             $item = $po->getProperty('wikibase_item');
             if ($item) {
                 $desc = ExtMobileFrontend::getWikibaseDescription($item);
                 $category = ExtMobileFrontend::getWikibasePropertyValue($item, $wgMFWikibaseImageCategory);
                 if ($desc) {
                     $outputPage->setProperty('wgMFDescription', $desc);
                 }
                 if ($category) {
                     $outputPage->setProperty('wgMFImagesCategory', $category);
                 }
             }
         }
         // Enable wrapped sections
         $po->setText(ExtMobileFrontend::DOMParse($outputPage, $po->getText(), $isBeta));
     }
     return true;
 }
 /**
  * @param Title $title Unused.
  * @param int $revId Unused.
  * @param ParserOptions $options Unused.
  * @param bool $generateHtml Whether to generate HTML (default: true).
  *
  * @return ParserOutput
  *
  * @see Content::getParserOutput
  */
 public function getParserOutput(Title $title, $revId = null, ParserOptions $options = null, $generateHtml = true)
 {
     if ($generateHtml) {
         $html = $this->getHtml();
     } else {
         $html = '';
     }
     $po = new ParserOutput($html);
     // Message objects are in the user language.
     $po->recordOption('userlang');
     return $po;
 }
示例#27
0
 /**
  * Add the HTML associated with a ParserOutput object, without any metadata.
  *
  * @since 1.24
  * @param ParserOutput $parserOutput
  */
 public function addParserOutputText($parserOutput)
 {
     $text = $parserOutput->getText();
     Hooks::run('OutputPageBeforeHTML', array(&$this, &$text));
     $this->addHTML($text);
 }
示例#28
0
 /**
  * Add a ParserOutput object, but without Html
  *
  * @param ParserOutput $parserOutput
  */
 public function addParserOutputNoText(&$parserOutput)
 {
     $this->mLanguageLinks += $parserOutput->getLanguageLinks();
     $this->addCategoryLinks($parserOutput->getCategories());
     $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->addModuleMessages($parserOutput->getModuleMessages());
     $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
     global $wgParserOutputHooks;
     foreach ($parserOutput->getOutputHooks() as $hookInfo) {
         list($hookName, $data) = $hookInfo;
         if (isset($wgParserOutputHooks[$hookName])) {
             call_user_func($wgParserOutputHooks[$hookName], $this, $parserOutput, $data);
         }
     }
     // Link flags are ignored for now, but may in the future be
     // used to mark individual language links.
     $linkFlags = array();
     wfRunHooks('LanguageLinks', array($this->getTitle(), &$this->mLanguageLinks, &$linkFlags));
     wfRunHooks('OutputPageParserOutput', array(&$this, $parserOutput));
 }
示例#29
0
 /**
  * Adjust title for pages with displaytitle, -{T|}- or language conversion
  * @param ParserOutput $pOutput
  */
 public function adjustDisplayTitle(ParserOutput $pOutput)
 {
     # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
     $titleText = $pOutput->getTitleText();
     if (strval($titleText) !== '') {
         $this->getContext()->getOutput()->setPageTitle($titleText);
     }
 }
示例#30
0
 /**
  * Mutator for $mDefaultSort
  *
  * @param string $sort New value
  */
 public function setDefaultSort($sort)
 {
     $this->mDefaultSort = $sort;
     $this->mOutput->setProperty('defaultsort', $sort);
 }