Class HTMLPurifier_LanguageFactory
Inheritance | HTMLPurifier_LanguageFactory |
---|
Class responsible for generating HTMLPurifier_Language objects, managing caching and fallbacks.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$cache | Cache of language code information used to load HTMLPurifier_Language objects. | HTMLPurifier_LanguageFactory | |
$keys | Valid keys in the HTMLPurifier_Language object. Designates which variables to slurp out of a message file. | HTMLPurifier_LanguageFactory |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$dir | Cached copy of dirname(FILE), directory of current file without trailing slash. | HTMLPurifier_LanguageFactory | |
$mergeable_keys_list | Keys whose contents are a list and can be merged. | HTMLPurifier_LanguageFactory | |
$mergeable_keys_map | Keys whose contents are a hash map and can be merged. | HTMLPurifier_LanguageFactory | |
$validator | Instance to validate language codes. | HTMLPurifier_LanguageFactory |
Public Methods
Method | Description | Defined By |
---|---|---|
create() | Creates a language object, handles class fallbacks | HTMLPurifier_LanguageFactory |
getFallbackFor() | Returns the fallback language for language | HTMLPurifier_LanguageFactory |
instance() | Retrieve sole instance of the factory. | HTMLPurifier_LanguageFactory |
loadLanguage() | Loads language into the cache, handles message file and fallbacks | HTMLPurifier_LanguageFactory |
setup() | Sets up the singleton, much like a constructor | HTMLPurifier_LanguageFactory |
Property Details
Structure is: $factory->cache[$language_code][$key] = $value
Method Details
Creates a language object, handles class fallbacks
public HTMLPurifier_Language create ( $config, $context, $code = false ) | ||
$config | HTMLPurifier_Config | |
$context | HTMLPurifier_Context | |
$code | bool|string | Code to override configuration with. Private parameter. |
Returns the fallback language for language
public string|bool getFallbackFor ( $code ) | ||
$code | string | Language code |
Retrieve sole instance of the factory.
public static HTMLPurifier_LanguageFactory instance ( $prototype = null ) | ||
$prototype | HTMLPurifier_LanguageFactory | Optional prototype to overload sole instance with,
|
Loads language into the cache, handles message file and fallbacks
public void loadLanguage ( $code ) | ||
$code | string | Language code |
Sets up the singleton, much like a constructor
public void setup ( ) |