HTMLPurifier_LanguageFactory
in package
Class responsible for generating HTMLPurifier_Language objects, managing caching and fallbacks.
Tags
Table of Contents
Properties
- $cache : mixed
- Cache of language code information used to load HTMLPurifier_Language objects.
- $keys : mixed
- Valid keys in the HTMLPurifier_Language object. Designates which variables to slurp out of a message file.
- $dir : mixed
- Cached copy of dirname(__FILE__), directory of current file without trailing slash.
- $mergeable_keys_list : mixed
- Keys whose contents are a list and can be merged.
- $mergeable_keys_map : mixed
- Keys whose contents are a hash map and can be merged.
- $validator : mixed
- Instance to validate language codes.
Methods
- create() : HTMLPurifier_Language
- Creates a language object, handles class fallbacks
- getFallbackFor() : string|bool
- Returns the fallback language for language
- instance() : HTMLPurifier_LanguageFactory
- Retrieve sole instance of the factory.
- loadLanguage() : mixed
- Loads language into the cache, handles message file and fallbacks
- setup() : mixed
- Sets up the singleton, much like a constructor
Properties
$cache
Cache of language code information used to load HTMLPurifier_Language objects.
public
mixed
$cache
Structure is: $factory->cache[$language_code][$key] = $value
Tags
$keys
Valid keys in the HTMLPurifier_Language object. Designates which variables to slurp out of a message file.
public
mixed
$keys
= array('fallback', 'messages', 'errorNames')
Tags
$dir
Cached copy of dirname(__FILE__), directory of current file without trailing slash.
protected
mixed
$dir
Tags
$mergeable_keys_list
Keys whose contents are a list and can be merged.
protected
mixed
$mergeable_keys_list
= array()
Tags
$mergeable_keys_map
Keys whose contents are a hash map and can be merged.
protected
mixed
$mergeable_keys_map
= array('messages' => \true, 'errorNames' => \true)
Tags
$validator
Instance to validate language codes.
protected
mixed
$validator
Tags
Methods
create()
Creates a language object, handles class fallbacks
public
create(HTMLPurifier_Config $config, HTMLPurifier_Context $context[, bool|string $code = false ]) : HTMLPurifier_Language
Parameters
- $config : HTMLPurifier_Config
- $context : HTMLPurifier_Context
- $code : bool|string = false
-
Code to override configuration with. Private parameter.
Return values
HTMLPurifier_LanguagegetFallbackFor()
Returns the fallback language for language
public
getFallbackFor(string $code) : string|bool
Parameters
- $code : string
-
language code
Tags
Return values
string|boolinstance()
Retrieve sole instance of the factory.
public
static instance([HTMLPurifier_LanguageFactory $prototype = null ]) : HTMLPurifier_LanguageFactory
Parameters
- $prototype : HTMLPurifier_LanguageFactory = null
-
Optional prototype to overload sole instance with, or bool true to reset to default factory.
Return values
HTMLPurifier_LanguageFactoryloadLanguage()
Loads language into the cache, handles message file and fallbacks
public
loadLanguage(string $code) : mixed
Parameters
- $code : string
-
language code
setup()
Sets up the singleton, much like a constructor
public
setup() : mixed