PHP Class Horde_Nls, horde

This includes common methods for handling language data, timezones, and hostname->country lookups.
Author: Jon Parise ([email protected])
Author: Chuck Hagenbuch ([email protected])
Author: Jan Schneider ([email protected])
Author: Michael Slusarz ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Свойство Type Description
$dnsResolver Net_DNS2_Resolver DNS resolver.

Protected Properties

Свойство Type Description
$_cache array Cached values.

Méthodes publiques

Méthode Description
checkCharset ( string $charset ) : boolean Check to see if character set is valid for htmlspecialchars() calls.
getCountryByHost ( string $host, string $datafile = null ) : mixed Get country information from a hostname or IP address.
getCountryISO ( string $code = null ) : mixed Returns either a specific or all ISO-3166 country names.
getLangInfo ( const $item ) : array Get the language info returned by nl_langinfo(), but cache it, to avoid repeated calls.
getLanguageISO ( string $code = null ) : mixed Returns either a specific or all ISO-639 language names.
getLocaleInfo ( ) : array Get the locale info returned by localeconv(), but cache it, to avoid repeated calls.
getTimezones ( ) : array Returns a list of available timezones.
getTimezonesWithAbbreviations ( ) : array Returns a list of available timezones, including timezone abbreviations.
tldLookup ( string $code ) : mixed Do a top level domain (TLD) lookup.

Method Details

checkCharset() public static méthode

Check to see if character set is valid for htmlspecialchars() calls.
public static checkCharset ( string $charset ) : boolean
$charset string The character set to check.
Résultat boolean Is charset valid for the current system?

getCountryByHost() public static méthode

Get country information from a hostname or IP address.
public static getCountryByHost ( string $host, string $datafile = null ) : mixed
$host string The hostname or IP address.
$datafile string The datafile for the GeoIP lookup. If not set, will skip this lookup.
Résultat mixed On success, return an array with the following entries: 'code' => Country Code 'name' => Country Name On failure, return false.

getCountryISO() public static méthode

Returns either a specific or all ISO-3166 country names.
public static getCountryISO ( string $code = null ) : mixed
$code string The ISO 3166 country code.
Résultat 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.

getLangInfo() public static méthode

Get the language info returned by nl_langinfo(), but cache it, to avoid repeated calls.
public static getLangInfo ( const $item ) : array
$item const The langinfo item to return.
Résultat array The results of nl_langinfo().

getLanguageISO() public static méthode

Returns either a specific or all ISO-639 language names.
public static getLanguageISO ( string $code = null ) : mixed
$code string The ISO 639 language code.
Résultat 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).

getLocaleInfo() public static méthode

Get the locale info returned by localeconv(), but cache it, to avoid repeated calls.
public static getLocaleInfo ( ) : array
Résultat array The results of localeconv().

getTimezones() public static méthode

Returns a list of available timezones.
public static getTimezones ( ) : array
Résultat array List of timezones.

getTimezonesWithAbbreviations() public static méthode

Contrary to getTimezones() the timezone IDs are values and the timezone labels are the keys, to allow multiple labels for the same timezone.
Since: 2.2.0
public static getTimezonesWithAbbreviations ( ) : array
Résultat array List of timezones.

tldLookup() public static méthode

Do a top level domain (TLD) lookup.
public static tldLookup ( string $code ) : mixed
$code string A 2-letter country code.
Résultat mixed The localized country name, or null if not found.

Property Details

$_cache protected_oe static_oe property

Cached values.
protected static array $_cache
Résultat array

$dnsResolver public_oe static_oe property

DNS resolver.
public static Net_DNS2_Resolver $dnsResolver
Résultat Net_DNS2_Resolver