function oembedembedly_oembedprovider_alter in oEmbed 6.0
Implement hook_oembedprovider_alter().
This is to workaround embed.ly's nonstandard oembed descriptions.
@todo Support wildcards in TLDs.
File
- ./
oembedembedly.module, line 96 - Embed.ly support for oEmbed.module
Code
function oembedembedly_oembedprovider_alter(&$providers) {
// oEmbed standard dictates that wildcards can only be used for subdomains in
// URL schemes. embed.ly breaks this rule, which causes unmatchable domains.
foreach ($providers as $host => $patterns) {
// When the first character is * such as *youtube.com.
if (strpos($host, '*') === 0) {
$new_host = drupal_substr($host, 1);
if (!empty($providers[$new_host])) {
$providers[$new_host] = array_merge($providers[$new_host], $patterns);
}
else {
$providers[$new_host] = $patterns;
}
unset($providers[$host]);
}
}
}