@@ -88,17 +88,26 @@ discard block |
||
88 | 88 | "; |
89 | 89 | } |
90 | 90 | |
91 | +/** |
|
92 | + * @param string $name |
|
93 | + */ |
|
91 | 94 | function item_xml($name, $val) { |
92 | 95 | if (!$val) $val = 0; |
93 | 96 | echo " <$name>$val</$name>\n"; |
94 | 97 | } |
95 | 98 | |
99 | +/** |
|
100 | + * @param string $name |
|
101 | + */ |
|
96 | 102 | function item_html($name, $val) { |
97 | 103 | $name = tra($name); |
98 | 104 | echo "<tr><td>$name</td><td>$val</td></tr>\n"; |
99 | 105 | //echo "<tr><td align=right>$name</td><td align=right>$val</td></tr>\n"; |
100 | 106 | } |
101 | 107 | |
108 | +/** |
|
109 | + * @param stdClass $x |
|
110 | + */ |
|
102 | 111 | function show_status_html($x) { |
103 | 112 | page_head(tra("Project status")); |
104 | 113 | $j = $x->jobs; |
@@ -190,6 +199,9 @@ discard block |
||
190 | 199 | page_tail(); |
191 | 200 | } |
192 | 201 | |
202 | +/** |
|
203 | + * @param stdClass $x |
|
204 | + */ |
|
193 | 205 | function show_status_xml($x) { |
194 | 206 | xml_header(); |
195 | 207 | echo "<server_status>\n<daemon_status>\n"; |
@@ -239,6 +251,11 @@ discard block |
||
239 | 251 | "; |
240 | 252 | } |
241 | 253 | |
254 | +/** |
|
255 | + * @param string $cmd |
|
256 | + * @param string $pidname |
|
257 | + * @param string $host |
|
258 | + */ |
|
242 | 259 | function local_daemon_running($cmd, $pidname, $host) { |
243 | 260 | if (!$pidname) { |
244 | 261 | $cmd = trim($cmd); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $avg = round($app->info->avg, 2); |
172 | 172 | $min = round($app->info->min, 2); |
173 | 173 | $max = round($app->info->max, 2); |
174 | - $x = $max?"$avg ($min - $max)":"---"; |
|
174 | + $x = $max ? "$avg ($min - $max)" : "---"; |
|
175 | 175 | $u = $app->info->users; |
176 | 176 | echo "<tr> |
177 | 177 | <td>$app->user_friendly_name</td> |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $cmd = trim($cmd); |
245 | 245 | $x = explode(" ", $cmd); |
246 | 246 | $prog = $x[0]; |
247 | - $pidname = $prog . '.pid'; |
|
247 | + $pidname = $prog.'.pid'; |
|
248 | 248 | } |
249 | 249 | $path = "../../pid_$host/$pidname"; |
250 | 250 | if (is_file($path)) { |
@@ -285,12 +285,12 @@ discard block |
||
285 | 285 | } |
286 | 286 | $master_host = $u["host"]; |
287 | 287 | if ($config->www_host) { |
288 | - $web_host = trim((string) $config->www_host); |
|
288 | + $web_host = trim((string)$config->www_host); |
|
289 | 289 | } else { |
290 | 290 | $web_host = $main_host; |
291 | 291 | } |
292 | 292 | if ($config->sched_host) { |
293 | - $sched_host = trim((string) $config->sched_host); |
|
293 | + $sched_host = trim((string)$config->sched_host); |
|
294 | 294 | } else { |
295 | 295 | $sched_host = $main_host; |
296 | 296 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | // the upload and download servers are sort of daemons too |
302 | 302 | // |
303 | - $url = trim((string) $config->download_url); |
|
303 | + $url = trim((string)$config->download_url); |
|
304 | 304 | $u = parse_url($url); |
305 | 305 | $h = $u["host"]; |
306 | 306 | if ($h == $master_host) { |
@@ -312,14 +312,14 @@ discard block |
||
312 | 312 | } else { |
313 | 313 | $have_remote = true; |
314 | 314 | } |
315 | - $url = trim((string) $config->upload_url); |
|
315 | + $url = trim((string)$config->upload_url); |
|
316 | 316 | $u = parse_url($url); |
317 | 317 | $h = $u["host"]; |
318 | 318 | if ($h == $master_host) { |
319 | 319 | $y = new StdClass; |
320 | 320 | $y->cmd = "Upload server"; |
321 | 321 | $y->host = $h; |
322 | - $y->status = !file_exists("../../stop_upload");; |
|
322 | + $y->status = !file_exists("../../stop_upload"); ; |
|
323 | 323 | $local_daemons[] = $y; |
324 | 324 | } else { |
325 | 325 | $have_remote = true; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $y = new StdClass; |
332 | 332 | $y->cmd = "Scheduler"; |
333 | 333 | $y->host = $sched_host; |
334 | - $y->status = !file_exists("../../stop_sched");; |
|
334 | + $y->status = !file_exists("../../stop_sched"); ; |
|
335 | 335 | $local_daemons[] = $y; |
336 | 336 | } else { |
337 | 337 | $have_remote = true; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $disabled_daemons[] = $x; |
348 | 348 | continue; |
349 | 349 | } |
350 | - $host = $d->host?(string)$d->host:$main_host; |
|
350 | + $host = $d->host ? (string)$d->host : $main_host; |
|
351 | 351 | if ($host != $web_host) { |
352 | 352 | $have_remote = true; |
353 | 353 | continue; |
@@ -251,7 +251,7 @@ |
||
251 | 251 | $pid = file_get_contents($path); |
252 | 252 | if ($pid) { |
253 | 253 | $pid = trim($pid); |
254 | - $out = Array(); |
|
254 | + $out = array(); |
|
255 | 255 | exec("ps -ww $pid", $out); |
256 | 256 | foreach ($out as $y) { |
257 | 257 | if (strstr($y, (string)$pid)) return 1; |
@@ -25,6 +25,9 @@ |
||
25 | 25 | |
26 | 26 | check_get_args(array("mode")); |
27 | 27 | |
28 | +/** |
|
29 | + * @param string $mode |
|
30 | + */ |
|
28 | 31 | function filename($mode) { |
29 | 32 | switch ($mode) { |
30 | 33 | case 'host': return "cuda_hosts.dat"; |
@@ -92,7 +92,7 @@ |
||
92 | 92 | echo $x; |
93 | 93 | break; |
94 | 94 | } |
95 | - echo "</td><td align=right>".format_credit_large($y->credit),"</td><td align=right>$y->nresults</td></tr>\n"; |
|
95 | + echo "</td><td align=right>".format_credit_large($y->credit), "</td><td align=right>$y->nresults</td></tr>\n"; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $mode = get_str('mode', true); |
@@ -37,6 +37,9 @@ discard block |
||
37 | 37 | return $n; |
38 | 38 | } |
39 | 39 | |
40 | +/** |
|
41 | + * @param integer $state |
|
42 | + */ |
|
40 | 43 | function show_all_link($batches, $state, $limit, $user, $app) { |
41 | 44 | $n = state_count($batches, $state); |
42 | 45 | if ($n > $limit) { |
@@ -269,6 +272,9 @@ discard block |
||
269 | 272 | page_tail(); |
270 | 273 | } |
271 | 274 | |
275 | +/** |
|
276 | + * @param null|integer $app_id |
|
277 | + */ |
|
272 | 278 | function check_admin_access($user, $app_id) { |
273 | 279 | $user_submit = BoincUserSubmit::lookup_userid($user->id); |
274 | 280 | if (!$user_submit) error_page("no access"); |
@@ -523,6 +529,9 @@ discard block |
||
523 | 529 | page_tail(); |
524 | 530 | } |
525 | 531 | |
532 | +/** |
|
533 | + * @param null|integer $state |
|
534 | + */ |
|
526 | 535 | function show_batches_in_state($batches, $state) { |
527 | 536 | switch ($state) { |
528 | 537 | case BATCH_STATE_IN_PROGRESS: |
@@ -369,7 +369,7 @@ |
||
369 | 369 | $text = "---"; |
370 | 370 | if ($batch->state == BATCH_STATE_COMPLETE) { |
371 | 371 | $y = '<font color="red">failed</font>'; |
372 | - } else { |
|
372 | + } else { |
|
373 | 373 | $y = "in progress"; |
374 | 374 | } |
375 | 375 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $wus = BoincWorkunit::enum("batch = $batch->id"); |
309 | 309 | $batch = get_batch_params($batch, $wus); |
310 | 310 | |
311 | - page_head("Batch $batch_id"); |
|
311 | + page_head("batch $batch_id"); |
|
312 | 312 | start_table(); |
313 | 313 | row2("name", $batch->name); |
314 | 314 | row2("application", $app->name); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $wu = BoincWorkunit::lookup_id($wuid); |
394 | 394 | if (!$wu) error_page("no such job"); |
395 | 395 | |
396 | - page_head("Job $wuid"); |
|
396 | + page_head("job $wuid"); |
|
397 | 397 | |
398 | 398 | echo " |
399 | 399 | <a href=workunit.php?wuid=$wuid>Workunit details</a> · |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | } |
324 | 324 | row2("GFLOP/hours, estimated", number_format(credit_to_gflop_hours($batch->credit_estimate), 2)); |
325 | 325 | row2("GFLOP/hours, actual", number_format(credit_to_gflop_hours($batch->credit_canonical), 2)); |
326 | - row2("Output File Size (MB)", number_format(batch_output_file_size($batch->id)/1e6,2)); |
|
326 | + row2("Output File Size (MB)", number_format(batch_output_file_size($batch->id)/1e6, 2)); |
|
327 | 327 | end_table(); |
328 | 328 | if (batch_output_file_size($batch->id) <= 1e8) { |
329 | 329 | $url = boinc_get_output_files_url($user, $batch_id); |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | "Canonical instance<br><small>click to see result page on BOINC server</smallp>", |
358 | 358 | "Download Results" |
359 | 359 | ); |
360 | - foreach($wus as $wu) { |
|
360 | + foreach ($wus as $wu) { |
|
361 | 361 | $resultid = $wu->canonical_resultid; |
362 | - $durl = boinc_get_wu_output_files_url($user,$wu->id); |
|
362 | + $durl = boinc_get_wu_output_files_url($user, $wu->id); |
|
363 | 363 | if ($resultid) { |
364 | 364 | $x = "<a href=result.php?resultid=$resultid>$resultid</a>"; |
365 | 365 | $y = '<font color="green">completed</font>'; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $text = "---"; |
370 | 370 | if ($batch->state == BATCH_STATE_COMPLETE) { |
371 | 371 | $y = '<font color="red">failed</font>'; |
372 | - } else { |
|
372 | + } else { |
|
373 | 373 | $y = "in progress"; |
374 | 374 | } |
375 | 375 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $results = BoincResult::enum("workunitid=$wuid"); |
435 | 435 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
436 | 436 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
437 | - foreach($results as $result) { |
|
437 | + foreach ($results as $result) { |
|
438 | 438 | echo "<tr> |
439 | 439 | <td><a href=result.php?resultid=$result->id>$result->id · $result->name </a></td> |
440 | 440 | <td>".state_string($result)."</td> |
@@ -57,6 +57,9 @@ |
||
57 | 57 | edit_form($user, $team, $forum, true); |
58 | 58 | } |
59 | 59 | |
60 | +/** |
|
61 | + * @param boolean $first |
|
62 | + */ |
|
60 | 63 | function edit_form($user, $team, $forum, $first) { |
61 | 64 | page_head(tra("Team Message Board")); |
62 | 65 | echo " |
@@ -30,6 +30,9 @@ |
||
30 | 30 | // list entries are of the form id => team, |
31 | 31 | // where team includes a field "refcnt". |
32 | 32 | // |
33 | +/** |
|
34 | + * @param integer $weight |
|
35 | + */ |
|
33 | 36 | function merge_lists($list1, &$list2, $weight) { |
34 | 37 | foreach($list1 as $team) { |
35 | 38 | $id = $team->id; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // where team includes a field "refcnt". |
32 | 32 | // |
33 | 33 | function merge_lists($list1, &$list2, $weight) { |
34 | - foreach($list1 as $team) { |
|
34 | + foreach ($list1 as $team) { |
|
35 | 35 | $id = $team->id; |
36 | 36 | if (array_key_exists($id, $list2)) { |
37 | 37 | $list2[$id]->refcnt += $weight; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | if (defined("SHOW_NONVALIDATED_TEAMS")) { |
98 | 98 | $user = BoincUser::lookup_id($team->userid); |
99 | 99 | echo "<td>"; |
100 | - echo $user->email_validated?"Yes":"No"; |
|
100 | + echo $user->email_validated ? "Yes" : "No"; |
|
101 | 101 | echo "</td>\n"; |
102 | 102 | } |
103 | 103 | echo " |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | xml_header(); |
138 | 138 | echo "<teams>\n"; |
139 | 139 | sort_list($list); |
140 | - foreach($list as $team) { |
|
140 | + foreach ($list as $team) { |
|
141 | 141 | show_team_xml($team); |
142 | 142 | } |
143 | 143 | echo "</teams>\n"; |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | merge_lists($list2, $list, 3); |
165 | 165 | $tried = true; |
166 | 166 | } |
167 | - if (strlen($params->country) && $params->country!='None') { |
|
167 | + if (strlen($params->country) && $params->country != 'None') { |
|
168 | 168 | $country = BoincDb::escape_string($params->country); |
169 | 169 | $list2 = get_teams("country = '$country'", $params->active); |
170 | 170 | //echo "<br>country matches: ",sizeof($list2); |
171 | 171 | merge_lists($list2, $list, 1); |
172 | 172 | $tried = true; |
173 | 173 | } |
174 | - if ($params->type and $params->type>1) { |
|
174 | + if ($params->type and $params->type > 1) { |
|
175 | 175 | $list2 = get_teams("type=$params->type", $params->active); |
176 | 176 | //echo "<br>type matches: ",sizeof($list2); |
177 | 177 | merge_lists($list2, $list, 2); |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | */ |
93 | 93 | require_once('dbconfig.php'); |
94 | 94 | if (!isset($dbserver) || empty($dbserver)) |
95 | - $dbserver='localhost'; |
|
95 | + $dbserver='localhost'; |
|
96 | 96 | $db_url = array( |
97 | - 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
|
98 | - 'boinc' => "{$boinc_dbtype}://{$boinc_dbuser}:".urlencode($boinc_dbpass)."@{$boinc_dbserver}/{$boinc_dbname}" |
|
97 | + 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
|
98 | + 'boinc' => "{$boinc_dbtype}://{$boinc_dbuser}:".urlencode($boinc_dbpass)."@{$boinc_dbserver}/{$boinc_dbname}" |
|
99 | 99 | ); |
100 | 100 | $db_prefix = ''; |
101 | 101 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | # $base_url = 'http://www.example.com'; // NO trailing slash! |
122 | 122 | if (stream_resolve_include_path('baseurl.php')) { |
123 | - include_once('baseurl.php'); |
|
123 | + include_once('baseurl.php'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -175,5 +175,5 @@ discard block |
||
175 | 175 | # 'anonymous' => 'Visitor', |
176 | 176 | # ); |
177 | 177 | $conf = array( |
178 | - 'maintenance_theme' => 'einstein', |
|
178 | + 'maintenance_theme' => 'einstein', |
|
179 | 179 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | require_once('dbconfig.php'); |
94 | 94 | if (!isset($dbserver) || empty($dbserver)) |
95 | - $dbserver='localhost'; |
|
95 | + $dbserver = 'localhost'; |
|
96 | 96 | $db_url = array( |
97 | 97 | 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
98 | 98 | 'boinc' => "{$boinc_dbtype}://{$boinc_dbuser}:".urlencode($boinc_dbpass)."@{$boinc_dbserver}/{$boinc_dbname}" |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | * settings are used there. Settings defined here should not be |
134 | 134 | * duplicated there so as to avoid conflict issues. |
135 | 135 | */ |
136 | -ini_set('arg_separator.output', '&'); |
|
137 | -ini_set('magic_quotes_runtime', 0); |
|
138 | -ini_set('magic_quotes_sybase', 0); |
|
139 | -ini_set('session.cache_expire', 200000); |
|
140 | -ini_set('session.cache_limiter', 'none'); |
|
141 | -ini_set('session.cookie_lifetime', 2000000); |
|
142 | -ini_set('session.gc_maxlifetime', 200000); |
|
143 | -ini_set('session.save_handler', 'user'); |
|
136 | +ini_set('arg_separator.output', '&'); |
|
137 | +ini_set('magic_quotes_runtime', 0); |
|
138 | +ini_set('magic_quotes_sybase', 0); |
|
139 | +ini_set('session.cache_expire', 200000); |
|
140 | +ini_set('session.cache_limiter', 'none'); |
|
141 | +ini_set('session.cookie_lifetime', 2000000); |
|
142 | +ini_set('session.gc_maxlifetime', 200000); |
|
143 | +ini_set('session.save_handler', 'user'); |
|
144 | 144 | ini_set('session.use_only_cookies', 1); |
145 | -ini_set('session.use_trans_sid', 0); |
|
146 | -ini_set('url_rewriter.tags', ''); |
|
145 | +ini_set('session.use_trans_sid', 0); |
|
146 | +ini_set('url_rewriter.tags', ''); |
|
147 | 147 | ini_set('memory_limit', '128M'); |
148 | 148 | ini_set('post_max_size', '8MB'); |
149 | 149 | ini_set('upload_max_filesize', '8MB'); |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * Implementation of hook_views_plugins(). |
10 | 10 | */ |
11 | 11 | function jump_views_plugins() { |
12 | - return array( |
|
12 | + return array( |
|
13 | 13 | 'style' => array( |
14 | - 'jump_views' => array( |
|
14 | + 'jump_views' => array( |
|
15 | 15 | 'title' => t('Jump menu'), |
16 | 16 | 'theme' => 'jump_views_plugin_style', |
17 | 17 | 'help' => t('Displays items as a select list jump menu.'), |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'uses fields' => TRUE, |
21 | 21 | 'uses options' => TRUE, |
22 | 22 | 'type' => 'normal', |
23 | - ), |
|
23 | + ), |
|
24 | 24 | ), |
25 | - ); |
|
25 | + ); |
|
26 | 26 | } |
@@ -16,9 +16,9 @@ |
||
16 | 16 | 'theme' => 'jump_views_plugin_style', |
17 | 17 | 'help' => t('Displays items as a select list jump menu.'), |
18 | 18 | 'handler' => 'jump_views_plugin_style', |
19 | - 'uses row plugin' => TRUE, |
|
20 | - 'uses fields' => TRUE, |
|
21 | - 'uses options' => TRUE, |
|
19 | + 'uses row plugin' => true, |
|
20 | + 'uses fields' => true, |
|
21 | + 'uses options' => true, |
|
22 | 22 | 'type' => 'normal', |
23 | 23 | ), |
24 | 24 | ), |
@@ -9,20 +9,20 @@ discard block |
||
9 | 9 | * Implementation of hook_views_default_views(). |
10 | 10 | */ |
11 | 11 | function jump_views_default_views() { |
12 | - $view = new view; |
|
13 | - $view->name = 'recent_nodes_jump_menu'; |
|
14 | - $view->description = 'Recent nodes in a jump menu.'; |
|
15 | - $view->tag = ''; |
|
16 | - $view->view_php = ''; |
|
17 | - $view->base_table = 'node'; |
|
18 | - $view->is_cacheable = FALSE; |
|
19 | - $view->api_version = 2; |
|
20 | - $view->disabled = TRUE; |
|
21 | - $handler = $view->new_display('default', 'Defaults', 'default'); |
|
22 | - $handler->override_option('fields', array( |
|
12 | + $view = new view; |
|
13 | + $view->name = 'recent_nodes_jump_menu'; |
|
14 | + $view->description = 'Recent nodes in a jump menu.'; |
|
15 | + $view->tag = ''; |
|
16 | + $view->view_php = ''; |
|
17 | + $view->base_table = 'node'; |
|
18 | + $view->is_cacheable = FALSE; |
|
19 | + $view->api_version = 2; |
|
20 | + $view->disabled = TRUE; |
|
21 | + $handler = $view->new_display('default', 'Defaults', 'default'); |
|
22 | + $handler->override_option('fields', array( |
|
23 | 23 | 'nid' => array( |
24 | - 'label' => 'Nid', |
|
25 | - 'alter' => array( |
|
24 | + 'label' => 'Nid', |
|
25 | + 'alter' => array( |
|
26 | 26 | 'alter_text' => 1, |
27 | 27 | 'text' => 'node/[nid]', |
28 | 28 | 'make_link' => 0, |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | 'ellipsis' => 1, |
39 | 39 | 'strip_tags' => 0, |
40 | 40 | 'html' => 0, |
41 | - ), |
|
42 | - 'link_to_node' => 0, |
|
43 | - 'exclude' => 1, |
|
44 | - 'id' => 'nid', |
|
45 | - 'table' => 'node', |
|
46 | - 'field' => 'nid', |
|
47 | - 'relationship' => 'none', |
|
41 | + ), |
|
42 | + 'link_to_node' => 0, |
|
43 | + 'exclude' => 1, |
|
44 | + 'id' => 'nid', |
|
45 | + 'table' => 'node', |
|
46 | + 'field' => 'nid', |
|
47 | + 'relationship' => 'none', |
|
48 | 48 | ), |
49 | 49 | 'title' => array( |
50 | - 'label' => '', |
|
51 | - 'alter' => array( |
|
50 | + 'label' => '', |
|
51 | + 'alter' => array( |
|
52 | 52 | 'alter_text' => 0, |
53 | 53 | 'text' => '', |
54 | 54 | 'make_link' => 0, |
@@ -64,60 +64,60 @@ discard block |
||
64 | 64 | 'ellipsis' => 1, |
65 | 65 | 'strip_tags' => 0, |
66 | 66 | 'html' => 0, |
67 | - ), |
|
68 | - 'link_to_node' => 0, |
|
69 | - 'exclude' => 0, |
|
70 | - 'id' => 'title', |
|
71 | - 'table' => 'node', |
|
72 | - 'field' => 'title', |
|
73 | - 'relationship' => 'none', |
|
67 | + ), |
|
68 | + 'link_to_node' => 0, |
|
69 | + 'exclude' => 0, |
|
70 | + 'id' => 'title', |
|
71 | + 'table' => 'node', |
|
72 | + 'field' => 'title', |
|
73 | + 'relationship' => 'none', |
|
74 | 74 | ), |
75 | - )); |
|
76 | - $handler->override_option('sorts', array( |
|
75 | + )); |
|
76 | + $handler->override_option('sorts', array( |
|
77 | 77 | 'changed' => array( |
78 | - 'order' => 'DESC', |
|
79 | - 'granularity' => 'second', |
|
80 | - 'id' => 'changed', |
|
81 | - 'table' => 'node', |
|
82 | - 'field' => 'changed', |
|
83 | - 'relationship' => 'none', |
|
78 | + 'order' => 'DESC', |
|
79 | + 'granularity' => 'second', |
|
80 | + 'id' => 'changed', |
|
81 | + 'table' => 'node', |
|
82 | + 'field' => 'changed', |
|
83 | + 'relationship' => 'none', |
|
84 | 84 | ), |
85 | - )); |
|
86 | - $handler->override_option('filters', array( |
|
85 | + )); |
|
86 | + $handler->override_option('filters', array( |
|
87 | 87 | 'status_extra' => array( |
88 | - 'operator' => '=', |
|
89 | - 'value' => '', |
|
90 | - 'group' => '0', |
|
91 | - 'exposed' => FALSE, |
|
92 | - 'expose' => array( |
|
88 | + 'operator' => '=', |
|
89 | + 'value' => '', |
|
90 | + 'group' => '0', |
|
91 | + 'exposed' => FALSE, |
|
92 | + 'expose' => array( |
|
93 | 93 | 'operator' => FALSE, |
94 | 94 | 'label' => '', |
95 | - ), |
|
96 | - 'id' => 'status_extra', |
|
97 | - 'table' => 'node', |
|
98 | - 'field' => 'status_extra', |
|
99 | - 'relationship' => 'none', |
|
95 | + ), |
|
96 | + 'id' => 'status_extra', |
|
97 | + 'table' => 'node', |
|
98 | + 'field' => 'status_extra', |
|
99 | + 'relationship' => 'none', |
|
100 | 100 | ), |
101 | - )); |
|
102 | - $handler->override_option('access', array( |
|
101 | + )); |
|
102 | + $handler->override_option('access', array( |
|
103 | 103 | 'type' => 'none', |
104 | - )); |
|
105 | - $handler->override_option('cache', array( |
|
104 | + )); |
|
105 | + $handler->override_option('cache', array( |
|
106 | 106 | 'type' => 'none', |
107 | - )); |
|
108 | - $handler->override_option('style_plugin', 'jump_views'); |
|
109 | - $handler->override_option('style_options', array( |
|
107 | + )); |
|
108 | + $handler->override_option('style_plugin', 'jump_views'); |
|
109 | + $handler->override_option('style_options', array( |
|
110 | 110 | 'grouping' => '', |
111 | 111 | 'keys' => array( |
112 | - 'nid' => 'nid', |
|
113 | - 'title' => 0, |
|
112 | + 'nid' => 'nid', |
|
113 | + 'title' => 0, |
|
114 | 114 | ), |
115 | 115 | 'first_item' => 'Recent nodes', |
116 | - )); |
|
117 | - $handler = $view->new_display('block', 'Block', 'block_1'); |
|
118 | - $handler->override_option('block_description', ''); |
|
119 | - $handler->override_option('block_caching', -1); |
|
116 | + )); |
|
117 | + $handler = $view->new_display('block', 'Block', 'block_1'); |
|
118 | + $handler->override_option('block_description', ''); |
|
119 | + $handler->override_option('block_caching', -1); |
|
120 | 120 | |
121 | - $views[$view->name] = $view; |
|
122 | - return $views; |
|
121 | + $views[$view->name] = $view; |
|
122 | + return $views; |
|
123 | 123 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $view->tag = ''; |
16 | 16 | $view->view_php = ''; |
17 | 17 | $view->base_table = 'node'; |
18 | - $view->is_cacheable = FALSE; |
|
18 | + $view->is_cacheable = false; |
|
19 | 19 | $view->api_version = 2; |
20 | - $view->disabled = TRUE; |
|
20 | + $view->disabled = true; |
|
21 | 21 | $handler = $view->new_display('default', 'Defaults', 'default'); |
22 | 22 | $handler->override_option('fields', array( |
23 | 23 | 'nid' => array( |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | 'operator' => '=', |
89 | 89 | 'value' => '', |
90 | 90 | 'group' => '0', |
91 | - 'exposed' => FALSE, |
|
91 | + 'exposed' => false, |
|
92 | 92 | 'expose' => array( |
93 | - 'operator' => FALSE, |
|
93 | + 'operator' => false, |
|
94 | 94 | 'label' => '', |
95 | 95 | ), |
96 | 96 | 'id' => 'status_extra', |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | |
8 | 8 | class jump_views_plugin_style extends views_plugin_style { |
9 | 9 | |
10 | - function render() { |
|
10 | + function render() { |
|
11 | 11 | // Build an array of field / field_alias pairs. |
12 | 12 | $this->field_map = array(); |
13 | 13 | foreach ($this->view->field as $field_name => $object) { |
14 | - $this-> field_map[$object->field_alias] = $field_name; |
|
14 | + $this-> field_map[$object->field_alias] = $field_name; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // $keys contains the fields used to build up the path. |
@@ -21,116 +21,116 @@ discard block |
||
21 | 21 | // callback. |
22 | 22 | $select = array(); |
23 | 23 | if (!empty($this->options['first_item'])) { |
24 | - $select[0] = $this->options['first_item']; |
|
24 | + $select[0] = $this->options['first_item']; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | foreach ($this->view->result as $row) { |
28 | - $select_key = array(); |
|
29 | - // For each field in the row, we first check if it's to be used |
|
30 | - // as part of the select key, then run views token replacement |
|
31 | - // on it. This allows for paths like node/n/revisions/6 to be built |
|
32 | - // easily. |
|
33 | - foreach ($row as $field => $value) { |
|
28 | + $select_key = array(); |
|
29 | + // For each field in the row, we first check if it's to be used |
|
30 | + // as part of the select key, then run views token replacement |
|
31 | + // on it. This allows for paths like node/n/revisions/6 to be built |
|
32 | + // easily. |
|
33 | + foreach ($row as $field => $value) { |
|
34 | 34 | if (in_array($this->field_map[$field], $keys)) { |
35 | - $field_object = $this->view->field[$this->field_map[$field]]; |
|
36 | - // Re-implementing some of the code from views_handler_field.inc |
|
37 | - // since we need to operate on $result, and to avoid using |
|
38 | - // a row style or templates. |
|
39 | - if (!empty($field_object->options['alter']['alter_text']) && !empty($field_object->options['alter']['text'])) { |
|
35 | + $field_object = $this->view->field[$this->field_map[$field]]; |
|
36 | + // Re-implementing some of the code from views_handler_field.inc |
|
37 | + // since we need to operate on $result, and to avoid using |
|
38 | + // a row style or templates. |
|
39 | + if (!empty($field_object->options['alter']['alter_text']) && !empty($field_object->options['alter']['text'])) { |
|
40 | 40 | $tokens = $this->get_render_tokens($this->field_map[$field], $row); |
41 | 41 | $value = $field_object->render_altered($tokens); |
42 | - } |
|
43 | - $select_key[] = $value; |
|
42 | + } |
|
43 | + $select_key[] = $value; |
|
44 | 44 | } |
45 | - } |
|
46 | - // For the value of the select, just use the output of the row, but strip |
|
47 | - // all markup first. |
|
48 | - $select_key = implode('/', $select_key); |
|
49 | - $raw_select_value = $this->row_plugin->render($row); |
|
50 | - $select_value = trim(html_entity_decode(strip_tags($raw_select_value), ENT_QUOTES)); |
|
51 | - $select[$select_key] = $select_value; |
|
45 | + } |
|
46 | + // For the value of the select, just use the output of the row, but strip |
|
47 | + // all markup first. |
|
48 | + $select_key = implode('/', $select_key); |
|
49 | + $raw_select_value = $this->row_plugin->render($row); |
|
50 | + $select_value = trim(html_entity_decode(strip_tags($raw_select_value), ENT_QUOTES)); |
|
51 | + $select[$select_key] = $select_value; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return jump_quickly($select); |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - function option_definition() { |
|
57 | + function option_definition() { |
|
58 | 58 | $options = parent::option_definition(); |
59 | 59 | $options['keys'] = array('default' => array()); |
60 | 60 | $options['first_item'] = array('default' => ''); |
61 | 61 | return $options; |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | - function options_form(&$form, $form_state) { |
|
64 | + function options_form(&$form, $form_state) { |
|
65 | 65 | parent::options_form($form, $form_state); |
66 | 66 | $handlers = $this->display->handler->get_handlers('field'); |
67 | 67 | if (empty($handlers)) { |
68 | - $form['error_markup'] = array( |
|
68 | + $form['error_markup'] = array( |
|
69 | 69 | '#value' => t('You need at least one field before you can configure your jump menu settings'), |
70 | 70 | '#prefix' => '<div class="error form-item description">', |
71 | 71 | '#suffix' => '</div>', |
72 | - ); |
|
73 | - return; |
|
72 | + ); |
|
73 | + return; |
|
74 | 74 | } |
75 | 75 | // Create an array of fields from the data we know. |
76 | 76 | foreach ($handlers as $field => $handler) { |
77 | - if ($label = $handler->label()) { |
|
77 | + if ($label = $handler->label()) { |
|
78 | 78 | $field_names[$field] = $label; |
79 | - } |
|
80 | - else { |
|
79 | + } |
|
80 | + else { |
|
81 | 81 | $field_names[$field] = $handler->ui_name(); |
82 | - } |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | $form['keys'] = array( |
85 | - '#type' => 'checkboxes', |
|
86 | - '#title' => t('Select keys'), |
|
87 | - '#default_value' => $this->options['keys'], |
|
88 | - '#description' => t("These fields will be used to build the path for each row, used as the 'key' in the select options, and will be automatically separated by '/'"), |
|
89 | - '#options' => $field_names, |
|
85 | + '#type' => 'checkboxes', |
|
86 | + '#title' => t('Select keys'), |
|
87 | + '#default_value' => $this->options['keys'], |
|
88 | + '#description' => t("These fields will be used to build the path for each row, used as the 'key' in the select options, and will be automatically separated by '/'"), |
|
89 | + '#options' => $field_names, |
|
90 | 90 | ); |
91 | 91 | $form['first_item'] = array( |
92 | - '#type' => 'textfield', |
|
93 | - '#title' => 'First item', |
|
94 | - '#default_value' => $this->options['first_item'], |
|
95 | - '#description' => t('This will be used as the first item in your select list, for example <em>Choose one</em>'), |
|
92 | + '#type' => 'textfield', |
|
93 | + '#title' => 'First item', |
|
94 | + '#default_value' => $this->options['first_item'], |
|
95 | + '#description' => t('This will be used as the first item in your select list, for example <em>Choose one</em>'), |
|
96 | 96 | ); |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Get the 'render' tokens to use for advanced rendering. |
|
101 | - * |
|
102 | - * This runs through all of the fields and arguments that |
|
103 | - * are available and gets their values. This will then be |
|
104 | - * used in one giant str_replace(). |
|
105 | - * Slightly modified from views_handler_field.inc |
|
106 | - */ |
|
107 | - function get_render_tokens($field_name, $row) { |
|
99 | + /** |
|
100 | + * Get the 'render' tokens to use for advanced rendering. |
|
101 | + * |
|
102 | + * This runs through all of the fields and arguments that |
|
103 | + * are available and gets their values. This will then be |
|
104 | + * used in one giant str_replace(). |
|
105 | + * Slightly modified from views_handler_field.inc |
|
106 | + */ |
|
107 | + function get_render_tokens($field_name, $row) { |
|
108 | 108 | $tokens = array(); |
109 | 109 | if (!empty($this->view->build_info['substitutions'])) { |
110 | - $tokens = $this->view->build_info['substitutions']; |
|
110 | + $tokens = $this->view->build_info['substitutions']; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $count = 0; |
114 | 114 | foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
115 | - $token = '%'. ++$count; |
|
116 | - if (!isset($tokens[$token])) { |
|
115 | + $token = '%'. ++$count; |
|
116 | + if (!isset($tokens[$token])) { |
|
117 | 117 | $tokens[$token] = ''; |
118 | - } |
|
118 | + } |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // Now add replacements for our fields. |
122 | 122 | $options = array(); |
123 | 123 | $map = array_flip($this->field_map); |
124 | 124 | foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) { |
125 | - $map = array_flip($this->field_map); |
|
126 | - if (isset($row->$map[$field])) { |
|
125 | + $map = array_flip($this->field_map); |
|
126 | + if (isset($row->$map[$field])) { |
|
127 | 127 | $tokens["[$field]"] = $row->$map[$field]; |
128 | - } |
|
129 | - else { |
|
128 | + } |
|
129 | + else { |
|
130 | 130 | $tokens["[$field]"] = ''; |
131 | - } |
|
131 | + } |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $tokens; |
135 | - } |
|
135 | + } |
|
136 | 136 | } |
@@ -112,7 +112,7 @@ |
||
112 | 112 | |
113 | 113 | $count = 0; |
114 | 114 | foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
115 | - $token = '%'. ++$count; |
|
115 | + $token = '%'.++$count; |
|
116 | 116 | if (!isset($tokens[$token])) { |
117 | 117 | $tokens[$token] = ''; |
118 | 118 | } |
@@ -76,8 +76,7 @@ discard block |
||
76 | 76 | foreach ($handlers as $field => $handler) { |
77 | 77 | if ($label = $handler->label()) { |
78 | 78 | $field_names[$field] = $label; |
79 | - } |
|
80 | - else { |
|
79 | + } else { |
|
81 | 80 | $field_names[$field] = $handler->ui_name(); |
82 | 81 | } |
83 | 82 | } |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | $map = array_flip($this->field_map); |
126 | 125 | if (isset($row->$map[$field])) { |
127 | 126 | $tokens["[$field]"] = $row->$map[$field]; |
128 | - } |
|
129 | - else { |
|
127 | + } else { |
|
130 | 128 | $tokens["[$field]"] = ''; |
131 | 129 | } |
132 | 130 | } |