src/sb/Text/Bling.php
public static function textStyles($str)
    {

        ##bold
        $str = preg_replace("~\[b\](.*?)\[/b\]~is", '<strong class="tb_b">$1</strong>', $str);

        ##sup
        $str = preg_replace("~\[sup\](.*?)\[/sup\]~is", '<sup class="tb_sup">$1</sup>', $str);

        ##sub
        $str = preg_replace("~\[sub\](.*?)\[/sub\]~is", '<sub class="tb_sub">$1</sub>', $str);

        ##italic
        $str = preg_replace("~\[i\](.*?)\[/i\]~is", '<em class="tb_i">$1</em>', $str);

        ##underline
        $str = preg_replace("~\[u\](.*?)\[/u\]~is", '<u class="tb_u">$1</u>', $str);

        ##cite
        $str = preg_replace("~\[cite\](.*?)\[/cite\]~is", '<cite class="tb_cite">$1</cite>', $str);

        ##hilite
        $str = preg_replace("~\[h(?:ilite)?\](.*?)\[/h(?:ilite)?\]~is", '<span class="tb_hilite">$1</span>', $str);

        ##line-though
        $str = preg_replace("~\[strike](.*?)\[/strike]~is", '<del class="tb_strike">$1</del>', $str);

        ## add small caps
        $str = preg_replace("~\[caps](.*?)\[/caps]~is", '<span class="tb_caps">$1</span>', $str);

        ## add center
        $str = preg_replace("~\[center](.*?)\[/center]~is", '<center class="tb_center">$1</center>', $str);

        ## add code tag
        ## add small caps
        $str = preg_replace("~\[code](.*?)\[/code]~is", '<pre style="background-color:black;color:green;overflow:auto;">$1</pre>', $str);

        ## font size
        $r = "~\[size=([\d(?:\.\d+)]+(?:em|px)?)\](.*?)\[\/size\]~is";
        while(preg_match($r, $str)){
            $str = preg_replace($r, '<span style="font-size:\\1;">\\2</span>', $str);
        }

        ## font size
        $r = "~\[size=(small|medium|large)\](.*?)\[\/size\]~is";
        while(preg_match($r, $str)){
            $str = preg_replace($r, '<span style="font-size:\\1;">\\2</span>', $str);
        }

        ## font color
        $r = "~\[color=(.*?)\](.*?)\[\/color\]~is";
        while(preg_match($r, $str)){
            $str = preg_replace($r, '<span style="color:\\1;">\\2</span>', $str);
        }

        return $str;
    }
public static function textStyles($str)
    {

        ##bold
        $str = preg_replace("~\[b\](.*?)\[/b\]~is", '<strong class="tb_b">$1</strong>', $str);

        ##sup
        $str = preg_replace("~\[sup\](.*?)\[/sup\]~is", '<sup class="tb_sup">$1</sup>', $str);

        ##sub
        $str = preg_replace("~\[sub\](.*?)\[/sub\]~is", '<sub class="tb_sub">$1</sub>', $str);

        ##italic
        $str = preg_replace("~\[i\](.*?)\[/i\]~is", '<em class="tb_i">$1</em>', $str);

        ##underline
        $str = preg_replace("~\[u\](.*?)\[/u\]~is", '<u class="tb_u">$1</u>', $str);

        ##cite
        $str = preg_replace("~\[cite\](.*?)\[/cite\]~is", '<cite class="tb_cite">$1</cite>', $str);

        ##hilite
        $str = preg_replace("~\[h(?:ilite)?\](.*?)\[/h(?:ilite)?\]~is", '<span class="tb_hilite">$1</span>', $str);

        ##line-though
        $str = preg_replace("~\[strike](.*?)\[/strike]~is", '<del class="tb_strike">$1</del>', $str);

        ## add small caps
        $str = preg_replace("~\[caps](.*?)\[/caps]~is", '<span class="tb_caps">$1</span>', $str);

        ## add center
        $str = preg_replace("~\[center](.*?)\[/center]~is", '<center class="tb_center">$1</center>', $str);

        ## add code tag
        ## add small caps
        $str = preg_replace("~\[code](.*?)\[/code]~is", '<pre style="background-color:black;color:green;overflow:auto;">$1</pre>', $str);

        ## font size
        $r = "~\[size=([\d(?:\.\d+)]+(?:em|px)?)\](.*?)\[\/size\]~is";
        while(preg_match($r, $str)){
            $str = preg_replace($r, '<span style="font-size:\\1;">\\2</span>', $str);
        }

        ## font size
        $r = "~\[size=(small|medium|large)\](.*?)\[\/size\]~is";
        while(preg_match($r, $str)){
            $str = preg_replace($r, '<span style="font-size:\\1;">\\2</span>', $str);
        }

        ## font color
        $r = "~\[color=(.*?)\](.*?)\[\/color\]~is";
        while(preg_match($r, $str)){
            $str = preg_replace($r, '<span style="color:\\1;">\\2</span>', $str);
        }

        return $str;
    }
public static function textStyles ( $ str ) { ##bold $ str = preg_replace ( "~\[b\](.*?)\[/b\]~is" , '<strong class="tb_b">$1</strong>' , $ str ) ; ##sup $ str = preg_replace ( "~\[sup\](.*?)\[/sup\]~is" , '<sup class="tb_sup">$1</sup>' , $ str ) ; ##sub $ str = preg_replace ( "~\[sub\](.*?)\[/sub\]~is" , '<sub class="tb_sub">$1</sub>' , $ str ) ; ##italic $ str = preg_replace ( "~\[i\](.*?)\[/i\]~is" , '<em class="tb_i">$1</em>' , $ str ) ; ##underline $ str = preg_replace ( "~\[u\](.*?)\[/u\]~is" , '<u class="tb_u">$1</u>' , $ str ) ; ##cite $ str = preg_replace ( "~\[cite\](.*?)\[/cite\]~is" , '<cite class="tb_cite">$1</cite>' , $ str ) ; ##hilite $ str = preg_replace ( "~\[h(?:ilite)?\](.*?)\[/h(?:ilite)?\]~is" , '<span class="tb_hilite">$1</span>' , $ str ) ; ##line-though $ str = preg_replace ( "~\[strike](.*?)\[/strike]~is" , '<del class="tb_strike">$1</del>' , $ str ) ; ## add small caps $ str = preg_replace ( "~\[caps](.*?)\[/caps]~is" , '<span class="tb_caps">$1</span>' , $ str ) ; ## add center $ str = preg_replace ( "~\[center](.*?)\[/center]~is" , '<center class="tb_center">$1</center>' , $ str ) ; ## add code tag ## add small caps $ str = preg_replace ( "~\[code](.*?)\[/code]~is" , '<pre style="background-color:black;color:green;overflow:auto;">$1</pre>' , $ str ) ; ## font size $ r = "~\[size=([\d(?:\.\d+)]+(?:em|px)?)\](.*?)\[\/size\]~is" ; while ( preg_match ( $ r , $ str ) ) { $ str = preg_replace ( $ r , '<span style="font-size:\\1;">\\2</span>' , $ str ) ; } ## font size $ r = "~\[size=(small|medium|large)\](.*?)\[\/size\]~is" ; while ( preg_match ( $ r , $ str ) ) { $ str = preg_replace ( $ r , '<span style="font-size:\\1;">\\2</span>' , $ str ) ; } ## font color $ r = "~\[color=(.*?)\](.*?)\[\/color\]~is" ; while ( preg_match ( $ r , $ str ) ) { $ str = preg_replace ( $ r , '<span style="color:\\1;">\\2</span>' , $ str ) ; } return $ str ; }
Converts text style tags

@param string $str
@return string $str;
Converts text style tags