+ $text = preg_replace_callback("/\[img\=([$URLSearchString]*)\](.*?)\[\/img\]/ism",
+ function ($matches) {
+ $matches[1] = proxy_url($matches[1]);
+ $matches[2] = htmlspecialchars($matches[2], ENT_COMPAT);
+ return '<img src="' . $matches[1] . '" alt="' . $matches[2] . '">';
+ },
+ $text);
+