function _get_facebook_locale in Facebook social plugins integration 6.2
Same name and namespace in other branches
- 6 fb_social.admin.inc \_get_facebook_locale()
- 7.2 fb_social.admin.inc \_get_facebook_locale()
1 call to _get_facebook_locale()
- fb_social_admin_settings_form in ./
fb_social.admin.inc - @file fb_social_ctools_export_ui.inc
File
- ./
fb_social.admin.inc, line 117 - fb_social_ctools_export_ui.inc
Code
function _get_facebook_locale() {
$fb_locale = array();
$cache = cache_get('fb_social');
if (empty($cache->data)) {
$result = drupal_http_request("https://www.facebook.com/translations/FacebookLocales.xml");
$xml = simplexml_load_string($result->data);
foreach ($xml->locale as $line) {
$representation = (array) $line->codes->code->standard->representation;
$name = (array) $line->englishName;
$key = $representation[0];
$value = $name[0];
$fb_locale[$key] = $value;
}
cache_set('fb_social', serialize($fb_locale), 'cache');
}
else {
$fb_locale = unserialize($cache->data);
}
return $fb_locale;
}