ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLanguageDetectorFactory Class Reference

Class ilLanguageDetectorFactory. More...

+ Collaboration diagram for ilLanguageDetectorFactory:

Public Member Functions

 getValidInstances ()
 
 createDetectorByType ($type)
 

Data Fields

const DEFAULT_DETECTOR = 1
 
const HTTP_REQUEST_DETECTOR = 2
 

Protected Attributes

 $client_ini
 
 $request_information = array()
 
 $settings
 

Detailed Description

Member Function Documentation

◆ createDetectorByType()

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

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

References $type.

Referenced by getValidInstances().

70  {
71  switch ($type) {
72  case self::HTTP_REQUEST_DETECTOR:
73  require_once 'Services/Language/classes/class.ilHttpRequestsLanguageDetector.php';
74  return new ilHttpRequestsLanguageDetector($this->request_information['HTTP_ACCEPT_LANGUAGE']);
75 
76  case self::DEFAULT_DETECTOR:
77  require_once 'Services/Language/classes/class.ilDefaultLanguageDetector.php';
78  return new ilDefaultLanguageDetector($this->client_ini);
79  }
80 
81  require_once 'Services/Language/exceptions/class.ilLanguageException.php';
82  throw new ilLanguageException(__METHOD__ . sprintf('Cannot create language detector instance for type %s!', $type));
83  }
$type
Class for language related exception handling in ILIAS.
Class ilDefaultLanguageDetector.
Class ilHttpRequestsLanguageDetector.
+ Here is the caller graph for this function:

◆ getValidInstances()

ilLanguageDetectorFactory::getValidInstances ( )
Returns
ilLanguageDetector[]

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

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

49  {
50  $detectors = array(
51  $this->createDetectorByType(self::DEFAULT_DETECTOR)
52  );
53 
54  if (
55  $this->settings->get('lang_detection') &&
57  ) {
58  $detectors[] = $this->createDetectorByType(self::HTTP_REQUEST_DETECTOR);
59  }
60 
61  return $detectors;
62  }
static usesHTTP()
Uses HTTP aka browser.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ 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.

◆ HTTP_REQUEST_DETECTOR

const ilLanguageDetectorFactory::HTTP_REQUEST_DETECTOR = 2

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


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