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


PHP Sanitizer::normalizeCharReferences方法代码示例

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


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

示例1: parseWikitext

 protected function parseWikitext($title, $newRevId)
 {
     $apiParams = array('action' => 'parse', 'page' => $title->getPrefixedDBkey(), 'oldid' => $newRevId, 'prop' => 'text|revid|categorieshtml|displaytitle|modules|jsconfigvars');
     $api = new ApiMain(new DerivativeRequest($this->getRequest(), $apiParams, false), true);
     $api->execute();
     if (defined('ApiResult::META_CONTENT')) {
         $result = $api->getResult()->getResultData(null, array('BC' => array(), 'Types' => array(), 'Strip' => 'all'));
     } else {
         $result = $api->getResultData();
     }
     $content = isset($result['parse']['text']['*']) ? $result['parse']['text']['*'] : false;
     $categorieshtml = isset($result['parse']['categorieshtml']['*']) ? $result['parse']['categorieshtml']['*'] : false;
     $links = isset($result['parse']['links']) ? $result['parse']['links'] : array();
     $revision = Revision::newFromId($result['parse']['revid']);
     $timestamp = $revision ? $revision->getTimestamp() : wfTimestampNow();
     $displaytitle = isset($result['parse']['displaytitle']) ? $result['parse']['displaytitle'] : false;
     $modules = isset($result['parse']['modules']) ? $result['parse']['modules'] : array();
     $jsconfigvars = isset($result['parse']['jsconfigvars']) ? $result['parse']['jsconfigvars'] : array();
     if ($content === false || strlen($content) && $revision === null) {
         return false;
     }
     if ($displaytitle !== false) {
         // Escape entities as in OutputPage::setPageTitle()
         $displaytitle = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($displaytitle));
     }
     return array('content' => $content, 'categorieshtml' => $categorieshtml, 'basetimestamp' => $timestamp, 'starttimestamp' => wfTimestampNow(), 'displayTitleHtml' => $displaytitle, 'modules' => $modules, 'jsconfigvars' => $jsconfigvars);
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:27,代码来源:ApiVisualEditorEdit.php

示例2: displaytitle

 /**
  * Override the title of the page when viewed, provided we've been given a
  * title which will normalise to the canonical title
  *
  * @param Parser $parser Parent parser
  * @param string $text Desired title text
  * @param string $uarg
  * @return string
  */
 public static function displaytitle($parser, $text = '', $uarg = '')
 {
     global $wgRestrictDisplayTitle;
     static $magicWords = null;
     if (is_null($magicWords)) {
         $magicWords = new MagicWordArray(['displaytitle_noerror', 'displaytitle_noreplace']);
     }
     $arg = $magicWords->matchStartToEnd($uarg);
     // parse a limited subset of wiki markup (just the single quote items)
     $text = $parser->doQuotes($text);
     // remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
     $text = $parser->killMarkers($text);
     // list of disallowed tags for DISPLAYTITLE
     // these will be escaped even though they are allowed in normal wiki text
     $bad = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr', 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rtc', 'rp', 'br'];
     // disallow some styles that could be used to bypass $wgRestrictDisplayTitle
     if ($wgRestrictDisplayTitle) {
         $htmlTagsCallback = function (&$params) {
             $decoded = Sanitizer::decodeTagAttributes($params);
             if (isset($decoded['style'])) {
                 // this is called later anyway, but we need it right now for the regexes below to be safe
                 // calling it twice doesn't hurt
                 $decoded['style'] = Sanitizer::checkCss($decoded['style']);
                 if (preg_match('/(display|user-select|visibility)\\s*:/i', $decoded['style'])) {
                     $decoded['style'] = '/* attempt to bypass $wgRestrictDisplayTitle */';
                 }
             }
             $params = Sanitizer::safeEncodeTagAttributes($decoded);
         };
     } else {
         $htmlTagsCallback = null;
     }
     // only requested titles that normalize to the actual title are allowed through
     // if $wgRestrictDisplayTitle is true (it is by default)
     // mimic the escaping process that occurs in OutputPage::setPageTitle
     $text = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($text, $htmlTagsCallback, [], [], $bad));
     $title = Title::newFromText(Sanitizer::stripAllTags($text));
     if (!$wgRestrictDisplayTitle || $title instanceof Title && !$title->hasFragment() && $title->equals($parser->mTitle)) {
         $old = $parser->mOutput->getProperty('displaytitle');
         if ($old === false || $arg !== 'displaytitle_noreplace') {
             $parser->mOutput->setDisplayTitle($text);
         }
         if ($old !== false && $old !== $text && !$arg) {
             $converter = $parser->getConverterLanguage()->getConverter();
             return '<span class="error">' . wfMessage('duplicate-displaytitle', $converter->markNoConversion(wfEscapeWikiText($old)), $converter->markNoConversion(wfEscapeWikiText($text)))->inContentLanguage()->text() . '</span>';
         } else {
             return '';
         }
     } else {
         $parser->addTrackingCategory('restricted-displaytitle-ignored');
         $converter = $parser->getConverterLanguage()->getConverter();
         return '<span class="error">' . wfMessage('restricted-displaytitle', $converter->markNoConversion(wfEscapeWikiText($text)))->inContentLanguage()->text() . '</span>';
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:63,代码来源:CoreParserFunctions.php

示例3: parse

 /**
  * Convert wikitext to HTML
  * Do not call this function recursively.
  *
  * @param string $text text we want to parse
  * @param $title Title object
  * @param $options ParserOptions
  * @param $linestart boolean
  * @param $clearState boolean
  * @param int $revid number to pass in {{REVISIONID}}
  * @return ParserOutput a ParserOutput
  */
 public function parse($text, Title $title, ParserOptions $options, $linestart = true, $clearState = true, $revid = null)
 {
     /**
      * First pass--just handle <nowiki> sections, pass the rest off
      * to internalParse() which does all the real work.
      */
     global $wgUseTidy, $wgAlwaysUseTidy, $wgShowHostnames;
     $fname = __METHOD__ . '-' . wfGetCaller();
     wfProfileIn(__METHOD__);
     wfProfileIn($fname);
     $this->startParse($title, $options, self::OT_HTML, $clearState);
     $this->mInputSize = strlen($text);
     if ($this->mOptions->getEnableLimitReport()) {
         $this->mOutput->resetParseStartTime();
     }
     # Remove the strip marker tag prefix from the input, if present.
     if ($clearState) {
         $text = str_replace($this->mUniqPrefix, '', $text);
     }
     $oldRevisionId = $this->mRevisionId;
     $oldRevisionObject = $this->mRevisionObject;
     $oldRevisionTimestamp = $this->mRevisionTimestamp;
     $oldRevisionUser = $this->mRevisionUser;
     $oldRevisionSize = $this->mRevisionSize;
     if ($revid !== null) {
         $this->mRevisionId = $revid;
         $this->mRevisionObject = null;
         $this->mRevisionTimestamp = null;
         $this->mRevisionUser = null;
         $this->mRevisionSize = null;
     }
     wfRunHooks('ParserBeforeStrip', array(&$this, &$text, &$this->mStripState));
     # No more strip!
     wfRunHooks('ParserAfterStrip', array(&$this, &$text, &$this->mStripState));
     $text = $this->internalParse($text);
     wfRunHooks('ParserAfterParse', array(&$this, &$text, &$this->mStripState));
     $text = $this->mStripState->unstripGeneral($text);
     # Clean up special characters, only run once, next-to-last before doBlockLevels
     $fixtags = array('/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1&#160;', '/(\\302\\253) /' => '\\1&#160;', '/&#160;(!\\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 (!($options->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);
         }
     }
     /**
      * A converted title will be provided in the output object if title and
      * content conversion are enabled, the article text does not contain
      * a conversion-suppressing double-underscore tag, and no
      * {{DISPLAYTITLE:...}} is present. DISPLAYTITLE takes precedence over
      * automatic link conversion.
      */
     if (!($options->getDisableTitleConversion() || isset($this->mDoubleUnderscores['nocontentconvert']) || isset($this->mDoubleUnderscores['notitleconvert']) || $this->mOutput->getDisplayTitle() !== false)) {
         $convruletitle = $this->getConverterLanguage()->getConvRuleTitle();
         if ($convruletitle) {
             $this->mOutput->setTitleText($convruletitle);
         } else {
             $titleText = $this->getConverterLanguage()->convertTitle($title);
             $this->mOutput->setTitleText($titleText);
         }
     }
     $text = $this->mStripState->unstripNoWiki($text);
     wfRunHooks('ParserBeforeTidy', array(&$this, &$text));
     $text = $this->replaceTransparentTags($text);
     $text = $this->mStripState->unstripGeneral($text);
     $text = Sanitizer::normalizeCharReferences($text);
     if ($wgUseTidy && $this->mOptions->getTidy() || $wgAlwaysUseTidy) {
         $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 ($this->mExpensiveFunctionCount > $this->mOptions->getExpensiveParserFunctionLimit()) {
         $this->limitationWarn('expensive-parserfunction', $this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit());
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:Parser.php

示例4: 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&#160;', '/(\\302\\253) /' => '\\1&#160;', '/&#160;(!\\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

示例5: parse

 /**
  * Convert wikitext to HTML
  * Do not call this function recursively.
  *
  * @param $text String: text we want to parse
  * @param $title A title object
  * @param $options ParserOptions
  * @param $linestart boolean
  * @param $clearState boolean
  * @param $revid Int: number to pass in {{REVISIONID}}
  * @return ParserOutput a ParserOutput
  */
 public function parse($text, Title $title, ParserOptions $options, $linestart = true, $clearState = true, $revid = null)
 {
     /**
      * First pass--just handle <nowiki> sections, pass the rest off
      * to internalParse() which does all the real work.
      */
     global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang;
     $fname = __METHOD__ . '-' . wfGetCaller();
     wfProfileIn(__METHOD__);
     wfProfileIn($fname);
     if ($clearState) {
         $this->clearState();
     }
     $this->mOptions = $options;
     $this->setTitle($title);
     $oldRevisionId = $this->mRevisionId;
     $oldRevisionTimestamp = $this->mRevisionTimestamp;
     if ($revid !== null) {
         $this->mRevisionId = $revid;
         $this->mRevisionTimestamp = null;
     }
     $this->setOutputType(self::OT_HTML);
     wfRunHooks('ParserBeforeStrip', array(&$this, &$text, &$this->mStripState));
     # No more strip!
     wfRunHooks('ParserAfterStrip', array(&$this, &$text, &$this->mStripState));
     $text = $this->internalParse($text);
     $text = $this->mStripState->unstripGeneral($text);
     # Clean up special characters, only run once, next-to-last before doBlockLevels
     $fixtags = array('/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1&nbsp;\\2', '/(\\302\\253) /' => '\\1&nbsp;', '/&nbsp;(!\\s*important)/' => ' \\1');
     $text = preg_replace(array_keys($fixtags), array_values($fixtags), $text);
     $text = $this->doBlockLevels($text, $linestart);
     $this->replaceLinkHolders($text);
     # the position of the parserConvert() call should not be changed. it
     # assumes that the links are all replaced and the only thing left
     # is the <nowiki> mark.
     # Side-effects: this calls $this->mOutput->setTitleText()
     $text = $wgContLang->parserConvert($text, $this);
     $text = $this->mStripState->unstripNoWiki($text);
     wfRunHooks('ParserBeforeTidy', array(&$this, &$text));
     //!JF Move to its own function
     $uniq_prefix = $this->mUniqPrefix;
     $matches = array();
     $elements = array_keys($this->mTransparentTagHooks);
     $text = self::extractTagsAndParams($elements, $text, $matches, $uniq_prefix);
     foreach ($matches as $marker => $data) {
         list($element, $content, $params, $tag) = $data;
         $tagName = strtolower($element);
         if (isset($this->mTransparentTagHooks[$tagName])) {
             $output = call_user_func_array($this->mTransparentTagHooks[$tagName], array($content, $params, $this));
         } else {
             $output = $tag;
         }
         $this->mStripState->general->setPair($marker, $output);
     }
     $text = $this->mStripState->unstripGeneral($text);
     $text = Sanitizer::normalizeCharReferences($text);
     if ($wgUseTidy && $this->mOptions->mTidy || $wgAlwaysUseTidy) {
         $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);
     }
     global $wgExpensiveParserFunctionLimit;
     if ($this->mExpensiveFunctionCount > $wgExpensiveParserFunctionLimit) {
         $this->limitationWarn('expensive-parserfunction', $this->mExpensiveFunctionCount, $wgExpensiveParserFunctionLimit);
     }
     wfRunHooks('ParserAfterTidy', array(&$this, &$text));
     # Information on include size limits, for the benefit of users who try to skirt them
     if ($this->mOptions->getEnableLimitReport()) {
         global $wgExpensiveParserFunctionLimit;
         $max = $this->mOptions->getMaxIncludeSize();
         $PFreport = "Expensive parser function count: {$this->mExpensiveFunctionCount}/{$wgExpensiveParserFunctionLimit}\n";
         $limitReport = "NewPP limit report\n" . "Preprocessor node count: {$this->mPPNodeCount}/{$this->mOptions->mMaxPPNodeCount}\n" . "Post-expand include size: {$this->mIncludeSizes['post-expand']}/{$max} bytes\n" . "Template argument size: {$this->mIncludeSizes['arg']}/{$max} bytes\n" . $PFreport;
         wfRunHooks('ParserLimitReport', array($this, &$limitReport));
         $text .= "\n<!-- \n{$limitReport}-->\n";
     }
     $this->mOutput->setText($text);
     $this->mRevisionId = $oldRevisionId;
     $this->mRevisionTimestamp = $oldRevisionTimestamp;
     wfProfileOut($fname);
     wfProfileOut(__METHOD__);
     return $this->mOutput;
 }
开发者ID:josephdye,项目名称:wikireader,代码行数:97,代码来源:Parser.php

示例6: parse

 /**
  * Convert wikitext to HTML
  * Do not call this function recursively.
  *
  * @param $text String: text we want to parse
  * @param $title Title object
  * @param $options ParserOptions
  * @param $linestart boolean
  * @param $clearState boolean
  * @param $revid Int: number to pass in {{REVISIONID}}
  * @return ParserOutput a ParserOutput
  */
 public function parse($text, Title $title, ParserOptions $options, $linestart = true, $clearState = true, $revid = null)
 {
     /**
      * First pass--just handle <nowiki> sections, pass the rest off
      * to internalParse() which does all the real work.
      */
     global $wgUseTidy, $wgAlwaysUseTidy;
     $fname = __METHOD__ . '-' . wfGetCaller();
     wfProfileIn(__METHOD__);
     wfProfileIn($fname);
     $this->startParse($title, $options, self::OT_HTML, $clearState);
     # Remove the strip marker tag prefix from the input, if present.
     if ($clearState) {
         $text = str_replace($this->mUniqPrefix, '', $text);
     }
     $oldRevisionId = $this->mRevisionId;
     $oldRevisionObject = $this->mRevisionObject;
     $oldRevisionTimestamp = $this->mRevisionTimestamp;
     $oldRevisionUser = $this->mRevisionUser;
     if ($revid !== null) {
         $this->mRevisionId = $revid;
         $this->mRevisionObject = null;
         $this->mRevisionTimestamp = null;
         $this->mRevisionUser = null;
     }
     wfRunHooks('ParserBeforeStrip', array(&$this, &$text, &$this->mStripState));
     # No more strip!
     wfRunHooks('ParserAfterStrip', array(&$this, &$text, &$this->mStripState));
     $text = $this->internalParse($text);
     wfRunHooks('ParserAfterParse', array(&$this, &$text, &$this->mStripState));
     $text = $this->mStripState->unstripGeneral($text);
     # Clean up special characters, only run once, next-to-last before doBlockLevels
     $fixtags = array('/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1&#160;', '/(\\302\\253) /' => '\\1&#160;', '/&#160;(!\\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 (!($options->getDisableContentConversion() || isset($this->mDoubleUnderscores['nocontentconvert']))) {
         # Run convert unconditionally in 1.18-compatible mode
         global $wgBug34832TransitionalRollback;
         if ($wgBug34832TransitionalRollback || !$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);
         }
     }
     /**
      * A converted title will be provided in the output object if title and
      * content conversion are enabled, the article text does not contain
      * a conversion-suppressing double-underscore tag, and no
      * {{DISPLAYTITLE:...}} is present. DISPLAYTITLE takes precedence over
      * automatic link conversion.
      */
     if (!($options->getDisableTitleConversion() || isset($this->mDoubleUnderscores['nocontentconvert']) || isset($this->mDoubleUnderscores['notitleconvert']) || $this->mOutput->getDisplayTitle() !== false)) {
         $convruletitle = $this->getConverterLanguage()->getConvRuleTitle();
         if ($convruletitle) {
             $this->mOutput->setTitleText($convruletitle);
         } else {
             $titleText = $this->getConverterLanguage()->convertTitle($title);
             $this->mOutput->setTitleText($titleText);
         }
     }
     $text = $this->mStripState->unstripNoWiki($text);
     wfRunHooks('ParserBeforeTidy', array(&$this, &$text));
     $text = $this->replaceTransparentTags($text);
     $text = $this->mStripState->unstripGeneral($text);
     $text = Sanitizer::normalizeCharReferences($text);
     if ($wgUseTidy && $this->mOptions->getTidy() || $wgAlwaysUseTidy) {
         $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 ($this->mExpensiveFunctionCount > $this->mOptions->getExpensiveParserFunctionLimit()) {
         $this->limitationWarn('expensive-parserfunction', $this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit());
     }
     wfRunHooks('ParserAfterTidy', array(&$this, &$text));
     # Information on include size limits, for the benefit of users who try to skirt them
     if ($this->mOptions->getEnableLimitReport()) {
//.........这里部分代码省略.........
开发者ID:h4ck3rm1k3,项目名称:mediawiki,代码行数:101,代码来源:Parser.php

示例7: normalizeAttributeValue

 /**
  * Normalize whitespace and character references in an XML source-
  * encoded text for an attribute value.
  *
  * See http://www.w3.org/TR/REC-xml/#AVNormalize for background,
  * but note that we're not returning the value, but are returning
  * XML source fragments that will be slapped into output.
  *
  * @param $text String
  * @return String
  */
 private static function normalizeAttributeValue($text)
 {
     return str_replace('"', '&quot;', self::normalizeWhitespace(Sanitizer::normalizeCharReferences($text)));
 }
开发者ID:JeroenDeDauw,项目名称:iRail,代码行数:15,代码来源:Sanitizer.php

示例8: parse

 /**
  * Convert wikitext to HTML
  * Do not call this function recursively.
  *
  * @param $text String: text we want to parse
  * @param $title A title object
  * @param $options ParserOptions
  * @param $linestart boolean
  * @param $clearState boolean
  * @param $revid Int: number to pass in {{REVISIONID}}
  * @return ParserOutput a ParserOutput
  */
 public function parse($text, Title $title, ParserOptions $options, $linestart = true, $clearState = true, $revid = null)
 {
     /**
      * First pass--just handle <nowiki> sections, pass the rest off
      * to internalParse() which does all the real work.
      */
     global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion;
     $fname = __METHOD__ . '-' . wfGetCaller();
     wfProfileIn(__METHOD__);
     wfProfileIn($fname);
     if ($clearState) {
         $this->clearState();
     }
     $this->mOptions = $options;
     $this->setTitle($title);
     // Page title has to be set for the pre-processor
     $oldRevisionId = $this->mRevisionId;
     $oldRevisionTimestamp = $this->mRevisionTimestamp;
     if ($revid !== null) {
         $this->mRevisionId = $revid;
         $this->mRevisionTimestamp = null;
     }
     $this->setOutputType(self::OT_HTML);
     wfRunHooks('ParserBeforeStrip', array(&$this, &$text, &$this->mStripState));
     # No more strip!
     wfRunHooks('ParserAfterStrip', array(&$this, &$text, &$this->mStripState));
     $text = $this->internalParse($text);
     $text = $this->mStripState->unstripGeneral($text);
     # Clean up special characters, only run once, next-to-last before doBlockLevels
     $fixtags = array('/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1&nbsp;\\2', '/(\\302\\253) /' => '\\1&nbsp;', '/&nbsp;(!\\s*important)/' => ' \\1');
     $text = preg_replace(array_keys($fixtags), array_values($fixtags), $text);
     $text = $this->doBlockLevels($text, $linestart);
     $this->replaceLinkHolders($text);
     /**
      * The page doesn't get language converted if
      * a) It's disabled
      * b) Content isn't converted
      * c) It's a conversion table
      */
     if (!($wgDisableLangConversion || isset($this->mDoubleUnderscores['nocontentconvert']) || $this->mTitle->isConversionTable())) {
         # 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 = $wgContLang->convert($text);
     }
     /**
      * A page get its title converted except:
      * a) Language conversion is globally disabled
      * b) Title convert is globally disabled
      * c) The page is a redirect page
      * d) User request with a "linkconvert" set to "no"
      * e) A "nocontentconvert" magic word has been set
      * f) A "notitleconvert" magic word has been set
      * g) User sets "noconvertlink" in his/her preference
      *
      * Note that if a user tries to set a title in a conversion
      * rule but content conversion was not done, then the parser
      * won't pick it up.  This is probably expected behavior.
      */
     if (!($wgDisableLangConversion || $wgDisableTitleConversion || isset($this->mDoubleUnderscores['nocontentconvert']) || isset($this->mDoubleUnderscores['notitleconvert']) || $this->mOutput->getDisplayTitle() !== false)) {
         $convruletitle = $wgContLang->getConvRuleTitle();
         if ($convruletitle) {
             $this->mOutput->setTitleText($convruletitle);
         } else {
             $titleText = $wgContLang->convertTitle($title);
             $this->mOutput->setTitleText($titleText);
         }
     }
     $text = $this->mStripState->unstripNoWiki($text);
     wfRunHooks('ParserBeforeTidy', array(&$this, &$text));
     //!JF Move to its own function
     $uniq_prefix = $this->mUniqPrefix;
     $matches = array();
     $elements = array_keys($this->mTransparentTagHooks);
     $text = self::extractTagsAndParams($elements, $text, $matches, $uniq_prefix);
     foreach ($matches as $marker => $data) {
         list($element, $content, $params, $tag) = $data;
         $tagName = strtolower($element);
         if (isset($this->mTransparentTagHooks[$tagName])) {
             $output = call_user_func_array($this->mTransparentTagHooks[$tagName], array($content, $params, $this));
         } else {
             $output = $tag;
         }
         $this->mStripState->general->setPair($marker, $output);
     }
     $text = $this->mStripState->unstripGeneral($text);
     $text = Sanitizer::normalizeCharReferences($text);
     if ($wgUseTidy && $this->mOptions->mTidy || $wgAlwaysUseTidy) {
//.........这里部分代码省略.........
开发者ID:rocLv,项目名称:conference,代码行数:101,代码来源:Parser.php

示例9: render

 static function render($input, $params, $parser)
 {
     global $wgScriptPath, $wgUser, $wgUrlProtocols, $wgNoFollowLinks;
     wfLoadExtensionMessages('ImageMap');
     $lines = explode("\n", $input);
     $first = true;
     $lineNum = 0;
     $mapHTML = '';
     $links = array();
     # Define canonical desc types to allow i18n of 'imagemap_desc_types'
     $descTypesCanonical = 'top-right, bottom-right, bottom-left, top-left, none';
     $descType = self::BOTTOM_RIGHT;
     $defaultLinkAttribs = false;
     $realmap = true;
     foreach ($lines as $line) {
         ++$lineNum;
         $externLink = false;
         $line = trim($line);
         if ($line == '' || $line[0] == '#') {
             continue;
         }
         if ($first) {
             $first = false;
             # The first line should have an image specification on it
             # Extract it and render the HTML
             $bits = explode('|', $line, 2);
             if (count($bits) == 1) {
                 $image = $bits[0];
                 $options = '';
             } else {
                 list($image, $options) = $bits;
             }
             $imageTitle = Title::newFromText($image);
             if (!$imageTitle || $imageTitle->getNamespace() != NS_IMAGE) {
                 return self::error('imagemap_no_image');
             }
             if (wfIsBadImage($imageTitle->getDBkey(), $parser->mTitle)) {
                 return self::error('imagemap_bad_image');
             }
             // Parse the options so we can use links and the like in the caption
             $parsedOptions = $parser->recursiveTagParse($options);
             $imageHTML = $parser->makeImage($imageTitle, $parsedOptions);
             $parser->replaceLinkHolders($imageHTML);
             $imageHTML = $parser->mStripState->unstripBoth($imageHTML);
             $imageHTML = Sanitizer::normalizeCharReferences($imageHTML);
             $parser->mOutput->addImage($imageTitle->getDBkey());
             $domDoc = new DOMDocument();
             wfSuppressWarnings();
             $ok = $domDoc->loadXML($imageHTML);
             wfRestoreWarnings();
             if (!$ok) {
                 return self::error('imagemap_invalid_image');
             }
             $xpath = new DOMXPath($domDoc);
             $imgs = $xpath->query('//img');
             if (!$imgs->length) {
                 return self::error('imagemap_invalid_image');
             }
             $imageNode = $imgs->item(0);
             $thumbWidth = $imageNode->getAttribute('width');
             $thumbHeight = $imageNode->getAttribute('height');
             if (function_exists('wfFindFile')) {
                 $imageObj = wfFindFile($imageTitle);
             } else {
                 // Old MW
                 $imageObj = wfFindFile($imageTitle);
             }
             if (!$imageObj || !$imageObj->exists()) {
                 return self::error('imagemap_invalid_image');
             }
             # Add the linear dimensions to avoid inaccuracy in the scale
             # factor when one is much larger than the other
             # (sx+sy)/(x+y) = s
             $denominator = $imageObj->getWidth() + $imageObj->getHeight();
             $numerator = $thumbWidth + $thumbHeight;
             if ($denominator <= 0 || $numerator <= 0) {
                 return self::error('imagemap_invalid_image');
             }
             $scale = $numerator / $denominator;
             continue;
         }
         # Handle desc spec
         $cmd = strtok($line, " \t");
         if ($cmd == 'desc') {
             $typesText = wfMsgForContent('imagemap_desc_types');
             if ($descTypesCanonical != $typesText) {
                 // i18n desc types exists
                 $typesText = $descTypesCanonical . ', ' . $typesText;
             }
             $types = array_map('trim', explode(',', $typesText));
             $type = trim(strtok(''));
             $descType = array_search($type, $types);
             if ($descType > 4) {
                 // A localized descType is used. Subtract 5 to reach the canonical desc type.
                 $descType = $descType - 5;
             }
             if ($descType === false || $descType < 0) {
                 // <0? In theory never, but paranoia...
                 return self::error('imagemap_invalid_desc', $typesText);
             }
//.........这里部分代码省略.........
开发者ID:akoehn,项目名称:wikireader,代码行数:101,代码来源:ImageMap_body.php

示例10: displaytitle

 /**
  * Override the title of the page when viewed, provided we've been given a
  * title which will normalise to the canonical title
  *
  * @param $parser Parser: parent parser
  * @param string $text desired title text
  * @return String
  */
 static function displaytitle($parser, $text = '')
 {
     global $wgRestrictDisplayTitle;
     // parse a limited subset of wiki markup (just the single quote items)
     $text = $parser->doQuotes($text);
     // remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
     $text = preg_replace('/' . preg_quote($parser->uniqPrefix(), '/') . '.*?' . preg_quote(Parser::MARKER_SUFFIX, '/') . '/', '', $text);
     // list of disallowed tags for DISPLAYTITLE
     // these will be escaped even though they are allowed in normal wiki text
     $bad = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr', 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rp', 'br');
     // disallow some styles that could be used to bypass $wgRestrictDisplayTitle
     if ($wgRestrictDisplayTitle) {
         $htmlTagsCallback = function (&$params) {
             $decoded = Sanitizer::decodeTagAttributes($params);
             if (isset($decoded['style'])) {
                 // this is called later anyway, but we need it right now for the regexes below to be safe
                 // calling it twice doesn't hurt
                 $decoded['style'] = Sanitizer::checkCss($decoded['style']);
                 if (preg_match('/(display|user-select|visibility)\\s*:/i', $decoded['style'])) {
                     $decoded['style'] = '/* attempt to bypass $wgRestrictDisplayTitle */';
                 }
             }
             $params = Sanitizer::safeEncodeTagAttributes($decoded);
         };
     } else {
         $htmlTagsCallback = null;
     }
     // only requested titles that normalize to the actual title are allowed through
     // if $wgRestrictDisplayTitle is true (it is by default)
     // mimic the escaping process that occurs in OutputPage::setPageTitle
     $text = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($text, $htmlTagsCallback, array(), array(), $bad));
     $title = Title::newFromText(Sanitizer::stripAllTags($text));
     if (!$wgRestrictDisplayTitle) {
         $parser->mOutput->setDisplayTitle($text);
     } elseif ($title instanceof Title && !$title->hasFragment() && $title->equals($parser->mTitle)) {
         $parser->mOutput->setDisplayTitle($text);
     }
     return '';
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:47,代码来源:CoreParserFunctions.php

示例11: displaytitle

 /**
  * Override the title of the page when viewed, provided we've been given a
  * title which will normalise to the canonical title
  *
  * @param $parser Parser: parent parser
  * @param string $text desired title text
  * @return String
  */
 static function displaytitle($parser, $text = '')
 {
     global $wgRestrictDisplayTitle;
     #parse a limited subset of wiki markup (just the single quote items)
     $text = $parser->doQuotes($text);
     #remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever
     $text = preg_replace('/' . preg_quote($parser->uniqPrefix(), '/') . '.*?' . preg_quote(Parser::MARKER_SUFFIX, '/') . '/', '', $text);
     #list of disallowed tags for DISPLAYTITLE
     #these will be escaped even though they are allowed in normal wiki text
     $bad = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr', 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rp', 'br');
     #only requested titles that normalize to the actual title are allowed through
     #if $wgRestrictDisplayTitle is true (it is by default)
     #mimic the escaping process that occurs in OutputPage::setPageTitle
     $text = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($text, null, array(), array(), $bad));
     $title = Title::newFromText(Sanitizer::stripAllTags($text));
     if (!$wgRestrictDisplayTitle) {
         $parser->mOutput->setDisplayTitle($text);
     } elseif ($title instanceof Title && $title->getFragment() == '' && $title->equals($parser->mTitle)) {
         $parser->mOutput->setDisplayTitle($text);
     }
     return '';
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:30,代码来源:CoreParserFunctions.php

示例12: normalizeAttributeValue

 /**
  * Normalize whitespace and character references in an XML source-
  * encoded text for an attribute value.
  *
  * See http://www.w3.org/TR/REC-xml/#AVNormalize for background,
  * but note that we're not returning the value, but are returning
  * XML source fragments that will be slapped into output.
  *
  * @param string $text
  * @return string
  * @access private
  */
 function normalizeAttributeValue($text)
 {
     return str_replace('"', '&quot;', preg_replace('/\\r\\n|[\\x20\\x0d\\x0a\\x09]/', ' ', Sanitizer::normalizeCharReferences($text)));
 }
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:16,代码来源:Sanitizer.php

示例13: parse

 /**
  * Convert wikitext to HTML
  * Do not call this function recursively.
  *
  * @private
  * @param string $text Text we want to parse
  * @param Title &$title A title object
  * @param array $options
  * @param boolean $linestart
  * @param boolean $clearState
  * @param int $revid number to pass in {{REVISIONID}}
  * @return ParserOutput a ParserOutput
  */
 function parse($text, &$title, $options, $linestart = true, $clearState = true, $revid = null)
 {
     /**
      * First pass--just handle <nowiki> sections, pass the rest off
      * to internalParse() which does all the real work.
      */
     global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang;
     $fname = 'Parser::parse-' . wfGetCaller();
     wfProfileIn($fname);
     if ($clearState) {
         $this->clearState();
     }
     $this->mOptions = $options;
     $this->mTitle =& $title;
     $oldRevisionId = $this->mRevisionId;
     if ($revid !== null) {
         $this->mRevisionId = $revid;
     }
     $this->setOutputType(OT_HTML);
     //$text = $this->strip( $text, $this->mStripState );
     // VOODOO MAGIC FIX! Sometimes the above segfaults in PHP5.
     $x =& $this->mStripState;
     wfRunHooks('ParserBeforeStrip', array(&$this, &$text, &$x));
     $text = $this->strip($text, $x);
     wfRunHooks('ParserAfterStrip', array(&$this, &$text, &$x));
     $text = $this->internalParse($text);
     $text = $this->unstrip($text, $this->mStripState);
     # Clean up special characters, only run once, next-to-last before doBlockLevels
     $fixtags = array('/(.) (?=\\?|:|;|!|\\302\\273)/' => '\\1&nbsp;\\2', '/(\\302\\253) /' => '\\1&nbsp;');
     $text = preg_replace(array_keys($fixtags), array_values($fixtags), $text);
     # only once and last
     $text = $this->doBlockLevels($text, $linestart);
     $this->replaceLinkHolders($text);
     # the position of the parserConvert() call should not be changed. it
     # assumes that the links are all replaced and the only thing left
     # is the <nowiki> mark.
     # Side-effects: this calls $this->mOutput->setTitleText()
     $text = $wgContLang->parserConvert($text, $this);
     $text = $this->unstripNoWiki($text, $this->mStripState);
     wfRunHooks('ParserBeforeTidy', array(&$this, &$text));
     $text = Sanitizer::normalizeCharReferences($text);
     if ($wgUseTidy and $this->mOptions->mTidy or $wgAlwaysUseTidy) {
         $text = Parser::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);
     }
     wfRunHooks('ParserAfterTidy', array(&$this, &$text));
     # Information on include size limits, for the benefit of users who try to skirt them
     if (max($this->mIncludeSizes) > 1000) {
         $max = $this->mOptions->getMaxIncludeSize();
         $text .= "<!-- \n" . "Pre-expand include size: {$this->mIncludeSizes['pre-expand']} bytes\n" . "Post-expand include size: {$this->mIncludeSizes['post-expand']} bytes\n" . "Template argument size: {$this->mIncludeSizes['arg']} bytes\n" . "Maximum: {$max} bytes\n" . "-->\n";
     }
     $this->mOutput->setText($text);
     $this->mRevisionId = $oldRevisionId;
     wfProfileOut($fname);
     return $this->mOutput;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:73,代码来源:Parser.php

示例14: wfMsgExt

/**
 * Returns message in the requested format
 * @param string $key Key of the message
 * @param array $options Processing rules:
 *  <i>parse</i>: parses wikitext to html
 *  <i>parseinline</i>: parses wikitext to html and removes the surrounding p's added by parser or tidy
 *  <i>escape</i>: filters message through htmlspecialchars
 *  <i>escapenoentities</i>: same, but allows entity references like &nbsp; through
 *  <i>replaceafter</i>: parameters are substituted after parsing or escaping
 *  <i>parsemag</i>: transform the message using magic phrases
 *  <i>content</i>: fetch message for content language instead of interface
 * Behavior for conflicting options (e.g., parse+parseinline) is undefined.
 */
function wfMsgExt($key, $options)
{
    global $wgOut, $wgParser;
    $args = func_get_args();
    array_shift($args);
    array_shift($args);
    if (!is_array($options)) {
        $options = array($options);
    }
    $forContent = false;
    if (in_array('content', $options)) {
        $forContent = true;
    }
    $string = wfMsgGetKey($key, true, $forContent, false);
    if (!in_array('replaceafter', $options)) {
        $string = wfMsgReplaceArgs($string, $args);
    }
    if (in_array('parse', $options)) {
        $string = $wgOut->parse($string, true, !$forContent);
    } elseif (in_array('parseinline', $options)) {
        $string = $wgOut->parse($string, true, !$forContent);
        $m = array();
        if (preg_match('/^<p>(.*)\\n?<\\/p>\\n?$/sU', $string, $m)) {
            $string = $m[1];
        }
    } elseif (in_array('parsemag', $options)) {
        global $wgMessageCache;
        if (isset($wgMessageCache)) {
            $string = $wgMessageCache->transform($string, !$forContent);
        }
    }
    if (in_array('escape', $options)) {
        $string = htmlspecialchars($string);
    } elseif (in_array('escapenoentities', $options)) {
        $string = htmlspecialchars($string);
        $string = str_replace('&amp;', '&', $string);
        $string = Sanitizer::normalizeCharReferences($string);
    }
    if (in_array('replaceafter', $options)) {
        $string = wfMsgReplaceArgs($string, $args);
    }
    return $string;
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:56,代码来源:GlobalFunctions.php

示例15: addAttributes

 protected function addAttributes(ChangeText $txt, array $attributes)
 {
     if (count($attributes) < 1) {
         return;
     }
     $keys = array_keys($attributes);
     $txt->addHtml(Sanitizer::normalizeCharReferences(' with "' . $keys[0] . '" attribute as "' . $attributes[$keys[0]] . '"'));
     $nbAttributes_min_1 = count($attributes) - 1;
     for ($i = 1; $i < $nbAttributes_min_1; $i++) {
         $key = $keys[$i];
         $attr = $attributes[$key];
         $txt->addHtml(Sanitizer::normalizeCharReferences(', with "' . $key . '" attribute as "' . $attr . '"'));
     }
     if ($nbAttributes_min_1 > 1) {
         $txt->addHtml(Sanitizer::normalizeCharReferences(' and with "' . $keys[$nbAttributes_min_1] . '" attribute as "' . $attributes[$keys[$nbAttributes_min_1]] . '"'));
     }
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:17,代码来源:HTMLDiff.php


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