1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| if ($_SERVER["PHP_SELF"] != '/forums.php' )
{
// <a href="http://www.example.com" target="_blank">Text</a>
$s = preg_replace(
"/\[url=((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
"<a href=redirect.php?url=\\1>\\3</a>", $s);
// <a href="http://www.example.com" target="_blank">http://www.example.com</a>
$s = preg_replace(
"/\[url\]((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\[\/url\]/i",
"<a href=redirect.php?url=\\1>\\1</a>", $s);
}else{
// <a href="http://www.example.com" target="_blank">Text</a>
$s = preg_replace(
"/\[url=((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
"<a href=\\1>\\3</a>", $s);
// <a href="http://www.example.com" target="_blank">http://www.example.com</a>
$s = preg_replace(
"/\[url\]((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\[\/url\]/i",
"<a href=\\1>\\1</a>", $s);
} |
Partager