ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCachedLanguage Class Reference

Class ilCachedLanguage. More...

+ Collaboration diagram for ilCachedLanguage:

Public Member Functions

 isActive ()
 
 writeToCache ()
 
 flush ()
 
 setLanguageKey ($language_key)
 
 getLanguageKey ()
 
 setLoaded ($loaded)
 
 getLoaded ()
 
 setTranslations ($translations)
 
 getTranslations ()
 

Static Public Member Functions

static getInstance ($key)
 

Protected Member Functions

 readFromCache ()
 

Protected Attributes

 $global_cache
 
 $loaded = false
 
 $language_key = 'en'
 
 $translations = array()
 

Static Protected Attributes

static $instances = array()
 

Detailed Description

Class ilCachedLanguage.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 10 of file class.ilCachedLanguage.php.

Member Function Documentation

◆ flush()

ilCachedLanguage::flush ( )

Definition at line 114 of file class.ilCachedLanguage.php.

115 {
116 if ($this->global_cache->isActive()) {
117 $this->global_cache->flush();
118 }
119 $this->readFromDB();
120 $this->writeToCache();
121 }

References writeToCache().

+ Here is the call graph for this function:

◆ getInstance()

static ilCachedLanguage::getInstance (   $key)
static
Parameters
$key
Returns
ilCachedLanguage

Definition at line 104 of file class.ilCachedLanguage.php.

105 {
106 if (!isset(self::$instances[$key])) {
107 self::$instances[$key] = new self($key);
108 }
109
110 return self::$instances[$key];
111 }
$key
Definition: croninfo.php:18

References $key.

Referenced by ilLanguage\__construct(), and ilObjLanguageExt\_saveValues().

+ Here is the caller graph for this function:

◆ getLanguageKey()

ilCachedLanguage::getLanguageKey ( )
Returns
string

Definition at line 136 of file class.ilCachedLanguage.php.

137 {
138 return $this->language_key;
139 }

References $language_key.

Referenced by readFromCache(), and writeToCache().

+ Here is the caller graph for this function:

◆ getLoaded()

ilCachedLanguage::getLoaded ( )
Returns
boolean

Definition at line 154 of file class.ilCachedLanguage.php.

155 {
156 return $this->loaded;
157 }

References $loaded.

◆ getTranslations()

ilCachedLanguage::getTranslations ( )
Returns
array

Definition at line 172 of file class.ilCachedLanguage.php.

173 {
174 return $this->translations;
175 }

References $translations.

Referenced by writeToCache().

+ Here is the caller graph for this function:

◆ isActive()

ilCachedLanguage::isActive ( )
Returns
bool

Definition at line 54 of file class.ilCachedLanguage.php.

55 {
56 return $this->global_cache->isActive();
57 }

◆ readFromCache()

ilCachedLanguage::readFromCache ( )
protected

Definition at line 60 of file class.ilCachedLanguage.php.

61 {
62 if ($this->global_cache->isActive()) {
63 $translations = $this->global_cache->get('translations_' . $this->getLanguageKey());
64 if (is_array($translations)) {
66 $this->setLoaded(true);
67 }
68 }
69 }
setTranslations($translations)

References $translations, getLanguageKey(), setLoaded(), and setTranslations().

+ Here is the call graph for this function:

◆ setLanguageKey()

ilCachedLanguage::setLanguageKey (   $language_key)
Parameters
string$language_key

Definition at line 127 of file class.ilCachedLanguage.php.

128 {
129 $this->language_key = $language_key;
130 }

References $language_key.

◆ setLoaded()

ilCachedLanguage::setLoaded (   $loaded)
Parameters
boolean$loaded

Definition at line 145 of file class.ilCachedLanguage.php.

146 {
147 $this->loaded = $loaded;
148 }

References $loaded.

Referenced by readFromCache().

+ Here is the caller graph for this function:

◆ setTranslations()

ilCachedLanguage::setTranslations (   $translations)
Parameters
array$translations

Definition at line 163 of file class.ilCachedLanguage.php.

164 {
165 $this->translations = $translations;
166 }

References $translations.

Referenced by readFromCache().

+ Here is the caller graph for this function:

◆ writeToCache()

ilCachedLanguage::writeToCache ( )

Definition at line 72 of file class.ilCachedLanguage.php.

73 {
74 if ($this->global_cache->isActive()) {
75 $this->global_cache->set('translations_' . $this->getLanguageKey(), $this->getTranslations());
76 }
77 }

References getLanguageKey(), and getTranslations().

Referenced by flush().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $global_cache

ilCachedLanguage::$global_cache
protected

Definition at line 12 of file class.ilCachedLanguage.php.

◆ $instances

ilCachedLanguage::$instances = array()
staticprotected

Definition at line 28 of file class.ilCachedLanguage.php.

◆ $language_key

ilCachedLanguage::$language_key = 'en'
protected

Definition at line 20 of file class.ilCachedLanguage.php.

Referenced by getLanguageKey(), and setLanguageKey().

◆ $loaded

ilCachedLanguage::$loaded = false
protected

Definition at line 16 of file class.ilCachedLanguage.php.

Referenced by getLoaded(), and setLoaded().

◆ $translations

ilCachedLanguage::$translations = array()
protected

Definition at line 24 of file class.ilCachedLanguage.php.

Referenced by getTranslations(), readFromCache(), and setTranslations().


The documentation for this class was generated from the following file: