", $output); $output = $smile; } // Insert images $output = preg_replace("/http:\/\/(.*\.jpg|\.gif|\.png|\.jpeg)/s", "IMAGE$1EGAMI", $output); // Replace URLs with tags $output = preg_replace("/http:\/\/(.*?)([\n ])/s", "$1$2", $output); // Finish inserting images $output = preg_replace("/IMAGE(.*?)EGAMI/s", "\"$1\"", $output); // Replace [quote title=...]...[/quote] $urls = ""; while(($start = strpos($output, "[quote"))) { $pre = substr($output, 0, $start); $url = substr($output, $start); $end = strpos($url, "[/quote]") + strlen("[/quote]"); $url = substr($url, 0, $end - strlen("[/quote]")); $post = substr($output, $start + $end + strlen("[/quote]") ); $header = substr($url, 0, strpos($url, "]") + 1); $body = substr($url, strpos($url, "]") + 1); $header = str_replace(array("title"), "", $header); $header = str_replace(array("="), "
", $header); $header = str_replace(array("[quote"), "
", $header); $header = str_replace(array("]"), "
", $header); $urls .= $pre . $header . $body . "
"; $output = $post; } $urls .= $output; $output = $urls; // // Hack to make quotes two levels deep. // // Replace [quote title=...]...[/quote] $urls = ""; while(($start = strpos($output, "[quote"))) { $pre = substr($output, 0, $start); $url = substr($output, $start); $end = strpos($url, "[/quote]") + strlen("[/quote]"); $url = substr($url, 0, $end - strlen("[/quote]")); $post = substr($output, $start + $end + strlen("[/quote]") ); $header = substr($url, 0, strpos($url, "]") + 1); $body = substr($url, strpos($url, "]") + 1); $header = str_replace(array("title"), "", $header); $header = str_replace(array("="), "
", $header); $header = str_replace(array("[quote"), "
", $header); $header = str_replace(array("]"), "
", $header); $urls .= $pre . $header . $body . "
"; $output = $post; } $urls .= $output; $output = $urls; $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is' ); $replace = array( '$1', '$1', '$1', '', '$1', '$2' ); $output = preg_replace ($search, $replace, $output); /* // $b = array("[b]", "[B]"); $b = str_replace($b, "", $output); $output = $b; $b = array("[/b]", "[/B]"); $b = str_replace($b, "", $output); $output = $b; // $i = array("[i]", "[I]"); $i = str_replace($i, "", $output); $output = $i; $i = array("[/i]", "[/i]"); $i = str_replace($i, "", $output); $output = $i; */ // Replace newlines with
tags $nls = array("\n"); $nls = str_replace($nls, "
\n", $output); $output = $nls; return $output; } ?>