", $output); $output = $smile; } // Find a unique symbols for image start and end markers $imgstartsymbol = "A"; $imgstartmarker = $imgstartsymbol; while(strpos($output, $imgstartmarker)) $imgstartmarker .= $imgstartsymbol; $imgendsymbol = "B"; $imgendmarker = $imgendsymbol; while(strpos($output, $imgendmarker)) $imgendmarker .= $imgendsymbol; // Find and mark image URLs (so that they don't get converted into normal links) $output = preg_replace("/http:\/\/(.*?\.jpg|.*?\.gif|.*?\.png|.*?\.jpeg)/", $imgstartmarker."$1".$imgendmarker, $output); // Replace URLs with tags $output = preg_replace("/http:\/\/(.*?)([\n ]|$)/s", "$1$2", $output); // Convert marked images to img tags and links $output = preg_replace("/".$imgstartmarker."(.*?)".$imgendmarker."/s", "", $output); // Replace URLs with tags $output = preg_replace("/\{\{([0-9]*?)\}\}/s", "", $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("="), "