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


PHP ParserOutput::addModules方法代碼示例

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


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

示例1: reportLimitData

 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);
     }
 }
開發者ID:negati-ve,項目名稱:openshift-mediawiki,代碼行數:19,代碼來源:LuaStandaloneEngine.php

示例2: formatHeadings


//.........這裏部分代碼省略.........
                     break;
                 }
             }
             $byteOffset += mb_strlen($this->mStripState->unstripBoth($frame->expand($node, PPFrame::RECOVER_ORIG)));
             $node = $node->getNextSibling();
         }
         $tocraw[] = array('toclevel' => $toclevel, 'level' => $level, 'line' => $tocline, 'number' => $numbering, 'index' => ($isTemplate ? 'T-' : '') . $sectionIndex, 'fromtitle' => $titleText, 'byteoffset' => $noOffset ? null : $byteOffset, 'anchor' => $anchor);
         # give headline the correct <h#> tag
         if ($maybeShowEditLink && $sectionIndex !== false) {
             // Output edit section links as markers with styles that can be customized by skins
             if ($isTemplate) {
                 # Put a T flag in the section identifier, to indicate to extractSections()
                 # that sections inside <includeonly> should be counted.
                 $editsectionPage = $titleText;
                 $editsectionSection = "T-{$sectionIndex}";
                 $editsectionContent = null;
             } else {
                 $editsectionPage = $this->mTitle->getPrefixedText();
                 $editsectionSection = $sectionIndex;
                 $editsectionContent = $headlineHint;
             }
             // We use a bit of pesudo-xml for editsection markers. The
             // language converter is run later on. Using a UNIQ style marker
             // leads to the converter screwing up the tokens when it
             // converts stuff. And trying to insert strip tags fails too. At
             // this point all real inputted tags have already been escaped,
             // so we don't have to worry about a user trying to input one of
             // these markers directly. We use a page and section attribute
             // to stop the language converter from converting these
             // important bits of data, but put the headline hint inside a
             // content block because the language converter is supposed to
             // be able to convert that piece of data.
             // Gets replaced with html in ParserOutput::getText
             $editlink = '<mw:editsection page="' . htmlspecialchars($editsectionPage);
             $editlink .= '" section="' . htmlspecialchars($editsectionSection) . '"';
             if ($editsectionContent !== null) {
                 $editlink .= '>' . $editsectionContent . '</mw:editsection>';
             } else {
                 $editlink .= '/>';
             }
         } else {
             $editlink = '';
         }
         $head[$headlineCount] = Linker::makeHeadline($level, $matches['attrib'][$headlineCount], $anchor, $headline, $editlink, $legacyAnchor);
         $headlineCount++;
     }
     $this->setOutputType($oldType);
     # Never ever show TOC if no headers
     if ($numVisible < 1) {
         $enoughToc = false;
     }
     if ($enoughToc) {
         if ($prevtoclevel > 0 && $prevtoclevel < $wgMaxTocLevel) {
             $toc .= Linker::tocUnindent($prevtoclevel - 1);
         }
         $toc = Linker::tocList($toc, $this->mOptions->getUserLangObj());
         $this->mOutput->setTOCHTML($toc);
         $toc = self::TOC_START . $toc . self::TOC_END;
         $this->mOutput->addModules('mediawiki.toc');
     }
     if ($isMain) {
         $this->mOutput->setSections($tocraw);
     }
     # split up and insert constructed headlines
     $blocks = preg_split('/<H[1-6].*?>[\\s\\S]*?<\\/H[1-6]>/i', $text);
     $i = 0;
     // build an array of document sections
     $sections = array();
     foreach ($blocks as $block) {
         // $head is zero-based, sections aren't.
         if (empty($head[$i - 1])) {
             $sections[$i] = $block;
         } else {
             $sections[$i] = $head[$i - 1] . $block;
         }
         /**
          * Send a hook, one per section.
          * The idea here is to be able to make section-level DIVs, but to do so in a
          * lower-impact, more correct way than r50769
          *
          * $this : caller
          * $section : the section number
          * &$sectionContent : ref to the content of the section
          * $showEditLinks : boolean describing whether this section has an edit link
          */
         Hooks::run('ParserSectionCreate', array($this, $i, &$sections[$i], $showEditLink));
         $i++;
     }
     if ($enoughToc && $isMain && !$this->mForceTocPosition) {
         // append the TOC at the beginning
         // Top anchor now in skin
         $sections[0] = $sections[0] . $toc . "\n";
     }
     $full .= join('', $sections);
     if ($this->mForceTocPosition) {
         return str_replace('<!--MWTOC-->', $toc, $full);
     } else {
         return $full;
     }
 }
開發者ID:rrameshs,項目名稱:mediawiki,代碼行數:101,代碼來源:Parser.php

示例3: commitToParserOutput

 /**
  * Similar to SMWOutputs::commitToParser() but acting on a ParserOutput object.
  *
  * @param ParserOutput $parserOutput
  */
 public static function commitToParserOutput(ParserOutput $parserOutput)
 {
     foreach (self::$scripts as $key => $script) {
         $parserOutput->addHeadItem($script . "\n", $key);
     }
     foreach (self::$headItems as $key => $item) {
         $parserOutput->addHeadItem("\t\t" . $item . "\n", $key);
     }
     $parserOutput->addModules(array_values(self::$resourceModules));
     self::$resourceModules = array();
     self::$headItems = array();
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:17,代碼來源:SMW_Outputs.php

示例4: reportLimitData

 public function reportLimitData(ParserOutput $output)
 {
     $data = $this->getLimitReportData();
     foreach ($data as $k => $v) {
         $output->setLimitReportData($k, $v);
     }
     if (isset($data['scribunto-limitreport-logs'])) {
         $output->addModules('ext.scribunto.logs');
     }
 }
開發者ID:sammykumar,項目名稱:TheVRForums,代碼行數:10,代碼來源:Engine.php


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