Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Nuorodos trumpinimas

Parašė bruzgis· 2008 Vas. 3 01:02:33
#9

$text = preg_replace('#(^|[\r\n ]|^\])((http|https|ftp|ftps)://[\w\#$%&~/.\-;:=,?@\[\]+]*)(|[\r\n ]|^\[)#sie', "'\\1<a href=\"\\2\" target=\"_blank\" title=\"autolink\">'.trimlink('\\2', 20).(strlen('\\2')>30?substr('\\2', strlen('\\2')-10, strlen('\\2')):'').'</a> '", $text);
$text = preg_replace('#(^|[\r\n ]|^\])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)(|[\r\n ]|^\[)#sie', "'\\1<a href=\"http://\\2\" target=\"_blank\" title=\"autolink\">'.trimlink('\\2', 20).(strlen('\\2')>30?substr('\\2', strlen('\\2')-10, strlen('\\2')):'').'</a> '", $text);


cia i maincore kisk :)