ILIAS  release_8 Revision v8.24
ilLanguageDetectorFactory Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilLanguageDetectorFactory:

Public Member Functions

 __construct ()
 
 getValidInstances ()
 
 createDetectorByType (int $type)
 

Protected Attributes

ilIniFile $client_ini
 
array $request_information = array()
 
ilSetting $settings
 

Private Attributes

const DEFAULT_DETECTOR = 1
 
const HTTP_REQUEST_DETECTOR = 2
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilLanguageDetectorFactory

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de /

Definition at line 27 of file class.ilLanguageDetectorFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ilLanguageDetectorFactory::__construct ( )

Definition at line 36 of file class.ilLanguageDetectorFactory.php.

37 {
38 global $DIC;
39
40 $this->client_ini = $DIC->clientIni();
41 $this->request_information = $_SERVER;
42 $this->settings = $DIC->settings();
43 }
global $DIC
Definition: feed.php:28
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10

References $_SERVER, $DIC, and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ createDetectorByType()

ilLanguageDetectorFactory::createDetectorByType ( int  $type)
Exceptions
ilLanguageException

Definition at line 67 of file class.ilLanguageDetectorFactory.php.

68 {
69 switch ($type) {
71 require_once "Services/Language/classes/class.ilHttpRequestsLanguageDetector.php";
72 return new ilHttpRequestsLanguageDetector($this->request_information["HTTP_ACCEPT_LANGUAGE"]);
73
75 require_once "Services/Language/classes/class.ilDefaultLanguageDetector.php";
76 return new ilDefaultLanguageDetector($this->client_ini);
77 }
78
79 require_once "Services/Language/exceptions/class.ilLanguageException.php";
80 throw new ilLanguageException(__METHOD__ . sprintf("Cannot create language detector instance for type %s!", $type));
81 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type

References $type, DEFAULT_DETECTOR, and HTTP_REQUEST_DETECTOR.

Referenced by getValidInstances().

+ Here is the caller graph for this function:

◆ getValidInstances()

ilLanguageDetectorFactory::getValidInstances ( )
Exceptions
ilLanguageException

Definition at line 48 of file class.ilLanguageDetectorFactory.php.

48 : array
49 {
50 $detectors = array(
51 $this->createDetectorByType(self::DEFAULT_DETECTOR)
52 );
53
54 if ($this->settings->get("lang_detection") &&
56 array_key_exists('HTTP_ACCEPT_LANGUAGE', $this->request_information)
57 ) {
58 $detectors[] = $this->createDetectorByType(self::HTTP_REQUEST_DETECTOR);
59 }
60
61 return $detectors;
62 }
static usesHTTP()
Uses HTTP aka browser.

References createDetectorByType(), ILIAS\Repository\settings(), and ilContext\usesHTTP().

+ Here is the call graph for this function:

Field Documentation

◆ $client_ini

ilIniFile ilLanguageDetectorFactory::$client_ini
protected

Definition at line 32 of file class.ilLanguageDetectorFactory.php.

◆ $request_information

array ilLanguageDetectorFactory::$request_information = array()
protected

Definition at line 33 of file class.ilLanguageDetectorFactory.php.

◆ $settings

ilSetting ilLanguageDetectorFactory::$settings
protected

Definition at line 34 of file class.ilLanguageDetectorFactory.php.

◆ DEFAULT_DETECTOR

const ilLanguageDetectorFactory::DEFAULT_DETECTOR = 1
private

Definition at line 29 of file class.ilLanguageDetectorFactory.php.

Referenced by createDetectorByType().

◆ HTTP_REQUEST_DETECTOR

const ilLanguageDetectorFactory::HTTP_REQUEST_DETECTOR = 2
private

Definition at line 30 of file class.ilLanguageDetectorFactory.php.

Referenced by createDetectorByType().


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