// 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", "
\\1
", $str); // Kolor tekstu $str = preg_replace("#\[color=(http://)?(.*?)\](.*?)\[/color\]#si", "\\3", $str); // Wielkość czcionki $str = preg_replace("#\[size=(http://)?(.*?)\](.*?)\[/size\]#si", "\\3", $str); // Obrazek $str = preg_replace("#\[img\](.*?)\[/img\]#si", "\"Obrazek\"", $str); // Obrazek z katalogu img $str = preg_replace("#\[ftp_img\](.*?)\[/ftp_img\]#si", "\"Obrazek\"", $str); // Pozioma linia $str = preg_replace("#\[hr=(\d{1,2}|100)\]#si", "
", $str); // Spacja $str=str_replace('[spacja]',' ',$str); // Znaki specjalne // znaki specjalne $str = str_replace('±', '±', $str); $str = str_replace('™', '™', $str); $str = str_replace('•', '•', $str); $str = str_replace('°', '°', $str); $str = str_replace('©', '©', $str); $str = str_replace('®', '®', $str); $str = str_replace('…', '…', $str); // błędne kodowanie m.in. z phpmyadmina $str = str_replace('ą', 'ą', $str); $str = str_replace('ć', 'ć', $str); $str = str_replace('ę', 'ę', $str); $str = str_replace('ł', 'ł', $str); $str = str_replace('ś', 'ś', $str); $str = str_replace('ź', 'Ľ', $str); $str = str_replace('ż', 'ż', $str); // znaki specjalne z m$ word $str = str_replace('±', 'ą', $str); $str = str_replace('’', '\'', $str); $str = str_replace('„', '"', $str); $str = str_replace('”', '"', $str); $str = str_replace('“', '"', $str); $str = str_replace('–', '-', $str); $str = str_replace('…', '…', $str); // Wykonaj html $str=preg_replace_callback("#\[html\](.*?)\[/html\]#si", "bbcode_htmlCode", $str); // Kod $str = preg_replace("#\[code\](.*?)\