$max) {
$size = $max;
}
if($size<$min) {
$size = $min;
}
$text = "".$text."";
return $text;
}
function removenlaftertag($text) {
$text = str_replace("]
","]",$text);
$text = str_replace("]
","]",$text);
$text = str_replace("[
","[",$text);
$text = str_replace("[
","[",$text);
$text = str_replace("]\n","]",$text);
$text = str_replace("]\r","]",$text);
$text = str_replace("]\n\r","]",$text);
$text = str_replace("[\n","[",$text);
$text = str_replace("[\r","[",$text);
$text = str_replace("[\n\r","[",$text);
$text = str_replace(" [","[",$text);
$text = preg_replace('/\s\s+/', ' ', $text);
return $text;
}
function code($text) {
$pid = rand(00,99);
$pid = "cp".$pid;
$width = 200;
$height = 100;
$text = preg_replace("/\[code\](.*?)\[\/code\]/i","",$text);
$text = preg_replace("/\[html\](.*?)\[\/html\]/i","",$text);
$text = preg_replace("/\[php\](.*?)\[\/php\]/i","",$text);
$text = preg_replace("/\[js\](.*?)\[\/js\]/i","",$text);
return $text;
}
function style() {
$text = $this->text;
$text = strip_tags($text,""); // Allow few tags
$text = nl2br($text);
$text = $this->removenlaftertag($text);
$text = stripslashes($text);
// Process BBCode
$text = preg_replace("/\[b\](.*?)\[\/b\]/i","$1",$text);
$text = preg_replace("/\[i\](.*?)\[\/i\]/i","$1",$text);
$text = preg_replace("/\[u\](.*?)\[\/u\]/i","$1",$text);
$text = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/i","$2",$text);
$text = preg_replace("/\[url\](.*?)\[\/url\]/i","$1",$text);
$text = preg_replace("/\[img=(.*?)\](.*?)\[\/img\]/i","
",$text);
$text = preg_replace("/\[img\](.*?)\[\/img\]/i","
",$text);
$text = preg_replace("/\[size=(.*?)\](.*?)\[\/size\]/e","BBCode::sizetext('$2','$1')",$text);
$text = preg_replace("/\[color=(.*?)\](.*?)\[\/color\]/i","$2",$text);
$text = $this->code($text);
return $text;
}
}
?>