/* ------------------------------------------------------------- /formatters/page/wakka.php */
//[Line 378]
$text = preg_replace_callback(
"/(\%\%.*?\%\%|".
"[\\\\]\\[.*?[\\\\]\\]|".
"[\\\\]\\(.*?[\\\\]\\)|".
"\"\".*?\"\"|".
"^\[\|.*?\|\]|". //EF => tableaux
"\[\[.*?\]\]|".
"\b[a-z]+:\/\/\S+\#blank\#|".
"\b[a-z]+:\/\/\S+|".
"\*\*|\#\#|@@|££|__|<|>|\/\/|".
"======|=====|====|===|==|".
"-{4,}|---|".
"\n(\t+|([ ]{1})+)(-|[0-9,a-z,A-Z]+\))?|".
"^(\t+|([ ]{1})+)(-|[0-9,a-z,A-Z]+\))?|".
"----|---|\#R\#|\#V\#|\#B\#|~~|\#C\#|:::|".
"\{\{.*?\}\}|".
"\b[A-Z][A-Z,a-z]+[:]([A-Z,a-z,0-9]*)\b|".
"\b([A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*)\b|".
"\n)/ms", "wakka2callback", $text);
// [Line 245]
// forced links width blank target
// \S : any character that is not a whitespace character
// \s : any whitespace character
else if (preg_match("/^\[\[(\S*)\s+\#blank\#\s+(.+)?\]\]$/", $thing, $matches))
{
list (, $url, $text) = $matches;
if ($url)
{
if ($url!=($url=(preg_replace("/@@|££|\[\[/","",$url))))$result="";
if (!isset($text)) $text = $url;
$text=preg_replace("/@@|££|\[\[/","",$text);
return $result.$wiki->LinkToBlank($url, "", $text);
}
else
{
return "";
}
}
// [Line 134]
// urls with blank target
else if (preg_match("/^([a-z]+:\/\/\S+?)\#blank\#$/", $thing, $matches)) {
$url = $matches[1];
if (!isset($matches[2])) $matches[2] = '';
return "$url".$matches[2];
}
/* ------------------------------------------------------------- /wakka.php */
// [Line 343]
function LinkToBlank($tag, $method = "", $text = "", $track = 1) {
$tag=htmlspecialchars($tag); //avoid xss
$text=htmlspecialchars($text); //paranoiac again
if (!$text) $text = $tag;
// is this an interwiki link?
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $tag, $matches))
{
$tag = $this->GetInterWikiUrl($matches[1], $matches[2]);
return "$text (interwiki)";
}
// is this a full link? ie, does it contain non alpha-numeric characters?
// Note : [:alnum:] is equivalent [0-9A-Za-z]
// [^[:alnum:]] means : some caracters other than [0-9A-Za-z]
// For example : "www.adress.com", "mailto:adress@domain.com", "http://www.adress.com"
else if (preg_match("/[^[:alnum:]]/", $tag))
{
// check for email addresses
if (preg_match("/^.+\@.+$/", $tag))
{
$tag = "mailto:".$tag;
}
// check for protocol-less URLs
else if (!preg_match("/:\/\//", $tag))
{
$tag = "http://".$tag; //Very important for xss (avoid javascript:() hacking)
}
// is this an inline image (text!=tag and url ends png,gif,jpeg)
if ($text!=$tag and preg_match("/.(gif|jpeg|png|jpg)$/i",$tag))
{
return "
";
}
else
{
return "$text";
}
}
else
{
// it's a Wiki link!
if (isset($_SESSION["linktracking"]) && $track) $this->TrackLinkTo($tag);
return ($this->LoadPage($tag) ? "href($method, $tag)."\">".$text."" : "".$text."href("edit", $tag)."\">?");
}
}