diff options
Diffstat (limited to 'it_text.class')
-rw-r--r-- | it_text.class | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/it_text.class b/it_text.class index 07b0e7a..5e33395 100644 --- a/it_text.class +++ b/it_text.class @@ -266,16 +266,20 @@ function dump_php() # Special sorting: natural, but _ is the first entry uksort($this->statictext, "strnatcmp"); - $this->statictext = array_merge(array('_' => $this->statictext['_']), $this->statictext); + $this->statictext = array_merge(['_' => $this->statictext['_']], $this->statictext); $oldmask = umask(002); $filename = $this->p['phpfiles'][0]; if ((count($this->p['phpfiles']) == 1)) { - $dump = '<?php return ' . strtr(var_export($this->statictext, true), array("=> \n array (" => "=> array(", "array (\n '_'" => "array(\n'_'", "\n ),\n " => "\n),\n", "\n ),\n" => "\n),\n", "\r" => "")) . ";\n?>\n"; - it::file_put_contents($tmpfile = tempnam('/tmp/', 'texts_'), $dump); - $result = it::system('/www/server/bin/convertsyntax.php -a {tmpfile} >{filename}', ['tmpfile' => $tmpfile, 'filename' => $filename]) == 0; - unlink($tmpfile); + foreach ($this->statictext as $label => $texts) + { + $dump .= var_export($label, true) . " => [\n"; + foreach ($texts as $lang => $text) + $dump .= " " . var_export($lang, true) . " => " . var_export($text, true) . ",\n"; + $dump .= "],\n"; + } + $result = it::file_put_contents($filename, "<?php return [\n$dump];\n"); } umask($oldmask); @@ -283,4 +287,3 @@ function dump_php() } } /* End class it_text */ -?> |