\Horde_Nls

The Horde_Nls class provides Native Language Support.

This includes common methods for handling language data, timezones, and hostname->country lookups.

Summary

Methods
Properties
Constants
checkCharset()
getTimezones()
getTimezonesWithAbbreviations()
getLocaleInfo()
getLangInfo()
getCountryByHost()
tldLookup()
getCountryISO()
getLanguageISO()
$dnsResolver
No constants found
No protected methods found
$_cache
N/A
No private methods found
No private properties found
N/A

Properties

$dnsResolver

$dnsResolver : \Net_DNS2_Resolver

DNS resolver.

Type

\Net_DNS2_Resolver

$_cache

$_cache : array

Cached values.

Type

array

Methods

checkCharset()

checkCharset(string  $charset) : boolean

Check to see if character set is valid for htmlspecialchars() calls.

Parameters

string $charset

The character set to check.

Returns

boolean —

Is charset valid for the current system?

getTimezones()

getTimezones() : array

Returns a list of available timezones.

Returns

array —

List of timezones.

getTimezonesWithAbbreviations()

getTimezonesWithAbbreviations() : array

Returns a list of available timezones, including timezone abbreviations.

Contrary to getTimezones() the timezone IDs are values and the timezone labels are the keys, to allow multiple labels for the same timezone.

Returns

array —

List of timezones.

getLocaleInfo()

getLocaleInfo() : array

Get the locale info returned by localeconv(), but cache it, to avoid repeated calls.

Returns

array —

The results of localeconv().

getLangInfo()

getLangInfo(\const  $item) : array

Get the language info returned by nl_langinfo(), but cache it, to avoid repeated calls.

Parameters

\const $item

The langinfo item to return.

Returns

array —

The results of nl_langinfo().

getCountryByHost()

getCountryByHost(string  $host, string  $datafile = null) : mixed

Get country information from a hostname or IP address.

Parameters

string $host

The hostname or IP address.

string $datafile

The datafile for the GeoIP lookup. If not set, will skip this lookup.

Returns

mixed —

On success, return an array with the following entries: 'code' => Country Code 'name' => Country Name On failure, return false.

tldLookup()

tldLookup(string  $code) : mixed

Do a top level domain (TLD) lookup.

Parameters

string $code

A 2-letter country code.

Returns

mixed —

The localized country name, or null if not found.

getCountryISO()

getCountryISO(string  $code = null) : mixed

Returns either a specific or all ISO-3166 country names.

Parameters

string $code

The ISO 3166 country code.

Returns

mixed —

If a country code has been requested will return the corresponding country name. If empty will return an array of all the country codes and their names.

getLanguageISO()

getLanguageISO(string  $code = null) : mixed

Returns either a specific or all ISO-639 language names.

Parameters

string $code

The ISO 639 language code.

Returns

mixed —

If a language code has been requested will return the corresponding language name. If empty will return an array of all the language codes (keys) and their names (values).