Filter/Bbcode.php
protected function _parseBbcodeImg(&$text)
    {
        $nbMatches = preg_match('#\[img\](.*?)\[/img\]#si', $text, $matches);
        if ($nbMatches != 0) {
            $urlImage = $matches[1];
            if (preg_match('#(.*\.php.*)|(.*\.(x?)(ht)?m.*)|(.*\.js.*)#si', $urlImage, $array)) {
                $text = preg_replace_callback(
                    '#\[img\](.*?)\[/img\]#si',
                    function ($matches) {
                        return '<span>' . htmlspecialchars($matches[1]) . '</span>';
                    },
                    $text
                );
            } else {
                $text = preg_replace_callback(
                    '#\[img\](.*?)\[/img\]#si',
                    function ($matches) {
                        return '<img src="' . $matches[1] . '" alt="' . htmlspecialchars($matches[1]) . '" />"';
                    },
                    $text
                );
            }
        }
    }
protected function _parseBbcodeImg(&$text)
    {
        $nbMatches = preg_match('#\[img\](.*?)\[/img\]#si', $text, $matches);
        if ($nbMatches != 0) {
            $urlImage = $matches[1];
            if (preg_match('#(.*\.php.*)|(.*\.(x?)(ht)?m.*)|(.*\.js.*)#si', $urlImage, $array)) {
                $text = preg_replace_callback(
                    '#\[img\](.*?)\[/img\]#si',
                    function ($matches) {
                        return '<span>' . htmlspecialchars($matches[1]) . '</span>';
                    },
                    $text
                );
            } else {
                $text = preg_replace_callback(
                    '#\[img\](.*?)\[/img\]#si',
                    function ($matches) {
                        return '<img src="' . $matches[1] . '" alt="' . htmlspecialchars($matches[1]) . '" />"';
                    },
                    $text
                );
            }
        }
    }
[img]http://www.site.tld/image.png[/img]