@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | $response->content_type = "text/plain; charset=utf-8"; |
27 | 27 | ob_start(); |
28 | 28 | |
29 | - require_once($GLOBALS['rootpath']."okapi/cronjobs.php"); |
|
29 | + require_once($GLOBALS['rootpath'] . "okapi/cronjobs.php"); |
|
30 | 30 | $schedule = Cache::get("cron_schedule"); |
31 | 31 | if ($schedule == null) |
32 | 32 | $schedule = array(); |
33 | 33 | print "Nearest event: "; |
34 | 34 | if (Okapi::get_var('cron_nearest_event')) |
35 | - print "in ".(Okapi::get_var('cron_nearest_event') - time())." seconds.\n\n"; |
|
35 | + print "in " . (Okapi::get_var('cron_nearest_event') - time()) . " seconds.\n\n"; |
|
36 | 36 | else |
37 | 37 | print "NOT SET\n\n"; |
38 | 38 | $cronjobs = CronJobController::get_enabled_cronjobs(); |
@@ -43,27 +43,27 @@ discard block |
||
43 | 43 | return $by_type; |
44 | 44 | return $cmp($a->get_name(), $b->get_name()); |
45 | 45 | }); |
46 | - print str_pad("TYPE", 11)." ".str_pad("NAME", 40)." SCHEDULE\n"; |
|
47 | - print str_pad("----", 11)." ".str_pad("----", 40)." --------\n"; |
|
46 | + print str_pad("TYPE", 11) . " " . str_pad("NAME", 40) . " SCHEDULE\n"; |
|
47 | + print str_pad("----", 11) . " " . str_pad("----", 40) . " --------\n"; |
|
48 | 48 | foreach ($cronjobs as $cronjob) |
49 | 49 | { |
50 | 50 | $type = $cronjob->get_type(); |
51 | 51 | $name = $cronjob->get_name(); |
52 | - print str_pad($type, 11)." ".str_pad($name, 40)." "; |
|
52 | + print str_pad($type, 11) . " " . str_pad($name, 40) . " "; |
|
53 | 53 | if (!isset($schedule[$name])) |
54 | 54 | print "NOT YET SCHEDULED\n"; |
55 | 55 | elseif ($schedule[$name] <= time()) |
56 | - print "DELAYED: should be run ".(time() - $schedule[$name])." seconds ago\n"; |
|
56 | + print "DELAYED: should be run " . (time() - $schedule[$name]) . " seconds ago\n"; |
|
57 | 57 | else |
58 | - print "scheduled to run in ".str_pad($schedule[$name] - time(), 6, " ", STR_PAD_LEFT)." seconds\n"; |
|
58 | + print "scheduled to run in " . str_pad($schedule[$name] - time(), 6, " ", STR_PAD_LEFT) . " seconds\n"; |
|
59 | 59 | } |
60 | 60 | print "\n"; |
61 | 61 | print "Crontab last ping: "; |
62 | 62 | if (Cache::get('crontab_last_ping')) |
63 | - print (time() - Cache::get('crontab_last_ping'))." seconds ago"; |
|
63 | + print (time() - Cache::get('crontab_last_ping')) . " seconds ago"; |
|
64 | 64 | else |
65 | 65 | print "NEVER"; |
66 | - print " (crontab_check_counter: ".Cache::get('crontab_check_counter').").\n"; |
|
66 | + print " (crontab_check_counter: " . Cache::get('crontab_check_counter') . ").\n"; |
|
67 | 67 | print "clog_revisions_daily: "; |
68 | 68 | if (Cache::get('clog_revisions_daily')) |
69 | 69 | { |
@@ -28,19 +28,22 @@ discard block |
||
28 | 28 | |
29 | 29 | require_once($GLOBALS['rootpath']."okapi/cronjobs.php"); |
30 | 30 | $schedule = Cache::get("cron_schedule"); |
31 | - if ($schedule == null) |
|
32 | - $schedule = array(); |
|
31 | + if ($schedule == null) { |
|
32 | + $schedule = array(); |
|
33 | + } |
|
33 | 34 | print "Nearest event: "; |
34 | - if (Okapi::get_var('cron_nearest_event')) |
|
35 | - print "in ".(Okapi::get_var('cron_nearest_event') - time())." seconds.\n\n"; |
|
36 | - else |
|
37 | - print "NOT SET\n\n"; |
|
35 | + if (Okapi::get_var('cron_nearest_event')) { |
|
36 | + print "in ".(Okapi::get_var('cron_nearest_event') - time())." seconds.\n\n"; |
|
37 | + } else { |
|
38 | + print "NOT SET\n\n"; |
|
39 | + } |
|
38 | 40 | $cronjobs = CronJobController::get_enabled_cronjobs(); |
39 | 41 | usort($cronjobs, function($a, $b) { |
40 | 42 | $cmp = function($a, $b) { return ($a < $b) ? -1 : (($a > $b) ? 1 : 0); }; |
41 | 43 | $by_type = $cmp($a->get_type(), $b->get_type()); |
42 | - if ($by_type != 0) |
|
43 | - return $by_type; |
|
44 | + if ($by_type != 0) { |
|
45 | + return $by_type; |
|
46 | + } |
|
44 | 47 | return $cmp($a->get_name(), $b->get_name()); |
45 | 48 | }); |
46 | 49 | print str_pad("TYPE", 11)." ".str_pad("NAME", 40)." SCHEDULE\n"; |
@@ -50,25 +53,28 @@ discard block |
||
50 | 53 | $type = $cronjob->get_type(); |
51 | 54 | $name = $cronjob->get_name(); |
52 | 55 | print str_pad($type, 11)." ".str_pad($name, 40)." "; |
53 | - if (!isset($schedule[$name])) |
|
54 | - print "NOT YET SCHEDULED\n"; |
|
55 | - elseif ($schedule[$name] <= time()) |
|
56 | - print "DELAYED: should be run ".(time() - $schedule[$name])." seconds ago\n"; |
|
57 | - else |
|
58 | - print "scheduled to run in ".str_pad($schedule[$name] - time(), 6, " ", STR_PAD_LEFT)." seconds\n"; |
|
56 | + if (!isset($schedule[$name])) { |
|
57 | + print "NOT YET SCHEDULED\n"; |
|
58 | + } elseif ($schedule[$name] <= time()) { |
|
59 | + print "DELAYED: should be run ".(time() - $schedule[$name])." seconds ago\n"; |
|
60 | + } else { |
|
61 | + print "scheduled to run in ".str_pad($schedule[$name] - time(), 6, " ", STR_PAD_LEFT)." seconds\n"; |
|
62 | + } |
|
59 | 63 | } |
60 | 64 | print "\n"; |
61 | 65 | print "Crontab last ping: "; |
62 | - if (Cache::get('crontab_last_ping')) |
|
63 | - print (time() - Cache::get('crontab_last_ping'))." seconds ago"; |
|
64 | - else |
|
65 | - print "NEVER"; |
|
66 | + if (Cache::get('crontab_last_ping')) { |
|
67 | + print (time() - Cache::get('crontab_last_ping'))." seconds ago"; |
|
68 | + } else { |
|
69 | + print "NEVER"; |
|
70 | + } |
|
66 | 71 | print " (crontab_check_counter: ".Cache::get('crontab_check_counter').").\n"; |
67 | 72 | print "clog_revisions_daily: "; |
68 | 73 | if (Cache::get('clog_revisions_daily')) |
69 | 74 | { |
70 | - foreach (Cache::get('clog_revisions_daily') as $time => $rev) |
|
71 | - print "$rev "; |
|
75 | + foreach (Cache::get('clog_revisions_daily') as $time => $rev) { |
|
76 | + print "$rev "; |
|
77 | + } |
|
72 | 78 | print "\n"; |
73 | 79 | } else { |
74 | 80 | print "NULL\n"; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | # Flush the stats, so the page is fresh upon every request. |
23 | 23 | |
24 | - require_once($GLOBALS['rootpath']."okapi/cronjobs.php"); |
|
24 | + require_once($GLOBALS['rootpath'] . "okapi/cronjobs.php"); |
|
25 | 25 | CronJobController::force_run("StatsWriterCronJob"); |
26 | 26 | |
27 | 27 | # When services/caches/map/tile method is called, it writes some extra |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | ob_start(); |
34 | 34 | |
35 | 35 | $start = isset($_GET['start']) ? $_GET['start'] : date( |
36 | - "Y-m-d 00:00:00", time() - 7*86400); |
|
36 | + "Y-m-d 00:00:00", time() - 7 * 86400); |
|
37 | 37 | $end = isset($_GET['end']) ? $_GET['end'] : date("Y-m-d 23:59:59"); |
38 | 38 | |
39 | 39 | print "From: $start\n"; |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | sum(total_runtime) |
47 | 47 | from okapi_stats_hourly |
48 | 48 | where |
49 | - period_start >= '".Db::escape_string($start)."' |
|
50 | - and period_start < '".Db::escape_string($end)."' |
|
49 | + period_start >= '".Db::escape_string($start) . "' |
|
50 | + and period_start < '".Db::escape_string($end) . "' |
|
51 | 51 | and service_name like '%caches/map/tile%' |
52 | 52 | group by service_name |
53 | 53 | "); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | if ($total_calls != $calls['A']) |
74 | 74 | { |
75 | - print "Partial results. Only ".$calls['A']." out of $total_calls are covered.\n"; |
|
75 | + print "Partial results. Only " . $calls['A'] . " out of $total_calls are covered.\n"; |
|
76 | 76 | print "All other will count as \"unaccounted for\".\n\n"; |
77 | 77 | $total_calls = $calls['A']; |
78 | 78 | } |
@@ -80,37 +80,37 @@ discard block |
||
80 | 80 | $calls_left = $total_calls; |
81 | 81 | $runtime_left = $total_runtime; |
82 | 82 | |
83 | - $perc = function($a, $b) { return ($b > 0) ? sprintf("%.1f", 100 * $a / $b)."%" : "(?)"; }; |
|
84 | - $avg = function($a, $b) { return ($b > 0) ? sprintf("%.4f", $a / $b)."s" : "(?)"; }; |
|
83 | + $perc = function($a, $b) { return ($b > 0) ? sprintf("%.1f", 100 * $a / $b) . "%" : "(?)"; }; |
|
84 | + $avg = function($a, $b) { return ($b > 0) ? sprintf("%.4f", $a / $b) . "s" : "(?)"; }; |
|
85 | 85 | $get_stats = function() use (&$calls_left, &$runtime_left, &$total_calls, &$total_runtime, &$perc) |
86 | 86 | { |
87 | 87 | return ( |
88 | - str_pad($perc($calls_left, $total_calls), 6, " ", STR_PAD_LEFT). |
|
88 | + str_pad($perc($calls_left, $total_calls), 6, " ", STR_PAD_LEFT) . |
|
89 | 89 | str_pad($perc($runtime_left, $total_runtime), 7, " ", STR_PAD_LEFT) |
90 | 90 | ); |
91 | 91 | }; |
92 | 92 | |
93 | 93 | print "%CALLS %TIME Description\n"; |
94 | 94 | print "====== ====== ======================================================================\n"; |
95 | - print $get_stats()." $total_calls responses served. Total runtime: ".sprintf("%.2f", $total_runtime)."s\n"; |
|
95 | + print $get_stats() . " $total_calls responses served. Total runtime: " . sprintf("%.2f", $total_runtime) . "s\n"; |
|
96 | 96 | print "\n"; |
97 | 97 | print " All of these requests needed a TileTree build/lookup. The average runtime of\n"; |
98 | - print " these lookups was ".$avg($runtime['A'], $total_calls).". ".$perc($runtime['A'], $total_runtime)." of total runtime was spent here.\n"; |
|
98 | + print " these lookups was " . $avg($runtime['A'], $total_calls) . ". " . $perc($runtime['A'], $total_runtime) . " of total runtime was spent here.\n"; |
|
99 | 99 | print "\n"; |
100 | 100 | |
101 | 101 | $runtime_left -= $runtime['A']; |
102 | 102 | |
103 | - print $get_stats()." All calls passed here after ~".$avg($runtime['A'], $total_calls)."\n"; |
|
103 | + print $get_stats() . " All calls passed here after ~" . $avg($runtime['A'], $total_calls) . "\n"; |
|
104 | 104 | |
105 | 105 | print "\n"; |
106 | 106 | print " Lookup result was then processed and \"image description\" was created. It was\n"; |
107 | 107 | print " passed on to the TileRenderer to compute the ETag hash string. The average runtime\n"; |
108 | - print " of this part was ".$avg($runtime['B'], $total_calls).". ".$perc($runtime['B'], $total_runtime)." of total runtime was spent here.\n"; |
|
108 | + print " of this part was " . $avg($runtime['B'], $total_calls) . ". " . $perc($runtime['B'], $total_runtime) . " of total runtime was spent here.\n"; |
|
109 | 109 | print "\n"; |
110 | 110 | |
111 | 111 | $runtime_left -= $runtime['B']; |
112 | 112 | |
113 | - print $get_stats()." All calls passed here after ~".$avg($runtime['A'] + $runtime['B'], $total_calls)."\n"; |
|
113 | + print $get_stats() . " All calls passed here after ~" . $avg($runtime['A'] + $runtime['B'], $total_calls) . "\n"; |
|
114 | 114 | |
115 | 115 | $etag_hits = $calls['B'] - $calls['C']; |
116 | 116 | |
@@ -120,29 +120,29 @@ discard block |
||
120 | 120 | |
121 | 121 | $calls_left = $calls['C']; |
122 | 122 | |
123 | - print $get_stats()." $calls_left calls passed here after ~".$avg($runtime['A'] + $runtime['B'], $total_calls)."\n"; |
|
123 | + print $get_stats() . " $calls_left calls passed here after ~" . $avg($runtime['A'] + $runtime['B'], $total_calls) . "\n"; |
|
124 | 124 | |
125 | 125 | $imagecache_hits = $calls['C'] - $calls['D']; |
126 | 126 | |
127 | 127 | print "\n"; |
128 | 128 | print " $imagecache_hits of these calls hit the server image cache.\n"; |
129 | - print " ".$perc($runtime['C'], $total_runtime)." of total runtime was spent to find these.\n"; |
|
129 | + print " " . $perc($runtime['C'], $total_runtime) . " of total runtime was spent to find these.\n"; |
|
130 | 130 | print "\n"; |
131 | 131 | |
132 | 132 | $calls_left = $calls['D']; |
133 | 133 | $runtime_left -= $runtime['C']; |
134 | 134 | |
135 | - print $get_stats()." $calls_left calls passed here after ~".$avg($runtime['A'] + $runtime['B'] + $runtime['C'], $total_calls)."\n"; |
|
135 | + print $get_stats() . " $calls_left calls passed here after ~" . $avg($runtime['A'] + $runtime['B'] + $runtime['C'], $total_calls) . "\n"; |
|
136 | 136 | print "\n"; |
137 | 137 | print " These calls required the tile to be rendered. On average, it took\n"; |
138 | - print " ".$avg($runtime['D'], $calls['D'])." to *render* a tile.\n"; |
|
139 | - print " ".$perc($runtime['D'], $total_runtime)." of total runtime was spent here.\n"; |
|
138 | + print " " . $avg($runtime['D'], $calls['D']) . " to *render* a tile.\n"; |
|
139 | + print " " . $perc($runtime['D'], $total_runtime) . " of total runtime was spent here.\n"; |
|
140 | 140 | print "\n"; |
141 | 141 | |
142 | 142 | $runtime_left -= $runtime['D']; |
143 | 143 | |
144 | - print $perc($runtime_left, $total_runtime)." of runtime was unaccounted for (other processing).\n"; |
|
145 | - print "Average response time was ".$avg($total_runtime, $total_calls).".\n\n"; |
|
144 | + print $perc($runtime_left, $total_runtime) . " of runtime was unaccounted for (other processing).\n"; |
|
145 | + print "Average response time was " . $avg($total_runtime, $total_calls) . ".\n\n"; |
|
146 | 146 | |
147 | 147 | print "Current okapi_cache score distribution:\n"; |
148 | 148 | $rs = Db::query(" |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | "); |
154 | 154 | while (list($log2, $count, $size) = Db::fetch_row($rs)) |
155 | 155 | { |
156 | - print $count." elements ($size bytes) with score between ".pow(2, $log2)." and ".pow(2, $log2 + 1).".\n"; |
|
156 | + print $count . " elements ($size bytes) with score between " . pow(2, $log2) . " and " . pow(2, $log2 + 1) . ".\n"; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $response->body = ob_get_clean(); |
@@ -63,8 +63,7 @@ |
||
63 | 63 | { |
64 | 64 | $total_calls = $c; |
65 | 65 | $total_runtime = $r; |
66 | - } |
|
67 | - elseif (strpos($name, 'extra/caches/map/tile/checkpoint') === 0) |
|
66 | + } elseif (strpos($name, 'extra/caches/map/tile/checkpoint') === 0) |
|
68 | 67 | { |
69 | 68 | $calls[$name[32]] = $c; |
70 | 69 | $runtime[$name[32]] = $r; |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | print "$id: $name\n"; |
35 | 35 | |
36 | 36 | print "\nAttributes:\n\n"; |
37 | - require_once($GLOBALS['rootpath'].'okapi/services/attrs/attr_helper.inc.php'); |
|
37 | + require_once($GLOBALS['rootpath'] . 'okapi/services/attrs/attr_helper.inc.php'); |
|
38 | 38 | $internal2acode = AttrHelper::get_internal_id_to_acode_mapping(); |
39 | 39 | $dict = self::get_all_attribute_names(); |
40 | 40 | foreach ($dict as $internal_id => $langs) |
41 | 41 | { |
42 | - print $internal_id.": "; |
|
42 | + print $internal_id . ": "; |
|
43 | 43 | $langkeys = array_keys($langs); |
44 | 44 | sort($langkeys); |
45 | 45 | if (in_array('en', $langkeys)) |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | else |
48 | 48 | print ">>>> ENGLISH NAME UNSET! <<<<"; |
49 | 49 | if (isset($internal2acode[$internal_id])) |
50 | - print " - ".$internal2acode[$internal_id]; |
|
50 | + print " - " . $internal2acode[$internal_id]; |
|
51 | 51 | else |
52 | 52 | print " - >>>> MISSING A-CODE MAPPING <<<<"; |
53 | 53 | print "\n"; |
54 | 54 | foreach ($langkeys as $langkey) |
55 | - print " $langkey: ".$langs[$langkey]."\n"; |
|
55 | + print " $langkey: " . $langs[$langkey] . "\n"; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | print "\nAttribute notices:\n\n"; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | if (!isset($internal2acode[$internal_id])) |
66 | 66 | { |
67 | - print "(!) Attribute ".$internal_id." is not mapped to any A-code.\n"; |
|
67 | + print "(!) Attribute " . $internal_id . " is not mapped to any A-code.\n"; |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | $acode = $internal2acode[$internal_id]; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | print "( ) Attribute $acode has a different name in the '$lang' language\n"; |
88 | 88 | print " Local name: $value\n"; |
89 | - print " OKAPI name: ".$attr['names'][$lang]."\n"; |
|
89 | + print " OKAPI name: " . $attr['names'][$lang] . "\n"; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
@@ -26,12 +26,14 @@ discard block |
||
26 | 26 | ob_start(); |
27 | 27 | |
28 | 28 | print "Cache Types:\n\n"; |
29 | - foreach (self::get_all_cachetypes() as $id => $name) |
|
30 | - print "$id: $name\n"; |
|
29 | + foreach (self::get_all_cachetypes() as $id => $name) { |
|
30 | + print "$id: $name\n"; |
|
31 | + } |
|
31 | 32 | |
32 | 33 | print "\nLog Types:\n\n"; |
33 | - foreach (self::get_all_logtypes() as $id => $name) |
|
34 | - print "$id: $name\n"; |
|
34 | + foreach (self::get_all_logtypes() as $id => $name) { |
|
35 | + print "$id: $name\n"; |
|
36 | + } |
|
35 | 37 | |
36 | 38 | print "\nAttributes:\n\n"; |
37 | 39 | require_once($GLOBALS['rootpath'].'okapi/services/attrs/attr_helper.inc.php'); |
@@ -42,17 +44,20 @@ discard block |
||
42 | 44 | print $internal_id.": "; |
43 | 45 | $langkeys = array_keys($langs); |
44 | 46 | sort($langkeys); |
45 | - if (in_array('en', $langkeys)) |
|
46 | - print strtoupper($langs['en']); |
|
47 | - else |
|
48 | - print ">>>> ENGLISH NAME UNSET! <<<<"; |
|
49 | - if (isset($internal2acode[$internal_id])) |
|
50 | - print " - ".$internal2acode[$internal_id]; |
|
51 | - else |
|
52 | - print " - >>>> MISSING A-CODE MAPPING <<<<"; |
|
47 | + if (in_array('en', $langkeys)) { |
|
48 | + print strtoupper($langs['en']); |
|
49 | + } else { |
|
50 | + print ">>>> ENGLISH NAME UNSET! <<<<"; |
|
51 | + } |
|
52 | + if (isset($internal2acode[$internal_id])) { |
|
53 | + print " - ".$internal2acode[$internal_id]; |
|
54 | + } else { |
|
55 | + print " - >>>> MISSING A-CODE MAPPING <<<<"; |
|
56 | + } |
|
53 | 57 | print "\n"; |
54 | - foreach ($langkeys as $langkey) |
|
55 | - print " $langkey: ".$langs[$langkey]."\n"; |
|
58 | + foreach ($langkeys as $langkey) { |
|
59 | + print " $langkey: ".$langs[$langkey]."\n"; |
|
60 | + } |
|
56 | 61 | } |
57 | 62 | |
58 | 63 | print "\nAttribute notices:\n\n"; |
@@ -110,8 +115,7 @@ discard block |
||
110 | 115 | # have translation tables. |
111 | 116 | |
112 | 117 | $rs = Db::query("select id, language, text_long from cache_attrib order by id"); |
113 | - } |
|
114 | - else |
|
118 | + } else |
|
115 | 119 | { |
116 | 120 | # OCDE branch uses translation tables. Let's make a select which will |
117 | 121 | # produce results compatible with the one above. |
@@ -146,8 +150,7 @@ discard block |
||
146 | 150 | # OCPL branch does not store cache types in many languages (just two). |
147 | 151 | |
148 | 152 | $rs = Db::query("select id, en from cache_type order by id"); |
149 | - } |
|
150 | - else |
|
153 | + } else |
|
151 | 154 | { |
152 | 155 | # OCDE branch uses translation tables. |
153 | 156 | |
@@ -181,8 +184,7 @@ discard block |
||
181 | 184 | # OCPL branch does not store cache types in many languages (just two). |
182 | 185 | |
183 | 186 | $rs = Db::query("select id, en from log_types order by id"); |
184 | - } |
|
185 | - else |
|
187 | + } else |
|
186 | 188 | { |
187 | 189 | # OCDE branch uses translation tables. |
188 | 190 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $tmp = Db::select_value(" |
26 | 26 | select data |
27 | 27 | from okapi_clog |
28 | - where id='".Db::escape_string($_GET['id'])."' |
|
28 | + where id='".Db::escape_string($_GET['id']) . "' |
|
29 | 29 | "); |
30 | 30 | $data = unserialize(gzinflate($tmp)); |
31 | 31 |
@@ -17,12 +17,12 @@ |
||
17 | 17 | { |
18 | 18 | public static function call() |
19 | 19 | { |
20 | - require_once($GLOBALS['rootpath'].'okapi/service_runner.php'); |
|
21 | - require_once($GLOBALS['rootpath'].'okapi/views/menu.inc.php'); |
|
20 | + require_once($GLOBALS['rootpath'] . 'okapi/service_runner.php'); |
|
21 | + require_once($GLOBALS['rootpath'] . 'okapi/views/menu.inc.php'); |
|
22 | 22 | |
23 | 23 | $vars = array( |
24 | 24 | 'menu' => OkapiMenu::get_menu_html("examples.html"), |
25 | - 'okapi_base_url' => Settings::get('SITE_URL')."okapi/", |
|
25 | + 'okapi_base_url' => Settings::get('SITE_URL') . "okapi/", |
|
26 | 26 | 'site_url' => Settings::get('SITE_URL'), |
27 | 27 | 'installations' => OkapiMenu::get_installations(), |
28 | 28 | 'okapi_rev' => Okapi::$version_number, |
@@ -18,11 +18,11 @@ |
||
18 | 18 | { |
19 | 19 | public static function call($methodname) |
20 | 20 | { |
21 | - require_once($GLOBALS['rootpath'].'okapi/service_runner.php'); |
|
21 | + require_once($GLOBALS['rootpath'] . 'okapi/service_runner.php'); |
|
22 | 22 | |
23 | 23 | if (!OkapiServiceRunner::exists($methodname)) |
24 | - throw new BadRequest("Method '$methodname' does not exist. ". |
|
25 | - "See OKAPI docs at ".Settings::get('SITE_URL')."okapi/"); |
|
24 | + throw new BadRequest("Method '$methodname' does not exist. " . |
|
25 | + "See OKAPI docs at " . Settings::get('SITE_URL') . "okapi/"); |
|
26 | 26 | $options = OkapiServiceRunner::options($methodname); |
27 | 27 | $request = new OkapiHttpRequest($options); |
28 | 28 | return OkapiServiceRunner::call($methodname, $request); |
@@ -20,9 +20,10 @@ |
||
20 | 20 | { |
21 | 21 | require_once($GLOBALS['rootpath'].'okapi/service_runner.php'); |
22 | 22 | |
23 | - if (!OkapiServiceRunner::exists($methodname)) |
|
24 | - throw new BadRequest("Method '$methodname' does not exist. ". |
|
23 | + if (!OkapiServiceRunner::exists($methodname)) { |
|
24 | + throw new BadRequest("Method '$methodname' does not exist. ". |
|
25 | 25 | "See OKAPI docs at ".Settings::get('SITE_URL')."okapi/"); |
26 | + } |
|
26 | 27 | $options = OkapiServiceRunner::options($methodname); |
27 | 28 | $request = new OkapiHttpRequest($options); |
28 | 29 | return OkapiServiceRunner::call($methodname, $request); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | public static function call() |
16 | 16 | { |
17 | - require_once($GLOBALS['rootpath'].'okapi/views/changelog_helper.inc.php'); |
|
17 | + require_once($GLOBALS['rootpath'] . 'okapi/views/changelog_helper.inc.php'); |
|
18 | 18 | |
19 | 19 | $changelog = new Changelog(); |
20 | 20 | $changes = array_merge($changelog->unavailable_changes, $changelog->available_changes); |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | use okapi\OkapiInternalConsumer; |
10 | 10 | use okapi\Settings; |
11 | 11 | |
12 | -require_once($GLOBALS['rootpath'].'okapi/service_runner.php'); |
|
12 | +require_once($GLOBALS['rootpath'] . 'okapi/service_runner.php'); |
|
13 | 13 | |
14 | 14 | class OkapiMenu |
15 | 15 | { |
16 | 16 | private static function link($current_path, $link_path, $link_name) |
17 | 17 | { |
18 | - return "<a href='".Settings::get('SITE_URL')."okapi/$link_path'".(($current_path == $link_path) |
|
19 | - ? " class='selected'" : "").">$link_name</a><br>"; |
|
18 | + return "<a href='" . Settings::get('SITE_URL') . "okapi/$link_path'" . (($current_path == $link_path) |
|
19 | + ? " class='selected'" : "") . ">$link_name</a><br>"; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** Get HTML-formatted side menu representation. */ |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | { |
25 | 25 | $chunks = array(); |
26 | 26 | if (Okapi::$version_number) |
27 | - $chunks[] = "<div class='revision'>ver. ".Okapi::$version_number. |
|
28 | - " (".substr(Okapi::$git_revision, 0, 7).")</div>"; |
|
27 | + $chunks[] = "<div class='revision'>ver. " . Okapi::$version_number . |
|
28 | + " (" . substr(Okapi::$git_revision, 0, 7) . ")</div>"; |
|
29 | 29 | $chunks[] = "<div class='main'>"; |
30 | 30 | $chunks[] = self::link($current_path, "introduction.html", "Introduction"); |
31 | 31 | $chunks[] = self::link($current_path, "signup.html", "Sign up"); |
@@ -23,9 +23,10 @@ discard block |
||
23 | 23 | public static function get_menu_html($current_path = null) |
24 | 24 | { |
25 | 25 | $chunks = array(); |
26 | - if (Okapi::$version_number) |
|
27 | - $chunks[] = "<div class='revision'>ver. ".Okapi::$version_number. |
|
26 | + if (Okapi::$version_number) { |
|
27 | + $chunks[] = "<div class='revision'>ver. ".Okapi::$version_number. |
|
28 | 28 | " (".substr(Okapi::$git_revision, 0, 7).")</div>"; |
29 | + } |
|
29 | 30 | $chunks[] = "<div class='main'>"; |
30 | 31 | $chunks[] = self::link($current_path, "introduction.html", "Introduction"); |
31 | 32 | $chunks[] = self::link($current_path, "signup.html", "Sign up"); |
@@ -48,8 +49,9 @@ discard block |
||
48 | 49 | $pos = strrpos($methodname, "/"); |
49 | 50 | $modulename = substr($methodname, 0, $pos); |
50 | 51 | $method_short_name = substr($methodname, $pos + 1); |
51 | - if (!isset($module_methods[$modulename])) |
|
52 | - $module_methods[$modulename] = array(); |
|
52 | + if (!isset($module_methods[$modulename])) { |
|
53 | + $module_methods[$modulename] = array(); |
|
54 | + } |
|
53 | 55 | $module_methods[$modulename][] = $method_short_name; |
54 | 56 | } |
55 | 57 | $modulenames = array_keys($module_methods); |
@@ -59,8 +61,9 @@ discard block |
||
59 | 61 | { |
60 | 62 | $chunks[] = "<div class='module'>$modulename</div>"; |
61 | 63 | $chunks[] = "<div class='methods'>"; |
62 | - foreach ($module_methods[$modulename] as $method_short_name) |
|
63 | - $chunks[] = self::link($current_path, "$modulename/$method_short_name.html", "$method_short_name"); |
|
64 | + foreach ($module_methods[$modulename] as $method_short_name) { |
|
65 | + $chunks[] = self::link($current_path, "$modulename/$method_short_name.html", "$method_short_name"); |
|
66 | + } |
|
64 | 67 | $chunks[] = "</div>"; |
65 | 68 | } |
66 | 69 | return implode("", $chunks); |
@@ -84,8 +87,7 @@ discard block |
||
84 | 87 | $inst_ref['site_url'] = $site_url; |
85 | 88 | $inst_ref['okapi_base_url'] = $site_url . 'okapi/'; |
86 | 89 | $inst_ref['selected'] = true; |
87 | - } |
|
88 | - else |
|
90 | + } else |
|
89 | 91 | { |
90 | 92 | $inst_ref['selected'] = false; |
91 | 93 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | require_once('menu.inc.php'); |
16 | 16 | |
17 | 17 | $vars = array( |
18 | - 'okapi_base_url' => Settings::get('SITE_URL')."okapi/", |
|
18 | + 'okapi_base_url' => Settings::get('SITE_URL') . "okapi/", |
|
19 | 19 | 'menu' => OkapiMenu::get_menu_html(), |
20 | 20 | 'installations' => OkapiMenu::get_installations(), |
21 | 21 | 'okapi_rev' => Okapi::$version_number, |