Passed
Pull Request — master (#2971)
by Christian
07:23 queued 14s
created
html/inc/translation.inc 1 patch
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             continue;
69 69
         }
70 70
         // only do files ending in .po
71
-        if (substr($file,-3) != ".po"){
71
+        if (substr($file,-3) != ".po") {
72 72
             //debug("File $file with unknown extension found in $info_dir");
73 73
             continue;
74 74
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             "-------------Compiling $transdir$file------------", 0
77 77
         );
78 78
         $language = parse_po_file($langdir.$transdir.$file);
79
-        if (!$language){
79
+        if (!$language) {
80 80
             language_log(
81 81
                 "WARNING: Could not parse language ".$file
82 82
             );
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             );
96 96
             exit;
97 97
         }
98
-        foreach ($language as $key => $value){
98
+        foreach ($language as $key => $value) {
99 99
             if ($value !== "") {
100 100
                 // Skip if the msgstr is empty
101 101
                 fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n");
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
     $parsing_text = false;
122 122
     $size = sizeof($translation_file);
123 123
     $output = array();
124
-    for ($i=0; $i<$size; $i++){
124
+    for ($i=0; $i<$size; $i++) {
125 125
         $entry = trim($translation_file[$i]);
126 126
         //echo "line $i: $entry\n";
127 127
         if (substr($entry, 0, 1)=="#") {
128 128
             continue;
129 129
         } elseif (strpos($entry, "msgid") !== false) {
130
-            if (!$first_entry){
130
+            if (!$first_entry) {
131 131
                 //If this is not the first, save the previous entry
132 132
                 $output[$current_token]=$current_token_text;
133 133
             }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     
150 150
     // Get the last token
151 151
     //
152
-    if ($current_token && $current_token_text){
152
+    if ($current_token && $current_token_text) {
153 153
         $output[$current_token] = $current_token_text;
154 154
     }
155 155
     return $output;
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
     
181 181
     // Find the string in the user's language
182 182
     //
183
-    foreach ($languages_in_use as $language){
183
+    foreach ($languages_in_use as $language) {
184 184
         if (isset($language_lookup_array[$language][$text])) {
185 185
             $text = $language_lookup_array[$language][$text];
186 186
             break;
187
-        } else if ($language=="en"){ 
187
+        } else if ($language=="en") {
188 188
             // This language is defined in the code and is always available
189 189
             break;
190 190
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // Replace relevant substrings with given arguments.
194 194
     // Use strtr to avoid problems if an argument contains %n.
195 195
     $replacements = array();
196
-    for ($i=1; $i<func_num_args(); $i++){
196
+    for ($i=1; $i<func_num_args(); $i++) {
197 197
         $replacements["%".$i] = func_get_arg($i);
198 198
     }
199 199
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     if ($loglevel==1) $msg = "[ Warning  ]";
218 218
     if ($loglevel==2) $msg = "[ CRITICAL ]";
219 219
 
220
-    if ($loglevel >= $lang_log_level){
220
+    if ($loglevel >= $lang_log_level) {
221 221
         echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n";
222 222
     }
223 223
 }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 // (by looking at cookies and browser settings)
227 227
 // cookies have highest priority.
228 228
 
229
-if (isset($_COOKIE['lang'])){
229
+if (isset($_COOKIE['lang'])) {
230 230
     $language_string = $_COOKIE['lang'].",";
231 231
 } else {
232 232
     $language_string = '';
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 for ($i=0; $i<$size; $i++) {
261 261
     if ((strlen($client_languages[$i])>2)
262 262
         && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
263
-    ){
263
+    ) {
264 264
         // If this is defined as primary-secondary, represent it as xx_YY
265 265
         //
266 266
         $language = substr(
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     //
288 288
     $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
289 289
     if (file_exists($file_name)) {
290
-        if (!in_array($language, $languages_in_use)){
290
+        if (!in_array($language, $languages_in_use)) {
291 291
             require_once($file_name);
292 292
             $languages_in_use[] = $language;
293 293
         }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     if ($language2) {
296 296
         $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc";
297 297
         if (file_exists($file_name)) {
298
-            if (!in_array($language2, $languages_in_use)){
298
+            if (!in_array($language2, $languages_in_use)) {
299 299
                 require_once($file_name);
300 300
                 $languages_in_use[] = $language2;
301 301
             }
Please login to merge, or discard this patch.