Skip to content

Instantly share code, notes, and snippets.

@GesJeremie
Created May 22, 2014 13:53
Show Gist options
  • Save GesJeremie/2081f2178a4ee9531556 to your computer and use it in GitHub Desktop.
Save GesJeremie/2081f2178a4ee9531556 to your computer and use it in GitHub Desktop.
<?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