YaWK  24.1
Yet another WebKit
language.php
Go to the documentation of this file.
1 <?php
2 namespace YAWK {
3  /**
4  * @details <b>Get and set the backend language.</b>
5  *
6  * <p>Language Support for Backend</i></p>
7  * The language files are located in<br>
8  * admin/language/lang-en-EN.ini
9  *
10  * @author Daniel Retzl <[email protected]>
11  * @copyright 2017 Daniel Retzl
12  * @license https://opensource.org/licenses/MIT
13  * @version 1.0.0
14  * @brief The language class - support multilingual backend
15  */
16  class language
17  {
18  /** * @param array $lang language array */
19  public $lang;
20  /** * @param string $defaultLanguage default language if no supported language can be detected */
22  /** * @param string $currentLanguage current setted language in format: en-EN */
24  /** * @param string $currentLanguage current setted language in format: en-EN */
26  /** * @param string $currentLanguageGlobal current setted language in format: en */
28  /** * @param string $detectedLanguage current detected language in format: en-EN */
30  /** * @param string $detectedLanguageGlobal current detected language in format: en */
32  /** * @param string $httpAcceptedLanguage current $_SERVER['HTTP_ACCEPTED_LANGUAGE'] in format: en-EN */
34  /** * @param string $pathToFile the path to the language file */
35  public $pathToFile;
36  /** * @param array $supportedLanguagesGlobal array that contains all supported languages, shortened to the first 2 chars eg. (en) */
38  /** * @param array $supportedLanguages array that contains all supported languages, but the full tag eg. (en-EN) */
40 
41  /**
42  * @brief initialize and return current language
43  * @return array|bool
44  * @copyright 2009-2016 Daniel Retzl
45  */
46  public function init($db, $referer)
47  {
48  // set current language
49  $this->httpAcceptedLanguage = $this->getClientLanguage();
50  $this->currentFrontendLanguage = settings::getSetting($db, "frontendLanguage");
51  $this->currentLanguage = $this->getCurrentLanguage($db, $referer);
52  return $this->setLanguage($this->currentLanguage);
53  }
54 
55  /**
56  * @brief returns the currently set language
57  * @copyright 2017 Daniel Retzl
58  * @param object $db database object
59  * @param string $referer frontend|backend from where it the call referred?
60  * @return string
61  */
62  public function getCurrentLanguage($db, $referer): string
63  {
64 
65  if (isset($referer) && (is_string($referer)))
66  {
67  if ($referer == "frontend")
68  {
69  if ($this->currentLanguage = settings::getSetting($db, "frontendLanguage"))
70  {
71  $_SESSION['lang'] = $this->currentLanguage;
72  // return current language from db-settings// if not, try to set it - with error supressor to avoid notices if output started before
73  @setcookie('lang', $this->currentLanguage, time() + (60 * 60 * 24 * 1460));
75  }
76  else
77  { // failed to get language
78  $this->currentLanguage = "en-EN"; // default: en-EN
79  $_SESSION['lang'] = $this->currentLanguage;
80  // return default value (en-EN)
82  }
83  }
84  else if ($referer == "backend")
85  {
86 
87  if ($this->currentLanguage = settings::getSetting($db, "backendLanguage"))
88  {
89  $_SESSION['lang'] = $this->currentLanguage;
90  // return current language from db-settings// if not, try to set it - with error supressor to avoid notices if output started before
91  @setcookie('lang', $this->currentLanguage, time() + (60 * 60 * 24 * 1460));
93  }
94  else
95  { // failed to get language
96  $this->currentLanguage = "en-EN"; // default: en-EN
97  $_SESSION['lang'] = $this->currentLanguage;
98  // return default value (en-EN)
100  }
101  }
102  else
103  {
104  if ($this->currentLanguage = settings::getSetting($db, "backendLanguage"))
105  {
106  $_SESSION['lang'] = $this->currentLanguage;
107  // return current language from db-settings// if not, try to set it - with error supressor to avoid notices if output started before
108  @setcookie('lang', $this->currentLanguage, time() + (60 * 60 * 24 * 1460));
109  return $this->currentLanguage;
110  }
111  else
112  { // failed to get language
113  $this->currentLanguage = "en-EN"; // default: en-EN
114  $_SESSION['lang'] = $this->currentLanguage;
115  // return default value (en-EN)
116  return $this->currentLanguage;
117  }
118  }
119  }
120  else
121  {
122  if ($this->currentLanguage = settings::getSetting($db, "backendLanguage"))
123  {
124  $_SESSION['lang'] = $this->currentLanguage;
125  // return current language from db-settings// if not, try to set it - with error supressor to avoid notices if output started before
126  @setcookie('lang', $this->currentLanguage, time() + (60 * 60 * 24 * 1460));
127  return $this->currentLanguage;
128  }
129  else
130  { // failed to get language
131  $this->currentLanguage = "en-EN"; // default: en-EN
132  $_SESSION['lang'] = $this->currentLanguage;
133  // return default value (en-EN)
134  return $this->currentLanguage;
135  }
136  }
137  }
138 
139  /**
140  * @brief returns the currently set backend language, but is static callable
141  * @author Daniel Retzl <[email protected]>
142  * @copyright 2017 Daniel Retzl
143  * @license https://opensource.org/licenses/MIT
144  * @return string
145  */
146  static function getCurrentLanguageStatic()
147  {
148  $currentLanguage = '';
149  // check if a GET param is set
150  if (isset($_GET['lang']) && (!empty($_GET['lang'])))
151  {
152  $currentLanguage = $_GET['lang']; // set GET param as current language
153  // register and overwrite session var
154  $_SESSION['lang'] = $currentLanguage;
155  // and check if cookie is set
156  if (empty($_COOKIE['lang']))
157  { // if not, try to set it - with error suppressor to avoid notices if output started before
158  @setcookie('lang', $currentLanguage, time() + (60 * 60 * 24 * 1460));
159  }
160  /* language set, cookie set */
161  return $currentLanguage;
162  }
163  else
164  {
165  // GET param not set, check if there is a $_SESSION[lang]
166  if (isset($_SESSION['lang']) && (!empty($_SESSION['lang'])))
167  {
168  // session var is set
169  return $_SESSION['lang'];
170  }
171  // SESSION param not set, check if there is a $_COOKIE[lang]
172  elseif (isset($_COOKIE['lang']) && (!empty($_COOKIE['lang'])))
173  {
174  // cookie var is set
175  return $_COOKIE['lang'];
176  }
177  else
178  {
179  // get language setting from database
180  if (!isset($db))
181  { // create new db object
182  require_once '../system/classes/db.php';
183  require_once '../system/classes/settings.php';
184  $db = new db();
185  }
186  // get backend language setting and save string eg. (en-EN) in $this->current
187  if (!($currentLanguage = (settings::getSetting($db, "backendLanguage")) === true)) { // failed to get backend language
188  $currentLanguage = "en-EN"; // default: en-EN
189  // return default value (en-EN)
190  }
191  return $currentLanguage;
192  }
193  }
194  }
195 
196 
197  /**
198  * @brief get and return client language
199  * @author Daniel Retzl <[email protected]>
200  * @copyright 2009-2016 Daniel Retzl
201  * @license https://opensource.org/licenses/MIT
202  * @return string
203  */
204  public function getClientLanguage(): string
205  {
206  // check if browser tells any accepted language
207  if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) || (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])))
208  { // format the string to eg: en-EN
209  $this->httpAcceptedLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 5);
210  $this->currentLanguageGlobal = substr($this->httpAcceptedLanguage, 0, 2);
212  }
213  else
214  { // var empty - cannot detect -
215  return false;
216  }
217  }
218 
219  /**
220  * @brief sets object supportedLanguages as array including all supported languages
221  * @author Daniel Retzl <[email protected]>
222  * @copyright 2009-2016 Daniel Retzl
223  * @license https://opensource.org/licenses/MIT
224  * @return bool
225  */
226  public function getSupportedLanguages(): bool
227  {
228  // walk /admin/language folder and get all language files into an array
229  require_once ('system/classes/filemanager.php');
230  $languageFiles = filemanager::getFilesFromFolderToArray('admin/language');
231  foreach ($languageFiles AS $file)
232  {
233  if ($file != ".htaccess")
234  {
235  $globalLanguageTag = substr($file, 5, -7);
236  $this->supportedLanguagesGlobal[] = $globalLanguageTag;
237  $localLanguageTag = substr($file, 5, -4);
238  $this->supportedLanguages[] = $localLanguageTag;
239  // $this->supportedLanguages[] = $globalLanguageTag;
240  }
241  }
242  if (is_array($this->supportedLanguagesGlobal) && (is_array($this->supportedLanguages)))
243  {
244  return true;
245  }
246  else
247  {
248  return false;
249  }
250  }
251 
252  /**
253  * @brief Check if a language is supported. This functions expect currentLanguage string in format "en-EN" or "en"
254  * @param string $currentLanguage language in format: en-EN or en
255  * @return bool
256  * @license https://opensource.org/licenses/MIT
257  * @copyright 2017 Daniel Retzl
258  */
259  public function isSupported(string $currentLanguage): bool
260  {
261  // create arrays with supported languages, one in format "en", the other one "en-EN"
262  $this->getSupportedLanguages();
263 
264  // check if language is set and not empty
265  if (isset($currentLanguage) && (!empty($currentLanguage)))
266  {
267  // if language is submitted as global language tag (short, like: en instead of en-EN)
268  if (strlen($currentLanguage) <= 2)
269  {
270  // check if supportedLanguages match with language
271  if (in_array($currentLanguage, $this->supportedLanguagesGlobal))
272  {
273  // language is supported
274  // $language->setLanguage($language->currentLanguageGlobal); // set language
275  return true;
276  }
277  else
278  {
279  // detected language is not supported, set en-EN as default
280  return false;
281  }
282  } // end global language tag (en)
283  else
284  { // check supportedLanguagesLocal match with detected user language
285  if (in_array($currentLanguage, $this->supportedLanguages))
286  { // language supported
287  return true;
288  }
289  else
290  { // language not supported
291  return false;
292  }
293  }
294  }
295  else
296  { // language is not set
297  return false;
298  }
299  }
300 
301  /**
302  * @brief Set a language as default and load (set) it current language
303  * @param string $defaultLanguage language in format: en-EN or en
304  * @copyright 2017 Daniel Retzl
305  * @license https://opensource.org/licenses/MIT
306  */
307  public function setDefault(string $defaultLanguage)
308  {
309  if ((!empty($defaultLanguage)))
310  {
311  // set default language
312  $this->currentLanguage = $defaultLanguage;
313  $this->setLanguage($defaultLanguage);
314  }
315  }
316 
317  /**
318  * @brief Returns the path to the language file
319  * @copyright 2017 Daniel Retzl
320  * @license https://opensource.org/licenses/MIT
321  * return string
322  */
323  public function getPathToLanguageFile()
324  {
325  // check if call comes from frontend or backend
326  if(stristr($_SERVER['PHP_SELF'], '/admin/') == TRUE)
327  {
328  // call seem to come from BACKEND
329  // check if directory is reachable
330  if (is_dir("language/"))
331  {
332  // set path to backend
333  $this->pathToFile = "language/";
334  }
335  elseif (is_dir("admin/language/"))
336  {
337  $this->pathToFile = "admin/language";
338  }
339  // call seems to come from admin/js/ folder (probably a class called by ajax in /system/classes/*
340  elseif (is_dir("../language/"))
341  {
342  $base_dir = __DIR__;
343  $base_dir = substr($base_dir, 0, -15); // remove last 15 chars
344  $this->pathToFile = $base_dir."/admin/language/";
345  }
346  else
347  {
348  '';
349  }
350  }
351 
352  // if setup is running
353  else if (isset($_SESSION['SETUP']) && ($_SESSION['SETUP'] == TRUE))
354  { // load backend language files
355  $this->pathToFile = "admin/language/";
356  }
357 
358  // in any other case load frontend language
359  else
360  { // set path to FRONTEND
361  if (is_dir("system/language/"))
362  { // set frontend language path
363  $this->pathToFile = "system/language/";
364  }
365  // if frontend language files are not reachable, check if backend language files exist
366  else if (is_dir("admin/language"))
367  { // load backend files instead
368  $this->pathToFile = "admin/language/";
369  }
370  // if frontend language files are not reachable, check if backend language files exist
371  else if (is_dir("../../../language"))
372  { // load backend files instead
373  $this->pathToFile = "../../../language/";
374  }
375  else
376  { // no language files found (even no backend files)
377  die ("ERROR: Unable to load language files. Several conditions failed - files are missing or corrupt. Please inform the page administrator about this concern.");
378  }
379  }
380  return $this->pathToFile;
381  }
382 
383  /**
384  * @brief set client language and parse corresponding ini file to an array called $lang
385  * @param string $currentLanguage the current language as string (e.g. en-US)
386  * @return array|bool $lang returns a language array
387  */
388  public function setLanguage(string $currentLanguage)
389  {
390  $this->pathToFile = $this->getPathToLanguageFile();
391 
392  // short language identify string global (just 2 chars) sent
393  if (strlen($currentLanguage) == 2)
394  { // build a proper currentLanguage string
395  $global = $currentLanguage;
396  $local = strtoupper($currentLanguage);
397  $currentLanguage = "$global-$local";
398  $this->currentLanguage = $currentLanguage;
399  }
400  // if language file exists...
401  if (is_file("$this->pathToFile"."lang-"."$currentLanguage".".ini"))
402  { // parse language file into array
403  if ($this->lang = parse_ini_file("$this->pathToFile"."lang-"."$currentLanguage".".ini"))
404  { // file loaded, return language array
405  return $this->lang;
406  }
407  else
408  { // file could not be parsed into array - abort with error
409  die ("could not load language file: $this->pathToFile"."lang-"."$currentLanguage".".ini");
410  }
411  }
412  // language file does not exist - check if an en-EN file exists...
413  elseif (is_file("$this->pathToFile"."lang-en-EN.ini"))
414  { // parse language file into array
415  if ($this->lang = parse_ini_file("$this->pathToFile"."lang-en-EN.ini"))
416  { // file loaded, return language array
417  return $this->lang;
418  }
419  else
420  { // file could not be parsed into array - abort with error
421  die ("ERROR: Could not load language file: $this->pathToFile"."lang-en-EN.ini");
422  }
423  }
424  else
425  { // language file not found
426  // english (default) language file not found
427  // abort with error
428  die ("CRITICAL ERROR: No language file found. It should be there, but it isn't. This is strange. Please check $this->pathToFile and install a language file.");
429  }
430  } /* end setLanguage */
431 
432 
433  /**
434  * @brief allow plugins to inject language tags to $lang array
435  * @param array $lang the language data array
436  * @param string $pathToFile absolute path to the injectable language file
437  * @return array $lang returns pushed language array
438  */
439  static function inject(array $lang, string $pathToFile): array
440  {
441  // check if language is saved in session or cookie to prevent unnecessary db actions
442  if (isset($_SESSION['lang']))
443  { // set from session setting
444  $currentLanguage = $_SESSION['lang'];
445  }
446  elseif (isset($_COOKIE['lang']))
447  { // set from cookie setting
448  $currentLanguage = $_COOKIE['lang'];
449  }
450  elseif (isset($_GET['lang']))
451  { // set from cookie setting
452  $currentLanguage = $_GET['lang'];
453  }
454  else
455  { // get current language from db
457  if (isset($currentLanguage) && (!empty($currentLanguage)))
458  { // set session var to save database resources
459  $_SESSION['lang'] = $currentLanguage;
460  }
461  }
462 
463  // get injectable tags from additional language file
464  $additionalTags = parse_ini_file("$pathToFile"."$currentLanguage".".ini");
465  // add every tag, once per row
466  foreach ($additionalTags AS $tag => $value)
467  { // add data to $lang array
468  $lang[$tag] = $value;
469  }
470  // fin -
471  return $lang;
472  } /* end setLanguage */
473 
474  /**
475  * @brief return options (inner html) for a language select field
476  * @return string returns a string with all possible language options
477  */
478  static function drawLanguageSelectOptions(): string
479  {
480  return '<option value=""></option>
481  <option value="af">Afrikaans</option>
482  <option value="sq">Albanian - shqip</option>
483  <option value="am">Amharic - አማርኛ</option>
484  <option value="ar">Arabic - العربية</option>
485  <option value="an">Aragonese - aragonés</option>
486  <option value="hy">Armenian - հայերեն</option>
487  <option value="ast">Asturian - asturianu</option>
488  <option value="az">Azerbaijani - azərbaycan dili</option>
489  <option value="eu">Basque - euskara</option>
490  <option value="be">Belarusian - беларуская</option>
491  <option value="bn">Bengali - বাংলা</option>
492  <option value="bs">Bosnian - bosanski</option>
493  <option value="br">Breton - brezhoneg</option>
494  <option value="bg">Bulgarian - български</option>
495  <option value="ca">Catalan - català</option>
496  <option value="ckb">Central Kurdish - کوردی (دەستنوسی عەرەبی)</option>
497  <option value="zh">Chinese - 中文</option>
498  <option value="zh-HK">Chinese (Hong Kong) - 中文(香港)</option>
499  <option value="zh-CN">Chinese (Simplified) - 中文(简体)</option>
500  <option value="zh-TW">Chinese (Traditional) - 中文(繁體)</option>
501  <option value="co">Corsican</option>
502  <option value="hr">Croatian - hrvatski</option>
503  <option value="cs">Czech - čeština</option>
504  <option value="da">Danish - dansk</option>
505  <option value="nl">Dutch - Nederlands</option>
506  <option value="en">English</option>
507  <option value="en-AU">English (Australia)</option>
508  <option value="en-CA">English (Canada)</option>
509  <option value="en-IN">English (India)</option>
510  <option value="en-NZ">English (New Zealand)</option>
511  <option value="en-ZA">English (South Africa)</option>
512  <option value="en-GB">English (United Kingdom)</option>
513  <option value="en-US">English (United States)</option>
514  <option value="eo">Esperanto - esperanto</option>
515  <option value="et">Estonian - eesti</option>
516  <option value="fo">Faroese - føroyskt</option>
517  <option value="fil">Filipino</option>
518  <option value="fi">Finnish - suomi</option>
519  <option value="fr">French - français</option>
520  <option value="fr-CA">French (Canada) - français (Canada)</option>
521  <option value="fr-FR">French (France) - français (France)</option>
522  <option value="fr-CH">French (Switzerland) - français (Suisse)</option>
523  <option value="gl">Galician - galego</option>
524  <option value="ka">Georgian - ქართული</option>
525  <option value="de">German - Deutsch</option>
526  <option value="de-AT">German (Austria) - Deutsch (Österreich)</option>
527  <option value="de-DE">German (Germany) - Deutsch (Deutschland)</option>
528  <option value="de-LI">German (Liechtenstein) - Deutsch (Liechtenstein)</option>
529  <option value="de-CH">German (Switzerland) - Deutsch (Schweiz)</option>
530  <option value="el">Greek - Ελληνικά</option>
531  <option value="gn">Guarani</option>
532  <option value="gu">Gujarati - ગુજરાતી</option>
533  <option value="ha">Hausa</option>
534  <option value="haw">Hawaiian - ʻŌlelo Hawaiʻi</option>
535  <option value="he">Hebrew - עברית</option>
536  <option value="hi">Hindi - हिन्दी</option>
537  <option value="hu">Hungarian - magyar</option>
538  <option value="is">Icelandic - íslenska</option>
539  <option value="id">Indonesian - Indonesia</option>
540  <option value="ia">Interlingua</option>
541  <option value="ga">Irish - Gaeilge</option>
542  <option value="it">Italian - italiano</option>
543  <option value="it-IT">Italian (Italy) - italiano (Italia)</option>
544  <option value="it-CH">Italian (Switzerland) - italiano (Svizzera)</option>
545  <option value="ja">Japanese - 日本語</option>
546  <option value="kn">Kannada - ಕನ್ನಡ</option>
547  <option value="kk">Kazakh - қазақ тілі</option>
548  <option value="km">Khmer - ខ្មែរ</option>
549  <option value="ko">Korean - 한국어</option>
550  <option value="ku">Kurdish - Kurdî</option>
551  <option value="ky">Kyrgyz - кыргызча</option>
552  <option value="lo">Lao - ລາວ</option>
553  <option value="la">Latin</option>
554  <option value="lv">Latvian - latviešu</option>
555  <option value="ln">Lingala - lingála</option>
556  <option value="lt">Lithuanian - lietuvių</option>
557  <option value="mk">Macedonian - македонски</option>
558  <option value="ms">Malay - Bahasa Melayu</option>
559  <option value="ml">Malayalam - മലയാളം</option>
560  <option value="mt">Maltese - Malti</option>
561  <option value="mr">Marathi - मराठी</option>
562  <option value="mn">Mongolian - монгол</option>
563  <option value="ne">Nepali - नेपाली</option>
564  <option value="no">Norwegian - norsk</option>
565  <option value="nb">Norwegian Bokmål - norsk bokmål</option>
566  <option value="nn">Norwegian Nynorsk - nynorsk</option>
567  <option value="oc">Occitan</option>
568  <option value="or">Oriya - ଓଡ଼ିଆ</option>
569  <option value="om">Oromo - Oromoo</option>
570  <option value="ps">Pashto - پښتو</option>
571  <option value="fa">Persian - فارسی</option>
572  <option value="pl">Polish - polski</option>
573  <option value="pt">Portuguese - português</option>
574  <option value="pt-BR">Portuguese (Brazil) - português (Brasil)</option>
575  <option value="pt-PT">Portuguese (Portugal) - português (Portugal)</option>
576  <option value="pa">Punjabi - ਪੰਜਾਬੀ</option>
577  <option value="qu">Quechua</option>
578  <option value="ro">Romanian - română</option>
579  <option value="mo">Romanian (Moldova) - română (Moldova)</option>
580  <option value="rm">Romansh - rumantsch</option>
581  <option value="ru">Russian - русский</option>
582  <option value="gd">Scottish Gaelic</option>
583  <option value="sr">Serbian - српски</option>
584  <option value="sh">Serbo-Croatian - Srpskohrvatski</option>
585  <option value="sn">Shona - chiShona</option>
586  <option value="sd">Sindhi</option>
587  <option value="si">Sinhala - සිංහල</option>
588  <option value="sk">Slovak - slovenčina</option>
589  <option value="sl">Slovenian - slovenščina</option>
590  <option value="so">Somali - Soomaali</option>
591  <option value="st">Southern Sotho</option>
592  <option value="es">Spanish - español</option>
593  <option value="es-AR">Spanish (Argentina) - español (Argentina)</option>
594  <option value="es-419">Spanish (Latin America) - español (Latinoamérica)</option>
595  <option value="es-MX">Spanish (Mexico) - español (México)</option>
596  <option value="es-ES">Spanish (Spain) - español (España)</option>
597  <option value="es-US">Spanish (United States) - español (Estados Unidos)</option>
598  <option value="su">Sundanese</option>
599  <option value="sw">Swahili - Kiswahili</option>
600  <option value="sv">Swedish - svenska</option>
601  <option value="tg">Tajik - тоҷикӣ</option>
602  <option value="ta">Tamil - தமிழ்</option>
603  <option value="tt">Tatar</option>
604  <option value="te">Telugu - తెలుగు</option>
605  <option value="th">Thai - ไทย</option>
606  <option value="ti">Tigrinya - ትግርኛ</option>
607  <option value="to">Tongan - lea fakatonga</option>
608  <option value="tr">Turkish - Türkçe</option>
609  <option value="tk">Turkmen</option>
610  <option value="tw">Twi</option>
611  <option value="uk">Ukrainian - українська</option>
612  <option value="ur">Urdu - اردو</option>
613  <option value="ug">Uyghur</option>
614  <option value="uz">Uzbek - o‘zbek</option>
615  <option value="vi">Vietnamese - Tiếng Việt</option>
616  <option value="wa">Walloon - wa</option>
617  <option value="cy">Welsh - Cymraeg</option>
618  <option value="fy">Western Frisian</option>
619  <option value="xh">Xhosa</option>
620  <option value="yi">Yiddish</option>
621  <option value="yo">Yoruba - Èdè Yorùbá</option>
622  <option value="zu">Zulu - isiZulu</option>';
623  }
624 
625  } /* END CLASS */
626 }
die
Definition: block-user.php:27
Mysqli database class; returns db connection object.
Definition: db.php:16
static getFilesFromFolderToArray($folder)
returns an array containing only files from folder (no subfolders)
The language class - support multilingual backend.
Definition: language.php:17
setDefault(string $defaultLanguage)
Set a language as default and load (set) it current language.
Definition: language.php:307
$currentLanguageGlobal
Definition: language.php:27
getClientLanguage()
get and return client language
Definition: language.php:204
getPathToLanguageFile()
Returns the path to the language file.
Definition: language.php:323
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
Definition: language.php:439
$supportedLanguagesGlobal
Definition: language.php:37
getSupportedLanguages()
sets object supportedLanguages as array including all supported languages
Definition: language.php:226
static drawLanguageSelectOptions()
return options (inner html) for a language select field
Definition: language.php:478
isSupported(string $currentLanguage)
Check if a language is supported. This functions expect currentLanguage string in format "en-EN" or "...
Definition: language.php:259
init($db, $referer)
initialize and return current language
Definition: language.php:46
setLanguage(string $currentLanguage)
set client language and parse corresponding ini file to an array called $lang
Definition: language.php:388
static getCurrentLanguageStatic()
returns the currently set backend language, but is static callable
Definition: language.php:146
getCurrentLanguage($db, $referer)
returns the currently set language
Definition: language.php:62
$currentFrontendLanguage
Definition: language.php:25
$detectedLanguageGlobal
Definition: language.php:31
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $_GET['id']
Definition: page-edit.php:357
$value