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