Pogledajte određenu poruku
Staro 23. 07. 2012.   #5
webarto
expert
Grand Master
 
Avatar webarto
 
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
webarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished road
Default

@ivanhoe, mislio sam da postavi taj jedan spam post, da ne ubadamo...

http://ideone.com/aPqux

PHP kôd:
<?php

$input 
"http://www.youtube.com/watch?v=itvJybdcYbI text [url=http://static.youtube.com/watch?v=itvJybdcYbI]What's up?[/url] text youtube.com/watch?v=itvJybdcYbI text www.youtube.com/watch?v=itvJybdcYbI";

echo 
can_haz_linkz($input)? 'Y''N';

$input "text [url=http://static.youtube.com/watch?v=itvJybdcYbI]What's up?[/url] text";

echo 
can_haz_linkz($input)? 'Y''N';

function 
can_haz_linkz($input)
{
    return 
preg_match(
        
"#([\w-]+:\/\/?|(www|([\w]+))[.])[^\s()<>\[\]]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/))#is"
        (
preg_replace("#\[url=(.*?)/url\]#is"''$input))
    );
}
__________________
Github // LinkedIn // PHP // ZCE // Stackoverflow PHP // Site5 Web Hosting
webarto je offline   Odgovorite uz citat