ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Php.php
Go to the documentation of this file.
1 <?php
3 
4 class Php extends Exporter
5 {
9  protected static function toStringDo($languages)
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  }
51  public static function getDescription()
52  {
53  return 'Build a PHP array';
54  }
55 }
Base class for all the exporters.
Definition: Exporter.php:10
PHP
Definition: index.php:3
static toStringDo($languages)
Definition: Php.php:9
$lc
Definition: date.php:267
$languages
Definition: cssgen2.php:34