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) { foreach ($arr as $a) {
if (is_array($a)){ if (is_array($a)){
if(substr($a[1],0,1) == '$') if (substr($a[1],0,1) == '$') {
continue; continue;
}
$s .= '$a->strings[' . $a[0] . "] = array(\n"; $s .= '$a->strings[' . $a[0] . "] = array(\n";
$s .= "\t0 => ". $a[0]. ",\n"; $s .= "\t0 => ". $a[0]. ",\n";
$s .= "\t1 => ". $a[1]. ",\n"; $s .= "\t1 => ". $a[1]. ",\n";
$s .= ");\n"; $s .= ");\n";
} else { } else {
if(substr($a,0,1) == '$') if (substr($a,0,1) == '$') {
continue; continue;
}
$s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n"; $s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n";
} }
} }
$zones = timezone_identifiers_list(); $zones = timezone_identifiers_list();
foreach($zones as $zone) foreach ($zones as $zone) {
$s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n"; $s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
}
echo $s; echo $s;

View File

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

View File

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

View File

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