Class HTMLPurifier_LanguageFactory

InheritanceHTMLPurifier_LanguageFactory

Class responsible for generating HTMLPurifier_Language objects, managing caching and fallbacks.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined 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

Hide inherited properties

PropertyTypeDescriptionDefined 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

Hide inherited methods

MethodDescriptionDefined 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

$cache public property

Structure is: $factory->cache[$language_code][$key] = $value

public $cache null
$dir protected property
protected $dir null
$keys public property
public $keys = ['fallback''messages''errorNames']
$mergeable_keys_list protected property
protected $mergeable_keys_list = []
$mergeable_keys_map protected property
protected $mergeable_keys_map = ['messages' => true'errorNames' => true]
$validator protected property
protected $validator null

Method Details

create() public method

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.

getFallbackFor() public method

Returns the fallback language for language

public string|bool getFallbackFor ( $code )
$code string

Language code

instance() public static method

Retrieve sole instance of the factory.

public static HTMLPurifier_LanguageFactory instance ( $prototype null )
$prototype HTMLPurifier_LanguageFactory

Optional prototype to overload sole instance with,

              or bool true to reset to default factory.
loadLanguage() public method

Loads language into the cache, handles message file and fallbacks

public void loadLanguage ( $code )
$code string

Language code

setup() public method

Sets up the singleton, much like a constructor

public void setup ( )