HumHub Documentation (unofficial)

HTMLPurifier_LanguageFactory
in package

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

Tags
note

Thanks to MediaWiki for the general logic, although this version has been entirely rewritten

todo

Serialized cache for languages

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
type

array

$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
type

array

$dir

Cached copy of dirname(__FILE__), directory of current file without trailing slash.

protected mixed $dir
Tags
type

string

$mergeable_keys_list

Keys whose contents are a list and can be merged.

protected mixed $mergeable_keys_list = array()
Tags
value

array lookup

$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
type

array

$validator

Instance to validate language codes.

protected mixed $validator
Tags
type

HTMLPurifier_AttrDef_Lang

Methods

getFallbackFor()

Returns the fallback language for language

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

language code

Tags
note

Loads the original language into cache

Return values
string|bool

loadLanguage()

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
Tags
note

Prevents people from getting this outside of the singleton


        
On this page

Search results