function oembedembedly_providers in oEmbed 7.0
Same name and namespace in other branches
- 8 modules/oembedembedly/oembedembedly.module \oembedembedly_providers()
- 7 modules/oembedembedly/oembedembedly.module \oembedembedly_providers()
Calls and caches embed.ly services api.
5 calls to oembedembedly_providers()
- oembedembedly_admin in oembedembedly/
oembedembedly.admin.inc - Admin form to configure embedly provider.
- oembedembedly_default_selected in oembedembedly/
oembedembedly.module - Helper function to populate defaults for all providers.
- oembedembedly_embedly_provider_scheme in oembedembedly/
plugins/ providers/ embedly.inc - oembedembedly_provider_callback in oembedembedly/
plugins/ providers/ embedly.inc - oembedembedly_provider_get_child in oembedembedly/
plugins/ providers/ embedly.inc
2 string references to 'oembedembedly_providers'
- oembedembedly_admin in oembedembedly/
oembedembedly.admin.inc - Admin form to configure embedly provider.
- oembedembedly_default_selected in oembedembedly/
oembedembedly.module - Helper function to populate defaults for all providers.
File
- oembedembedly/
oembedembedly.module, line 30 - Embed.ly support for oEmbed.module
Code
function oembedembedly_providers() {
$cache = cache_get('oembedly');
if ($cache && isset($cache->data)) {
$providers = $cache->data;
}
else {
$response = drupal_http_request('http://api.embed.ly/1/services');
if ($response->code == 200) {
$json = json_decode($response->data);
$providers = array();
foreach ($json as $provider) {
$providers[$provider->name] = $provider;
}
}
else {
$providers = FALSE;
}
cache_set('oembedly', $providers, 'cache', REQUEST_TIME + 3600 * ($providers ? 24 : 6));
if (variable_get('oembedembedly_default', TRUE)) {
oembed_providers_reset();
}
}
return $providers;
}