From fa77d999eb0a3e58c4bd62d6a85e44aaf83de415 Mon Sep 17 00:00:00 2001 From: Josh Sutinen Date: Sat, 3 Mar 2012 12:39:24 -0500 Subject: [PATCH 1/2] Wordwrapping BEFORE applying bbcode breaks long links Wordwrapping AFTER breaks the HTML generated by bbcode when using PHP's wordwrap(), better not to hard wordwrap at all and just do it with CSS --- ext/bbcode/main.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php index f4157bab..0be2a5ef 100644 --- a/ext/bbcode/main.php +++ b/ext/bbcode/main.php @@ -25,10 +25,6 @@ class BBCode extends FormatterExtension { public function format(/*string*/ $text) { - global $config; - if($config->get_bool("word_wrap", true)) { - $text = wordwrap($text, 80, " ", true); - } $text = preg_replace_callback("/(\[img\]https?:\/\/.*?\[\/img\])/s", array($this, "unwrap"), $text); $text = preg_replace_callback("/(\[url=(?:https?|ftp|irc|mailto):\/\/.*?\])/s", array($this, "unwrap"), $text); $text = preg_replace_callback("/(\[url\](?:https?|ftp|irc|mailto):\/\/.*?\[\/url\])/s", array($this, "unwrap"), $text); @@ -75,10 +71,6 @@ class BBCode extends FormatterExtension { } public function strip(/*string*/ $text) { - global $config; - if($config->get_bool("word_wrap", true)) { - $text = wordwrap($text, 80, " ", true); - } $text = preg_replace("/\[b\](.*?)\[\/b\]/s", "\\1", $text); $text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text); $text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text); From 4f37b48070027b3c929a69e586055dedea30ff90 Mon Sep 17 00:00:00 2001 From: Josh Sutinen Date: Sat, 3 Mar 2012 12:43:04 -0500 Subject: [PATCH 2/2] Apply word-wrap: break-word; to all body contents to force reallylongunbreakablestrings to be broken per the theme's dimensions rather than the arbitrary 80 characters set by the bbcode extension --- themes/default/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/default/style.css b/themes/default/style.css index 4a0bc0ce..8051b13d 100644 --- a/themes/default/style.css +++ b/themes/default/style.css @@ -144,6 +144,7 @@ UL { margin-right: 16px; text-align: center; height: 1%; + word-wrap: break-word; } #body TABLE { width: 90%;