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


PHP ParserOptions::getInterfaceMessage方法代碼示例

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


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

示例1: getTargetLanguage

 /**
  * Get the target language for the content being parsed. This is usually the
  * language that the content is in.
  *
  * @since 1.19
  *
  * @throws MWException
  * @return Language|null
  */
 public function getTargetLanguage()
 {
     $target = $this->mOptions->getTargetLanguage();
     if ($target !== null) {
         return $target;
     } elseif ($this->mOptions->getInterfaceMessage()) {
         return $this->mOptions->getUserLangObj();
     } elseif (is_null($this->mTitle)) {
         throw new MWException(__METHOD__ . ': $this->mTitle is null');
     }
     return $this->mTitle->getPageLanguage();
 }
開發者ID:Tarendai,項目名稱:spring-website,代碼行數:21,代碼來源:Parser.php

示例2: getFunctionLang

 /**
  * @return Language
  */
 function getFunctionLang()
 {
     $target = $this->mOptions->getTargetLanguage();
     if ($target !== null) {
         return $target;
     } elseif ($this->mOptions->getInterfaceMessage()) {
         global $wgLang;
         return $wgLang;
     } elseif (is_null($this->mTitle)) {
         throw new MWException(__METHOD__ . ': $this->mTitle is null');
     }
     return $this->mTitle->getPageLanguage();
 }
開發者ID:eFFemeer,項目名稱:seizamcore,代碼行數:16,代碼來源:Parser.php

示例3: internalParseHalfParsed

 /**
  * Helper function for parse() that transforms half-parsed HTML into fully
  * parsed HTML.
  *
  * @param string $text
  * @param bool $isMain
  * @param bool $linestart
  * @return string
  */
 private function internalParseHalfParsed($text, $isMain = true, $linestart = true)
 {
     $text = $this->mStripState->unstripGeneral($text);
     if ($isMain) {
         Hooks::run('ParserAfterUnstrip', array(&$this, &$text));
     }
     # Clean up special characters, only run once, next-to-last before doBlockLevels
     $fixtags = array('/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1 ', '/(\\302\\253) /' => '\\1 ', '/ (!\\s*important)/' => ' \\1');
     $text = preg_replace(array_keys($fixtags), array_values($fixtags), $text);
     $text = $this->doBlockLevels($text, $linestart);
     $this->replaceLinkHolders($text);
     /**
      * The input doesn't get language converted if
      * a) It's disabled
      * b) Content isn't converted
      * c) It's a conversion table
      * d) it is an interface message (which is in the user language)
      */
     if (!($this->mOptions->getDisableContentConversion() || isset($this->mDoubleUnderscores['nocontentconvert']))) {
         if (!$this->mOptions->getInterfaceMessage()) {
             # The position of the convert() call should not be changed. it
             # assumes that the links are all replaced and the only thing left
             # is the <nowiki> mark.
             $text = $this->getConverterLanguage()->convert($text);
         }
     }
     $text = $this->mStripState->unstripNoWiki($text);
     if ($isMain) {
         Hooks::run('ParserBeforeTidy', array(&$this, &$text));
     }
     $text = $this->replaceTransparentTags($text);
     $text = $this->mStripState->unstripGeneral($text);
     $text = Sanitizer::normalizeCharReferences($text);
     if (MWTidy::isEnabled() && $this->mOptions->getTidy()) {
         $text = MWTidy::tidy($text);
     } else {
         # attempt to sanitize at least some nesting problems
         # (bug #2702 and quite a few others)
         $tidyregs = array('/(<([bi])>)(<([bi])>)?([^<]*)(<\\/?a[^<]*>)([^<]*)(<\\/\\4>)?(<\\/\\2>)/' => '\\1\\3\\5\\8\\9\\6\\1\\3\\7\\8\\9', '/(<a[^>]+>)([^<]*)(<a[^>]+>[^<]*)<\\/a>(.*)<\\/a>/' => '\\1\\2</a>\\3</a>\\1\\4</a>', '/(<([aib]) [^>]+>)([^<]*)(<div([^>]*)>)(.*)(<\\/div>)([^<]*)(<\\/\\2>)/' => '\\1\\3&lt;div\\5&gt;\\6&lt;/div&gt;\\8\\9', '/<([bi])><\\/\\1>/' => '');
         $text = preg_replace(array_keys($tidyregs), array_values($tidyregs), $text);
     }
     if ($isMain) {
         Hooks::run('ParserAfterTidy', array(&$this, &$text));
     }
     return $text;
 }
開發者ID:rrameshs,項目名稱:mediawiki,代碼行數:55,代碼來源:Parser.php

示例4: getParserFor

 /**
  * Get Parser instance that's suitable for passing it to CoreParserFunctions
  * in MessageCache::transform()
  *
  * @author Władysław Bodzek <wladek@wikia-inc.com>
  *
  * @param ParserOptions $popts
  * @return Parser
  */
 function getParserFor(ParserOptions $popts)
 {
     $interfaceMessage = $popts->getInterfaceMessage();
     $userLanguage = $popts->getUserLang();
     $hash = array();
     foreach (array($interfaceMessage, $userLanguage) as $obj) {
         if (is_object($obj)) {
             $hash[] = get_class($obj);
         } else {
             $hash[] = serialize($obj);
         }
     }
     $hash = implode('|', $hash);
     if (!isset(self::$parsersCache[$hash])) {
         if (count(self::$parsersCache) > 25) {
             foreach (self::$parsersCache as $parser) {
                 ParserPool::release($parser);
             }
         }
         $parser = ParserPool::get();
         $parser->startExternalParse(new Title('DoesntExistXYZ'), $popts, Parser::OT_PREPROCESS, true);
         self::$parsersCache[$hash] = $parser;
     }
     return self::$parsersCache[$hash];
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:34,代碼來源:MessageCache.php


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