Created
May 22, 2014 13:53
-
-
Save GesJeremie/2081f2178a4ee9531556 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function valid_youtube($string) | |
{ | |
return TRUE; | |
} | |
function valid_stream($link, $providers) | |
{ | |
// If you set a simple string | |
$providers = (array) $providers; | |
// Loop all providers | |
foreach ($providers as $provider) | |
{ | |
if (function_exists('valid_' . $provider)) | |
{ | |
$callback = 'valid_' . $provider; | |
if ($callback($link)) | |
{ | |
return TRUE; | |
} | |
} | |
} | |
return FALSE; | |
} | |
var_dump(valid_stream('http://www.youtube.com/', array('dailymotion', 'youtube'))); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment