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


PHP qa_block_words_match_all函数代码示例

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


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

示例1: output_widget

 public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'db/selects.php';
     $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
     $maxcount = reset($populartags);
     // $themeobject->output(sprintf('<h2 style="margin-top: 0; padding-top: 0;">%s</h2>', qa_lang_html('main/popular_tags')));
     // $themeobject->output('<div style="font-size: 10px;">');
     $themeobject->output(sprintf('<div class="panel panel-primary" style="padding: 0;"><div class="panel-heading"><h3 class="panel-title">%s</h3></div>', qa_lang_html('main/popular_tags')));
     $themeobject->output('<div class="panel-body">');
     $maxsize = qa_opt('tag_cloud_font_size');
     $minsize = qa_opt('tag_cloud_minimal_font_size');
     $scale = qa_opt('tag_cloud_size_popular');
     $blockwordspreg = qa_get_block_words_preg();
     foreach ($populartags as $tag => $count) {
         $matches = qa_block_words_match_all($tag, $blockwordspreg);
         if (empty($matches)) {
             if ($scale) {
                 $size = number_format($maxsize * $count / $maxcount, 1);
                 if ($size < $minsize) {
                     $size = $minsize;
                 }
             } else {
                 $size = $maxsize;
             }
             $themeobject->output(sprintf('<a href="%s" style="font-size: %dpx; vertical-align: baseline;">%s</a>', qa_path_html('tag/' . $tag), $size, qa_html($tag)));
         }
     }
     // $themeobject->output('</div>');
     $themeobject->output('</div></div>');
 }
开发者ID:architbakliwal,项目名称:Q2A,代码行数:30,代码来源:qa-tag-cloud.php

示例2: test__qa_block_words_match_all

 public function test__qa_block_words_match_all()
 {
     $test1 = qa_block_words_match_all('onion belt', '');
     $wordpreg = qa_block_words_to_preg($this->blockWordString);
     $test2 = qa_block_words_match_all('tried an ocean boat', $wordpreg);
     // matches are returned as array of [offset] => [length]
     $expected = array(0 => 5, 9 => 5, 15 => 4);
     $this->assertEmpty($test1);
     $this->assertEquals($expected, $test2);
 }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:10,代码来源:UtilStringTest.php

示例3: output_widget

 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     $widget_opt = @$themeobject->current_widget['param']['options'];
     if (@$themeobject->current_widget['param']['locations']['show_title']) {
         $themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/tags') . '<a href="' . qa_path_html('tags') . '">' . qa_lang('cleanstrap/view_all') . '</a></h3>');
     }
     $to_show = (int) $widget_opt['cs_tags_count'];
     $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, !empty($to_show) ? $to_show : 20));
     reset($populartags);
     $themeobject->output('<div class="ra-tags-widget clearfix">');
     $blockwordspreg = qa_get_block_words_preg();
     foreach ($populartags as $tag => $count) {
         if (count(qa_block_words_match_all($tag, $blockwordspreg))) {
             continue;
         }
         // skip censored tags
         $themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" class="widget-tag">' . qa_html($tag) . '<span>' . $count . '</span></a>');
     }
     $themeobject->output('</div>');
 }
开发者ID:microbye,项目名称:CleanStrap,代码行数:21,代码来源:widget_tags.php

示例4: qa_post_html_fields

function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $options = array())
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    if (isset($options['blockwordspreg'])) {
        require_once QA_INCLUDE_DIR . 'util/string.php';
    }
    $fields = array('raw' => $post);
    //	Useful stuff used throughout function
    $postid = $post['postid'];
    $isquestion = $post['basetype'] == 'Q';
    $isanswer = $post['basetype'] == 'A';
    $isbyuser = qa_post_is_by_user($post, $userid, $cookieid);
    $anchor = urlencode(qa_anchor($post['basetype'], $postid));
    $elementid = isset($options['elementid']) ? $options['elementid'] : $anchor;
    $microformats = @$options['microformats'];
    $isselected = @$options['isselected'];
    $favoritedview = @$options['favoritedview'];
    $favoritemap = $favoritedview ? qa_get_favorite_non_qs_map() : array();
    //	High level information
    $fields['hidden'] = @$post['hidden'];
    $fields['tags'] = 'id="' . qa_html($elementid) . '"';
    $fields['classes'] = $isquestion && $favoritedview && @$post['userfavoriteq'] ? 'qa-q-favorited' : '';
    if ($isquestion && isset($post['closedbyid'])) {
        $fields['classes'] = ltrim($fields['classes'] . ' qa-q-closed');
    }
    if ($microformats) {
        $fields['classes'] .= ' hentry ' . ($isquestion ? 'question' : ($isanswer ? $isselected ? 'answer answer-selected' : 'answer' : 'comment'));
    }
    //	Question-specific stuff (title, URL, tags, answer count, category)
    if ($isquestion) {
        if (isset($post['title'])) {
            $fields['url'] = qa_q_path_html($postid, $post['title']);
            if (isset($options['blockwordspreg'])) {
                $post['title'] = qa_block_words_replace($post['title'], $options['blockwordspreg']);
            }
            $fields['title'] = qa_html($post['title']);
            if ($microformats) {
                $fields['title'] = '<span class="entry-title">' . $fields['title'] . '</span>';
            }
            /*if (isset($post['score'])) // useful for setting match thresholds
            		$fields['title'].=' <small>('.$post['score'].')</small>';*/
        }
        if (@$options['tagsview'] && isset($post['tags'])) {
            $fields['q_tags'] = array();
            $tags = qa_tagstring_to_tags($post['tags']);
            foreach ($tags as $tag) {
                if (isset($options['blockwordspreg']) && count(qa_block_words_match_all($tag, $options['blockwordspreg']))) {
                    // skip censored tags
                    continue;
                }
                $fields['q_tags'][] = qa_tag_html($tag, $microformats, @$favoritemap['tag'][qa_strtolower($tag)]);
            }
        }
        if (@$options['answersview'] && isset($post['acount'])) {
            $fields['answers_raw'] = $post['acount'];
            $fields['answers'] = $post['acount'] == 1 ? qa_lang_html_sub_split('main/1_answer', '1', '1') : qa_lang_html_sub_split('main/x_answers', number_format($post['acount']));
            $fields['answer_selected'] = isset($post['selchildid']);
        }
        if (@$options['viewsview'] && isset($post['views'])) {
            $fields['views_raw'] = $post['views'];
            $fields['views'] = $post['views'] == 1 ? qa_lang_html_sub_split('main/1_view', '1', '1') : qa_lang_html_sub_split('main/x_views', number_format($post['views']));
        }
        if (@$options['categoryview'] && isset($post['categoryname']) && isset($post['categorybackpath'])) {
            $favoriteclass = '';
            if (count(@$favoritemap['category'])) {
                if (@$favoritemap['category'][$post['categorybackpath']]) {
                    $favoriteclass = ' qa-cat-favorited';
                } else {
                    foreach ($favoritemap['category'] as $categorybackpath => $dummy) {
                        if (substr('/' . $post['categorybackpath'], -strlen($categorybackpath)) == $categorybackpath) {
                            $favoriteclass = ' qa-cat-parent-favorited';
                        }
                    }
                }
            }
            $fields['where'] = qa_lang_html_sub_split('main/in_category_x', '<a href="' . qa_path_html(@$options['categorypathprefix'] . implode('/', array_reverse(explode('/', $post['categorybackpath'])))) . '" class="qa-category-link' . $favoriteclass . '">' . qa_html($post['categoryname']) . '</a>');
        }
    }
    //	Answer-specific stuff (selection)
    if ($isanswer) {
        $fields['selected'] = $isselected;
        if ($isselected) {
            $fields['select_text'] = qa_lang_html('question/select_text');
        }
    }
    //	Post content
    if (@$options['contentview'] && isset($post['content'])) {
        $viewer = qa_load_viewer($post['content'], $post['format']);
        $fields['content'] = $viewer->get_html($post['content'], $post['format'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow']));
        if ($microformats) {
            $fields['content'] = '<div class="entry-content">' . $fields['content'] . '</div>';
        }
        $fields['content'] = '<a name="' . qa_html($postid) . '"></a>' . $fields['content'];
        // this is for backwards compatibility with any existing links using the old style of anchor
        // that contained the post id only (changed to be valid under W3C specifications)
    }
//.........这里部分代码省略.........
开发者ID:amiyasahu,项目名称:question2answer,代码行数:101,代码来源:format.php

示例5: qa_block_words_replace

function qa_block_words_replace($string, $wordspreg, $character = '*')
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    if (strlen($wordspreg)) {
        $matches = qa_block_words_match_all($string, $wordspreg);
        krsort($matches, SORT_NUMERIC);
        foreach ($matches as $start => $length) {
            // get length again below to deal with multi-byte characters
            $string = substr_replace($string, str_repeat($character, qa_strlen(substr($string, $start, $length))), $start, $length);
        }
    }
    return $string;
}
开发者ID:amiyasahu,项目名称:question2answer,代码行数:16,代码来源:string.php

示例6: output_widget

 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
     reset($populartags);
     $maxcount = current($populartags);
     $themeobject->output('<h2 style="margin-top:0; padding-top:0;">', qa_lang_html('main/popular_tags'), '</h2>');
     $themeobject->output('<div style="font-size:10px;">');
     $maxsize = qa_opt('tag_cloud_font_size');
     $scale = qa_opt('tag_cloud_size_popular');
     $blockwordspreg = qa_get_block_words_preg();
     foreach ($populartags as $tag => $count) {
         if (count(qa_block_words_match_all($tag, $blockwordspreg))) {
             continue;
         }
         // skip censored tags
         $size = number_format($scale ? $maxsize * $count / $maxcount : $maxsize, 1);
         if ($size >= 5 || !$scale) {
             $themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" style="font-size:' . $size . 'px; vertical-align:baseline;">' . qa_html($tag) . '</a>');
         }
     }
     $themeobject->output('</div>');
 }
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:23,代码来源:qa-tag-cloud.php

示例7: get_html

 function get_html($content, $format, $options)
 {
     if ($format == 'html') {
         $html = qa_sanitize_html($content, @$options['linksnewwindow'], false);
         // sanitize again for display, for extra safety, and due to new window setting
         if (isset($options['blockwordspreg'])) {
             // filtering out blocked words inline within HTML is pretty complex, e.g. p<B>oo</B>p must be caught
             require_once QA_INCLUDE_DIR . 'qa-util-string.php';
             $html = preg_replace('/<\\s*(' . $this->htmllineseparators . ')[^A-Za-z0-9]/i', "\n\\0", $html);
             // tags to single new line
             $html = preg_replace('/<\\s*(' . $this->htmlparagraphseparators . ')[^A-Za-z0-9]/i', "\n\n\\0", $html);
             // tags to double new line
             preg_match_all('/<[^>]*>/', $html, $pregmatches, PREG_OFFSET_CAPTURE);
             // find tag positions and lengths
             $tagmatches = $pregmatches[0];
             $text = preg_replace('/<[^>]*>/', '', $html);
             // effectively strip_tags() but use same regexp as above to ensure consistency
             $blockmatches = qa_block_words_match_all($text, $options['blockwordspreg']);
             // search for blocked words within text
             $nexttagmatch = array_shift($tagmatches);
             $texttohtml = 0;
             $htmlshift = 0;
             foreach ($blockmatches as $textoffset => $textlength) {
                 while (isset($nexttagmatch) && $nexttagmatch[1] <= $textoffset + $texttohtml) {
                     // keep text and html in sync
                     $texttohtml += strlen($nexttagmatch[0]);
                     $nexttagmatch = array_shift($tagmatches);
                 }
                 while (1) {
                     $replacepart = $textlength;
                     if (isset($nexttagmatch)) {
                         $replacepart = min($replacepart, $nexttagmatch[1] - ($textoffset + $texttohtml));
                     }
                     // stop replacing early if we hit an HTML tag
                     $replacelength = qa_strlen(substr($text, $textoffset, $replacepart));
                     // to work with multi-byte characters
                     $html = substr_replace($html, str_repeat('*', $replacelength), $textoffset + $texttohtml + $htmlshift, $replacepart);
                     $htmlshift += $replacelength - $replacepart;
                     // HTML might have moved around if we replaced multi-byte characters
                     if ($replacepart >= $textlength) {
                         break;
                     }
                     // we have replaced everything expected, otherwise more left (due to hitting an HTML tag)
                     $textlength -= $replacepart;
                     $textoffset += $replacepart;
                     $texttohtml += strlen($nexttagmatch[0]);
                     $nexttagmatch = array_shift($tagmatches);
                 }
             }
         }
         if (@$options['showurllinks']) {
             // we need to ensure here that we don't put new links inside existing ones
             require_once QA_INCLUDE_DIR . 'qa-util-string.php';
             $htmlunlinkeds = array_reverse(preg_split('|<[Aa]\\s+[^>]+>.*</[Aa]\\s*>|', $html, -1, PREG_SPLIT_OFFSET_CAPTURE));
             // start from end so we substitute correctly
             foreach ($htmlunlinkeds as $htmlunlinked) {
                 // and that we don't detect links inside HTML, e.g. <IMG SRC="http://...">
                 $thishtmluntaggeds = array_reverse(preg_split('/<[^>]*>/', $htmlunlinked[0], -1, PREG_SPLIT_OFFSET_CAPTURE));
                 // again, start from end
                 foreach ($thishtmluntaggeds as $thishtmluntagged) {
                     $innerhtml = $thishtmluntagged[0];
                     if (is_numeric(strpos($innerhtml, '://'))) {
                         // quick test first
                         $newhtml = qa_html_convert_urls($innerhtml, qa_opt('links_in_new_window'));
                         $html = substr_replace($html, $newhtml, $htmlunlinked[1] + $thishtmluntagged[1], strlen($innerhtml));
                     }
                 }
             }
         }
     } elseif ($format == '') {
         if (isset($options['blockwordspreg'])) {
             require_once QA_INCLUDE_DIR . 'qa-util-string.php';
             $content = qa_block_words_replace($content, $options['blockwordspreg']);
         }
         $html = qa_html($content, true);
         if (@$options['showurllinks']) {
             require_once QA_INCLUDE_DIR . 'qa-app-format.php';
             $html = qa_html_convert_urls($html, qa_opt('links_in_new_window'));
         }
     } else {
         $html = '[no viewer found for format: ' . qa_html($format) . ']';
     }
     // for unknown formats
     return $html;
 }
开发者ID:ramo01,项目名称:1kapp,代码行数:85,代码来源:qa-viewer-basic.php

示例8: qa_block_words_replace

function qa_block_words_replace($string, $wordspreg, $character = '*')
{
    if (strlen($wordspreg)) {
        $matches = qa_block_words_match_all($string, $wordspreg);
        krsort($matches, SORT_NUMERIC);
        foreach ($matches as $start => $length) {
            // get length again below to deal with multi-byte characters
            $string = substr_replace($string, str_repeat($character, qa_strlen(substr($string, $start, $length))), $start, $length);
        }
    }
    return $string;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:12,代码来源:qa-util-string.php

示例9: qa_post_html_fields

function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $options = array())
{
    if (isset($options['blockwordspreg'])) {
        require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    }
    $fields = array();
    $fields['raw'] = $post;
    //	Useful stuff used throughout function
    $postid = $post['postid'];
    $isquestion = $post['basetype'] == 'Q';
    $isanswer = $post['basetype'] == 'A';
    $isbyuser = qa_post_is_by_user($post, $userid, $cookieid);
    $anchor = urlencode(qa_anchor($post['basetype'], $postid));
    $microformats = @$options['microformats'];
    $isselected = @$options['isselected'];
    //	High level information
    $fields['hidden'] = $post['hidden'];
    $fields['tags'] = 'ID="' . $anchor . '"';
    if ($microformats) {
        $fields['classes'] = 'hentry ' . ($isquestion ? 'question' : ($isanswer ? $isselected ? 'answer answer-selected' : 'answer' : 'comment'));
    }
    //	Question-specific stuff (title, URL, tags, answer count, category)
    if ($isquestion) {
        if (isset($post['title'])) {
            if (isset($options['blockwordspreg'])) {
                $post['title'] = qa_block_words_replace($post['title'], $options['blockwordspreg']);
            }
            $fields['title'] = qa_html($post['title']);
            if ($microformats) {
                $fields['title'] = '<SPAN CLASS="entry-title">' . $fields['title'] . '</SPAN>';
            }
            $fields['url'] = qa_path_html(qa_q_request($postid, $post['title']));
            /*if (isset($post['score'])) // useful for setting match thresholds
            		$fields['title'].=' <SMALL>('.$post['score'].')</SMALL>';*/
        }
        if (@$options['tagsview'] && isset($post['tags'])) {
            $fields['q_tags'] = array();
            $tags = qa_tagstring_to_tags($post['tags']);
            foreach ($tags as $tag) {
                if (isset($options['blockwordspreg']) && count(qa_block_words_match_all($tag, $options['blockwordspreg']))) {
                    // skip censored tags
                    continue;
                }
                $fields['q_tags'][] = qa_tag_html($tag, $microformats);
            }
        }
        if (@$options['answersview'] && isset($post['acount'])) {
            $fields['answers_raw'] = $post['acount'];
            $fields['answers'] = $post['acount'] == 1 ? qa_lang_html_sub_split('main/1_answer', '1', '1') : qa_lang_html_sub_split('main/x_answers', number_format($post['acount']));
            $fields['answer_selected'] = isset($post['selchildid']);
        }
        if (@$options['viewsview'] && isset($post['views'])) {
            $fields['views_raw'] = $post['views'];
            $fields['views'] = $post['views'] == 1 ? qa_lang_html_sub_split('main/1_view', '1', '1') : qa_lang_html_sub_split('main/x_views', number_format($post['views']));
        }
        if (isset($post['categoryname']) && isset($post['categorybackpath'])) {
            $fields['where'] = qa_lang_html_sub_split('main/in_category_x', '<A HREF="' . qa_path_html(@$options['categorypathprefix'] . implode('/', array_reverse(explode('/', $post['categorybackpath'])))) . '" CLASS="qa-category-link">' . qa_html($post['categoryname']) . '</A>');
        }
    }
    //	Answer-specific stuff (selection)
    if ($isanswer) {
        $fields['selected'] = $isselected;
        if ($isselected) {
            $fields['select_text'] = qa_lang_html('question/select_text');
        }
    }
    //	Post content
    if (!empty($post['content'])) {
        $viewer = qa_load_viewer($post['content'], $post['format']);
        $fields['content'] = $viewer->get_html($post['content'], $post['format'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow']));
        if ($microformats) {
            $fields['content'] = '<SPAN CLASS="entry-content">' . $fields['content'] . '</SPAN>';
        }
        $fields['content'] = '<A NAME="' . qa_html($postid) . '"></A>' . $fields['content'];
        // this is for backwards compatibility with any existing links using the old style of anchor
        // that contained the post id only (changed to be valid under W3C specifications)
    }
    //	Voting stuff
    if (@$options['voteview']) {
        $voteview = $options['voteview'];
        //	Calculate raw values and pass through
        $upvotes = (int) @$post['upvotes'];
        $downvotes = (int) @$post['downvotes'];
        $netvotes = (int) ($upvotes - $downvotes);
        $fields['upvotes_raw'] = $upvotes;
        $fields['downvotes_raw'] = $downvotes;
        $fields['netvotes_raw'] = $netvotes;
        //	Create HTML versions...
        $upvoteshtml = qa_html($upvotes);
        $downvoteshtml = qa_html($downvotes);
        if ($netvotes >= 1) {
            $netvoteshtml = '+' . qa_html($netvotes);
        } elseif ($netvotes <= -1) {
            $netvoteshtml = '&ndash;' . qa_html(-$netvotes);
        } else {
            $netvoteshtml = '0';
        }
        //	...with microformats if appropriate
        if ($microformats) {
            $netvoteshtml .= '<SPAN CLASS="votes-up"><SPAN CLASS="value-title" TITLE="' . $upvoteshtml . '"></SPAN></SPAN>' . '<SPAN CLASS="votes-down"><SPAN CLASS="value-title" TITLE="' . $downvoteshtml . '"></SPAN></SPAN>';
//.........这里部分代码省略.........
开发者ID:TheProjecter,项目名称:microprobe,代码行数:101,代码来源:qa-app-format.php

示例10: get_html

 function get_html($content, $format, $options)
 {
     if ($format == 'html') {
         $html = qa_sanitize_html($content, @$options['linksnewwindow']);
         // sanitize again for display, for extra safety, and due to new window setting
         if (isset($options['blockwordspreg'])) {
             // filtering out blocked words inline within HTML is pretty complex, e.g. p<B>oo</B>p must be caught
             require_once QA_INCLUDE_DIR . 'qa-util-string.php';
             $html = preg_replace('/<\\s*(' . $this->htmllineseparators . ')[^A-Za-z0-9]/i', "\n\\0", $html);
             // tags to single new line
             $html = preg_replace('/<\\s*(' . $this->htmlparagraphseparators . ')[^A-Za-z0-9]/i', "\n\n\\0", $html);
             // tags to double new line
             preg_match_all('/<[^>]*>/', $html, $pregmatches, PREG_OFFSET_CAPTURE);
             // find tag positions and lengths
             $tagmatches = $pregmatches[0];
             $text = preg_replace('/<[^>]*>/', '', $html);
             // effectively strip_tags() but use same regexp as above to ensure consistency
             $blockmatches = qa_block_words_match_all($text, $options['blockwordspreg']);
             // search for blocked words within text
             $nexttagmatch = array_shift($tagmatches);
             $texttohtml = 0;
             $htmlshift = 0;
             foreach ($blockmatches as $textoffset => $textlength) {
                 while (isset($nexttagmatch) && $nexttagmatch[1] <= $textoffset + $texttohtml) {
                     // keep text and html in sync
                     $texttohtml += strlen($nexttagmatch[0]);
                     $nexttagmatch = array_shift($tagmatches);
                 }
                 while (1) {
                     $replacepart = $textlength;
                     if (isset($nexttagmatch)) {
                         $replacepart = min($replacepart, $nexttagmatch[1] - ($textoffset + $texttohtml));
                     }
                     // stop replacing early if we hit an HTML tag
                     $replacelength = qa_strlen(substr($text, $textoffset, $replacepart));
                     // to work with multi-byte characters
                     $html = substr_replace($html, str_repeat('*', $replacelength), $textoffset + $texttohtml + $htmlshift, $replacepart);
                     $htmlshift += $replacelength - $replacepart;
                     // HTML might have moved around if we replaced multi-byte characters
                     if ($replacepart >= $textlength) {
                         break;
                     }
                     // we have replaced everything expected, otherwise more left (due to hitting an HTML tag)
                     $textlength -= $replacepart;
                     $textoffset += $replacepart;
                     $texttohtml += strlen($nexttagmatch[0]);
                     $nexttagmatch = array_shift($tagmatches);
                 }
             }
         }
     } else {
         if (isset($options['blockwordspreg'])) {
             require_once QA_INCLUDE_DIR . 'qa-util-string.php';
             $content = qa_block_words_replace($content, $options['blockwordspreg']);
         }
         $html = qa_html($content, true);
         if (@$options['showurllinks']) {
             require_once QA_INCLUDE_DIR . 'qa-app-format.php';
             $html = qa_html_convert_urls($html, qa_opt('links_in_new_window'));
         }
     }
     return $html;
 }
开发者ID:TheProjecter,项目名称:microprobe,代码行数:63,代码来源:qa-viewer-basic.php


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