當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ParserOutput::getProperty方法代碼示例

本文整理匯總了PHP中ParserOutput::getProperty方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParserOutput::getProperty方法的具體用法?PHP ParserOutput::getProperty怎麽用?PHP ParserOutput::getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ParserOutput的用法示例。


在下文中一共展示了ParserOutput::getProperty方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testProperties

 /**
  * @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);
 }
開發者ID:MediaWiki-stable,項目名稱:1.26.1,代碼行數:22,代碼來源:ParserOutputTest.php

示例2: egOgmcParserOutputApplyValues

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__);
}
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:19,代碼來源:OpenGraphMetaCustomizations.setup.php

示例3: onOutputPageParserOutput

 /**
  * 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;
 }
開發者ID:micha6554,項目名稱:mediawiki-extensions-MobileFrontend,代碼行數:36,代碼來源:MobileFrontend.hooks.php

示例4: onOutputPageParserOutput

 /**
  * Propogate if we should create a ToC from ParserOutput -> OutputPage.
  *
  * Its assumed we should create a ToC on the following conditions:
  *  * __NOCOLLABORATIONHUBTOC__ is not on page
  *  * Somebody added parser metadata to the OutputPage (More likely to be a real page)
  *  * The limit report was enabled (More likely to be a real page)
  * These conditions are hacky. Ideally we'd come up with a more
  * robust way of determining if this is really a wikipage.
  *
  * Eventually, the TOC will be output by onOutputPageBeforeHTML hook if this
  * hook signals it is ok.
  *
  * @param $out OutputPage
  * @param $pout ParserOutput
  */
 public static function onOutputPageParserOutput(OutputPage $out, ParserOutput $pout)
 {
     if ($out->getProperty('CollaborationHubSubpage')) {
         // We've already been here, so we can't abort
         // outputting the TOC at this stage.
         wfDebug(__METHOD__ . ' TOC already outputted, possibly incorrectly.');
         return;
     }
     if ($pout->getProperty('nocollaborationhubtoc') !== false) {
         // TOC disabled, mark as done.
         $out->setProperty('CollaborationHubSubpage', true);
     } elseif ($pout->getLimitReportData()) {
         $out->setProperty('CollaborationHubSubpage', "in-progress");
     }
 }
開發者ID:wikimedia,項目名稱:mediawiki-extensions-CollaborationKit,代碼行數:31,代碼來源:CollaborationKit.hooks.php

示例5: getDefaultSort

 /**
  * Get the defaultsort property
  * @return string|null
  */
 public function getDefaultSort()
 {
     return $this->parserOutput->getProperty('defaultsort');
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:8,代碼來源:WikiTextStructure.php

示例6: onOutputPageParserOutput

 /**
  * 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)
 {
     $context = MobileContext::singleton();
     $mfUseWikibaseDescription = $context->getMFConfig()->get('MFUseWikibaseDescription');
     if ($context->shouldDisplayMobileView()) {
         $outputPage->enableTOC(false);
         $outputPage->setProperty('MinervaTOC', $po->getTOCHTML() !== '');
         if ($mfUseWikibaseDescription && $context->isBetaGroupMember()) {
             $item = $po->getProperty('wikibase_item');
             if ($item) {
                 $desc = ExtMobileFrontend::getWikibaseDescription($item);
                 if ($desc) {
                     $outputPage->setProperty('wgMFDescription', $desc);
                 }
             }
         }
     }
     return true;
 }
開發者ID:GoProjectOwner,項目名稱:mediawiki-extensions-MobileFrontend,代碼行數:28,代碼來源:MobileFrontend.hooks.php

示例7: saveToParserOutput

 protected function saveToParserOutput(\ParserOutput $parserOutput, Nodes\NodeInfobox $raw)
 {
     if ($raw) {
         $infoboxes = $parserOutput->getProperty(PortableInfoboxDataService::INFOBOXES_PROPERTY_NAME);
         $infoboxes[] = ['data' => $raw->getRenderData(), 'sources' => $raw->getSource()];
         $parserOutput->setProperty(PortableInfoboxDataService::INFOBOXES_PROPERTY_NAME, $infoboxes);
     }
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:8,代碼來源:PortableInfoboxParserTagController.class.php


注:本文中的ParserOutput::getProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。