curly braces + spaces added

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-26 14:44:46 +01:00 committed by Roland Haeder
parent 15c77beee2
commit 720e7d6034
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
7 changed files with 121 additions and 97 deletions

View file

@ -43,21 +43,24 @@ function string_plural_select($n){
foreach ($arr as $a) {
if (is_array($a)){
if(substr($a[1],0,1) == '$')
if (substr($a[1],0,1) == '$') {
continue;
}
$s .= '$a->strings[' . $a[0] . "] = array(\n";
$s .= "\t0 => ". $a[0]. ",\n";
$s .= "\t1 => ". $a[1]. ",\n";
$s .= ");\n";
} else {
if(substr($a,0,1) == '$')
if (substr($a,0,1) == '$') {
continue;
}
$s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n";
}
}
$zones = timezone_identifiers_list();
foreach($zones as $zone)
foreach ($zones as $zone) {
$s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
}
echo $s;

View file

@ -17,14 +17,16 @@ unset($db_host, $db_user, $db_pass, $db_data);
Config::load();
$maint_mode = 1;
if($argc > 1)
if ($argc > 1) {
$maint_mode = intval($argv[1]);
}
set_config('system', 'maintenance', $maint_mode);
if($maint_mode)
if ($maint_mode) {
$mode_str = "maintenance mode";
else
} else {
$mode_str = "normal mode";
}
echo "\n\tSystem set in $mode_str\n\n";
echo "Usage:\n\n";

View file

@ -42,7 +42,9 @@ function po2php_run(&$argv, &$argc) {
foreach ($infile as $l) {
$l = str_replace('\"', DQ_ESCAPE, $l);
$len = strlen($l);
if ($l[0]=="#") $l="";
if ($l[0]=="#") {
$l="";
}
if (substr($l,0,15) == '"Plural-Forms: '){
$match=Array();
preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match);
@ -55,12 +57,15 @@ function po2php_run(&$argv, &$argc) {
$out .= '}}'."\n";
}
if ($k!="" && substr($l,0,7) == "msgstr "){
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($ink) {
$ink = False;
$out .= '$a->strings["'.$k.'"] = ';
}
if ($inv) {
$inv = False;
$out .= '"'.$v.'"';
}
$v = substr($l,8,$len-10);
$v = preg_replace_callback($escape_s_exp,'escape_s',$v);
@ -68,8 +73,14 @@ function po2php_run(&$argv, &$argc) {
//$out .= $v;
}
if ($k!="" && substr($l,0,7) == "msgstr["){
if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($ink) {
$ink = False;
$out .= '$a->strings["'.$k.'"] = ';
}
if ($inv) {
$inv = False;
$out .= '"'.$v.'"';
}
if (!$arr) {
$arr=True;
@ -85,7 +96,6 @@ function po2php_run(&$argv, &$argc) {
if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; };
if ($ink) {
$k .= trim($l,"\"\r\n");
$k = preg_replace_callback($escape_s_exp,'escape_s',$k);
@ -93,8 +103,13 @@ function po2php_run(&$argv, &$argc) {
}
if (substr($l,0,6)=="msgid "){
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($k!="") $out .= $arr?");\n":";\n";
if ($inv) {
$inv = False;
$out .= '"'.$v.'"';
}
if ($k != "") {
$out .= $arr?");\n":";\n";
}
$arr = False;
$k = str_replace("msgid ","",$l);
if ($k != '""' ) {
@ -116,8 +131,13 @@ function po2php_run(&$argv, &$argc) {
}
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($k!="") $out .= $arr?");\n":";\n";
if ($inv) {
$inv = False;
$out .= '"'.$v.'"';
}
if ($k!="") {
$out .= $arr?");\n":";\n";
}
$out = str_replace(DQ_ESCAPE, '\"', $out);
file_put_contents($outfile, $out);

View file

@ -12,11 +12,11 @@
$a = new App();
if(x($a->config,'php_path'))
if (x($a->config,'php_path')) {
$phpath = $a->config['php_path'];
else
} else {
$phpath = 'php';
}
echo "Directory: mod\n";
$files = glob('mod/*.php');
@ -47,7 +47,6 @@
}
}
echo "String files\n";
echo 'util/strings.php' . "\n";