optional word wrapping

This commit is contained in:
Shish 2009-10-18 00:27:12 +01:00
parent dd65b63be9
commit 6ec72e7ac2
2 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,10 @@
class BBCode extends FormatterExtension {
public function format($text) {
$text = wordwrap($text, 80, " ", true);
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);
@ -46,7 +49,10 @@ class BBCode extends FormatterExtension {
}
public function strip($text) {
$text = wordwrap($text, 80, " ", true);
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);

View File

@ -164,6 +164,7 @@ class Setup extends SimpleExtension {
$config->set_default_string("base_href", "./index.php?q=");
$config->set_default_string("theme", "default");
$config->set_default_bool("use_autodate", true);
$config->set_default_bool("word_wrap", true);
$config->set_default_string("use_autodate", "F j, Y");
$config->set_default_string("cookie_prefix", "shm");
}