ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Gettext\Languages\Exporter\Php Class Reference
+ Inheritance diagram for Gettext\Languages\Exporter\Php:
+ Collaboration diagram for Gettext\Languages\Exporter\Php:

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 toStringDo ($languages)
 
- Static Protected Member Functions inherited from Gettext\Languages\Exporter\Exporter
static toStringDo ($languages)
 Convert a list of Language instances to string. More...
 

Detailed Description

Definition at line 4 of file Php.php.

Member Function Documentation

◆ getDescription()

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

Definition at line 51 of file Php.php.

52  {
53  return 'Build a PHP array';
54  }

◆ toStringDo()

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

Definition at line 9 of file Php.php.

References $c, $languages, and $lc.

10  {
11  $lines = array();
12  $lines[] = '<?php';
13  $lines[] = 'return array(';
14  foreach ($languages as $lc) {
15  $lines[] = ' \''.$lc->id.'\' => array(';
16  $lines[] = ' \'name\' => \''.addslashes($lc->name).'\',';
17  if (isset($lc->supersededBy)) {
18  $lines[] = ' \'supersededBy\' => \''.$lc->supersededBy.'\',';
19  }
20  if (isset($lc->script)) {
21  $lines[] = ' \'script\' => \''.addslashes($lc->script).'\',';
22  }
23  if (isset($lc->territory)) {
24  $lines[] = ' \'territory\' => \''.addslashes($lc->territory).'\',';
25  }
26  if (isset($lc->baseLanguage)) {
27  $lines[] = ' \'baseLanguage\' => \''.addslashes($lc->baseLanguage).'\',';
28  }
29  $lines[] = ' \'formula\' => \''.$lc->formula.'\',';
30  $lines[] = ' \'plurals\' => '.count($lc->categories).',';
31  $catNames = array();
32  foreach ($lc->categories as $c) {
33  $catNames[] = "'{$c->id}'";
34  }
35  $lines[] = ' \'cases\' => array('.implode(', ', $catNames).'),';
36  $lines[] = ' \'examples\' => array(';
37  foreach ($lc->categories as $c) {
38  $lines[] = ' \''.$c->id.'\' => \''.$c->examples.'\',';
39  }
40  $lines[] = ' ),';
41  $lines[] = ' ),';
42  }
43  $lines[] = ');';
44  $lines[] = '';
45 
46  return implode("\n", $lines);
47  }
$lc
Definition: date.php:267
$languages
Definition: cssgen2.php:34

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