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


PHP base::select方法代码示例

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


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

示例1: str_to_html

function str_to_html($string)
{
    $code = array();
    $lang = array();
    $re = '#(``)(@(abap|actionscript|actionscript3|ada|apache|applescript|apt_sources|asm|asp|autoit|avisynth|bash|basic4gl|bf|bibtex|blitzbasic|bnf|boo|c|c_mac|caddcl|cadlisp|cfdg|cfm|cil|cmake|cobol|cpp|cpp-qt|csharp|css|d|dcs|delphi|diff|div|dos|dot|eiffel|e-mail|erlang|fo|fortran|freebasic|genero|gettext|glsl|gml|gnuplot|groovy|haskell|hq9plus|html4strict|idl|ini|inno|intercal|io|java|java5|javascript|kixtart|klonec|latex|lisp|locobasic|lolcode|lotusformulas|lotusscript|lscript|lsl2|lua|m68k|make|matlab|mirc|modula3|mpasm|mxml|mysql|nsis|oberon2|objc|ocaml|ocaml-brief|oobas|oracle11|oracle8|pascal|per|perl|php|php-brief|pic16|pixelbender|plsql|povray|powershell|progress|prolog|providex||python|qbasic|rails|rebol|reg|robots|ruby|sas|scala|scheme|scilab|sdlbasic|smalltalk|smarty|sql|tcl|teraterm|text|thinbasic|tsql|typoscript|vb|vbnet|verilog|vhdl|vim|visualfoxpro|visualprolog|whitespace|whois|winbatch|xml|xorg_conf|xpp|z80)@)?(.*?[^``]?)(``)#sim';
    $vh = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $lang[$i] = $match[3][$i];
        $with_breaks = mark::highlight(html_entity_decode($match[4][$i], ENT_QUOTES), $match[3][$i], "librarys/geshi/geshi");
        $code[$i] = $with_breaks;
        $string = str_replace($match[0][$i], '⓬' . $i . '⓬', $string);
    }
    $latex = array();
    $latex_re = '#(\\{%\\{)(.*?)(\\}%\\})#suim';
    $vh = preg_match_all($latex_re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $with_breaks = mark::make_latex($match[2][$i]);
        $latex[$i] = $with_breaks;
        $string = str_replace($match[0][$i], '☣' . $i . '☣', $string);
    }
    $re = '#(\\{\\{)(.*?)(\\}\\})#suim';
    $vh = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $with_breaks = mark::make_formula($match[2][$i]);
        $math[$i] = $with_breaks;
        $string = str_replace($match[0][$i], 'ᴥ' . $i . 'ᴥ', $string);
    }
    $string = htmlspecialchars($string);
    $string = str_replace('\\', '&#92;', $string);
    $string = '<p>' . $string . '</p>';
    $string = preg_replace("#(\\*\\*)(.*?(^\\*\\*)?)(\\*\\*)#sim", "<b>\$2</b>", $string);
    $string = preg_replace("#(%%)(.*?(^%%)?)(%%)#sim", "<span class=\"spoiler\">\$2</span>", $string);
    $string = preg_replace("#(__)(.*?(^__)?)(__)#sim", "<b>\$2</b>", $string);
    $string = preg_replace("#(\\*)([^ ].*?(^\\*)?)(\\*)#sim", "<i>\$2</i>", $string);
    $string = preg_replace("#(_)(.*?(^_)?)(_)#sim", "<i>\$2</i>", $string);
    $string = preg_replace("#(\\\$)(.*?(^\\\$)?)(\\\$)#sim", "<u>\$2</u>", $string);
    $string = preg_replace("#( |&nbsp;|<p>)([A-zА-я0-9<&;>/]*)(\\^W)#suim", "\$1<s>\$2</s>", $string);
    $string = preg_replace("@(##)(.*?([^##])?)(##)@sim", "<sub>\$2</sub>", $string);
    $string = preg_replace("@(#)(.*?(^#)?)(#)@sim", "<sup>\$2</sup>", $string);
    $string = str_replace('imgh://', 'http://', $string);
    $string = str_replace('imghs://', 'https://', $string);
    $string = preg_replace("#(\\* |\\+ |- ){2,}+#", "\$1", $string);
    $re = '#(\\* |\\+ |- )(.*?[^((\\r\\n){2,}|</p>)]?)((\\r\\n){2,}|</p>)#sim';
    $vt = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        $string = preg_replace($re, "<ul><li>&nbsp;\$2</ul>", $string, 1);
        $with_breaks = preg_replace('/(\\r\\n)(\\* |\\+ |- )/', '<li>&nbsp;', $match[2][$i]);
        $string = str_replace($match[2][$i], $with_breaks, $string);
    }
    $string = preg_replace("#([0-9]\\. ){2,}+#", "\$1", $string);
    $re = '#([0-9]\\. )(.*?[^((\\r\\n){2,}|</p>)]?)((\\r\\n){2,}|</p>)#sim';
    $vt = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        $string = preg_replace($re, "<ol><li>&nbsp;\$2</ol>", $string, 1);
        $with_breaks = preg_replace('/(\\r\\n)([0-9]\\. )/', '<li>&nbsp;', $match[2][$i]);
        $string = str_replace($match[2][$i], $with_breaks, $string);
    }
    $string = preg_replace("#(>>|&gt;&gt;)(.*?(^>>|&gt;&gt;)?)(>>|&gt;&gt;)#sim", "<p align=\"right\">\$2</p>", $string);
    $string = preg_replace("#(<<|&lt;&lt;)(.*?(^<<|&lt;&lt;)?)(<<|&lt;&lt;)#sim", "<p align=\"left\">\$2</p>", $string);
    $string = preg_replace("#(<>|&lt;&gt;)(.*?(^<>|&lt;&gt;)?)(<>|&lt;&gt;)#sim", "<p align=\"center\">\$2</p>", $string);
    $quote = array();
    $re = '#(`)([^`].*?[^`]?)(`)#sim';
    $vt = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        $string = preg_replace($re, "<div class=\"quote\"><pre>\$2</pre></div>", $string, 1);
        $with_breaks = preg_replace('/^(\\r\\n)+/', '', $match[2][$i]);
        $with_breaks = preg_replace('/(\\r\\n)+$/', '', $with_breaks);
        //$with_breaks = preg_replace('/\n/', '<li>&nbsp;', $with_breaks);
        $quote[$i] = $with_breaks;
        $string = str_replace($match[2][$i], '⓬⓬' . $i . '⓬⓬', $string);
    }
    $user_re = "#(\\^)(.*?[^\\^]?)(\\^)#sim";
    $arr = preg_match_all($user_re, $string, $match);
    for ($i = 0; $i < $arr; $i++) {
        $where_arr = array(array("key" => 'nick', "value" => $match[2][$i], "oper" => '='));
        $sel = base::select('users', '', '*', $where_arr, 'AND');
        if (!empty($sel)) {
            $string = preg_replace($user_re, "<b><a href=\"/profile.php?user=\$2\">\$2</a></b>", $string, 1);
        } else {
            $string = preg_replace($user_re, "\$2", $string, 1);
        }
    }
    $url_re = '#(~)((@)(.*?[^@]?)(@))?(.*?[^~]?)(~)#sim';
    $vt = preg_match_all($url_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        if (filter_var($match[6][$i], FILTER_VALIDATE_URL)) {
            if (empty($match[4][$i])) {
                $string = preg_replace($url_re, "<a href=\"\$6\">\$6</a>", $string, 1);
            } else {
                $string = preg_replace($url_re, "<a href=\"\$6\">\$4</a>", $string, 1);
            }
        }
    }
    $img_re = '#(~~)((@)(left|right|middle|top|bottom)(@))?(.*?[^~]{2}?)(~~)#sim';
    $vt = preg_match_all($img_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        if (!empty($match[3][$i])) {
            $string = preg_replace($img_re, "<img src=\"\$6\" align=\"\$4\" style=\"max-width: 1024px\" alt=\"[путь к изображению некорректен]\" />", $string, 1);
        } else {
            $string = preg_replace($img_re, "<img src=\"\$6\" style=\"max-width: 1024px\" alt=\"[путь к изображению некорректен]\" />", $string, 1);
//.........这里部分代码省略.........
开发者ID:vladimir-g,项目名称:rulinux-engine,代码行数:101,代码来源:wakaba-mark.php

示例2: str_to_html

function str_to_html($string)
{
    $code = array();
    $lang = array();
    $re = '#(<code)([ ]?lang=["]?(abap|actionscript|actionscript3|ada|apache|applescript|apt_sources|asm|asp|autoit|avisynth|bash|basic4gl|bf|bibtex|blitzbasic|bnf|boo|c|c_mac|caddcl|cadlisp|cfdg|cfm|cil|cmake|cobol|cpp|cpp-qt|csharp|css|d|dcs|delphi|diff|div|dos|dot|eiffel|e-mail|erlang|fo|fortran|freebasic|genero|gettext|glsl|gml|gnuplot|groovy|haskell|hq9plus|html4strict|idl|ini|inno|intercal|io|java|java5|javascript|kixtart|klonec|latex|lisp|locobasic|lolcode|lotusformulas|lotusscript|lscript|lsl2|lua|m68k|make|matlab|mirc|modula3|mpasm|mxml|mysql|nsis|oberon2|objc|ocaml|ocaml-brief|oobas|oracle11|oracle8|pascal|per|perl|php|php-brief|pic16|pixelbender|plsql|povray|powershell|progress|prolog|providex||python|qbasic|rails|rebol|reg|robots|ruby|sas|scala|scheme|scilab|sdlbasic|smalltalk|smarty|sql|tcl|teraterm|text|thinbasic|tsql|typoscript|vb|vbnet|verilog|vhdl|vim|visualfoxpro|visualprolog|whitespace|whois|winbatch|xml|xorg_conf|xpp|z80)["]?)?(>)((?!</code>).*?)(</code>)#suim';
    $vh = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $lang[$i] = $match[3][$i];
        $with_breaks = mark::highlight(html_entity_decode($match[5][$i], ENT_QUOTES), $match[3][$i], "librarys/geshi/geshi");
        $code[$i] = $with_breaks;
        $string = str_replace($match[0][$i], '⓬' . $i . '⓬', $string);
    }
    $latex = array();
    $latex_re = '#(<latex>)(.*?)(</latex>)#suim';
    $vh = preg_match_all($latex_re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $with_breaks = mark::make_latex($match[2][$i]);
        $latex[$i] = $with_breaks;
        $string = str_replace($match[0][$i], '☣' . $i . '☣', $string);
    }
    $math = array();
    $re = '#(<m>)(.*?)(</m>)#suim';
    $vh = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $with_breaks = mark::make_formula($match[2][$i]);
        $math[$i] = $with_breaks;
        $string = str_replace($match[0][$i], 'ᴥ' . $i . 'ᴥ', $string);
    }
    $string = htmlspecialchars($string);
    $string = str_replace('\\', '&#92;', $string);
    $string = preg_replace("#(&lt;b&gt;)(.*?[^&lt;/b&gt;]?)(&lt;/b&gt;)#suim", "<b>\$2</b>", $string);
    $string = preg_replace("#(&lt;span class=&quot;spoiler&quot;&gt;)((?!&lt;/span&gt).*?)(&lt;/span&gt;)#suim", "<span class=\"spoiler\">\$2</span>", $string);
    $string = preg_replace("#(&lt;i&gt;)(.*?[^&lt;/i&gt;]?)(&lt;/i&gt;)#suim", "<i>\$2</i>", $string);
    $string = preg_replace("#(&lt;u&gt;)(.*?[^&lt;/u&gt;]?)(&lt;/u&gt;)#suim", "<u>\$2</u>", $string);
    $string = preg_replace("#(&lt;s&gt;)(.*?[^&lt;/s&gt;]?)(&lt;/s&gt;)#suim", "<s>\$2</s>", $string);
    $string = preg_replace("#(&lt;sub&gt;)(.*?[^&lt;/sub&gt;]?)(&lt;/sub&gt;)#suim", "<sub>\$2</sub>", $string);
    $string = preg_replace("#(&lt;sup&gt;)(.*?[^&lt;/sup&gt;]?)(&lt;/sup&gt;)#suim", "<sup>\$2</sup>", $string);
    $string = str_replace('imgh://', 'http://', $string);
    $string = str_replace('imghs://', 'https://', $string);
    $string = preg_replace("#(&lt;) ?(br) ?/?(&gt;)#suim", "<br>", $string);
    $qoute_re = "#(&lt;q&gt;)(.*?(?!&lt;q))(&lt;/q&gt;)#suim";
    $vt = preg_match_all($qoute_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        $string = preg_replace($qoute_re, "<div class=\"quote\"><pre>\$2</pre></div>", $string, 1);
        $with_breaks = preg_replace('/^(\\r\\n)+/', '', $match[2][$i]);
        $with_breaks = preg_replace('/(\\r\\n)+$/', '', $with_breaks);
        $string = str_replace($match[2][$i], $with_breaks, $string);
    }
    $list_re = "#(&lt;ul&gt;)(.*?(?!ul&gt;))(&lt;/ul&gt;)#suim";
    $vt = preg_match_all($list_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        $string = preg_replace($list_re, "<ul>\$2</ul>", $string, 1);
        $with_breaks = preg_replace('/^(\\r\\n)+/', '', $match[2][$i]);
        $with_breaks = preg_replace('/(\\r\\n)+$/', '', $with_breaks);
        $with_breaks = preg_replace('#&lt;li&gt;#suim', '<li>&nbsp;', $with_breaks);
        $string = str_replace($match[2][$i], $with_breaks, $string);
    }
    $num_re = "#(&lt;ol&gt;)(.*?(?!ol&gt;))(&lt;/ol&gt;)#suim";
    $vt = preg_match_all($num_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        $string = preg_replace($num_re, "<ol start=\"1\">\$2</ol>", $string, 1);
        $with_breaks = preg_replace('/^(\\r\\n)+/', '', $match[2][$i]);
        $with_breaks = preg_replace('/(\\r\\n)+$/', '', $with_breaks);
        $with_breaks = preg_replace('#&lt;li&gt;#suim', '<li>&nbsp;', $with_breaks);
        $string = str_replace($match[2][$i], $with_breaks, $string);
    }
    $string = preg_replace('#(&lt;p align=&quot;)(left|right|center)(&quot;&gt;)(.*?(^/p&gt;)?)(&lt;/p&gt;)#suim', "<p align=\"\$2\">\$4</p>", $string);
    $img_re = '#(&lt;img) ?(align=&quot;)?(left|right|middle|top|bottom)?(&quot;)?(src=&quot;)((?!&quot;).*?)(&quot;&gt;)#suim';
    $vt = preg_match_all($img_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        if (!empty($match[3][$i])) {
            $string = preg_replace($img_re, "<img src=\"\$6\" align=\"\$3\" style=\"max-width: 1024px\" alt=\"[путь к изображению некорректен]\" />", $string, 1);
        } else {
            $string = preg_replace($img_re, "<img src=\"\$6\" style=\"max-width: 1024px\" alt=\"[путь к изображению некорректен]\" />", $string, 1);
        }
    }
    $user_re = "#(&lt;span class=&quot;user&quot;&gt;)((?!&lt;/span&gt;).*?)(&lt;/span&gt;)#suim";
    $arr = preg_match_all($user_re, $string, $match);
    for ($i = 0; $i < $arr; $i++) {
        $where_arr = array(array("key" => 'nick', "value" => $match[2][$i], "oper" => '='));
        $sel = base::select('users', '', '*', $where_arr, 'AND');
        if (!empty($sel)) {
            $string = preg_replace($user_re, "<b><a href=\"/profile.php?user=\$2\">\$2</a></b>", $string, 1);
        } else {
            $string = preg_replace($user_re, "\$2", $string, 1);
        }
    }
    $url_re = '#(&lt;a href=&quot;)((?!&quot;).*?)(&quot;&gt;)((?!&lt;/a&gt;).*?)(&lt;/a&gt;)#suim';
    $vt = preg_match_all($url_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        if (filter_var($match[2][$i], FILTER_VALIDATE_URL)) {
            $string = preg_replace($url_re, "<a href=\"\$2\">\$4</a>", $string);
        }
    }
    $string = '<p>' . $string . '</p>';
    $re = "#(⓬)([0-9]+)(⓬)#suim";
    $vt = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        $string = str_replace('⓬' . $match[2][$i] . '⓬', '<fieldset><legend>' . $lang[$match[2][$i]] . '</legend>' . $code[$match[2][$i]] . '</fieldset>', $string);
    }
//.........这里部分代码省略.........
开发者ID:vladimir-g,项目名称:rulinux-engine,代码行数:101,代码来源:base-html.php

示例3: str_to_html

function str_to_html($string)
{
    $code = array();
    $lang = array();
    $code_re = "#(\\[code)=?(abap|actionscript|actionscript3|ada|apache|applescript|apt_sources|asm|asp|autoit|avisynth|bash|basic4gl|bf|bibtex|blitzbasic|bnf|boo|c|c_mac|caddcl|cadlisp|cfdg|cfm|cil|cmake|cobol|cpp|cpp-qt|csharp|css|d|dcs|delphi|diff|div|dos|dot|eiffel|e-mail|erlang|fo|fortran|freebasic|genero|gettext|glsl|gml|gnuplot|groovy|haskell|hq9plus|html4strict|idl|ini|inno|intercal|io|java|java5|javascript|kixtart|klonec|latex|lisp|locobasic|lolcode|lotusformulas|lotusscript|lscript|lsl2|lua|m68k|make|matlab|mirc|modula3|mpasm|mxml|mysql|nsis|oberon2|objc|ocaml|ocaml-brief|oobas|oracle11|oracle8|pascal|per|perl|php|php-brief|pic16|pixelbender|plsql|povray|powershell|progress|prolog|providex||python|qbasic|rails|rebol|reg|robots|ruby|sas|scala|scheme|scilab|sdlbasic|smalltalk|smarty|sql|tcl|teraterm|text|thinbasic|tsql|typoscript|vb|vbnet|verilog|vhdl|vim|visualfoxpro|visualprolog|whitespace|whois|winbatch|xml|xorg_conf|xpp|z80)?(\\])(.*?[^\\[/code\\]]?)(\\[/code\\])#sim";
    $arr = preg_match_all($code_re, $string, $match);
    for ($i = 0; $i < $arr; $i++) {
        $lang[$i] = $match[3][$i];
        $with_breaks = mark::highlight(html_entity_decode($match[4][$i], ENT_QUOTES), $match[2][$i], "librarys/geshi/geshi");
        $code[$i] = $with_breaks;
        $string = str_replace($match[0][$i], '⓬' . $i . '⓬', $string);
    }
    $latex = array();
    $latex_re = '#(\\[latex\\])(.*?)(\\[/latex\\])#suim';
    $vh = preg_match_all($latex_re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $with_breaks = mark::make_latex($match[2][$i]);
        $latex[$i] = $with_breaks;
        $string = str_replace($match[0][$i], '☣' . $i . '☣', $string);
    }
    $math = array();
    $re = '#(\\[math\\])(.*?)(\\[/math\\])#suim';
    $vh = preg_match_all($re, $string, $match);
    for ($i = 0; $i < $vh; $i++) {
        $with_breaks = mark::make_formula($match[2][$i]);
        $math[$i] = $with_breaks;
        $string = str_replace($match[0][$i], 'ᴥ' . $i . 'ᴥ', $string);
    }
    $string = htmlspecialchars($string);
    $string = str_replace('\\', '&#92;', $string);
    $string = preg_replace("#(\\[b\\])(.*?[^\\[/b\\]]?)(\\[/b\\])#sim", "<b>\$2</b>", $string);
    $string = preg_replace("#(\\[spoiler\\])(.*?[^\\[/spoiler\\]]?)(\\[/spoiler\\])#sim", "<span class=\"spoiler\">\$2</span>", $string);
    $string = preg_replace("#(\\[i\\])(.*?[^\\[/i\\]]?)(\\[/i\\])#sim", "<i>\$2</i>", $string);
    $string = preg_replace("#(\\[u\\])(.*?[^\\[/u\\]]?)(\\[/u\\])#sim", "<u>\$2</u>", $string);
    $string = preg_replace("#(\\[s\\])(.*?[^\\[/s\\]]?)(\\[/s\\])#sim", "<s>\$2</s>", $string);
    $string = preg_replace("#(\\[sub\\])(.*?[^\\[/sub\\]]?)(\\[/sub\\])#sim", "<sub>\$2</sub>", $string);
    $string = preg_replace("#(\\[sup\\])(.*?[^\\[/sup\\]]?)(\\[/sup\\])#sim", "<sup>\$2</sup>", $string);
    $string = str_replace('imgh://', 'http://', $string);
    $string = str_replace('imghs://', 'https://', $string);
    $tags = array('list' => '<ul>', 'num' => '<ol>', 'quote' => '<div class="quote"><pre>');
    foreach ($tags as $tag => $val) {
        if ($tag == 'list') {
            $re = '#(\\[list\\])(.*?[^\\[/list\\]]?)(\\[/list\\])#sim';
            $vt = preg_match_all($re, $string, $match);
            for ($i = 0; $i < $vt; $i++) {
                $string = preg_replace($re, "{$val}\$2</ul>", $string, 1);
                $with_breaks = str_replace('[*]', '<li>&nbsp;', $match[2][$i]);
                $string = str_replace($match[2][$i], $with_breaks, $string);
            }
        }
        if ($tag == 'num') {
            $re = '#(\\[num\\])(.*?[^\\[/num\\]]?)(\\[/num\\])#sim';
            $vt = preg_match_all($re, $string, $match);
            for ($i = 0; $i < $vt; $i++) {
                $string = preg_replace($re, "{$val}\$2</ol>", $string, 1);
                $with_breaks = str_replace('[*]', '<li>&nbsp;', $match[2][$i]);
                $string = str_replace($match[2][$i], $with_breaks, $string);
            }
        }
        if ($tag == 'quote') {
            $re = '#(\\[quote\\])(.*?[^\\[/quote\\]]?)(\\[/quote\\])#sim';
            $vt = preg_match_all($re, $string, $match);
            for ($i = 0; $i < $vt; $i++) {
                $string = preg_replace($re, "{$val}\$2</pre></div>", $string, 1);
                $with_breaks = $match[2][$i];
                $string = str_replace($match[2][$i], $with_breaks, $string);
            }
        }
    }
    $string = preg_replace('#(\\[p align=)(left|right|center)(\\])(.*?[^\\[/p\\]]?)(\\[/p\\])#sim', "<p align=\"\$2\">\$4</p>", $string);
    $img_re = '#(\\[img) ?(align=)?(left|right|middle|top|bottom)?(\\])(.*?[^\\[/img\\]]?)(\\[/img\\])#sim';
    $vt = preg_match_all($img_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        if (!empty($match[3][$i])) {
            $string = preg_replace($img_re, "<img src=\"\$5\" align=\"\$3\" style=\"max-width: 1024px\" alt=\"[путь к изображению некорректен]\" />", $string, 1);
        } else {
            $string = preg_replace($img_re, "<img src=\"\$5\" style=\"max-width: 1024px\" alt=\"[путь к изображению некорректен]\" />", $string, 1);
        }
    }
    $user_re = "#(\\[user\\])(.*?[^\\[/user\\]]?)(\\[/user\\])#sim";
    $arr = preg_match_all($user_re, $string, $match);
    for ($i = 0; $i < $arr; $i++) {
        $where_arr = array(array("key" => 'nick', "value" => $match[2][$i], "oper" => '='));
        $sel = base::select('users', '', '*', $where_arr, 'AND');
        if (!empty($sel)) {
            $string = preg_replace($user_re, "<b><a href=\"/profile.php?user=\$2\">\$2</a></b>", $string, 1);
        } else {
            $string = preg_replace($user_re, "\$2", $string, 1);
        }
    }
    $url_re = '#(\\[url\\])(.*?[^\\[/url\\]]?)(\\[/url\\])#sim';
    $vt = preg_match_all($url_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
        if (filter_var($match[2][$i], FILTER_VALIDATE_URL)) {
            $string = preg_replace($url_re, "<a href=\"\$2\">\$2</a>", $string);
        }
    }
    $url_par_re = '#(\\[url=)(.*?[^\\]]?)(\\])(.*?[^\\[/url\\]]?)(\\[/url\\])#sim';
    $vt = preg_match_all($url_par_re, $string, $match);
    for ($i = 0; $i < $vt; $i++) {
//.........这里部分代码省略.........
开发者ID:vladimir-g,项目名称:rulinux-engine,代码行数:101,代码来源:bbcode.php


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