Autor | Zpráva | ||
---|---|---|---|
Vader Profil |
#1 · Zasláno: 30. 10. 2011, 13:52:11
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 * |
#2 · Zasláno: 30. 10. 2011, 19:19:13
Skus napriklad:
$a = Array(" :/", " :)"); $b = Array("img1", "img2"); |
||
Časová prodleva: 12 let
|
0