Filter/Bbcode.php
public function filter($text)
    {
        //removing /r because it's bad!
        $text = str_replace("\r", '', $text);
        //transform all  double spaces in ' &nbsp;' to respect multiples spaces
        $text = str_replace('  ', ' &nbsp;', $text);

        // first [nobbcode][/nobbcode] -> don't interpret bbcode
        $this->_parseBbcodeNobbcode($text);

        // parse strange bbcode, before other bbcode
        $this->_parseBbcodeCode($text);
        $this->_parseBbcodeQuote($text);

        $this->_parseBbcodeList($text);

        // easy bbcode replacement

        // [i]txt[/i]
        $this->_parseSimpleBbcode('i', '<em>$1</em>', $text);
        // [u]txt[/u]
        $this->_parseSimpleBbcode('u', '<u>$1</u>', $text);
        // [b]txt[/b]
        $this->_parseSimpleBbcode('b', '<strong>$1</strong>', $text);
        // [del]txt[/del] & [strike]txt[/strike]
        $this->_parseSimpleBbcode('del', '<del>$1</del>', $text);
        $this->_parseSimpleBbcode('strike', '<del>$1</del>', $text);

        // [color=color]txt[/color]
        $this->_parseParamBbcode('color', '([a-zA-Z]*|\#?[0-9a-fA-F]{6})', '<span style="color: $1">$2</span>', $text);
        // [bgcolor=color]txt[/bgcolor]
        $this->_parseParamBbcode('bgcolor', '([a-zA-Z]*|\#?[0-9a-fA-F]{6})', '<span style="background-color: $1">$2</span>', $text);
        // [align=(center|left|right)][/align]
        $this->_parseParamBbcode('align', '(center|left|right|justify){1}', '<div style="text-alignement: $1">$2</div>', $text);
        // [size=$size][/size]
        $this->_parseParamBbcode('size', '([0-9].*)', '<span style="font-size: $1">$2</span>', $text);

        $this->_parseBbcodeEmail($text);
        $this->_parseBbcodeUrl($text);
        $this->_parseBbcodeImg($text);
        $this->_parseBbcodeSpoiler($text);
        $this->_parseScriptTags($text);

        $this->_parseSmiley($text);

        //[br]
        $this->_parseBbcodeBr($text);

        return $text;
    }
public function filter($text)
    {
        //removing /r because it's bad!
        $text = str_replace("\r", '', $text);
        //transform all  double spaces in ' &nbsp;' to respect multiples spaces
        $text = str_replace('  ', ' &nbsp;', $text);

        // first [nobbcode][/nobbcode] -> don't interpret bbcode
        $this->_parseBbcodeNobbcode($text);

        // parse strange bbcode, before other bbcode
        $this->_parseBbcodeCode($text);
        $this->_parseBbcodeQuote($text);

        $this->_parseBbcodeList($text);

        // easy bbcode replacement

        // [i]txt[/i]
        $this->_parseSimpleBbcode('i', '<em>$1</em>', $text);
        // [u]txt[/u]
        $this->_parseSimpleBbcode('u', '<u>$1</u>', $text);
        // [b]txt[/b]
        $this->_parseSimpleBbcode('b', '<strong>$1</strong>', $text);
        // [del]txt[/del] & [strike]txt[/strike]
        $this->_parseSimpleBbcode('del', '<del>$1</del>', $text);
        $this->_parseSimpleBbcode('strike', '<del>$1</del>', $text);

        // [color=color]txt[/color]
        $this->_parseParamBbcode('color', '([a-zA-Z]*|\#?[0-9a-fA-F]{6})', '<span style="color: $1">$2</span>', $text);
        // [bgcolor=color]txt[/bgcolor]
        $this->_parseParamBbcode('bgcolor', '([a-zA-Z]*|\#?[0-9a-fA-F]{6})', '<span style="background-color: $1">$2</span>', $text);
        // [align=(center|left|right)][/align]
        $this->_parseParamBbcode('align', '(center|left|right|justify){1}', '<div style="text-alignement: $1">$2</div>', $text);
        // [size=$size][/size]
        $this->_parseParamBbcode('size', '([0-9].*)', '<span style="font-size: $1">$2</span>', $text);

        $this->_parseBbcodeEmail($text);
        $this->_parseBbcodeUrl($text);
        $this->_parseBbcodeImg($text);
        $this->_parseBbcodeSpoiler($text);
        $this->_parseScriptTags($text);

        $this->_parseSmiley($text);

        //[br]
        $this->_parseBbcodeBr($text);

        return $text;
    }
Defined by Zend_Filter_Interface

Returns the string $text, when bbcode are replace by html code

@param  string $text
@return string