25    public $keys = array(
'fallback', 
'messages', 
'errorNames');
 
   59    public static function instance($prototype = 
null)
 
   61        static $instance = 
null;
 
   62        if ($prototype !== 
null) {
 
   63            $instance = $prototype;
 
   64        } elseif ($instance === 
null || $prototype == 
true) {
 
   78        $this->dir = HTMLPURIFIER_PREFIX . 
'/HTMLPurifier';
 
   91        if (
$code === 
false) {
 
   92            $code = $this->validator->validate(
 
  100        if (
$code === 
false) {
 
  104        $pcode = str_replace(
'-', 
'_', 
$code); 
 
  110            $class = 
'HTMLPurifier_Language_' . $pcode;
 
  111            $file  = $this->dir . 
'/Language/classes/' . 
$code . 
'.php';
 
  112            if (file_exists(
$file) || class_exists($class, 
false)) {
 
  117                $fallback = $raw_fallback ? $raw_fallback : 
'en';
 
  120                if (!$raw_fallback) {
 
  139        return $this->cache[
$code][
'fallback'];
 
  148        static $languages_seen = array(); 
 
  151        if (isset($this->cache[
$code])) {
 
  164            $filename = $this->dir . 
'/Language/messages/en.php';
 
  168            $cache = compact($this->keys);
 
  175            if (isset($languages_seen[
$code])) {
 
  177                    'Circular fallback reference in language ' .
 
  183            $language_seen[
$code] = 
true;
 
  187            $fallback_cache = $this->cache[
$fallback];
 
  190            foreach ($this->keys as $key) {
 
  191                if (isset(
$cache[$key]) && isset($fallback_cache[$key])) {
 
  192                    if (isset($this->mergeable_keys_map[$key])) {
 
  194                    } elseif (isset($this->mergeable_keys_list[$key])) {
 
  195                        $cache[$key] = array_merge($fallback_cache[$key], 
$cache[$key]);
 
  198                    $cache[$key] = $fallback_cache[$key];
 
An exception for terminatinating execution or to throw for unit testing.
Validates the HTML attribute lang, effectively a language code.
Class responsible for generating HTMLPurifier_Language objects, managing caching and fallbacks.
setup()
Sets up the singleton, much like a constructor.
static instance($prototype=null)
Retrieve sole instance of the factory.
$mergeable_keys_map
Keys whose contents are a hash map and can be merged.
$dir
Cached copy of dirname(FILE), directory of current file without trailing slash.
create($config, $context, $code=false)
Creates a language object, handles class fallbacks.
loadLanguage($code)
Loads language into the cache, handles message file and fallbacks.
$cache
Cache of language code information used to load HTMLPurifier_Language objects.
$mergeable_keys_list
Keys whose contents are a list and can be merged.
$keys
Valid keys in the HTMLPurifier_Language object.
$validator
Instance to validate language codes.
getFallbackFor($code)
Returns the fallback language for language.
Represents a language and defines localizable string formatting and other functions,...
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file