// bbcode Function bbcode($str){ // usun zbedne $str=htmlspecialchars(trim($str)); // Odnośnik, otwieranie w nowym oknie $str = preg_replace("#\[url\](.*?)?(.*?)\[/url\]#si", "\\1\\2", $str); // Odnośnik, otwieranie w nowym oknie, definiowanie treści odnośnika $str = preg_replace("#\[url=(.*?)?(.*?)\](.*?)\[/url\]#si", "\\3", $str); // Odnośnik, otwieranie w tym samym oknie $str = preg_replace("#\[url2\](.*?)?(.*?)\[/url2\]#si", "\\1\\2", $str); // Odnośnik, otwieranie w tym samym oknie, definiowanie treści odnośnika $str = preg_replace("#\[url2=(.*?)?(.*?)\](.*?)\[/url2\]#si", "\\3", $str); // Automatyczne tworzenie linków $str = preg_replace_callback("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#si", "bbcode_autolink", $str); $str = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", " www.\\2.\\3\\4", $str); $str = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1\\2_(at)_\\3", $str); // Kolorowanie składni $str=preg_replace_callback("#\[php\](.*?)\[/php\]#si", "bbcode_phpCode", $str); // Ukrywanie treści $str = preg_replace_callback("#\[ukryj=\"?(.*?)\"?\](.*?)\[/ukryj]#si", 'ukryj', $str); // Pogrubiony tekst $str = preg_replace("#\[b\](.*?)\[/b\]#si", "\\1", $str); // Pochylony tekst $str = preg_replace("#\[i\](.*?)\[/i\]#si", "\\1", $str); // Podkreślony tekst $str = preg_replace("#\[u\](.*?)\[/u\]#si", "\\1", $str); // Pomniejszanie tekstu $str = preg_replace("#\[sm\](.*?)\[/sm\]#si", "\\1", $str); // Powiększanie tekstu $str = preg_replace("#\[big\](.*?)\[/big\]#si", "\\1", $str); // Akapit $str = preg_replace("/\[p\](.*?)\[\/p\]/si", "
\\1
", $str); // Akapit z wyrównaniem $str = preg_replace("#\[p=(http://)?(.*?)\](.*?)\[/p\]#si", "\\3
", $str); // Wyśrodkowanie tekstu $str = preg_replace("/\[center\](.*?)\[\/center\]/si", "