Created
July 14, 2010 13:53
-
-
Save dtinth/475437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// find links to convert | |
if (strstr($msg, 'http://')) | |
{ | |
$links = array(); | |
foreach (explode(' ', $msg) as $w) | |
if (substr($w, 0, 7) == 'http://' && $smcFunc['strlen']($w) > 7) | |
$links[] = '<a href="' . $w . '" target="_blank">' . ($smcFunc['strlen']($w) > $shoutbox['maxLinkLenght'] ? substr($w, 0, $shoutbox['maxLinkLenght'] - 8) . '...' . substr($w, -8) : $w) . '</a>'; | |
else | |
$links[] = $w; | |
$msg = implode(' ', $links); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// find links to convert | |
if (strstr($msg, 'http://')) | |
{ | |
$links = array(); | |
foreach (explode(' ', $msg) as $w) { | |
$lhtml = ($func['strlen']($w) > $shoutbox['maxLinkLenght'] ? substr($w, 0, $shoutbox['maxLinkLenght'] - 8) . '...' . substr($w, -8) : $w); | |
$ext = strtolower(substr($w, -4)); | |
if ($ext == '.jpg' || $ext == '.png' || $ext == '.gif') | |
$lhtml = '<span><i>Loading Image...</i></span><img style="display:none" onload="if(this.height>400)this.height=300;else if(this.width>400)this.width=400;this.style.display="inline";this.previousSibling.style.display="none";document.getElementById("shoutbox_banned").scrollTop+=this.offsetHeight" src="' . $w . '" alt="Image"/>'; | |
if (substr($w, 0, 7) == 'http://' && $func['strlen']($w) > 7) | |
$links[] = '<a href="' . $w . '" target="_blank">' . $lhtml . '</a>'; | |
else | |
$links[] = $w; | |
} | |
$msg = implode(' ', $links); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment