ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLanguageDetectorFactory Class Reference

Class ilLanguageDetectorFactory. 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

Constructor & Destructor Documentation

◆ __construct()

ilLanguageDetectorFactory::__construct ( )

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

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

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 66 of file class.ilLanguageDetectorFactory.php.

67 {
68 switch ($type) {
70 return new ilHttpRequestsLanguageDetector($this->request_information["HTTP_ACCEPT_LANGUAGE"]);
71
73 return new ilDefaultLanguageDetector($this->client_ini);
74 }
75
76 throw new ilLanguageException(__METHOD__ . sprintf("Cannot create language detector instance for type %s!", $type));
77 }
Class ilDefaultLanguageDetector.
Class ilHttpRequestsLanguageDetector.
Class for language related exception handling in ILIAS.

References 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 47 of file class.ilLanguageDetectorFactory.php.

47 : array
48 {
49 $detectors = array(
50 $this->createDetectorByType(self::DEFAULT_DETECTOR)
51 );
52
53 if ($this->settings->get("lang_detection") &&
55 array_key_exists('HTTP_ACCEPT_LANGUAGE', $this->request_information)
56 ) {
57 $detectors[] = $this->createDetectorByType(self::HTTP_REQUEST_DETECTOR);
58 }
59
60 return $detectors;
61 }
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 31 of file class.ilLanguageDetectorFactory.php.

◆ $request_information

array ilLanguageDetectorFactory::$request_information = array()
protected

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

◆ $settings

ilSetting ilLanguageDetectorFactory::$settings
protected

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

◆ DEFAULT_DETECTOR

const ilLanguageDetectorFactory::DEFAULT_DETECTOR = 1
private

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

Referenced by createDetectorByType().

◆ HTTP_REQUEST_DETECTOR

const ilLanguageDetectorFactory::HTTP_REQUEST_DETECTOR = 2
private

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

Referenced by createDetectorByType().


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