/** * Returns the default country as localized string. * * @return string the default country's localized name, will be empty if there is no default country */ private function getDefaultCountry() { $defaultCountryCode = tx_oelib_ConfigurationRegistry::get('plugin.tx_staticinfotables_pi1')->getAsString('countryCode'); if ($defaultCountryCode === '') { return ''; } $this->initStaticInfo(); if (class_exists('SJBR\\StaticInfoTables\\Utility\\LocalizationUtility', TRUE)) { $currentLanguageCode = Tx_Oelib_ConfigurationRegistry::get('config')->getAsString('language'); $identifiers = array('iso' => $defaultCountryCode); $result = \SJBR\StaticInfoTables\Utility\LocalizationUtility::getLabelFieldValue($identifiers, 'static_countries', $currentLanguageCode, TRUE); } else { $result = tx_staticinfotables_div::getTitleFromIsoCode('static_countries', $defaultCountryCode, $this->staticInfo->getCurrentLanguage(), TRUE); } return $result; }
/** * Getting the name of a country, country subdivision, currency, language, tax * * @param string Defines the type of entry of the requested name: 'TERRIRORIES', 'COUNTRIES', 'SUBDIVISIONS', 'CURRENCIES', 'LANGUAGES', 'TAXES', 'SUBTAXES' * @param string The ISO alpha-3 code of a territory, country or currency, or the ISO alpha-2 code of a language or the code of a country subdivision, can be a comma ',' separated string, then all the single items are looked up and returned * @param string The value of the country code (cn_iso_3) for which a name of type 'SUBDIVISIONS', 'TAXES' or 'SUBTAXES' is requested (meaningful only in these cases) * @param string The value of the country subdivision code for which a name of type 'SUBTAXES' is requested (meaningful only in this case) * @param boolean local name only - if set local title is returned * @return string The name of the object in the current language */ function getStaticInfoName($type = 'COUNTRIES', $code, $country = '', $countrySubdivision = '', $local = FALSE) { global $TYPO3_DB, $TSFE; if (in_array($type, $this->types) && trim($code)) { $codeArray = t3lib_div::trimExplode(',', $code); $table = $this->tables[$type]; if (!$table) { return FALSE; } $lang = $this->getCurrentLanguage(); if (!t3lib_extMgm::isLoaded(STATIC_INFO_TABLES_EXTkey . '_' . strtolower($lang))) { $lang = ''; } $nameArray = array(); foreach ($codeArray as $tmpisoCode) { $isoCodeArray = array(); $isoCodeArray[] = $tmpisoCode; switch ($type) { case 'TERRITORIES': case 'COUNTRIES': case 'CURRENCIES': $name = tx_staticinfotables_div::getTitleFromIsoCode($table, $isoCodeArray, $lang, $local); break; case 'SUBDIVISIONS': case 'TAXES': $isoCodeArray[] = trim($country) ? trim($country) : $this->defaultCountry; $name = tx_staticinfotables_div::getTitleFromIsoCode($table, $isoCodeArray, $lang, $local); break; case 'SUBTAXES': $isoCodeArray[] = trim($country) ? trim($country) : $this->defaultCountry; $isoCodeArray[] = trim($countrySubdivision) ? trim($countrySubdivision) : $this->defaultCountryZone; $name = tx_staticinfotables_div::getTitleFromIsoCode($table, $isoCodeArray, $lang, $local); break; case 'LANGUAGES': $isoCodeArray = t3lib_div::trimExplode('_', $code, 1); $name = tx_staticinfotables_div::getTitleFromIsoCode($table, $isoCodeArray, $lang, $local); break; } if (!$name && $lang != 'EN') { // use the default English name if there is not text in another language $name = tx_staticinfotables_div::getTitleFromIsoCode($table, $isoCodeArray, '', $local); } $nameArray[] = $TSFE->csConv($name, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['charset']); } $rc = implode(',', $nameArray); } else { $rc = FALSE; } return $rc; }