1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628: 629: 630: 631: 632: 633: 634: 635: 636: 637: 638: 639: 640: 641: 642: 643: 644: 645: 646: 647: 648: 649: 650: 651: 652: 653: 654: 655: 656: 657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672: 673: 674: 675: 676: 677: 678: 679: 680: 681: 682: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738:
<?php
if(!defined('SITE_LOCALE')) {
if(function_exists('getOptionFromDB')) {
define('SITE_LOCALE', getOptionFromDB('locale'));
} else {
define('SITE_LOCALE', 'en_US');
}
}
function getLanguageArray() {
return array(
'af' => gettext('Afrikaans'),
'sq_AL' => gettext('Albanian'),
'ar_AE' => gettext('Arabic (United Arab Emirates)'),
'ar_BH' => gettext('Arabic (Bahrain)'),
'ar_DZ' => gettext('Arabic (Algeria)'),
'ar_EG' => gettext('Arabic (Egypt)'),
'ar_IN' => gettext('Arabic (Iran)'),
'ar_IQ' => gettext('Arabic (Iraq)'),
'ar_JO' => gettext('Arabic (Jordan)'),
'ar_KW' => gettext('Arabic (Kuwait)'),
'ar_LB' => gettext('Arabic (Lebanon)'),
'ar_LY' => gettext('Arabic (Libya)'),
'ar_MA' => gettext('Arabic (Morocco)'),
'ar_OM' => gettext('Arabic (Oman)'),
'ar_QA' => gettext('Arabic (Qatar)'),
'ar_SA' => gettext('Arabic (Saudi Arabia)'),
'ar_SD' => gettext('Arabic (Sudan)'),
'ar_SY' => gettext('Arabic (Syria)'),
'ar_TN' => gettext('Arabic (Tunisia)'),
'ar_YE' => gettext('Arabic (Yemen)'),
'eu_ES' => gettext('Basque (Basque)'),
'be_BY' => gettext('Belarusian'),
'bn_BD' => gettext('Bengali'),
'bg_BG' => gettext('Bulgarian'),
'ca_ES' => gettext('Catalan'),
'zh_Hans_CN' => gettext('Chinese (People’s Republic of China)'),
'zh_Hans_HK' => gettext('Chinese (Hong Kong)'),
'zh_Hant_TW' => gettext('Chinese (Taiwan)'),
'hr_HR' => gettext('Croatian'),
'cs_CZ' => gettext('Czech'),
'km_KH' => gettext('Cambodian'),
'da_DK' => gettext('Danish'),
'nl_BE' => gettext('Dutch (Belgium)'),
'nl_NL' => gettext('Dutch (The Netherlands)'),
'en_AU' => gettext('English (Australia)'),
'en_CA' => gettext('English (Canada)'),
'en_GB' => gettext('English (United Kingdom)'),
'en_IN' => gettext('English (India)'),
'en_NZ' => gettext('English (New Zealand)'),
'en_PH' => gettext('English (Philippines)'),
'en_US' => gettext('English (United States)'),
'en_ZA' => gettext('English (South Africa)'),
'en_ZW' => gettext('English (Zimbabwe)'),
'eo' => gettext('Esperanto'),
'et_EE' => gettext('Estonian'),
'fi_FI' => gettext('Finnish'),
'fo_FO' => gettext('Faroese'),
'fr_BE' => gettext('French (Belgium)'),
'fr_CA' => gettext('French (Canada)'),
'fr_CH' => gettext('French (Switzerland)'),
'fr_FR' => gettext('French (France)'),
'fr_LU' => gettext('French (Luxembourg)'),
'gl_ES' => gettext('Galician'),
'gu_IN' => gettext('Gujarati'),
'el' => gettext('Greek'),
'de_AT' => gettext('German (Austria)'),
'de_BE' => gettext('German (Belgium)'),
'de_CH' => gettext('German (Switzerland)'),
'de_DE' => gettext('German (Germany)'),
'de_LU' => gettext('German (Luxembourg)'),
'he_IL' => gettext('Hebrew'),
'hi_IN' => gettext('Hindi'),
'hu_HU' => gettext('Hungarian'),
'id_ID' => gettext('Indonesian'),
'is_IS' => gettext('Icelandic'),
'it_CH' => gettext('Italian (Switzerland)'),
'it_IT' => gettext('Italian (Italy)'),
'ja_JP' => gettext('Japanese'),
'ko_KR' => gettext('Korean'),
'lt_LT' => gettext('Lithuanian'),
'lv_LV' => gettext('Latvian'),
'mk_MK' => gettext('Macedonian'),
'mn_MN' => gettext('Mongolian'),
'ms_MY' => gettext('Malay'),
'mg_MG' => gettext('Malagasy'),
'nb_NO' => gettext('Norwegian (Bokmål)'),
'no_NO' => gettext('Norwegian'),
'ni_ID' => gettext('Nias'),
'fa_IR' => gettext('Persian'),
'pl_PL' => gettext('Polish'),
'pt_BR' => gettext('Portuguese (Brazil)'),
'pt_PT' => gettext('Portuguese (Portugal)'),
'ro_RO' => gettext('Romanian'),
'ru_RU' => gettext('Russian (Russia)'),
'ru_UA' => gettext('Russian (Ukraine)'),
'si_LK' => gettext('Sinhala'),
'sk_SK' => gettext('Slovak'),
'sl_SI' => gettext('Slovenian'),
'es_AR' => gettext('Spanish (Argentina)'),
'es_BO' => gettext('Spanish (Bolivia)'),
'es_CL' => gettext('Spanish (Chile)'),
'es_CO' => gettext('Spanish (Columbia)'),
'es_CR' => gettext('Spanish (Costa Rica)'),
'es_DO' => gettext('Spanish (Dominican Republic)'),
'es_EC' => gettext('Spanish (Ecuador)'),
'es_ES' => gettext('Spanish (Spain)'),
'es_GT' => gettext('Spanish (Guatemala)'),
'es_HN' => gettext('Spanish (Honduras)'),
'es_MX' => gettext('Spanish (Mexico)'),
'es_NI' => gettext('Spanish (Nicaragua)'),
'es_PA' => gettext('Spanish (Panama)'),
'es_PE' => gettext('Spanish (Peru)'),
'es_PR' => gettext('Spanish (Puerto Rico)'),
'es_PY' => gettext('Spanish (Paraguay)'),
'es_SV' => gettext('Spanish (El Salvador)'),
'es_US' => gettext('Spanish (United States)'),
'es_UY' => gettext('Spanish (Uruguay)'),
'es_VE' => gettext('Spanish (Venezuela)'),
'es_LA' => gettext('Spanish (Latin America)'),
'sr_YU' => gettext('Serbian'),
'sr_RS' => gettext('Serbian'),
'sv_FI' => gettext('Swedish (Finland)'),
'sv_SE' => gettext('Swedish (Sweden)'),
'ta_IN' => gettext('Tamil'),
'te_IN' => gettext('Telugu'),
'th_TH' => gettext('Thai'),
'tr_TR' => gettext('Turkish'),
'uk_UA' => gettext('Ukrainian'),
'uz_UZ' => gettext('Uzbek'),
'ur_PK' => gettext('Urdu (Pakistan)'),
'vi_VN' => gettext('Vietnamese'),
'cy' => gettext('Welsh')
);
}
function generateLanguageList($all = false) {
global $_zp_active_languages, $_zp_all_languages;
if (is_null($_zp_all_languages)) {
$zp_languages = getLanguageArray();
$dir = @opendir(SERVERPATH . "/" . ZENFOLDER . "/locale/");
$_zp_active_languages = $_zp_all_languages = array();
if ($dir !== false) {
while ($dirname = readdir($dir)) {
if (is_dir(SERVERPATH . "/" . ZENFOLDER . "/locale/" . $dirname) && (substr($dirname, 0, 1) != '.')) {
if (isset($zp_languages[$dirname])) {
$language = $zp_languages[$dirname];
if (empty($language)) {
$language = $dirname;
}
} else {
$language = $dirname;
}
$_zp_all_languages[$language] = $dirname;
if (!getOption('disallow_' . $dirname)) {
$_zp_active_languages[$language] = $dirname;
}
}
}
closedir($dir);
}
ksort($_zp_all_languages);
ksort($_zp_active_languages);
}
if ($all) {
return $_zp_all_languages;
} else {
return $_zp_active_languages;
}
}
function setMainDomain() {
$locale = getUserLocale();
return setupCurrentLocale($locale);
}
function gettext_th($string, $theme = Null) {
global $_zp_gallery;
if (empty($theme)) {
$theme = $_zp_gallery->getCurrentTheme();
}
setupDomain($theme, 'theme');
$translation = gettext($string);
setupDomain();
return $translation;
}
function ngettext_th($msgid1, $msgid2, $n, $theme = NULL) {
global $_zp_gallery;
if (empty($theme)) {
$theme = $_zp_gallery->getCurrentTheme();
}
setupDomain($theme, 'theme');
$translation = ngettext($msgid1, $msgid2, $n);
setupDomain();
return $translation;
}
function gettext_pl($string, $plugin) {
setupDomain($plugin, 'plugin');
$translation = gettext($string);
setupDomain();
return $translation;
}
function ngettext_pl($msgid1, $msgid2, $n, $plugin) {
setupDomain($plugin, 'plugin');
$translation = ngettext($msgid1, $msgid2, $n);
setupDomain();
return $translation;
}
function i18nSetLocale($locale) {
global $_zp_RTL_css;
$en1 = LOCAL_CHARSET;
$en2 = str_replace('ISO-', 'ISO', $en1);
$locale_hyphen = str_replace('_', '-', $locale);
$simple = explode('-', $locale_hyphen);
$try[$locale . '.UTF8'] = $locale . '.UTF8';
$try[$locale . '.UTF-8'] = $locale . '.UTF-8';
$try[$locale . '.@euro'] = $locale . '.@euro';
$try[$locale . '.' . $en2] = $locale . '.' . $en2;
$try[$locale . '.' . $en1] = $locale . '.' . $en1;
$try[$locale] = $locale;
$try[$simple[0]] = $simple[0];
$try['NULL'] = NULL;
$rslt = setlocale(LC_ALL, $try);
$_zp_RTL_css = in_array(substr($rslt, 0, 2), array('fa', 'ar', 'he', 'hi', 'ur'));
if (DEBUG_LOCALE) {
debugLog("setlocale(" . implode(',', $try) . ") returned: $rslt");
}
return $rslt;
}
function setupDomain($domain = NULL, $type = NULL) {
global $_zp_active_languages, $_zp_all_languages;
switch ($type) {
case "plugin":
$domainpath = getPlugin($domain . "/locale/");
break;
case "theme":
$domainpath = SERVERPATH . "/" . THEMEFOLDER . "/" . $domain . "/locale/";
break;
default:
$domain = 'zenphoto';
$domainpath = SERVERPATH . "/" . ZENFOLDER . "/locale/";
break;
}
bindtextdomain($domain, $domainpath);
if (function_exists('bind_textdomain_codeset')) {
bind_textdomain_codeset($domain, 'UTF-8');
}
textdomain($domain);
$_zp_active_languages = $_zp_all_languages = NULL;
}
function setupCurrentLocale($override = NULL) {
if (is_null($override)) {
$locale = getOption('locale');
} else {
$locale = $override;
}
if (getOption('disallow_' . $locale)) {
if (DEBUG_LOCALE)
debugLogBacktrace("setupCurrentLocale($override): $locale denied by option.");
$locale = getOption('locale');
if (empty($locale) || getOption('disallow_' . $locale)) {
$languages = generateLanguageList();
$locale = array_shift($languages);
}
}
@putenv("LANG=$locale");
@putenv("LANGUAGE=$locale");
$result = i18nSetLocale($locale);
if (!$result) {
if (isset($_REQUEST['locale']) || is_null($override)) {
if (isset($_REQUEST['oldlocale'])) {
$locale = sanitize($_REQUEST['oldlocale'], 3);
setOption('locale', $locale, false);
zp_clearCookie('zpcms_locale');
}
}
}
if (DEBUG_LOCALE)
debugLogBacktrace("setupCurrentLocale($override): locale=$locale, \$result=$result");
setupDomain();
return $result;
}
function getLangAttributeLocale($locale = NULL) {
if(empty($locale)) {
$locale = getUserLocale();
}
return str_replace('_', '-', $locale);
}
function parseHttpAcceptLanguage($str = NULL) {
if (!$str) {
$str = @$_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
if (!is_string($str)) {
return array();
}
$langs = explode(',', $str);
$accepted = array();
foreach ($langs as $lang) {
if (preg_match('/([A-Za-z]{1,2})(-([A-Za-z0-9]+))?(;q=([0-9\.]+))?/', $lang, $found)) {
$code = $found[1];
$morecode = array_key_exists(3, $found) ? $found[3] : false;
$fullcode = $morecode ? $code . '_' . $morecode : $code;
$coef = sprintf('%3.1f', array_key_exists(5, $found) ? $found[5] : '1');
if ($coef) {
$accepted[$coef . '-' . $code] = array('code' => $code, 'coef' => $coef, 'morecode' => $morecode, 'fullcode' => $fullcode);
}
}
}
krsort($accepted);
if (DEBUG_LOCALE) {
debugLog("parseHttpAcceptLanguage($str)");
debugLogVar('parseHttpAcceptLanguage::$accepted', $accepted);
}
return $accepted;
}
function validateLocale($userlocale, $source) {
if (DEBUG_LOCALE)
debugLog("validateLocale($userlocale,$source)");
$userlocale = strtoupper(str_replace('-', '_', $userlocale));
$languageSupport = generateLanguageList();
$locale = NULL;
if (!empty($userlocale)) {
foreach ($languageSupport as $key => $value) {
if (strtoupper($value) == $userlocale) {
$locale = $value;
if (DEBUG_LOCALE)
debugLog("locale set from $source: " . $locale);
break;
} else if (@preg_match('/^' . $userlocale . '/', strtoupper($value))) {
$locale = $value;
if (DEBUG_LOCALE)
debugLog("locale set from $source (partial match): " . $locale);
break;
}
}
}
return $locale;
}
function getUserLocale() {
global $_zp_current_admin_obj, $_zp_current_locale;
if (!$_zp_current_locale) {
if (DEBUG_LOCALE)
debugLogBackTrace("getUserLocale()");
if (isset($_REQUEST['locale'])) {
if (isset($_POST['locale'])) {
$_zp_current_locale = validateLocale(sanitize($_POST['locale']), 'POST');
} else {
$_zp_current_locale = validateLocale(sanitize($_GET['locale']), 'URI string');
}
if ($_zp_current_locale) {
zp_setCookie('zpcms_locale', $_zp_current_locale);
}
if (DEBUG_LOCALE)
debugLog("dynamic_locale from URL: " . sanitize($_REQUEST['locale']) . "=>$_zp_current_locale");
} else {
$matches = explode('.', @$_SERVER['HTTP_HOST']);
if ($_zp_current_locale = validateLocale($matches[0], 'HTTP_HOST')) {
zp_clearCookie('zpcms_locale');
}
}
if (!$_zp_current_locale && is_object($_zp_current_admin_obj)) {
$_zp_current_locale = $_zp_current_admin_obj->getLanguage();
if (DEBUG_LOCALE)
debugLog("locale from user: " . $_zp_current_locale);
}
if (!$_zp_current_locale) {
$localeOption = getOption('locale');
$_zp_current_locale = zp_getCookie('zpcms_locale');
if (DEBUG_LOCALE)
debugLog("locale from option: " . $localeOption . '; dynamic locale=' . $_zp_current_locale);
if (empty($localeOption) && empty($_zp_current_locale)) {
$languageSupport = generateLanguageList();
$userLang = parseHttpAcceptLanguage();
foreach ($userLang as $lang) {
$l = strtoupper($lang['fullcode']);
$_zp_current_locale = validateLocale($l, 'HTTP Accept Language');
if ($_zp_current_locale)
break;
}
} else {
if (empty($_zp_current_locale)) {
$_zp_current_locale = $localeOption;
}
}
}
if (empty($_zp_current_locale)) {
$languageSupport = generateLanguageList();
if (in_array('en_US', $languageSupport)) {
$_zp_current_locale = 'en_US';
} else {
$_zp_current_locale = array_shift($languageSupport);
}
} else {
setOption('locale', $_zp_current_locale, false);
}
if (DEBUG_LOCALE)
debugLog("getUserLocale Returning locale: " . $_zp_current_locale);
}
return $_zp_current_locale;
}
function get_language_string($dbstring, $locale = NULL) {
$strings = getSerializedArray($dbstring);
$actual_local = getOption('locale');
if (is_null($locale))
$locale = $actual_local;
if (isset($strings[$locale])) {
return $strings[$locale];
}
if (isset($strings[$actual_local])) {
return $strings[$actual_local];
}
if (isset($strings['en_US'])) {
return $strings['en_US'];
}
return array_shift($strings);
}
function getTimezones() {
$cities = array();
if (function_exists('timezone_abbreviations_list')) {
$timezones = timezone_abbreviations_list();
foreach ($timezones as $key => $zones) {
foreach ($zones as $id => $zone) {
if ($zone['timezone_id'] == 'UTC' || preg_match('/^(Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)\//', $zone['timezone_id'])) {
$cities[] = $zone['timezone_id'];
}
}
}
$cities = array_unique($cities);
ksort($cities, SORT_LOCALE_STRING);
}
return $cities;
}
function timezoneDiff($server, $local) {
if (function_exists('timezone_abbreviations_list')) {
$timezones = timezone_abbreviations_list();
foreach ($timezones as $key => $zones) {
foreach ($zones as $id => $zone) {
if (!isset($offset_server) && $zone['timezone_id'] === $server) {
$offset_server = (int) $zone['offset'];
}
if (!isset($offset_local) && $zone['timezone_id'] === $local) {
$offset_local = (int) $zone['offset'];
}
if (isset($offset_server) && isset($offset_local)) {
return ($offset_server - $offset_local) / 3600;
}
}
}
}
return 0;
}
function getAllTranslations($text) {
$entry_locale = getUserLocale();
$result = array('en_US' => $text);
$languages = generateLanguageList();
foreach ($languages as $language) {
setupCurrentLocale($language);
$xlated = gettext($text);
if ($xlated != $text) {
$result[$language] = $xlated;
}
}
setupCurrentLocale($entry_locale);
if (count($result) == 1) {
return $text;
}
return serialize($result);
}
function getLanguageSubdomains() {
$domains = array();
$langs = generateLanguageList();
$domains = array();
foreach ($langs as $value) {
$domains[substr($value, 0, 2)][] = $value;
}
$langs = array();
foreach ($domains as $simple => $full) {
if (count($full) > 1) {
foreach ($full as $loc) {
$langs[$loc] = $loc;
}
} else {
$langs[$full[0]] = $simple;
}
}
if (isset($langs[SITE_LOCALE])) {
$langs[SITE_LOCALE] = '';
}
return $langs;
}
function getLanguageText($loc = NULL, $separator = NULL) {
global $_locale_Subdomains;
if (is_null($loc)) {
$text = @$_locale_Subdomains[zp_getCookie('zpcms_locale')];
} else {
$text = @$_locale_Subdomains[$loc];
if (empty($text)) {
$text = $loc;
}
}
if (!is_null($separator)) {
$text = str_replace('_', $separator, $text);
}
return $text;
}
if (function_exists('date_default_timezone_set')) {
$tz = getOption('time_zone');
if (!empty($tz)) {
$err = error_reporting(0);
date_default_timezone_set($tz);
@ini_set('date.timezone', $tz);
error_reporting($err);
}
unset($tz);
}
function getSystemLocales($plainarray = false) {
if (class_exists('ResourceBundle')) {
$locales = ResourceBundle::getLocales('');
$array = array();
if ($plainarray) {
return $locales;
} else {
foreach ($locales as $locale) {
$expl = explode('_', $locale);
$array[$expl[0]][] = $locale;
}
return $array;
}
}
return false;
}
function getLanguageDisplayName($locale) {
if (class_exists('Locale')) {
return Locale::getDisplayName($locale);
} else {
$languages = getLanguageArray();
if (array_key_exists($locale, $languages)) {
return $languages[$locale];
}
}
}
$_locale_Subdomains = getLanguageSubdomains();