Copy this code and paste it in your HTML
<?php
class x {
public function query($query){
return new Query($query);
}
}
class Query {
public function Query($query, $sql){
$this->query = $query;
$this->sql = $sql;
}
public function attr(){
for($i=1;
$i<$num;
++$i) $this->query = str_replace("%".$i, $get[$i-1], $this->query);
return $this;
}
public function cut($num){
if(strlen($this->query) > $num){ $this->query = substr($this->query, 0, $num)."...";
}
return $this;
}
public function finish(){ return $this->query; }
public function mail($pattern='/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/'){ return preg_match($pattern, $this->query)?
true:false;
}
public function hash(){
$this->query = sha1($this->query);
return $this;
}
$this->query = md5($this->query);
return $this;
}
public function protect(){
}
return $this;
}
public function bb($type=false){
$str = $this->query;
$str = preg_replace("#\[b\](.*?)\[/b\]#si", '<b>\\1</b>', $str);
$str = preg_replace("#\[i\](.*?)\[/i\]#si", '<i>\\1</i>', $str);
$str = preg_replace("#\[u\](.*?)\[/u\]#si", '<u>\\1</u>', $str);
$str = preg_replace("#\[s\](.*?)\[/s\]#si", '<span class="s">\\1</span>', $str);
$str = preg_replace("#\[img\](.*?)\[/img\]#si", '<img src="\\1" alt="" />', $str);
$str = preg_replace("#\[img=(.*?)\](.*?)\[/img\]#si", '<img src="\\1" alt="\\2" />', $str);
$str = preg_replace("#\[url\](http.*?)\[/url\]#si", "<a href=\"\\1\">\\1</a>", $str);
$str = preg_replace("#\[url=(http.*?)\](.*?)\[/url\]#si", "<a href=\"\\1\">\\2</a>", $str);
$str = preg_replace("#\[url\](.*?)\[/url\]#si", "<a href=\"http://\\1\">\\1</a>", $str);
$str = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si", "<a href=\"http://\\1\">\\2</a>", $str);
$str = preg_replace("#\[quote\](.*?)\[/quote\]#si",'<blockquote class="cytat">\\1</blockquote>',$str);
$str = preg_replace("#\[quote=(.*?)\](.*?)\[/quote\]#si",'<p><cite>\\1</cite> napisa�(a):</p><blockquote>\\2</blockquote>',$str);
$str = preg_replace("#\[code\](.*?)\[/code\]#si",'<pre>\\1</pre>',$str);
$str = preg_replace("#\[hr=([0-9]{1,2}|100)\]#si", '<hr class="linia" width="\\1%">', $str);
$this->query = $str;
return $type?$this:$str;
}
}
?>