diff --git a/parsers/BBCodeParser.php b/parsers/BBCodeParser.php index 69cb5643f..b5e930d83 100644 --- a/parsers/BBCodeParser.php +++ b/parsers/BBCodeParser.php @@ -9,14 +9,19 @@ $options = $config['HTML_BBCodeParser']; //Debug::show($options); unset($options); -/** - * TODO Investigate whether SSViewer will be fast enough to handle hundreds of little template files. - * - * A better (more SS) way of doing the HTML code in here is to place them all in small template files - * (eg. BBCodeParser_Code.ss contains the HTML for BBCodeParser::parseCode()), but the overhead this - * would cause is likely to make this very unusable, as nice as it would be. - */ + class BBCodeParser extends TextParser { + + protected static $autolinkUrls = true; + + static function autolinkUrls() { + return (self::$autolinkUrls != null) ? true : false; + } + + static function disable_autolink_urls($autolink = false) { + BBCodeParser::$autolinkUrls = $autolink; + } + static function usable_tags() { return new DataObjectSet( new ArrayData(array( @@ -94,16 +99,14 @@ class BBCodeParser extends TextParser { return $useabletags.""; } - function parse() { $this->content = str_replace(array('&', '<', '>'), array('&', '<', '>'), $this->content); $this->content = HTML_BBCodeParser::staticQparse($this->content); $this->content = "

".$this->content."

"; $this->content = str_replace("\n\n", "

", $this->content); - $this->content = str_replace("\n", "
", $this->content); + $this->content = str_replace("\n", "
", $this->content); return $this->content; } - } ?> \ No newline at end of file diff --git a/parsers/HTML/BBCodeParser/Filter/Links.php b/parsers/HTML/BBCodeParser/Filter/Links.php index ced113b6b..0afd4a138 100644 --- a/parsers/HTML/BBCodeParser/Filter/Links.php +++ b/parsers/HTML/BBCodeParser/Filter/Links.php @@ -118,6 +118,11 @@ class HTML_BBCodeParser_Filter_Links extends HTML_BBCodeParser_Filter if ($matches[1] == $o.'url'.$c) { return $matches[0]; } + + if(!BBCodeParser::autolinkUrls()){ + return $matches[0]; + } + $punctuation = '.,;:'; // Links can't end with these chars $trailing = '';