optional word wrapping
This commit is contained in:
		
							parent
							
								
									d46dca7fab
								
							
						
					
					
						commit
						c6f940664f
					
				@ -2,7 +2,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class BBCode extends FormatterExtension {
 | 
					class BBCode extends FormatterExtension {
 | 
				
			||||||
	public function format($text) {
 | 
						public function format($text) {
 | 
				
			||||||
 | 
							global $config;
 | 
				
			||||||
 | 
							if($config->get_bool("word_wrap", true)) {
 | 
				
			||||||
			$text = wordwrap($text, 80, " ", true);
 | 
								$text = wordwrap($text, 80, " ", true);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		$text = preg_replace_callback("/(\[img\]https?:\/\/.*?\[\/img\])/s", array($this, "unwrap"), $text);
 | 
							$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):\/\/.*?\])/s", array($this, "unwrap"), $text);
 | 
				
			||||||
		$text = preg_replace_callback("/(\[url\](?:https?|ftp|irc|mailto):\/\/.*?\[\/url\])/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) {
 | 
						public function strip($text) {
 | 
				
			||||||
 | 
							global $config;
 | 
				
			||||||
 | 
							if($config->get_bool("word_wrap", true)) {
 | 
				
			||||||
			$text = wordwrap($text, 80, " ", true);
 | 
								$text = wordwrap($text, 80, " ", true);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		$text = preg_replace("/\[b\](.*?)\[\/b\]/s", "\\1", $text);
 | 
							$text = preg_replace("/\[b\](.*?)\[\/b\]/s", "\\1", $text);
 | 
				
			||||||
		$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text);
 | 
							$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text);
 | 
				
			||||||
		$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text);
 | 
							$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text);
 | 
				
			||||||
 | 
				
			|||||||
@ -164,6 +164,7 @@ class Setup extends SimpleExtension {
 | 
				
			|||||||
		$config->set_default_string("base_href", "./index.php?q=");
 | 
							$config->set_default_string("base_href", "./index.php?q=");
 | 
				
			||||||
		$config->set_default_string("theme", "default");
 | 
							$config->set_default_string("theme", "default");
 | 
				
			||||||
		$config->set_default_bool("use_autodate", true);
 | 
							$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("use_autodate", "F j, Y");
 | 
				
			||||||
		$config->set_default_string("cookie_prefix", "shm");
 | 
							$config->set_default_string("cookie_prefix", "shm");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user