@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $subset = sanitize_tags(get_str("subset")); |
28 | 28 | $venue = sanitize_tags(get_str("venue")); |
29 | 29 | $columns = get_int("cols", true); |
30 | -$c = $columns?"&cols=$columns":""; |
|
30 | +$c = $columns ? "&cols=$columns" : ""; |
|
31 | 31 | check_venue($venue); |
32 | 32 | check_subset($subset); |
33 | 33 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $title = tra("Edit %1 preferences", subset_name($subset)); |
43 | 43 | if ($venue) $title = "$title for $venue"; |
44 | 44 | page_head($title); |
45 | - $x = $venue?"&venue=$venue":""; |
|
45 | + $x = $venue ? "&venue=$venue" : ""; |
|
46 | 46 | |
47 | 47 | echo PREFS_FORM_DESC1; |
48 | 48 | echo PREFS_FORM_ERROR_DESC; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $title = tra("Edit %1 preferences", subset_name($subset)); |
68 | 68 | if ($venue) $title = "$title for $venue"; |
69 | 69 | page_head($title); |
70 | - $x = $venue?"&venue=$venue":""; |
|
70 | + $x = $venue ? "&venue=$venue" : ""; |
|
71 | 71 | |
72 | 72 | echo PREFS_FORM_ERROR_DESC; |
73 | 73 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | project_forum_index_intro(); |
59 | 59 | } |
60 | 60 | |
61 | - if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE){ |
|
61 | + if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE) { |
|
62 | 62 | $categories = BoincCategory::enum("true order by orderID"); |
63 | 63 | } else { |
64 | 64 | echo "<p>" |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | if ($offset === false) $offset = 0; |
85 | 85 | if ($offset >= $nmsgs) $offset = 0; |
86 | 86 | echo sprintf('Showing messages %d to %d of %d', |
87 | - $offset+1, |
|
88 | - min($offset+$nshow, $nmsgs), |
|
87 | + $offset + 1, |
|
88 | + min($offset + $nshow, $nmsgs), |
|
89 | 89 | $nmsgs |
90 | 90 | ); |
91 | 91 | if ($offset) { |
92 | 92 | echo sprintf( |
93 | 93 | ' · <a href=pm.php?action=inbox&offset=%d>Previous %d</a>', |
94 | - max(0, $offset-$nshow), $nshow |
|
94 | + max(0, $offset - $nshow), $nshow |
|
95 | 95 | ); |
96 | 96 | } |
97 | - if ($offset+$nshow < $nmsgs) { |
|
97 | + if ($offset + $nshow < $nmsgs) { |
|
98 | 98 | echo sprintf( |
99 | 99 | ' · <a href=pm.php?action=inbox&offset=%d>Next %d</a>', |
100 | - $offset+$nshow, $nshow |
|
100 | + $offset + $nshow, $nshow |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | array('style="width: 12em;"', 'style="width: 10em;"', "") |
113 | 113 | ); |
114 | 114 | $i = 0; |
115 | - foreach($msgs as $msg) { |
|
116 | - if ($i<$offset) { |
|
115 | + foreach ($msgs as $msg) { |
|
116 | + if ($i < $offset) { |
|
117 | 117 | $i++; |
118 | 118 | continue; |
119 | 119 | } |
120 | - if ($i>=$offset+$nshow) break; |
|
120 | + if ($i >= $offset + $nshow) break; |
|
121 | 121 | $i++; |
122 | 122 | $sender = BoincUser::lookup_id($msg->senderid); |
123 | 123 | if (!$sender) { |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $msgs = BoincPrivateMessage::enum( |
392 | 392 | "userid=$logged_in_user->id" |
393 | 393 | ); |
394 | - foreach($msgs as $msg) { |
|
394 | + foreach ($msgs as $msg) { |
|
395 | 395 | $x = "pm_select_$msg->id"; |
396 | 396 | if (post_str($x, true)) { |
397 | 397 | $msg = BoincPrivateMessage::lookup_id($msg->id); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $y = []; |
26 | 26 | $x[] = sprintf('%s%s', |
27 | 27 | user_links($user, BADGE_HEIGHT_MEDIUM), |
28 | - UNIQUE_USER_NAME?'':" (ID $user->id)" |
|
28 | + UNIQUE_USER_NAME ? '' : " (ID $user->id)" |
|
29 | 29 | ); |
30 | 30 | $y[] = null; |
31 | 31 | if (!DISABLE_TEAMS) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $where = "true"; |
109 | 109 | $search_string = get_str('search_string'); |
110 | 110 | if (strlen($search_string)) { |
111 | - if (strlen($search_string)<3) { |
|
111 | + if (strlen($search_string) < 3) { |
|
112 | 112 | error_page(tra("search string must be at least 3 characters")); |
113 | 113 | } |
114 | 114 | $s = BoincDb::escape_string($search_string); |
@@ -140,17 +140,17 @@ discard block |
||
140 | 140 | $search_type = get_str('search_type', true); |
141 | 141 | $order_clause = "id desc"; |
142 | 142 | if ($search_type == 'rac') { |
143 | - $order_clause ="expavg_credit desc"; |
|
143 | + $order_clause = "expavg_credit desc"; |
|
144 | 144 | } else if ($search_type == 'total') { |
145 | - $order_clause ="total_credit desc"; |
|
145 | + $order_clause = "total_credit desc"; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated"; |
149 | 149 | $users = BoincUser::enum_fields($fields, $where, "order by $order_clause limit 100"); |
150 | 150 | page_head(tra("User search results")); |
151 | - $n=0; |
|
151 | + $n = 0; |
|
152 | 152 | foreach ($users as $user) { |
153 | - if ($n==0) { |
|
153 | + if ($n == 0) { |
|
154 | 154 | start_table('table-striped'); |
155 | 155 | $x = ['Name']; |
156 | 156 | $y = [null]; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $postid = get_int('postid', true); |
31 | 31 | $filter = get_str('filter', true); |
32 | 32 | |
33 | -if ($filter != "false"){ |
|
33 | +if ($filter != "false") { |
|
34 | 34 | $filter = true; |
35 | 35 | } else { |
36 | 36 | $filter = false; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | if ($temp_sort_style) { |
80 | 80 | $sort_style = $temp_sort_style; |
81 | 81 | } else if ($sort_style) { |
82 | - $forum_style = 0; // this is deprecated |
|
83 | - if ($logged_in_user){ |
|
82 | + $forum_style = 0; // this is deprecated |
|
83 | + if ($logged_in_user) { |
|
84 | 84 | $logged_in_user->prefs->thread_sorting = $sort_style; |
85 | 85 | $logged_in_user->prefs->update("thread_sorting=$sort_style"); |
86 | 86 | } else { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | } else { |
94 | 94 | // get the sorting style from the user or a cookie |
95 | - if ($logged_in_user){ |
|
95 | + if ($logged_in_user) { |
|
96 | 96 | $sort_style = $logged_in_user->prefs->thread_sorting; |
97 | 97 | } else { |
98 | 98 | list($forum_style, $sort_style) = parse_forum_cookie(); |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | |
119 | 119 | if (false) { |
120 | 120 | if ($forum->parent_type == 0) { |
121 | - if ($category->is_helpdesk && !$thread->status){ |
|
122 | - if ($logged_in_user){ |
|
123 | - if ($thread->owner == $logged_in_user->id){ |
|
124 | - if ($thread->replies !=0) { |
|
121 | + if ($category->is_helpdesk && !$thread->status) { |
|
122 | + if ($logged_in_user) { |
|
123 | + if ($thread->owner == $logged_in_user->id) { |
|
124 | + if ($thread->replies != 0) { |
|
125 | 125 | // Show a "this question has been answered" to the author |
126 | 126 | echo "<p>"; |
127 | 127 | show_button( |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // If logged in user is moderator, enable some extra features |
190 | 190 | // |
191 | 191 | if (is_moderator($logged_in_user, $forum)) { |
192 | - if ($thread->hidden){ |
|
192 | + if ($thread->hidden) { |
|
193 | 193 | show_button_small( |
194 | 194 | "forum_moderate_thread_action.php?action=unhide&thread=".$thread->id."$tokens", |
195 | 195 | tra("Unhide"), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | tra("Hide this thread") |
203 | 203 | ); |
204 | 204 | } |
205 | - if ($thread->sticky){ |
|
205 | + if ($thread->sticky) { |
|
206 | 206 | show_button_small( |
207 | 207 | "forum_moderate_thread_action.php?action=desticky&thread=".$thread->id."$tokens", |
208 | 208 | tra("Make unsticky"), |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | start_table('table-striped'); |
28 | 28 | |
29 | 29 | $x = ['User']; |
30 | - for ($i=0; $i<S_NFLAGS; $i++) { |
|
30 | + for ($i = 0; $i < S_NFLAGS; $i++) { |
|
31 | 31 | $x[] = $special_user_bitfield[$i]; |
32 | 32 | } |
33 | 33 | $x[] = ''; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $pref->userid |
43 | 43 | ); |
44 | 44 | $x = ["$user->name ($user->id)"]; |
45 | - for ($j=0; $j<S_NFLAGS; $j++) { |
|
45 | + for ($j = 0; $j < S_NFLAGS; $j++) { |
|
46 | 46 | $bit = substr($pref->special_user, $j, 1); |
47 | - $c = ($bit == 1)?"checked":""; |
|
47 | + $c = ($bit == 1) ? "checked" : ""; |
|
48 | 48 | $x[] = sprintf( |
49 | 49 | '<input type="checkbox" name="role%d" value="1" %s>', |
50 | 50 | $j, $c |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | echo '<form action="user_permissions.php" method="POST">'; |
59 | 59 | $x = ['Add User ID: <input type="text" name="userid" size="6">']; |
60 | - for ($j=0; $j<S_NFLAGS; $j++) { |
|
60 | + for ($j = 0; $j < S_NFLAGS; $j++) { |
|
61 | 61 | $x[] = sprintf( |
62 | 62 | '<input type="checkbox" name="role%d" value="1">', |
63 | 63 | $j |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (!$user) error_page('no user'); |
78 | 78 | BoincForumPrefs::lookup($user); |
79 | 79 | |
80 | - for ($i=0; $i<S_NFLAGS; $i++) { |
|
80 | + for ($i = 0; $i < S_NFLAGS; $i++) { |
|
81 | 81 | if (post_int("role$i", true) == 1) { |
82 | 82 | $bitset .= '1'; |
83 | 83 | echo "<br> setting $i"; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // Also error-check values, and return errors in $errors->* |
34 | 34 | |
35 | 35 | function option($name, $val) { |
36 | - $x = ($name == $val) ? "selected" : ""; |
|
36 | + $x = ($name == $val) ? "selected" : ""; |
|
37 | 37 | return "<option name='$name' $x>$name\n"; |
38 | 38 | } |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (APP_SELECT_PREFS) { |
54 | 54 | $app_array = array(); |
55 | 55 | $apps = BoincApp::enum("deprecated=0"); |
56 | - foreach($apps as $app) { |
|
56 | + foreach ($apps as $app) { |
|
57 | 57 | $app_array[] = array($app->id, $app->user_friendly_name); |
58 | 58 | } |
59 | 59 | } else { |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | function number_select($name, $max, $n) { |
94 | - $sel = ($n == 0) ? "selected":""; |
|
94 | + $sel = ($n == 0) ? "selected" : ""; |
|
95 | 95 | $x = "<select class=\"form-control input-sm\" name=$name> <option value=0 $sel>".tra("No limit")."</option>"; |
96 | - for ($i=1; $i<=$max; $i++) { |
|
97 | - $sel = ($n == $i) ? "selected":""; |
|
96 | + for ($i = 1; $i <= $max; $i++) { |
|
97 | + $sel = ($n == $i) ? "selected" : ""; |
|
98 | 98 | $x .= "<option value=$i $sel>$i</option>"; |
99 | 99 | } |
100 | 100 | $x .= "</select>"; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | return tra("No limit"); |
107 | 107 | } |
108 | 108 | |
109 | -function project_specific_prefs_edit($prefs, $error=false) { |
|
109 | +function project_specific_prefs_edit($prefs, $error = false) { |
|
110 | 110 | global $app_array; |
111 | 111 | if (COLOR_PREFS) { |
112 | 112 | $x = $prefs->color_scheme; |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | } else { |
133 | 133 | $present = true; |
134 | 134 | } |
135 | - $checked = $present?"checked":""; |
|
135 | + $checked = $present ? "checked" : ""; |
|
136 | 136 | $x .= "<input type=checkbox name=app_id_$app_id $checked> $app_name<br>"; |
137 | 137 | } |
138 | 138 | tooltip_row2(APP_SELECT_TOOLTIP, APP_SELECT_DESC, $x); |
139 | - $checked = $prefs->allow_non_preferred_apps?"checked":""; |
|
139 | + $checked = $prefs->allow_non_preferred_apps ? "checked" : ""; |
|
140 | 140 | row2(ACCEPT_ANY_DESC, "<input type=checkbox name=allow_non_preferred_apps $checked>"); |
141 | 141 | } |
142 | 142 | if (NON_GRAPHICAL_PREF) { |
143 | - $checked = $prefs->non_graphical?"checked":""; |
|
143 | + $checked = $prefs->non_graphical ? "checked" : ""; |
|
144 | 144 | row2( |
145 | 145 | NON_GRAPHICAL_DESC, |
146 | 146 | "<input type=checkbox name=non_graphical $checked>" |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | return $x; |
217 | 217 | } |
218 | 218 | |
219 | -function project_specific_prefs_show($prefs, $columns=false) { |
|
219 | +function project_specific_prefs_show($prefs, $columns = false) { |
|
220 | 220 | global $app_array; |
221 | 221 | if ($columns) { |
222 | 222 | if (COLOR_PREFS) { |
223 | - row_defs(COLOR_DESC,"color_scheme", "", "", $prefs); |
|
223 | + row_defs(COLOR_DESC, "color_scheme", "", "", $prefs); |
|
224 | 224 | } |
225 | 225 | if (GFX_CPU_PREFS) { |
226 | 226 | row_defs(MAX_GFX_CPU_PCT_DESC, "max_gfx_cpu_pct", "", "", $prefs); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | row2(ACCEPT_ANY_DESC, $prefs->allow_non_preferred_apps_text); |
255 | 255 | } |
256 | 256 | if (NON_GRAPHICAL_PREF) { |
257 | - row2(NON_GRAPHICAL_DESC, $prefs->non_graphical?tra("yes"):tra("no")); |
|
257 | + row2(NON_GRAPHICAL_DESC, $prefs->non_graphical ?tra("yes") : tra("no")); |
|
258 | 258 | } |
259 | 259 | if (MAX_JOBS_PREF) { |
260 | 260 | row2(tra("Max # jobs"), limit_string($prefs->max_jobs)); |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | $cursor = 0; |
278 | 278 | while ($thisxml = parse_next_element($prefs_xml, "<app_id>", $cursor)) { |
279 | 279 | if (is_numeric($thisxml)) { |
280 | - $n = (int) $thisxml; |
|
280 | + $n = (int)$thisxml; |
|
281 | 281 | $prefs->app_ids[] = $n; |
282 | 282 | } |
283 | 283 | } |
284 | 284 | $prefs->allow_non_preferred_apps = parse_element($prefs_xml, "<allow_non_preferred_apps>"); |
285 | - $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps?"yes":"no"; |
|
285 | + $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps ? "yes" : "no"; |
|
286 | 286 | } |
287 | 287 | if (NON_GRAPHICAL_PREF) { |
288 | 288 | $prefs->non_graphical = parse_bool($prefs_xml, "non_graphical"); |
@@ -147,11 +147,11 @@ |
||
147 | 147 | |
148 | 148 | function site_list($sites) { |
149 | 149 | echo "<ul>\n"; |
150 | - for ($i=0; $i<count($sites); $i++) { |
|
150 | + for ($i = 0; $i < count($sites); $i++) { |
|
151 | 151 | $s = $sites[$i]; |
152 | 152 | $url = $s[0]; |
153 | 153 | $name = $s[1]; |
154 | - $comment = array_key_exists(2, $s)?$s[2]:""; |
|
154 | + $comment = array_key_exists(2, $s) ? $s[2] : ""; |
|
155 | 155 | echo "<li><a href=\"$url\">$name</a> $comment\n"; |
156 | 156 | } |
157 | 157 | echo "</ul>\n"; |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $dh = opendir($langdir.$transdir); |
65 | 65 | if (!$dh) die("can't open translation dir"); |
66 | 66 | while (($file = readdir($dh)) !== false) { |
67 | - if ($file==".." || $file==".") { |
|
67 | + if ($file == ".." || $file == ".") { |
|
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 |
||
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,10 +95,10 @@ discard block |
||
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 | - fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
101 | + fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | // don't write \?\> - may append |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | function parse_po_file($file) { |
116 | 116 | $translation_file = file($file); |
117 | 117 | $first_entry = true; |
118 | - $current_token_text=""; |
|
119 | - $current_token =""; |
|
118 | + $current_token_text = ""; |
|
119 | + $current_token = ""; |
|
120 | 120 | $parsing_token = false; |
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 | - if (substr($entry, 0, 1)=="#") { |
|
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 | - $output[$current_token]=$current_token_text; |
|
132 | + $output[$current_token] = $current_token_text; |
|
133 | 133 | } |
134 | 134 | $current_token = get_po_line($entry, $file); |
135 | - $current_token_text=""; |
|
135 | + $current_token_text = ""; |
|
136 | 136 | $parsing_token = true; |
137 | 137 | $parsing_text = false; |
138 | - $first_entry=false; |
|
138 | + $first_entry = false; |
|
139 | 139 | } elseif (strpos($entry, "msgstr") !== false) { |
140 | 140 | $current_token_text = get_po_line($entry, $file); |
141 | 141 | $parsing_token = false; |
@@ -149,7 +149,7 @@ discard block |
||
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; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | // Returns the contents of a line (ie removes "" from start and end) |
160 | 160 | // |
161 | 161 | function get_po_line($line, $file) { |
162 | - $start = strpos($line, '"')+1; |
|
162 | + $start = strpos($line, '"') + 1; |
|
163 | 163 | $stop = strrpos($line, '"'); |
164 | - $x = substr($line, $start, $stop-$start); |
|
164 | + $x = substr($line, $start, $stop - $start); |
|
165 | 165 | $n = preg_match("/[^\\\\]\"/", $x); |
166 | 166 | if ($n) { |
167 | 167 | echo "ERROR - MISMATCHED QUOTES IN $file: $line\n"; |
@@ -180,11 +180,11 @@ discard block |
||
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 |
||
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 | |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | return $text; |
211 | 211 | } |
212 | 212 | |
213 | -function language_log($message, $loglevel=0) { |
|
213 | +function language_log($message, $loglevel = 0) { |
|
214 | 214 | global $lang_log_level; |
215 | 215 | $msg = ""; |
216 | - if ($loglevel==0) $msg = "[ Debug ]"; |
|
217 | - if ($loglevel==1) $msg = "[ Warning ]"; |
|
218 | - if ($loglevel==2) $msg = "[ CRITICAL ]"; |
|
216 | + if ($loglevel == 0) $msg = "[ Debug ]"; |
|
217 | + if ($loglevel == 1) $msg = "[ Warning ]"; |
|
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 |
||
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 = ''; |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | // Loop over languages that the client requests |
258 | 258 | // |
259 | 259 | $size = sizeof($client_languages); |
260 | -for ($i=0; $i<$size; $i++) { |
|
261 | - if ((strlen($client_languages[$i])>2) |
|
260 | +for ($i = 0; $i < $size; $i++) { |
|
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( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // if main language is english, look no further |
281 | 281 | // |
282 | - if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) { |
|
282 | + if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) { |
|
283 | 283 | break; |
284 | 284 | } |
285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
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 |
||
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 | } |
@@ -303,6 +303,6 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
306 | +$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
307 | 307 | |
308 | 308 | ?> |