#i", "\n", str_replace( "\r\n", "", $txt )); return $txt; } function textParse($txt) { global $bin; // Strip the slashes $txt = stripslashes($txt); // Destroy any HTML $txt = htmlentities($txt); // Convert newlines into
$txt = nl2br( $txt ); // [b], [i], [u], [s] $txt = preg_replace("#\[b\](.+?)\[/b\]#is", "$1", $txt); $txt = preg_replace("#\[i\](.+?)\[/i\]#is", "$1", $txt); $txt = preg_replace("#\[u\](.+?)\[/u\]#is", "$1", $txt); $txt = preg_replace("#\[s\](.+?)\[/s\]#is", "$1", $txt); // (tm), (c), (r), (deg), (cent), (pound), (yen) $txt = preg_replace("#\(tm\)#is", "™", $txt); $txt = preg_replace("#\(c\)#is", "©", $txt); $txt = preg_replace("#\(r\)#is", "®", $txt); $txt = preg_replace("#\(deg\)#is", "°", $txt); $txt = preg_replace("#\(cent\)#is", "¢", $txt); $txt = preg_replace("#\(pound\)#is", "£", $txt); $txt = preg_replace("#\(yen\)#is", "¥", $txt); // [color], [size] $txt = preg_replace("#\[color=(.+?)\](.+?)\[/color\]#is", "$2", $txt); $txt = preg_replace("#\[size=(.+?)\](.+?)\[/size\]#is", "$2", $txt); // [url] $txt = preg_replace("#\[url=(.+?)\](.+?)\[/url\]#is", "$2", $txt); $txt = preg_replace("#\[url\](.+?)\[/url\]#is", "$1", $txt); // [email] $txt = preg_replace("#\[email=(.+?)\](.+?)\[/email\]#is", "$2", $txt); $txt = preg_replace("#\[email\](.+?)\[/email\]#is", "$1", $txt); // Add the slashes $txt = addslashes($txt); return $txt; } function textUnParse($txt) { global $bin; // Strip the slashes $txt = stripslashes($txt); // Convert newlines into
$txt = $this->br2nl($txt); // [b], [i], [u], [s] $txt = preg_replace("#(.+?)#is", "\[b\]$1\[/b\]", $txt); $txt = preg_replace("#(.+?)#is", "\[i\]$1\[/i\]", $txt); $txt = preg_replace("#(.+?)#is", "\[u\]$1\[/u\]", $txt); $txt = preg_replace("#(.+?)#is", "\[s\]$1\[/s\]", $txt); // (tm), (c), (r), (deg), (cent), (pound), (yen) $txt = preg_replace("#&\#8482;#is", "\(tm\)", $txt); $txt = preg_replace("#©#is", "\(c\)", $txt); $txt = preg_replace("#®#is", "\(r\)", $txt); $txt = preg_replace("#°#is", "\(deg\)", $txt); $txt = preg_replace("#¢#is", "\(cent\)", $txt); $txt = preg_replace("#£#is", "\(pound\)", $txt); $txt = preg_replace("#¥#is", "\(yen\)", $txt); // [color], [size] $txt = preg_replace("#(.+?)#is", "\[color=$1\]$2\[/color\]", $txt); $txt = preg_replace("#(.+?)#is", "\[size=$1\]$2\[/size\]", $txt); // [url] $txt = preg_replace("#(.+?)#is", "\[url=$1\]$2\[/url\]", $txt); // [email] $txt = preg_replace("#(.+?)#is", "\[email=$1\]$2\[/email\]", $txt); return $txt; } } ?>