Documentation

Horde_Nls
in package

The Horde_Nls class provides Native Language Support.

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

Tags
author

Jon Parise jon@horde.org

author

Chuck Hagenbuch chuck@horde.org

author

Jan Schneider jan@horde.org

author

Michael Slusarz slusarz@horde.org

category

Horde

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$dnsResolver  : Net_DNS2_Resolver
DNS resolver.
$_cache  : array<string|int, mixed>
Cached values.
checkCharset()  : bool
Check to see if character set is valid for htmlspecialchars() calls.
getCountryByHost()  : mixed
Get country information from a hostname or IP address.
getCountryISO()  : mixed
Returns either a specific or all ISO-3166 country names.
getLangInfo()  : array<string|int, mixed>
Get the language info returned by nl_langinfo(), but cache it, to avoid repeated calls.
getLanguageISO()  : mixed
Returns either a specific or all ISO-639 language names.
getLocaleInfo()  : array<string|int, mixed>
Get the locale info returned by localeconv(), but cache it, to avoid repeated calls.
getTimezones()  : array<string|int, mixed>
Returns a list of available timezones.
getTimezonesWithAbbreviations()  : array<string|int, mixed>
Returns a list of available timezones, including timezone abbreviations.
tldLookup()  : mixed
Do a top level domain (TLD) lookup.

Properties

$dnsResolver

DNS resolver.

public static Net_DNS2_Resolver $dnsResolver

$_cache

Cached values.

protected static array<string|int, mixed> $_cache = array()

Methods

checkCharset()

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

public static checkCharset(string $charset) : bool
Parameters
$charset : string

The character set to check.

Return values
bool

Is charset valid for the current system?

getCountryByHost()

Get country information from a hostname or IP address.

public static getCountryByHost(string $host[, string $datafile = null ]) : mixed
Parameters
$host : string

The hostname or IP address.

$datafile : string = null

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

Return values
mixed

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

getCountryISO()

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

public static getCountryISO([string $code = null ]) : mixed
Parameters
$code : string = null

The ISO 3166 country code.

Return values
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()

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

public static getLangInfo(const $item) : array<string|int, mixed>
Parameters
$item : const

The langinfo item to return.

Return values
array<string|int, mixed>

The results of nl_langinfo().

getLanguageISO()

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

public static getLanguageISO([string $code = null ]) : mixed
Parameters
$code : string = null

The ISO 639 language code.

Return values
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()

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

public static getLocaleInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

The results of localeconv().

getTimezones()

Returns a list of available timezones.

public static getTimezones() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of timezones.

getTimezonesWithAbbreviations()

Returns a list of available timezones, including timezone abbreviations.

public static getTimezonesWithAbbreviations() : array<string|int, mixed>

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

Tags
since
2.2.0
Return values
array<string|int, mixed>

List of timezones.

tldLookup()

Do a top level domain (TLD) lookup.

public static tldLookup(string $code) : mixed
Parameters
$code : string

A 2-letter country code.

Return values
mixed

The localized country name, or null if not found.

Search results