Skip to content

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.

public $cache

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.

public $keys

validator

Instance to validate language codes.

protected $validator

dir

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

protected $dir

mergeable_keys_map

Keys whose contents are a hash map and can be merged.

protected $mergeable_keys_map

mergeable_keys_list

Keys whose contents are a list and can be merged.

protected $mergeable_keys_list

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

public setup(): mixed

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

public getFallbackFor(string $code): string|bool

Parameters:

Parameter Type Description
$code string language code

loadLanguage

Loads language into the cache, handles message file and fallbacks

public loadLanguage(string $code): mixed

Parameters:

Parameter Type Description
$code string language code


Automatically generated on 2025-03-18