Autor Zpráva
Vader
Profil
Mám tento script:
<?php
		function MatchLink($url){
			 $url = Str_Replace("\\r","\r",$url);
			 $url = Str_Replace("\\n","\n<br>",$url);
			 $url = Str_Replace("\\n\\r","\n\r",$url);

			 $in = Array('`((?:https?|ftp)://\S+[[:alnum:]]/?)`si',
				     '`((?<!//)(www\.\S+[[:alnum:]]/?))`si'
			       );
			 $out = Array("<a href=\"$1\" rel=\"nofollow\">$1</a>",
				      "<a href=\"http://$1\" rel=\"nofollow\">$1</a>"
			        );
			 return Preg_Replace($in, $out, $url);
		}

function chat($c) {

$a = Array(":/", ":)");
$b = Array("img1", "img2");

echo MatchLink(str_replace($a, $b, $c));
}
chat("Tento script si mýli link s emotikonami :/, príklad linku: http://adresa.sk");
?>


Script vypíše: Tento script si mýli link s emotikonami img1, príklad linku: httpimg1/adresa.sk
Ale malo by: Tento script si mýli link s emotikonami img1, príklad linku: <a href="http://adresa.sk" ref="nofollow">http://adresa.sk</a>
SeparateSK
Profil *
Skus napriklad:
$a = Array(" :/", " :)");
$b = Array("img1", "img2");

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0