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


PHP WikiPage::makeParserOptions方法代码示例

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


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

示例1: getParserOptions

	/**
	 * Get parser options suitable for rendering the primary article wikitext
	 * @return ParserOptions
	 */
	public function getParserOptions() {
		if ( !$this->mParserOptions ) {
			$this->mParserOptions = $this->mPage->makeParserOptions( $this->getContext() );
		}
		// Clone to allow modifications of the return value without affecting cache
		return clone $this->mParserOptions;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:11,代码来源:Article.php

示例2: getParserOptions

 /**
  * Get parser options suitable for rendering the primary article wikitext
  * @return ParserOptions|false
  */
 public function getParserOptions()
 {
     global $wgUser;
     if (!$this->mParserOptions) {
         $this->mParserOptions = $this->mPage->makeParserOptions($wgUser);
     }
     // Clone to allow modifications of the return value without affecting cache
     return clone $this->mParserOptions;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:Article.php

示例3: 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

示例4: makeParserOptions

 /**
  * Constructs a ParserOptions object
  *
  * @param WikiPage $pageObj
  * @param array $params
  *
  * @return ParserOptions
  */
 protected function makeParserOptions(WikiPage $pageObj, array $params)
 {
     $popts = $pageObj->makeParserOptions($this->getContext());
     $popts->enableLimitReport(!$params['disablepp'] && !$params['disablelimitreport']);
     $popts->setIsPreview($params['preview'] || $params['sectionpreview']);
     $popts->setIsSectionPreview($params['sectionpreview']);
     $popts->setEditSection(!$params['disableeditsection']);
     if ($params['disabletidy']) {
         $popts->setTidy(false);
     }
     return $popts;
 }
开发者ID:huatuoorg,项目名称:mediawiki,代码行数:20,代码来源:ApiParse.php

示例5: makeParserOptions

 /**
  * Constructs a ParserOptions object
  *
  * @param WikiPage $pageObj
  * @param array $params
  *
  * @return ParserOptions
  */
 protected function makeParserOptions(WikiPage $pageObj, array $params)
 {
     wfProfileIn(__METHOD__);
     $popts = $pageObj->makeParserOptions($this->getContext());
     $popts->enableLimitReport(!$params['disablepp']);
     $popts->setIsPreview($params['preview'] || $params['sectionpreview']);
     $popts->setIsSectionPreview($params['sectionpreview']);
     wfProfileOut(__METHOD__);
     return $popts;
 }
开发者ID:spring,项目名称:spring-website,代码行数:18,代码来源:ApiParse.php

示例6: makeParserOptions

 /**
  * Constructs a ParserOptions object
  *
  * @param WikiPage $pageObj
  * @param array $params
  *
  * @return array [ ParserOptions, ScopedCallback, bool $suppressCache ]
  */
 protected function makeParserOptions(WikiPage $pageObj, array $params)
 {
     $popts = $pageObj->makeParserOptions($this->getContext());
     $popts->enableLimitReport(!$params['disablepp'] && !$params['disablelimitreport']);
     $popts->setIsPreview($params['preview'] || $params['sectionpreview']);
     $popts->setIsSectionPreview($params['sectionpreview']);
     $popts->setEditSection(!$params['disableeditsection']);
     if ($params['disabletidy']) {
         $popts->setTidy(false);
     }
     $reset = null;
     $suppressCache = false;
     Hooks::run('ApiMakeParserOptions', [$popts, $pageObj->getTitle(), $params, $this, &$reset, &$suppressCache]);
     return [$popts, $reset, $suppressCache];
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:23,代码来源:ApiParse.php

示例7: getPreviewText

 /**
  * Get the rendered text for previewing.
  * @throws MWException
  * @return string
  */
 function getPreviewText()
 {
     global $wgOut, $wgUser, $wgRawHtml, $wgLang;
     global $wgAllowUserCss, $wgAllowUserJs;
     $stats = $wgOut->getContext()->getStats();
     if ($wgRawHtml && !$this->mTokenOk) {
         // Could be an offsite preview attempt. This is very unsafe if
         // HTML is enabled, as it could be an attack.
         $parsedNote = '';
         if ($this->textbox1 !== '') {
             // Do not put big scary notice, if previewing the empty
             // string, which happens when you initially edit
             // a category page, due to automatic preview-on-open.
             $parsedNote = $wgOut->parse("<div class='previewnote'>" . wfMessage('session_fail_preview_html')->text() . "</div>", true, true);
         }
         $stats->increment('edit.failures.session_loss');
         return $parsedNote;
     }
     $note = '';
     try {
         $content = $this->toEditContent($this->textbox1);
         $previewHTML = '';
         if (!Hooks::run('AlternateEditPreview', array($this, &$content, &$previewHTML, &$this->mParserOutput))) {
             return $previewHTML;
         }
         # provide a anchor link to the editform
         $continueEditing = '<span class="mw-continue-editing">' . '[[#' . self::EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' . wfMessage('continue-editing')->text() . ']]</span>';
         if ($this->mTriedSave && !$this->mTokenOk) {
             if ($this->mTokenOkExceptSuffix) {
                 $note = wfMessage('token_suffix_mismatch')->plain();
                 $stats->increment('edit.failures.bad_token');
             } else {
                 $note = wfMessage('session_fail_preview')->plain();
                 $stats->increment('edit.failures.session_loss');
             }
         } elseif ($this->incompleteForm) {
             $note = wfMessage('edit_form_incomplete')->plain();
             if ($this->mTriedSave) {
                 $stats->increment('edit.failures.incomplete_form');
             }
         } else {
             $note = wfMessage('previewnote')->plain() . ' ' . $continueEditing;
         }
         $parserOptions = $this->page->makeParserOptions($this->mArticle->getContext());
         $parserOptions->setIsPreview(true);
         $parserOptions->setIsSectionPreview(!is_null($this->section) && $this->section !== '');
         # don't parse non-wikitext pages, show message about preview
         if ($this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage()) {
             if ($this->mTitle->isCssJsSubpage()) {
                 $level = 'user';
             } elseif ($this->mTitle->isCssOrJsPage()) {
                 $level = 'site';
             } else {
                 $level = false;
             }
             if ($content->getModel() == CONTENT_MODEL_CSS) {
                 $format = 'css';
                 if ($level === 'user' && !$wgAllowUserCss) {
                     $format = false;
                 }
             } elseif ($content->getModel() == CONTENT_MODEL_JAVASCRIPT) {
                 $format = 'js';
                 if ($level === 'user' && !$wgAllowUserJs) {
                     $format = false;
                 }
             } else {
                 $format = false;
             }
             # Used messages to make sure grep find them:
             # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview
             if ($level && $format) {
                 $note = "<div id='mw-{$level}{$format}preview'>" . wfMessage("{$level}{$format}preview")->text() . ' ' . $continueEditing . "</div>";
             }
         }
         # If we're adding a comment, we need to show the
         # summary as the headline
         if ($this->section === "new" && $this->summary !== "") {
             $content = $content->addSectionHeader($this->summary);
         }
         $hook_args = array($this, &$content);
         ContentHandler::runLegacyHooks('EditPageGetPreviewText', $hook_args);
         Hooks::run('EditPageGetPreviewContent', $hook_args);
         $parserOptions->enableLimitReport();
         # For CSS/JS pages, we should have called the ShowRawCssJs hook here.
         # But it's now deprecated, so never mind
         $pstContent = $content->preSaveTransform($this->mTitle, $wgUser, $parserOptions);
         $scopedCallback = $parserOptions->setupFakeRevision($this->mTitle, $pstContent, $wgUser);
         $parserOutput = $pstContent->getParserOutput($this->mTitle, null, $parserOptions);
         # Try to stash the edit for the final submission step
         # @todo: different date format preferences cause cache misses
         ApiStashEdit::stashEditFromPreview($this->getArticle(), $content, $pstContent, $parserOutput, $parserOptions, $parserOptions, wfTimestampNow());
         $parserOutput->setEditSectionTokens(false);
         // no section edit links
         $previewHTML = $parserOutput->getText();
         $this->mParserOutput = $parserOutput;
//.........这里部分代码省略.........
开发者ID:OrBin,项目名称:mediawiki,代码行数:101,代码来源:EditPage.php

示例8: makeParserOptions

 /**
  * Creates a ParserOptions instance
  * @param WikiPage $wp
  * @return ParserOptions
  */
 protected function makeParserOptions(WikiPage $wp)
 {
     return $wp->makeParserOptions($this);
 }
开发者ID:negati-ve,项目名称:openshift-mediawiki,代码行数:9,代码来源:ApiMobileView.php

示例9: getPreviewParserOptions

 /**
  * Get parser options for a preview
  * @return ParserOptions
  */
 protected function getPreviewParserOptions()
 {
     $parserOptions = $this->page->makeParserOptions($this->mArticle->getContext());
     $parserOptions->setIsPreview(true);
     $parserOptions->setIsSectionPreview(!is_null($this->section) && $this->section !== '');
     $parserOptions->enableLimitReport();
     return $parserOptions;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:12,代码来源:EditPage.php

示例10: getParserOutputForIndexing

 /**
  * Produce page output suitable for indexing.
  *
  * Specific content handlers may override it if they need different content handling.
  *
  * @param WikiPage    $page
  * @param ParserCache $cache
  * @return ParserOutput
  */
 public function getParserOutputForIndexing(WikiPage $page, ParserCache $cache = null)
 {
     $parserOptions = $page->makeParserOptions('canonical');
     $revId = $page->getRevision()->getId();
     if ($cache) {
         $parserOutput = $cache->get($page, $parserOptions);
     }
     if (empty($parserOutput)) {
         $parserOutput = $page->getContent()->getParserOutput($page->getTitle(), $revId, $parserOptions);
         if ($cache) {
             $cache->save($parserOutput, $page, $parserOptions);
         }
     }
     return $parserOutput;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:24,代码来源:ContentHandler.php


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