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


PHP OutputPage::addParserOutputContent方法代碼示例

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


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

示例1: showHtmlPreview

 /**
  * Wraps the provided html code in a div and outputs it to the page
  *
  * @param Title $title
  * @param ParserOutput $pout
  * @param OutputPage $out
  */
 private function showHtmlPreview(Title $title, ParserOutput $pout, OutputPage $out)
 {
     $lang = $title->getPageViewLanguage();
     $out->addHTML("<h2>" . $this->msg('expand_templates_preview')->escaped() . "</h2>\n");
     $out->addHTML(Html::openElement('div', array('class' => 'mw-content-' . $lang->getDir(), 'dir' => $lang->getDir(), 'lang' => $lang->getHtmlCode())));
     $out->addParserOutputContent($pout);
     $out->addHTML(Html::closeElement('div'));
 }
開發者ID:Habatchii,項目名稱:wikibase-for-mediawiki,代碼行數:15,代碼來源:SpecialExpandTemplates.php

示例2: showHtmlPreview

 /**
  * Wraps the provided html code in a div and outputs it to the page
  *
  * @param Title $title
  * @param ParserOutput $pout
  * @param OutputPage $out
  */
 private function showHtmlPreview(Title $title, ParserOutput $pout, OutputPage $out)
 {
     $lang = $title->getPageViewLanguage();
     $out->addHTML("<h2>" . $this->msg('expand_templates_preview')->escaped() . "</h2>\n");
     if ($this->getConfig()->get('RawHtml')) {
         $request = $this->getRequest();
         $user = $this->getUser();
         // To prevent cross-site scripting attacks, don't show the preview if raw HTML is
         // allowed and a valid edit token is not provided (bug 71111). However, MediaWiki
         // does not currently provide logged-out users with CSRF protection; in that case,
         // do not show the preview unless anonymous editing is allowed.
         if ($user->isAnon() && !$user->isAllowed('edit')) {
             $error = ['expand_templates_preview_fail_html_anon'];
         } elseif (!$user->matchEditToken($request->getVal('wpEditToken'), '', $request)) {
             $error = ['expand_templates_preview_fail_html'];
         } else {
             $error = false;
         }
         if ($error) {
             $out->wrapWikiMsg("<div class='previewnote'>\n\$1\n</div>", $error);
             return;
         }
     }
     $out->addHTML(Html::openElement('div', ['class' => 'mw-content-' . $lang->getDir(), 'dir' => $lang->getDir(), 'lang' => $lang->getHtmlCode()]));
     $out->addParserOutputContent($pout);
     $out->addHTML(Html::closeElement('div'));
     $out->setCategoryLinks($pout->getCategories());
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:35,代碼來源:SpecialExpandTemplates.php


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