ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Gettext\Languages\Exporter\Json Class Reference
+ Inheritance diagram for Gettext\Languages\Exporter\Json:
+ Collaboration diagram for Gettext\Languages\Exporter\Json:

Static Public Member Functions

static getDescription ()
 
- Static Public Member Functions inherited from Gettext\Languages\Exporter\Exporter
static getExporters ($onlyForPublicUse=false)
 Return the list of all the available exporters. More...
 
static getExporterDescription ($exporterHandle)
 Return the description of a specific exporter. More...
 
static getExporterClassName ($exporterHandle)
 Returns the fully qualified class name of a exporter given its handle. More...
 
static toString ($languages, $options=null)
 Convert a list of Language instances to string. More...
 
static toFile ($languages, $filename, $options=null)
 Save the Language instances to a file. More...
 
static isForPublicUse ()
 Is this exporter for public use? More...
 
static getDescription ()
 Return a short description of the exporter. More...
 

Static Protected Member Functions

static getEncodeOptions ()
 Return the options for json_encode. More...
 
static toStringDo ($languages)
 
static toStringDo ($languages)
 Convert a list of Language instances to string. More...
 

Detailed Description

Definition at line 4 of file Json.php.

Member Function Documentation

◆ getDescription()

static Gettext\Languages\Exporter\Json::getDescription ( )
static
See also
Exporter::getDescription

Reimplemented from Gettext\Languages\Exporter\Exporter.

Reimplemented in Gettext\Languages\Exporter\Prettyjson.

Definition at line 59 of file Json.php.

60 {
61 return 'Build a compressed JSON-encoded file';
62 }

◆ getEncodeOptions()

static Gettext\Languages\Exporter\Json::getEncodeOptions ( )
staticprotected

Return the options for json_encode.

Returns
int

Reimplemented in Gettext\Languages\Exporter\Prettyjson.

Definition at line 10 of file Json.php.

11 {
12 $result = 0;
13 if (defined('\JSON_UNESCAPED_SLASHES')) {
14 $result |= \JSON_UNESCAPED_SLASHES;
15 }
16 if (defined('\JSON_UNESCAPED_UNICODE')) {
17 $result |= \JSON_UNESCAPED_UNICODE;
18 }
19
20 return $result;
21 }
$result
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

References $result, and defined.

◆ toStringDo()

static Gettext\Languages\Exporter\Json::toStringDo (   $languages)
staticprotected
See also
Exporter::toStringDo

Reimplemented from Gettext\Languages\Exporter\Exporter.

Definition at line 25 of file Json.php.

26 {
27 $list = array();
28 foreach ($languages as $language) {
29 $item = array();
30 $item['name'] = $language->name;
31 if (isset($language->supersededBy)) {
32 $item['supersededBy'] = $language->supersededBy;
33 }
34 if (isset($language->script)) {
35 $item['script'] = $language->script;
36 }
37 if (isset($language->territory)) {
38 $item['territory'] = $language->territory;
39 }
40 if (isset($language->baseLanguage)) {
41 $item['baseLanguage'] = $language->baseLanguage;
42 }
43 $item['formula'] = $language->formula;
44 $item['plurals'] = count($language->categories);
45 $item['cases'] = array();
46 $item['examples'] = array();
47 foreach ($language->categories as $category) {
48 $item['cases'][] = $category->id;
49 $item['examples'][$category->id] = $category->examples;
50 }
51 $list[$language->id] = $item;
52 }
53
54 return json_encode($list, static::getEncodeOptions());
55 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41

References $list.


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