// $Id$ //getClass('link'); global $pref, $parm; /** * e107 BBCodes * * @package e107 * @subpackage bbcode * @version $Id$; * * @todo try and avoid URLs with a language in [..] */ /** [link=$parm $extras]$code_text[/link] Correct Usage: [link=http://mysite.com external]My text[/link] [link=http://mysite.com rel=external]My text[/link] [link=external]http://mysite.com[/link] [link]http://mysite.com[/link] [link=mailto:myemail@email.com]My name[/link] Historic usage: [link=external=http://mysite.com]My text[/link] */ $tp = e107::getParser(); $parm = $tp->filter(trim($parm)); /* Fix for people using link=external= */ if(strpos($parm,"external=") !== FALSE) { list($extras,$parm) = explode("=",$parm,2); $parm = $parm." ".$extras; } if(strpos($parm, 'mailto') === 0) { list($pre,$email) = explode(":",$parm); list($p1,$p2) = explode("@",$email); $p2=rawurlencode($p2); // Primarily to pick up spaces, which are not allowed return "".$code_text.""; } if (substr($code_text,0,1) === ']') { // Special fix for E107 urls including a language (not nice, really) $code_text = substr($code_text,1); $parm .= ']'; } list($link,$extras) = array_pad(explode(" ",$parm), 2, null); if(!$parm) $link = $code_text; if($link == "external" && empty($extras)) { $link = $code_text; $extras = "rel=external"; } $extras = (string) $extras; if($extras == "external" || strpos($extras,"rel=external")!==FALSE) { $insert = "rel='external' "; } else { $insert = ($pref['links_new_window'] && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#" && substr($link,0,1) != "/" && strpos($extras,"rel=internal")===FALSE) ? "rel='external' " : ""; } if (strtolower(substr($link,0,11)) == 'javascript:') return ''; return "".$code_text."";