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


PHP wfUrlProtocolsWithoutProtRel函数代码示例

本文整理汇总了PHP中wfUrlProtocolsWithoutProtRel函数的典型用法代码示例。如果您正苦于以下问题:PHP wfUrlProtocolsWithoutProtRel函数的具体用法?PHP wfUrlProtocolsWithoutProtRel怎么用?PHP wfUrlProtocolsWithoutProtRel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: link

 /**
  * @param $text string
  * @return string
  */
 function link($text)
 {
     # Catch links like http://www.mediawiki.org/wiki/Special:Code/MediaWiki/44245#c829
     # Ended by space or brackets (like those pesky <br /> tags)
     $text = preg_replace_callback('/(^|[^\\w[])(' . wfUrlProtocolsWithoutProtRel() . ')(' . Parser::EXT_LINK_URL_CLASS . '+)/', array($this, 'generalLink'), $text);
     $text = preg_replace_callback('/\\br(\\d+)\\b/', array($this, 'messageRevLink'), $text);
     $text = preg_replace_callback(CodeRevision::BugReference, array($this, 'messageBugLink'), $text);
     return $text;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:CodeCommentLinker.php

示例2: markNoConversion

 /**
  * Prepare external link text for conversion. When the text is
  * a URL, it shouldn't be converted, and it'll be wrapped in
  * the "raw" tag (-{R| }-) to prevent conversion.
  *
  * This function is called "markNoConversion" for historical
  * reasons.
  *
  * @param string $text Text to be used for external link
  * @param bool $noParse Wrap it without confirming it's a real URL first
  * @return string The tagged text
  */
 public function markNoConversion($text, $noParse = false)
 {
     // Excluding protocal-relative URLs may avoid many false positives.
     if ($noParse || preg_match('/^(?:' . wfUrlProtocolsWithoutProtRel() . ')/', $text)) {
         return $this->mConverter->markNoConversion($text);
     } else {
         return $text;
     }
 }
开发者ID:nanasess,项目名称:mediawiki,代码行数:21,代码来源:Language.php

示例3: doMagicLinks

    /**
     * Replace special strings like "ISBN xxx" and "RFC xxx" with
     * magic external links.
     *
     * DML
     * @private
     *
     * @param $text string
     *
     * @return string
     */
    function doMagicLinks($text)
    {
        wfProfileIn(__METHOD__);
        $prots = wfUrlProtocolsWithoutProtRel();
        $urlChar = self::EXT_LINK_URL_CLASS;
        $text = preg_replace_callback('!(?:                           # Start cases
				(<a[ \\t\\r\\n>].*?</a>) |     # m[1]: Skip link text
				(<.*?>) |                   # m[2]: Skip stuff inside HTML elements' . "\n\t\t\t\t(\\b(?i:{$prots}){$urlChar}+) |  # m[3]: Free external links" . '
				(?:RFC|PMID)\\s+([0-9]+) |   # m[4]: RFC or PMID, capture number
				ISBN\\s+(\\b                  # m[5]: ISBN, capture number
					(?: 97[89] [\\ \\-]? )?   # optional 13-digit ISBN prefix
					(?: [0-9]  [\\ \\-]? ){9} # 9 digits with opt. delimiters
					[0-9Xx]                 # check digit
					\\b)
			)!xu', array(&$this, 'magicLinkCallback'), $text);
        wfProfileOut(__METHOD__);
        return $text;
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:29,代码来源:Parser.php

示例4: doMagicLinks

    /**
     * Replace special strings like "ISBN xxx" and "RFC xxx" with
     * magic external links.
     *
     * DML
     * @private
     *
     * @param string $text
     *
     * @return string
     */
    public function doMagicLinks($text)
    {
        $prots = wfUrlProtocolsWithoutProtRel();
        $urlChar = self::EXT_LINK_URL_CLASS;
        $addr = self::EXT_LINK_ADDR;
        $space = self::SPACE_NOT_NL;
        #  non-newline space
        $spdash = "(?:-|{$space})";
        # a dash or a non-newline space
        $spaces = "{$space}++";
        # possessive match of 1 or more spaces
        $text = preg_replace_callback('!(?:                            # Start cases
				(<a[ \\t\\r\\n>].*?</a>) |      # m[1]: Skip link text
				(<.*?>) |                    # m[2]: Skip stuff inside
				                             #       HTML elements' . "\n\t\t\t\t(\\b(?i:{$prots})({$addr}{$urlChar}*)) | # m[3]: Free external links\n\t\t\t\t                             # m[4]: Post-protocol path\n\t\t\t\t\\b(?:RFC|PMID) {$spaces}       # m[5]: RFC or PMID, capture number\n\t\t\t\t\t([0-9]+)\\b |\n\t\t\t\t\\bISBN {$spaces} (             # m[6]: ISBN, capture number\n\t\t\t\t\t(?: 97[89] {$spdash}? )?   #  optional 13-digit ISBN prefix\n\t\t\t\t\t(?: [0-9]  {$spdash}? ){9} #  9 digits with opt. delimiters\n\t\t\t\t\t[0-9Xx]                  #  check digit\n\t\t\t\t)\\b\n\t\t\t)!xu", array(&$this, 'magicLinkCallback'), $text);
        return $text;
    }
开发者ID:rrameshs,项目名称:mediawiki,代码行数:28,代码来源:Parser.php

示例5: formatHTML

 /**
  * Pretty-print various elements in HTML format, such as xml tags and
  * URLs. This method also escapes characters like <
  * @deprecated since 1.25
  * @param string $text
  * @return string
  */
 protected function formatHTML($text)
 {
     wfDeprecated(__METHOD__, '1.25');
     // Escape everything first for full coverage
     $text = htmlspecialchars($text);
     if ($this->mFormat === 'XML') {
         // encode all comments or tags as safe blue strings
         $text = str_replace('&lt;', '<span style="color:blue;">&lt;', $text);
         $text = str_replace('&gt;', '&gt;</span>', $text);
     }
     // identify requests to api.php
     $text = preg_replace('#^(\\s*)(api\\.php\\?[^ <\\n\\t]+)$#m', '\\1<a href="\\2">\\2</a>', $text);
     if ($this->mHelp) {
         // make lines inside * bold
         $text = preg_replace('#^(\\s*)(\\*[^<>\\n]+\\*)(\\s*)$#m', '$1<b>$2</b>$3', $text);
     }
     // Armor links (bug 61362)
     $masked = [];
     $text = preg_replace_callback('#<a .*?</a>#', function ($matches) use(&$masked) {
         $sha = sha1($matches[0]);
         $masked[$sha] = $matches[0];
         return "<{$sha}>";
     }, $text);
     // identify URLs
     $protos = wfUrlProtocolsWithoutProtRel();
     // This regex hacks around bug 13218 (&quot; included in the URL)
     $text = preg_replace("#(((?i){$protos}).*?)(&quot;)?([ \\'\"<>\n]|&lt;|&gt;|&quot;)#", '<a href="\\1">\\1</a>\\3\\4', $text);
     // Unarmor links
     $text = preg_replace_callback('#<([0-9a-f]{40})>#', function ($matches) use(&$masked) {
         $sha = $matches[1];
         return isset($masked[$sha]) ? $masked[$sha] : $matches[0];
     }, $text);
     /**
      * Temporary fix for bad links in help messages. As a special case,
      * XML-escaped metachars are de-escaped one level in the help message
      * for legibility. Should be removed once we have completed a fully-HTML
      * version of the help message.
      */
     if ($this->mUnescapeAmps) {
         $text = preg_replace('/&amp;(amp|quot|lt|gt);/', '&\\1;', $text);
     }
     return $text;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:50,代码来源:ApiFormatBase.php

示例6: formatHTML

 /**
  * Pretty-print various elements in HTML format, such as xml tags and
  * URLs. This method also escapes characters like <
  * @param $text string
  * @return string
  */
 protected function formatHTML($text)
 {
     // Escape everything first for full coverage
     $text = htmlspecialchars($text);
     // encode all comments or tags as safe blue strings
     $text = str_replace('&lt;', '<span style="color:blue;">&lt;', $text);
     $text = str_replace('&gt;', '&gt;</span>', $text);
     // identify requests to api.php
     $text = preg_replace("#api\\.php\\?[^ <\n\t]+#", '<a href="\\0">\\0</a>', $text);
     if ($this->mHelp) {
         // make strings inside * bold
         $text = preg_replace("#\\*[^<>\n]+\\*#", '<b>\\0</b>', $text);
     }
     // identify URLs
     $protos = wfUrlProtocolsWithoutProtRel();
     // This regex hacks around bug 13218 (&quot; included in the URL)
     $text = preg_replace("#(((?i){$protos}).*?)(&quot;)?([ \\'\"<>\n]|&lt;|&gt;|&quot;)#", '<a href="\\1">\\1</a>\\3\\4', $text);
     /**
      * Temporary fix for bad links in help messages. As a special case,
      * XML-escaped metachars are de-escaped one level in the help message
      * for legibility. Should be removed once we have completed a fully-HTML
      * version of the help message.
      */
     if ($this->mUnescapeAmps) {
         $text = preg_replace('/&amp;(amp|quot|lt|gt);/', '&\\1;', $text);
     }
     return $text;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:34,代码来源:ApiFormatBase.php

示例7: formatHTML

 /**
  * Pretty-print various elements in HTML format, such as xml tags and
  * URLs. This method also escapes characters like <
  * @param $text string
  * @return string
  */
 protected function formatHTML($text)
 {
     // Escape everything first for full coverage
     $text = htmlspecialchars($text);
     // encode all comments or tags as safe blue strings
     $text = preg_replace('/\\&lt;(!--.*?--|.*?)\\&gt;/', '<span style="color:blue;">&lt;\\1&gt;</span>', $text);
     // identify requests to api.php
     $text = preg_replace('#^(\\s*)(api\\.php\\?[^ <\\n\\t]+)$#m', '\\1<a href="\\2">\\2</a>', $text);
     if ($this->mHelp) {
         // make strings inside * bold
         $text = preg_replace("#\\*[^<>\n]+\\*#", '<b>\\0</b>', $text);
         // make strings inside $ italic
         $text = preg_replace("#\\\$[^<>\n]+\\\$#", '<b><i>\\0</i></b>', $text);
     }
     // Armor links (bug 61362)
     $this->mMasked = array();
     $text = preg_replace_callback('#<a .*?</a>#', array($this, 'armorLinkCallback'), $text);
     // identify URLs
     $protos = wfUrlProtocolsWithoutProtRel();
     // This regex hacks around bug 13218 (&quot; included in the URL)
     $text = preg_replace("#(({$protos}).*?)(&quot;)?([ \\'\"<>\n]|&lt;|&gt;|&quot;)#", '<a href="\\1">\\1</a>\\3\\4', $text);
     // Unarmor links
     $text = preg_replace_callback('#<([0-9a-f]{40})>#', array($this, 'unarmorLinkCallback'), $text);
     $this->mMasked = null;
     /**
      * Temporary fix for bad links in help messages. As a special case,
      * XML-escaped metachars are de-escaped one level in the help message
      * for legibility. Should be removed once we have completed a fully-HTML
      * version of the help message.
      */
     if ($this->mUnescapeAmps) {
         $text = preg_replace('/&amp;(amp|quot|lt|gt);/', '&\\1;', $text);
     }
     return $text;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:41,代码来源:ApiFormatBase.php


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