• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP filter_save_ignore_tags函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: filter_phrases

/**
 * Process phrases intelligently found within a HTML text (such as adding links).
 *
 * @staticvar array $usedpharses
 * @param string $text             the text that we are filtering
 * @param array $link_array       an array of filterobjects
 * @param array $ignoretagsopen   an array of opening tags that we should ignore while filtering
 * @param array $ignoretagsclose  an array of corresponding closing tags
 * @param bool $overridedefaultignore True to only use tags provided by arguments
 * @return string
 **/
function filter_phrases($text, &$link_array, $ignoretagsopen = NULL, $ignoretagsclose = NULL, $overridedefaultignore = false)
{
    global $CFG;
    static $usedphrases;
    $ignoretags = array();
    // To store all the enclosig tags to be completely ignored.
    $tags = array();
    // To store all the simple tags to be ignored.
    if (!$overridedefaultignore) {
        // A list of open/close tags that we should not replace within
        // Extended to include <script>, <textarea>, <select> and <a> tags
        // Regular expression allows tags with or without attributes
        $filterignoretagsopen = array('<head>', '<nolink>', '<span class="nolink">', '<script(\\s[^>]*?)?>', '<textarea(\\s[^>]*?)?>', '<select(\\s[^>]*?)?>', '<a(\\s[^>]*?)?>');
        $filterignoretagsclose = array('</head>', '</nolink>', '</span>', '</script>', '</textarea>', '</select>', '</a>');
    } else {
        // Set an empty default list.
        $filterignoretagsopen = array();
        $filterignoretagsclose = array();
    }
    // Add the user defined ignore tags to the default list.
    if (is_array($ignoretagsopen)) {
        foreach ($ignoretagsopen as $open) {
            $filterignoretagsopen[] = $open;
        }
        foreach ($ignoretagsclose as $close) {
            $filterignoretagsclose[] = $close;
        }
    }
    // Invalid prefixes and suffixes for the fullmatch searches
    // Every "word" character, but the underscore, is a invalid suffix or prefix.
    // (nice to use this because it includes national characters (accents...) as word characters.
    $filterinvalidprefixes = '([^\\W_])';
    $filterinvalidsuffixes = '([^\\W_])';
    // Double up some magic chars to avoid "accidental matches"
    $text = preg_replace('/([#*%])/', '\\1\\1', $text);
    //Remove everything enclosed by the ignore tags from $text
    filter_save_ignore_tags($text, $filterignoretagsopen, $filterignoretagsclose, $ignoretags);
    // Remove tags from $text
    filter_save_tags($text, $tags);
    // Time to cycle through each phrase to be linked
    $size = sizeof($link_array);
    for ($n = 0; $n < $size; $n++) {
        $linkobject =& $link_array[$n];
        // Set some defaults if certain properties are missing
        // Properties may be missing if the filterobject class has not been used to construct the object
        if (empty($linkobject->phrase)) {
            continue;
        }
        // Avoid integers < 1000 to be linked. See bug 1446.
        $intcurrent = intval($linkobject->phrase);
        if (!empty($intcurrent) && strval($intcurrent) == $linkobject->phrase && $intcurrent < 1000) {
            continue;
        }
        // All this work has to be done ONLY it it hasn't been done before
        if (!$linkobject->work_calculated) {
            if (!isset($linkobject->hreftagbegin) or !isset($linkobject->hreftagend)) {
                $linkobject->work_hreftagbegin = '<span class="highlight"';
                $linkobject->work_hreftagend = '</span>';
            } else {
                $linkobject->work_hreftagbegin = $linkobject->hreftagbegin;
                $linkobject->work_hreftagend = $linkobject->hreftagend;
            }
            // Double up chars to protect true duplicates
            // be cleared up before returning to the user.
            $linkobject->work_hreftagbegin = preg_replace('/([#*%])/', '\\1\\1', $linkobject->work_hreftagbegin);
            if (empty($linkobject->casesensitive)) {
                $linkobject->work_casesensitive = false;
            } else {
                $linkobject->work_casesensitive = true;
            }
            if (empty($linkobject->fullmatch)) {
                $linkobject->work_fullmatch = false;
            } else {
                $linkobject->work_fullmatch = true;
            }
            // Strip tags out of the phrase
            $linkobject->work_phrase = strip_tags($linkobject->phrase);
            // Double up chars that might cause a false match -- the duplicates will
            // be cleared up before returning to the user.
            $linkobject->work_phrase = preg_replace('/([#*%])/', '\\1\\1', $linkobject->work_phrase);
            // Set the replacement phrase properly
            if ($linkobject->replacementphrase) {
                //We have specified a replacement phrase
                // Strip tags
                $linkobject->work_replacementphrase = strip_tags($linkobject->replacementphrase);
            } else {
                //The replacement is the original phrase as matched below
                $linkobject->work_replacementphrase = '$1';
            }
//.........这里部分代码省略.........
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:101,代码来源:filterlib.php


示例2: convert_urls_into_links

/**
 * Given some text this function converts any URLs it finds into HTML links
 *
 * @param string $text Passed in by reference. The string to be searched for urls.
 */
function convert_urls_into_links(&$text)
{
    //I've added img tags to this list of tags to ignore.
    //See MDL-21168 for more info. A better way to ignore tags whether or not
    //they are escaped partially or completely would be desirable. For example:
    //<a href="blah">
    //&lt;a href="blah"&gt;
    //&lt;a href="blah">
    $filterignoretagsopen = array('<a\\s[^>]+?>');
    $filterignoretagsclose = array('</a>');
    filter_save_ignore_tags($text, $filterignoretagsopen, $filterignoretagsclose, $ignoretags);
    // Check if we support unicode modifiers in regular expressions. Cache it.
    // TODO: this check should be a environment requirement in Moodle 2.0, as far as unicode
    // chars are going to arrive to URLs officially really soon (2010?)
    // Original RFC regex from: http://www.bytemycode.com/snippets/snippet/796/
    // Various ideas from: http://alanstorm.com/url_regex_explained
    // Unicode check, negative assertion and other bits from Moodle.
    static $unicoderegexp;
    if (!isset($unicoderegexp)) {
        $unicoderegexp = @preg_match('/\\pL/u', 'a');
        // This will fail silenty, returning false,
    }
    $unicoderegexp = false;
    //force non use of unicode modifiers. MDL-21296
    if ($unicoderegexp) {
        //We can use unicode modifiers
        $text = preg_replace('#(?<!=["\'])(((http(s?))://)(((([\\pLl0-9]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl0-9])\\.)+([\\pLl]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl]))|(([0-9]{1,3}\\.){3}[0-9]{1,3}))(:[\\pL0-9]*)?(/([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-fA-F0-9]{2})*)*(\\?([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,\\.;])#iu', '<a href="\\1" target="_blank">\\1</a>', $text);
        $text = preg_replace('#(?<!=["\']|//)((www\\.([\\pLl0-9]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl0-9])\\.)+([\\pLl]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl])(:[\\pL0-9]*)?(/([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-fA-F0-9]{2})*)*(\\?([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,\\.;])#iu', '<a href="http://\\1" target="_blank">\\1</a>', $text);
    } else {
        //We cannot use unicode modifiers
        $text = preg_replace('#(?<!=["\'])(((http(s?))://)(((([a-z0-9]([a-z0-9]|-)*[a-z0-9]|[a-z0-9])\\.)+([a-z]([a-z0-9]|-)*[a-z0-9]|[a-z]))|(([0-9]{1,3}\\.){3}[0-9]{1,3}))(:[a-zA-Z0-9]*)?(/([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-f0-9]{2})*)*(\\?([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,\\.;])#i', '<a href="\\1" target="_blank">\\1</a>', $text);
        $text = preg_replace('#(?<!=["\']|//)((www\\.([a-z0-9]([a-z0-9]|-)*[a-z0-9]|[a-z0-9])\\.)+([a-z]([a-z0-9]|-)*[a-z0-9]|[a-z])(:[a-zA-Z0-9]*)?(/([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-f0-9]{2})*)*(\\?([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,\\.;])#i', '<a href="http://\\1" target="_blank">\\1</a>', $text);
    }
    if (!empty($ignoretags)) {
        $ignoretags = array_reverse($ignoretags);
        /// Reversed so "progressive" str_replace() will solve some nesting problems.
        $text = str_replace(array_keys($ignoretags), $ignoretags, $text);
    }
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:44,代码来源:weblib.php


示例3: convert_urls_into_links

 /**
  * Given some text this function converts any URLs it finds into HTML links
  *
  * @param string $text Passed in by reference. The string to be searched for urls.
  */
 protected function convert_urls_into_links(&$text)
 {
     //I've added img tags to this list of tags to ignore.
     //See MDL-21168 for more info. A better way to ignore tags whether or not
     //they are escaped partially or completely would be desirable. For example:
     //<a href="blah">
     //&lt;a href="blah"&gt;
     //&lt;a href="blah">
     $filterignoretagsopen = array('<a\\s[^>]+?>');
     $filterignoretagsclose = array('</a>');
     filter_save_ignore_tags($text, $filterignoretagsopen, $filterignoretagsclose, $ignoretags);
     // Check if we support unicode modifiers in regular expressions. Cache it.
     // TODO: this check should be a environment requirement in Moodle 2.0, as far as unicode
     // chars are going to arrive to URLs officially really soon (2010?)
     // Original RFC regex from: http://www.bytemycode.com/snippets/snippet/796/
     // Various ideas from: http://alanstorm.com/url_regex_explained
     // Unicode check, negative assertion and other bits from Moodle.
     static $unicoderegexp;
     if (!isset($unicoderegexp)) {
         $unicoderegexp = @preg_match('/\\pL/u', 'a');
         // This will fail silently, returning false,
     }
     // TODO MDL-21296 - use of unicode modifiers may cause a timeout
     $urlstart = '(?:http(s)?://|(?<!://)(www\\.))';
     $domainsegment = '(?:[\\pLl0-9][\\pLl0-9-]*[\\pLl0-9]|[\\pLl0-9])';
     $numericip = '(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3})';
     $port = '(?::\\d*)';
     $pathchar = '(?:[\\pL0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-f0-9]{2})';
     $path = "(?:/{$pathchar}*)*";
     $querystring = '(?:\\?(?:[\\pL0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)';
     $fragment = '(?:\\#(?:[\\pL0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)';
     // Lookbehind assertions.
     // Is not HTML attribute or CSS URL property. Unfortunately legit text like "url(http://...)" will not be a link.
     $lookbehindstart = "(?<!=[\"']|\\burl\\([\"' ]|\\burl\\()";
     $lookbehindend = "(?<![]),.;])";
     $regex = "{$lookbehindstart}{$urlstart}((?:{$domainsegment}\\.)+{$domainsegment}|{$numericip})" . "({$port}?{$path}{$querystring}?{$fragment}?){$lookbehindend}";
     if ($unicoderegexp) {
         $regex = '#' . $regex . '#ui';
     } else {
         $regex = '#' . preg_replace(array('\\pLl', '\\PL'), 'a-z', $regex) . '#i';
     }
     $text = preg_replace($regex, '<a href="http$1://$2$3$4" class="_blanktarget">$0</a>', $text);
     if (!empty($ignoretags)) {
         $ignoretags = array_reverse($ignoretags);
         /// Reversed so "progressive" str_replace() will solve some nesting problems.
         $text = str_replace(array_keys($ignoretags), $ignoretags, $text);
     }
     if ($this->get_global_config('embedimages')) {
         // now try to inject the images, this code was originally in the mediapluing filter
         // this may be useful only if somebody relies on the fact the links in FORMAT_MOODLE get converted
         // to URLs which in turn change to real images
         $search = '/<a href="([^"]+\\.(jpg|png|gif))" class="_blanktarget">([^>]*)<\\/a>/is';
         $text = preg_replace_callback($search, 'filter_urltolink_img_callback', $text);
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:60,代码来源:filter.php


示例4: convert_urls_into_links

 /**
  * Given some text this function converts any URLs it finds into HTML links
  *
  * @param string $text Passed in by reference. The string to be searched for urls.
  */
 protected function convert_urls_into_links(&$text)
 {
     //I've added img tags to this list of tags to ignore.
     //See MDL-21168 for more info. A better way to ignore tags whether or not
     //they are escaped partially or completely would be desirable. For example:
     //<a href="blah">
     //&lt;a href="blah"&gt;
     //&lt;a href="blah">
     $filterignoretagsopen = array('<a\\s[^>]+?>');
     $filterignoretagsclose = array('</a>');
     filter_save_ignore_tags($text, $filterignoretagsopen, $filterignoretagsclose, $ignoretags);
     // Check if we support unicode modifiers in regular expressions. Cache it.
     // TODO: this check should be a environment requirement in Moodle 2.0, as far as unicode
     // chars are going to arrive to URLs officially really soon (2010?)
     // Original RFC regex from: http://www.bytemycode.com/snippets/snippet/796/
     // Various ideas from: http://alanstorm.com/url_regex_explained
     // Unicode check, negative assertion and other bits from Moodle.
     static $unicoderegexp;
     if (!isset($unicoderegexp)) {
         $unicoderegexp = @preg_match('/\\pL/u', 'a');
         // This will fail silently, returning false,
     }
     // TODO MDL-21296 - use of unicode modifiers may cause a timeout
     $urlstart = '(?:http(s)?://|(?<!://)(www\\.))';
     $domainsegment = '(?:[\\pLl0-9][\\pLl0-9-]*[\\pLl0-9]|[\\pLl0-9])';
     $numericip = '(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3})';
     $port = '(?::\\d*)';
     $pathchar = '(?:[\\pL0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-f0-9]{2})';
     $path = "(?:/{$pathchar}*)*";
     $querystring = '(?:\\?(?:[\\pL0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)';
     $fragment = '(?:\\#(?:[\\pL0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)';
     // Lookbehind assertions.
     // Is not HTML attribute or CSS URL property. Unfortunately legit text like "url(http://...)" will not be a link.
     $lookbehindend = "(?<![]),.;])";
     $regex = "{$urlstart}((?:{$domainsegment}\\.)+{$domainsegment}|{$numericip})" . "({$port}?{$path}{$querystring}?{$fragment}?){$lookbehindend}";
     if ($unicoderegexp) {
         $regex = '#' . $regex . '#ui';
     } else {
         $regex = '#' . preg_replace(array('\\pLl', '\\PL'), 'a-z', $regex) . '#i';
     }
     // Locate any HTML tags.
     $matches = preg_split('/(<[^<|>]*>)/i', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
     // Iterate through the tokenized text to handle chunks (html and content).
     foreach ($matches as $idx => $chunk) {
         // Nothing to do. We skip completely any html chunk.
         if (strpos(trim($chunk), '<') === 0) {
             continue;
         }
         // Nothing to do. We skip any content chunk having any of these attributes.
         if (preg_match('#(background=")|(action=")|(style="background)|(href=")|(src=")|(url [(])#', $chunk)) {
             continue;
         }
         // Arrived here, we want to process every word in this chunk.
         $text = $chunk;
         $words = explode(' ', $text);
         foreach ($words as $idx2 => $word) {
             // ReDoS protection. Stop processing if a word is too large.
             if (strlen($word) < 4096) {
                 $words[$idx2] = preg_replace($regex, '<a href="http$1://$2$3$4" class="_blanktarget">$0</a>', $word);
             }
         }
         $text = implode(' ', $words);
         // Copy the result back to the array.
         $matches[$idx] = $text;
     }
     $text = implode('', $matches);
     if (!empty($ignoretags)) {
         $ignoretags = array_reverse($ignoretags);
         /// Reversed so "progressive" str_replace() will solve some nesting problems.
         $text = str_replace(array_keys($ignoretags), $ignoretags, $text);
     }
     if (get_config('filter_urltolink', 'embedimages')) {
         // now try to inject the images, this code was originally in the mediapluing filter
         // this may be useful only if somebody relies on the fact the links in FORMAT_MOODLE get converted
         // to URLs which in turn change to real images
         $search = '/<a href="([^"]+\\.(jpg|png|gif))" class="_blanktarget">([^>]*)<\\/a>/is';
         $text = preg_replace_callback($search, 'filter_urltolink_img_callback', $text);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:84,代码来源:filter.php


示例5: convert_urls_into_links

 /**
  * Given some text this function converts any URLs it finds into HTML links
  *
  * @param string $text Passed in by reference. The string to be searched for urls.
  */
 protected function convert_urls_into_links(&$text)
 {
     //I've added img tags to this list of tags to ignore.
     //See MDL-21168 for more info. A better way to ignore tags whether or not
     //they are escaped partially or completely would be desirable. For example:
     //<a href="blah">
     //&lt;a href="blah"&gt;
     //&lt;a href="blah">
     $filterignoretagsopen = array('<a\\s[^>]+?>');
     $filterignoretagsclose = array('</a>');
     filter_save_ignore_tags($text, $filterignoretagsopen, $filterignoretagsclose, $ignoretags);
     // Check if we support unicode modifiers in regular expressions. Cache it.
     // TODO: this check should be a environment requirement in Moodle 2.0, as far as unicode
     // chars are going to arrive to URLs officially really soon (2010?)
     // Original RFC regex from: http://www.bytemycode.com/snippets/snippet/796/
     // Various ideas from: http://alanstorm.com/url_regex_explained
     // Unicode check, negative assertion and other bits from Moodle.
     static $unicoderegexp;
     if (!isset($unicoderegexp)) {
         $unicoderegexp = @preg_match('/\\pL/u', 'a');
         // This will fail silently, returning false,
     }
     //todo: MDL-21296 - use of unicode modifiers may cause a timeout
     if ($unicoderegexp) {
         //We can use unicode modifiers
         $text = preg_replace('#(?<!=["\'])(((http(s?))://)(((([\\pLl0-9]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl0-9])\\.)+([\\pLl]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl]))|(([0-9]{1,3}\\.){3}[0-9]{1,3}))(:[\\pL0-9]*)?(/([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-fA-F0-9]{2})*)*(\\?([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,.;])#iu', '<a href="\\1" class="_blanktarget">\\1</a>', $text);
         $text = preg_replace('#(?<!=["\']|//)((www\\.([\\pLl0-9]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl0-9])\\.)+([\\pLl]([\\pLl0-9]|-)*[\\pLl0-9]|[\\pLl])(:[\\pL0-9]*)?(/([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-fA-F0-9]{2})*)*(\\?([\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[\\pLl0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,.;])#iu', '<a href="http://\\1" class="_blanktarget">\\1</a>', $text);
     } else {
         //We cannot use unicode modifiers
         $text = preg_replace('#(?<!=["\'])(((http(s?))://)(((([a-z0-9]([a-z0-9]|-)*[a-z0-9]|[a-z0-9])\\.)+([a-z]([a-z0-9]|-)*[a-z0-9]|[a-z]))|(([0-9]{1,3}\\.){3}[0-9]{1,3}))(:[a-zA-Z0-9]*)?(/([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-f0-9]{2})*)*(\\?([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,.;])#i', '<a href="\\1" class="_blanktarget">\\1</a>', $text);
         $text = preg_replace('#(?<!=["\']|//)((www\\.([a-z0-9]([a-z0-9]|-)*[a-z0-9]|[a-z0-9])\\.)+([a-z]([a-z0-9]|-)*[a-z0-9]|[a-z])(:[a-zA-Z0-9]*)?(/([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@-]|%[a-f0-9]{2})*)*(\\?([a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]|%[a-fA-F0-9]{2})*)?(\\#[a-z0-9\\.!$&\'\\(\\)*+,;=_~:@/?-]*)?)(?<![,.;])#i', '<a href="http://\\1" class="_blanktarget">\\1</a>', $text);
     }
     if (!empty($ignoretags)) {
         $ignoretags = array_reverse($ignoretags);
         /// Reversed so "progressive" str_replace() will solve some nesting problems.
         $text = str_replace(array_keys($ignoretags), $ignoretags, $text);
     }
     if ($this->get_global_config('embedimages')) {
         // now try to inject the images, this code was originally in the mediapluing filter
         // this may be useful only if somebody relies on the fact the links in FORMAT_MOODLE get converted
         // to URLs which in turn change to real images
         $search = '/<a href="([^"]+\\.(jpg|png|gif))" class="_blanktarget">([^>]*)<\\/a>/is';
         $text = preg_replace_callback($search, 'filter_urltolink_img_callback', $text);
     }
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:50,代码来源:filter.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP filter_save_tags函数代码示例发布时间:2022-05-15
下一篇:
PHP filter_rules_sort函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap