当前位置: 首页>>代码示例>>PHP>>正文


PHP WikiPage::getParserOutput方法代码示例

本文整理汇总了PHP中WikiPage::getParserOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiPage::getParserOutput方法的具体用法?PHP WikiPage::getParserOutput怎么用?PHP WikiPage::getParserOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WikiPage的用法示例。


在下文中一共展示了WikiPage::getParserOutput方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getParserOutput

 /**
  * Lightweight method to get the parser output for a page, checking the parser cache
  * and so on. Doesn't consider most of the stuff that WikiPage::view is forced to
  * consider, so it's not appropriate to use there.
  *
  * @since 1.16 (r52326) for LiquidThreads
  *
  * @param $oldid mixed integer Revision ID or null
  * @param $user User The relevant user
  * @return ParserOutput or false if the given revsion ID is not found
  */
 public function getParserOutput($oldid = null, User $user = null)
 {
     global $wgUser;
     $user = is_null($user) ? $wgUser : $user;
     $parserOptions = $this->mPage->makeParserOptions($user);
     return $this->mPage->getParserOutput($parserOptions, $oldid);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:Article.php

示例2: getParserOutput

 /**
  * Lightweight method to get the parser output for a page, checking the parser cache
  * and so on. Doesn't consider most of the stuff that WikiPage::view is forced to
  * consider, so it's not appropriate to use there.
  *
  * @since 1.16 (r52326) for LiquidThreads
  *
  * @param $oldid mixed integer Revision ID or null
  * @param $user User The relevant user
  * @return ParserOutput or false if the given revsion ID is not found
  */
 public function getParserOutput($oldid = null, User $user = null)
 {
     if ($user === null) {
         $parserOptions = $this->getParserOptions();
     } else {
         $parserOptions = $this->mPage->makeParserOptions($user);
     }
     return $this->mPage->getParserOutput($parserOptions, $oldid);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:20,代码来源:Article.php

示例3: getParsedContent

 /**
  * @param $page WikiPage
  * @param $popts ParserOptions
  * @param $pageId Int
  * @param $getWikitext Bool
  * @return ParserOutput
  */
 private function getParsedContent(WikiPage $page, $popts, $pageId = null, $getWikitext = false)
 {
     $this->content = $page->getContent(Revision::RAW);
     //XXX: really raw?
     if ($this->section !== false && $this->content !== null) {
         $this->content = $this->getSectionContent($this->content, !is_null($pageId) ? 'page id ' . $pageId : $page->getTitle()->getText());
         // Not cached (save or load)
         return $this->content->getParserOutput($page->getTitle(), null, $popts);
     } else {
         // Try the parser cache first
         // getParserOutput will save to Parser cache if able
         $pout = $page->getParserOutput($popts);
         if (!$pout) {
             $this->dieUsage("There is no revision ID {$page->getLatest()}", 'missingrev');
         }
         if ($getWikitext) {
             $this->content = $page->getContent(Revision::RAW);
         }
         return $pout;
     }
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:28,代码来源:ApiParse.php

示例4: getParserOutput

 protected function getParserOutput(WikiPage $page, Revision $rev)
 {
     $parserOptions = $page->makeParserOptions($this->getContext());
     if (!$rev->isCurrent() || !$rev->getTitle()->quickUserCan('edit', $this->getUser())) {
         $parserOptions->setEditSection(false);
     }
     $parserOutput = $page->getParserOutput($parserOptions, $rev->getId());
     return $parserOutput;
 }
开发者ID:guochangjiang,项目名称:mediawiki,代码行数:9,代码来源:DifferenceEngine.php

示例5: testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored

 public function testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored()
 {
     $this->setMwGlobals('wgCategoryCollation', 'uppercase');
     $templateTitle = Title::newFromText('Template:TestingTemplate');
     $templatePage = new WikiPage($templateTitle);
     $wikiPage = new WikiPage(Title::newFromText('Testing'));
     $wikiPage->doEditContent(new WikitextContent('{{TestingTemplate}}'), 'added template');
     $this->runAllRelatedJobs();
     $otherWikiPage = new WikiPage(Title::newFromText('Some_other_page'));
     $otherWikiPage->doEditContent(new WikitextContent('{{TestingTemplate}}'), 'added template');
     $this->runAllRelatedJobs();
     $this->assertRecentChangeByCategorization($templateTitle, $templatePage->getParserOutput(new ParserOptions()), Title::newFromText('Baz'), []);
     $templatePage->doEditContent(new WikitextContent('[[Category:Baz]]'), 'added category');
     $this->runAllRelatedJobs();
     $this->assertRecentChangeByCategorization($templateTitle, $templatePage->getParserOutput(new ParserOptions()), Title::newFromText('Baz'), [['Baz', '[[:Template:TestingTemplate]] added to category, ' . '[[Special:WhatLinksHere/Template:TestingTemplate|this page is included within other pages]]']]);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:16,代码来源:LinksUpdateTest.php

示例6: testGetParserOutput_nonexisting

 /**
  * @covers WikiPage::getParserOutput
  */
 public function testGetParserOutput_nonexisting()
 {
     static $count = 0;
     $count++;
     $page = new WikiPage(new Title("WikiPageTest_testGetParserOutput_nonexisting_{$count}"));
     $opt = new ParserOptions();
     $po = $page->getParserOutput($opt);
     $this->assertFalse($po, "getParserOutput() shall return false for non-existing pages.");
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:12,代码来源:WikiPageTest.php

示例7: getParserOutput

 /**
  * Performs a page parse
  * @param WikiPage $wp
  * @param ParserOptions $parserOptions
  * @return ParserOutput
  */
 protected function getParserOutput(WikiPage $wp, ParserOptions $parserOptions)
 {
     $time = microtime(true);
     $parserOutput = $wp->getParserOutput($parserOptions);
     $time = microtime(true) - $time;
     if (!$parserOutput) {
         wfDebugLog('mobile', "Empty parser output on '{$wp->getTitle()->getPrefixedText()}'" . ": rev {$wp->getId()}, time {$time}");
         throw new Exception(__METHOD__ . ": PoolCounter didn't return parser output");
     }
     $parserOutput->setTOCEnabled(false);
     return $parserOutput;
 }
开发者ID:negati-ve,项目名称:openshift-mediawiki,代码行数:18,代码来源:ApiMobileView.php

示例8: execute

 public function execute()
 {
     global $IP;
     require_once "{$IP}/extensions/wikihow/common/S3.php";
     define('WH_USE_BACKUP_DB', true);
     $pageIds = array();
     // allow for the input files to be specified on the command line
     if ($this->getOption('stream')) {
         $data = stream_get_contents(STDIN);
         $data = array_map('trim', explode("\n", $data));
         foreach ($data as $inputTitle) {
             $title = Title::newFromText($inputTitle, 6);
             if (!$title) {
                 continue;
             }
             $id = $title->getArticleID();
             $pageIds[] = $id;
         }
     }
     // if provided title, add that to the array
     $titleText = $this->getOption('title');
     if ($titleText) {
         $title = Title::newFromText($titleText, 6);
         $id = $title->getArticleID();
         $pageIds[] = $id;
     }
     // if there is a start, add articles to the array
     $start = $this->getOption('start');
     if ($start) {
         $dbr = wfGetDB(DB_SLAVE);
         $options = array("page_id > {$start}", "page_namespace = 6");
         $stop = $this->getOption('stop');
         if ($stop) {
             $options[] = "page_id < {$stop}";
         }
         $res = $dbr->select("page", "page_id", $options, __FILE__);
         // put them all into an array first
         foreach ($res as $row) {
             $pageIds[] = $row->page_id;
         }
     }
     $purgeTitles = array();
     $filesToPurgeFromCDN = array();
     foreach ($pageIds as $pageId) {
         $title = Title::newFromID($pageId);
         $file = wfLocalFile($title);
         if (!$file) {
             continue;
         }
         $userName = $file->getUser("text");
         if (WatermarkSupport::isWikihowCreator($userName)) {
             decho("file", $title->getText(), false);
             if ($this->getOption('s3')) {
                 decho("will purge from s3", false, false);
                 self::purgeThumbnailsFromS3($file);
             }
             if ($this->getOption('regenerate')) {
                 decho("will regenerate thumbnails", $file->getThumbnails(), false);
                 WatermarkSupport::recreateThumbnails($file);
                 decho("regeneration of thumbnails complete", false, false);
             }
             if ($this->getOption('purgelocal')) {
                 decho("will purge local cache thumbnails", $file->getThumbnails(), false);
                 $file->purgeCache();
                 // get titles that point here so we can purge them and
                 // regenerate those pages so the thumbnails come back
                 $purgeTitles = array_unique(array_merge($purgeTitles, ImageHelper::getLinkedArticles($title)));
                 decho("purging of thumbnails complete", false, false);
             }
             if ($this->getOption('cdn')) {
                 $filesToPurgeFromCDN[] = $file;
             }
         }
     }
     //purge the titles that have linked to these images
     foreach ($purgeTitles as $linkedTitle) {
         decho('will purge', $linkedTitle, false);
         // will now get the parser output to refresh the thumbnail
         // or else cdn may get reset before the thumbnails are regenerated
         $wp = new WikiPage($linkedTitle);
         $wp->doPurge();
         $po = ParserOptions::newFromUser($wgUser);
         $wp->getParserOutput($po);
     }
     if ($this->getOption('cdn')) {
         decho("will purge from cdn", false, false);
         $this->purgeThumbnailsFromCDNetworks($filesToPurgeFromCDN);
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:89,代码来源:removeThumbnailsSince.php

示例9: testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored

 public function testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored()
 {
     $this->setMwGlobals('wgCategoryCollation', 'uppercase');
     $templateTitle = Title::newFromText('Template:TestingTemplate');
     $templatePage = new WikiPage($templateTitle);
     $wikiPage = new WikiPage(Title::newFromText('Testing'));
     $wikiPage->doEditContent(new WikitextContent('{{TestingTemplate}}'), 'added template');
     $otherWikiPage = new WikiPage(Title::newFromText('Some_other_page'));
     $otherWikiPage->doEditContent(new WikitextContent('{{TestingTemplate}}'), 'added template');
     $templatePage->doEditContent(new WikitextContent('[[Category:Foo]]'), 'added category');
     $this->assertRecentChangeByCategorization($templateTitle, $templatePage->getParserOutput(new ParserOptions()), Title::newFromText('Foo'), array(array('Foo', '[[:Template:TestingTemplate]] and 2 pages added to category')));
 }
开发者ID:huatuoorg,项目名称:mediawiki,代码行数:12,代码来源:LinksUpdateTest.php


注:本文中的WikiPage::getParserOutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。