ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLanguageDetectorFactory Class Reference

Class ilLanguageDetectorFactory. More...

+ Collaboration diagram for ilLanguageDetectorFactory:

Public Member Functions

 __construct ()
 
 getValidInstances ()
 
 createDetectorByType ($type)
 

Data Fields

const DEFAULT_DETECTOR = 1
 
const HTTP_REQUEST_DETECTOR = 2
 

Protected Attributes

 $client_ini
 
 $request_information = array()
 
 $settings
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLanguageDetectorFactory::__construct ( )

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

33 {
34 global $DIC;
35
36 $this->client_ini = $DIC->clientIni();
37 $this->request_information = $_SERVER;
38 $this->settings = $DIC->settings();
39 }
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46

References $_SERVER, $DIC, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ createDetectorByType()

ilLanguageDetectorFactory::createDetectorByType (   $type)
Parameters
int$type
Exceptions
ilLanguageException
Returns
ilLanguageDetector

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

66 {
67 switch ($type) {
69 require_once 'Services/Language/classes/class.ilHttpRequestsLanguageDetector.php';
70 return new ilHttpRequestsLanguageDetector($this->request_information['HTTP_ACCEPT_LANGUAGE']);
71
73 require_once 'Services/Language/classes/class.ilDefaultLanguageDetector.php';
74 return new ilDefaultLanguageDetector($this->client_ini);
75 }
76
77 require_once 'Services/Language/exceptions/class.ilLanguageException.php';
78 throw new ilLanguageException(__METHOD__ . sprintf('Cannot create language detector instance for type %s!', $type));
79 }
Class ilDefaultLanguageDetector.
Class ilHttpRequestsLanguageDetector.
Class for language related exception handling in ILIAS.
$type

References $type, DEFAULT_DETECTOR, and HTTP_REQUEST_DETECTOR.

Referenced by getValidInstances().

+ Here is the caller graph for this function:

◆ getValidInstances()

ilLanguageDetectorFactory::getValidInstances ( )
Returns
ilLanguageDetector[]

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

45 {
46 $detectors = array(
47 $this->createDetectorByType(self::DEFAULT_DETECTOR)
48 );
49
50 if (
51 $this->settings->get('lang_detection') &&
53 ) {
54 $detectors[] = $this->createDetectorByType(self::HTTP_REQUEST_DETECTOR);
55 }
56
57 return $detectors;
58 }
static usesHTTP()
Uses HTTP aka browser.

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

+ Here is the call graph for this function:

Field Documentation

◆ $client_ini

ilLanguageDetectorFactory::$client_ini
protected

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

◆ $request_information

ilLanguageDetectorFactory::$request_information = array()
protected

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

◆ $settings

ilLanguageDetectorFactory::$settings
protected

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

◆ DEFAULT_DETECTOR

const ilLanguageDetectorFactory::DEFAULT_DETECTOR = 1

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

Referenced by createDetectorByType().

◆ HTTP_REQUEST_DETECTOR

const ilLanguageDetectorFactory::HTTP_REQUEST_DETECTOR = 2

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

Referenced by createDetectorByType().


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