ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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:22
+ 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.

Referenced by getValidInstances().

67  {
68  switch ($type) {
69  case self::HTTP_REQUEST_DETECTOR:
70  return new ilHttpRequestsLanguageDetector($this->request_information["HTTP_ACCEPT_LANGUAGE"]);
71 
72  case self::DEFAULT_DETECTOR:
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 for language related exception handling in ILIAS.
Class ilDefaultLanguageDetector.
Class ilHttpRequestsLanguageDetector.
+ Here is the caller graph for this function:

◆ getValidInstances()

ilLanguageDetectorFactory::getValidInstances ( )
Exceptions
ilLanguageException

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

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

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.
+ 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.

◆ HTTP_REQUEST_DETECTOR

const ilLanguageDetectorFactory::HTTP_REQUEST_DETECTOR = 2
private

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


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