@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | # Key-related functions |
139 | 139 | |
140 | 140 | function api_log_call($key) { |
141 | - if ($key=='DOCS') { |
|
141 | + if ($key == 'DOCS') { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | $ip = $_SERVER['REMOTE_ADDR']; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | # Output functions |
217 | 217 | |
218 | -function api_output($arr, $last_mod=null) { |
|
218 | +function api_output($arr, $last_mod = null) { |
|
219 | 219 | $output = get_http_var('output'); |
220 | 220 | if (!get_http_var('docs')) { |
221 | 221 | $cond = api_header($output, $last_mod); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | } |
226 | 226 | if ($output == 'xml') { |
227 | - $out = '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
|
227 | + $out = '<?xml version="1.0" encoding="utf-8"?>' . "\n"; |
|
228 | 228 | $out .= '<twfy>' . api_output_xml($arr) . '</twfy>'; |
229 | 229 | } elseif ($output == 'php') { |
230 | 230 | $out = api_output_php($arr); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | print $out; |
244 | 244 | } |
245 | 245 | |
246 | -function api_header($o, $last_mod=null) { |
|
246 | +function api_header($o, $last_mod = null) { |
|
247 | 247 | if ($last_mod && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { |
248 | 248 | $t = cond_parse_http_date($_SERVER['HTTP_IF_MODIFIED_SINCE']); |
249 | 249 | if (isset($t) && $t >= $last_mod) { |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | #$type = 'text/plain'; |
271 | 271 | header("Content-Type: $type; charset=$charset"); |
272 | - if ($last_mod>0) { |
|
272 | + if ($last_mod > 0) { |
|
273 | 273 | header('Last-Modified: ' . date('r', $last_mod)); |
274 | 274 | } |
275 | 275 | return false; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | global $api_xml_arr; |
302 | 302 | $verbose = get_http_var('verbose') ? "\n" : ''; |
303 | 303 | if (is_array($v)) { |
304 | - if (count($v) && array_keys($v) === range(0, count($v)-1)) { |
|
304 | + if (count($v) && array_keys($v) === range(0, count($v) - 1)) { |
|
305 | 305 | $elt = 'match'; |
306 | 306 | $api_xml_arr++; |
307 | 307 | $out = "<$elt>"; |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | -function api_output_js($v, $level=0) { |
|
325 | +function api_output_js($v, $level = 0) { |
|
326 | 326 | $verbose = get_http_var('verbose') ? "\n" : ''; |
327 | 327 | $out = ''; |
328 | 328 | if (is_array($v)) { |
329 | 329 | # PHP arrays are both JS arrays and objects |
330 | - if (count($v) && array_keys($v) === range(0, count($v)-1)) { |
|
331 | - $out = '[' . join(",$verbose" , array_map('api_output_js', $v)) . ']'; |
|
330 | + if (count($v) && array_keys($v) === range(0, count($v) - 1)) { |
|
331 | + $out = '[' . join(",$verbose", array_map('api_output_js', $v)) . ']'; |
|
332 | 332 | } else { |
333 | 333 | $out = '{' . $verbose; |
334 | 334 | $b = false; |
@@ -337,16 +337,16 @@ discard block |
||
337 | 337 | $out .= ",$verbose"; |
338 | 338 | } |
339 | 339 | if ($verbose) { |
340 | - $out .= str_repeat(' ', ($level+1)*2); |
|
340 | + $out .= str_repeat(' ', ($level + 1) * 2); |
|
341 | 341 | $out .= '"' . $k . '" : '; |
342 | 342 | } else { |
343 | 343 | $out .= '"' . $k . '":'; |
344 | 344 | } |
345 | - $out .= api_output_js($vv, $level+1); |
|
345 | + $out .= api_output_js($vv, $level + 1); |
|
346 | 346 | $b = true; |
347 | 347 | } |
348 | 348 | if ($verbose) { |
349 | - $out .= "\n" . str_repeat(' ', $level*2); |
|
349 | + $out .= "\n" . str_repeat(' ', $level * 2); |
|
350 | 350 | } |
351 | 351 | $out .= '}'; |
352 | 352 | } |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | $out = "null"; |
355 | 355 | } elseif (is_string($v)) { |
356 | 356 | $out = '"' . str_replace( |
357 | - array("\\",'"',"\n","\t","\r", "‶", "″", "“", "”"), |
|
358 | - array("\\\\",'\"','\n','\t','\r', '\"', '\"', '\"', '\"'), $v) . '"'; |
|
357 | + array("\\", '"', "\n", "\t", "\r", "‶", "″", "“", "”"), |
|
358 | + array("\\\\", '\"', '\n', '\t', '\r', '\"', '\"', '\"', '\"'), $v) . '"'; |
|
359 | 359 | } elseif (is_bool($v)) { |
360 | 360 | $out = $v ? 'true' : 'false'; |
361 | 361 | } elseif (is_int($v) || is_float($v)) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return null; |
71 | 71 | } |
72 | 72 | |
73 | -function _api_cacheCheck($fn, $arg='') { |
|
73 | +function _api_cacheCheck($fn, $arg = '') { |
|
74 | 74 | $cache = INCLUDESPATH . '../docs/api/cache/' . $fn; |
75 | 75 | if (is_file($cache)) { |
76 | 76 | return unserialize(file_get_contents($cache)); |
@@ -88,58 +88,58 @@ discard block |
||
88 | 88 | function _api_ni_centroids() { |
89 | 89 | return array( |
90 | 90 | # East Londonderry |
91 | - 66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ), |
|
92 | - 14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ), |
|
91 | + 66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907), |
|
92 | + 14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907), |
|
93 | 93 | # Foyle |
94 | - 66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ), |
|
95 | - 14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ), |
|
94 | + 66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456), |
|
95 | + 14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456), |
|
96 | 96 | # West Tyrone |
97 | - 66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ), |
|
98 | - 14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ), |
|
97 | + 66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278), |
|
98 | + 14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278), |
|
99 | 99 | # Fermanagh & South Tyrone |
100 | - 14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ), |
|
101 | - 66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ), |
|
100 | + 14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237), |
|
101 | + 66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237), |
|
102 | 102 | # Newry & Armagh |
103 | - 14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ), |
|
104 | - 66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ), |
|
103 | + 14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770), |
|
104 | + 66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770), |
|
105 | 105 | # Upper Bann |
106 | - 14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ), |
|
107 | - 66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ), |
|
106 | + 14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098), |
|
107 | + 66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098), |
|
108 | 108 | # South Down |
109 | - 14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ), |
|
110 | - 66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ), |
|
109 | + 14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344), |
|
110 | + 66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344), |
|
111 | 111 | # Lagan Valley |
112 | - 14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ), |
|
113 | - 66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ), |
|
112 | + 14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398), |
|
113 | + 66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398), |
|
114 | 114 | # Strangford |
115 | - 14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ), |
|
116 | - 66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ), |
|
115 | + 14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343), |
|
116 | + 66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343), |
|
117 | 117 | # North Down |
118 | - 14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ), |
|
119 | - 66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ), |
|
118 | + 14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384), |
|
119 | + 66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384), |
|
120 | 120 | # South Antrim |
121 | - 14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ), |
|
122 | - 66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ), |
|
121 | + 14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905), |
|
122 | + 66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905), |
|
123 | 123 | # East Antrim |
124 | - 66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ), |
|
125 | - 14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ), |
|
124 | + 66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179), |
|
125 | + 14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179), |
|
126 | 126 | # North Antrim |
127 | - 66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ), |
|
128 | - 14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ), |
|
127 | + 66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125), |
|
128 | + 14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125), |
|
129 | 129 | # Mid Ulster |
130 | - 66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ), |
|
131 | - 14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ), |
|
130 | + 66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044), |
|
131 | + 14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044), |
|
132 | 132 | # Belfast North |
133 | - 14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ), |
|
134 | - 66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ), |
|
133 | + 14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511), |
|
134 | + 66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511), |
|
135 | 135 | # Belfast East |
136 | - 14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ), |
|
137 | - 66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ), |
|
136 | + 14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792), |
|
137 | + 66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792), |
|
138 | 138 | # Belfast South |
139 | - 14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ), |
|
140 | - 66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ), |
|
139 | + 14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064), |
|
140 | + 66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064), |
|
141 | 141 | # Belfast West |
142 | - 14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ), |
|
143 | - 66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ), |
|
142 | + 14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650), |
|
143 | + 66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650), |
|
144 | 144 | ); |
145 | 145 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <?php |
18 | 18 | } |
19 | 19 | |
20 | -function _api_getPerson_row($row, $has_party=false) { |
|
20 | +function _api_getPerson_row($row, $has_party = false) { |
|
21 | 21 | global $parties; |
22 | 22 | $row['full_name'] = member_full_name($row['house'], $row['title'], $row['given_name'], |
23 | 23 | $row['family_name'], $row['lordofname']); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if ($has_party && isset($parties[$row['party']])) { |
32 | 32 | $row['party'] = $parties[$row['party']]; |
33 | 33 | } |
34 | - list($image,$sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']); |
|
34 | + list($image, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']); |
|
35 | 35 | if ($image) { |
36 | 36 | list($width, $height) = getimagesize(str_replace(IMAGEPATH, BASEDIR . IMAGEPATH, $image)); |
37 | 37 | $row['image'] = $image; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | return $row; |
59 | 59 | } |
60 | 60 | |
61 | -function api_getPerson_id($id, $house='') { |
|
61 | +function api_getPerson_id($id, $house = '') { |
|
62 | 62 | $db = new ParlDB; |
63 | 63 | $params = array( |
64 | 64 | ':person_id' => $id |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -function _api_getPerson_output($q, $flatten=false) { |
|
83 | +function _api_getPerson_output($q, $flatten = false) { |
|
84 | 84 | $output = array(); |
85 | 85 | $last_mod = 0; |
86 | 86 | $house = null; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | and c_main.main_name and constituency.name like :constituency_name and constituency.from_date <= date(now()) |
42 | 42 | and date(now()) <= constituency.to_date |
43 | 43 | order by name', array( |
44 | - ':constituency_name' => '%' . $s .'%' |
|
44 | + ':constituency_name' => '%' . $s . '%' |
|
45 | 45 | )); |
46 | 46 | $output = array(); |
47 | 47 | $done = array(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | function api_getConstituencies($date = 'now()') { |
71 | 71 | $db = new ParlDB; |
72 | 72 | $q = $db->query('select cons_id, name from constituency |
73 | - where main_name and from_date <= date('.$date.') and date('.$date.') <= to_date |
|
73 | + where main_name and from_date <= date('.$date . ') and date(' . $date . ') <= to_date |
|
74 | 74 | order by name'); |
75 | 75 | $output = array(); |
76 | 76 | foreach ($q as $row) { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | function _api_angle_between($a1, $a2) { |
154 | 154 | if (abs($a1 - $a2) > M_PI) { |
155 | - return 2*M_PI - abs($a1 - $a2); |
|
155 | + return 2 * M_PI - abs($a1 - $a2); |
|
156 | 156 | } |
157 | 157 | return abs($a1 - $a2); |
158 | 158 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function api_getAlerts_start_date($start_date) { |
4 | - $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date')); |
|
4 | + $args = array('start_date' => $start_date, 'end_date' => get_http_var('end_date')); |
|
5 | 5 | $alert = new ALERT(); |
6 | - $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']); |
|
6 | + $data = $alert->fetch_between($confirmed = 1, $deleted = 0, $args['start_date'], $args['end_date']); |
|
7 | 7 | api_output($data); |
8 | 8 | } |
9 | 9 |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | $this_page = 'bill_index'; |
4 | 4 | include_once '../../../../includes/easyparliament/init.php'; |
5 | -$DATA->set_page_metadata($this_page, 'heading','Legislative and Regulatory Reform Bill'); |
|
5 | +$DATA->set_page_metadata($this_page, 'heading', 'Legislative and Regulatory Reform Bill'); |
|
6 | 6 | $PAGE->page_start(); |
7 | 7 | $PAGE->stripe_start(); |
8 | -$PAGE->block_start(array ('title'=>'House of Commons - Normal Run')); |
|
8 | +$PAGE->block_start(array('title'=>'House of Commons - Normal Run')); |
|
9 | 9 | ?> |
10 | 10 | <ul> |
11 | 11 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | parse_bill('2006141.txt'); |
46 | 46 | $amendments = read_amendments('amendments.txt'); # The amendments, by number |
47 | 47 | parse_amendments(); |
48 | - $out = $title."\n\n"; |
|
48 | + $out = $title . "\n\n"; |
|
49 | 49 | $out .= "Page,Line\n"; |
50 | 50 | foreach ($bill as $page_num => $page) { |
51 | 51 | foreach ($page as $line_num => $line) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | print '</ul>'; |
60 | 60 | $PAGE->block_end(); |
61 | 61 | $includes = array( |
62 | - array ( |
|
62 | + array( |
|
63 | 63 | 'type' => 'include', |
64 | 64 | 'content' => 'bills_intro' |
65 | 65 | ), |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $intitle = true; |
78 | 78 | $title = ''; |
79 | 79 | foreach ($f as $r) { |
80 | - if ($line<1) { |
|
80 | + if ($line < 1) { |
|
81 | 81 | $line++; |
82 | 82 | continue; |
83 | 83 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | continue; |
98 | 98 | } |
99 | - if (substr($r, 0, 8)=='Bill 141') { |
|
99 | + if (substr($r, 0, 8) == 'Bill 141') { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | if (preg_match('#\s+([1-4]?[05])$#', $r, $m)) { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | if ($r == "\n") { |
144 | 144 | continue; |
145 | 145 | } |
146 | - if ($line<1) { |
|
146 | + if ($line < 1) { |
|
147 | 147 | $line++; |
148 | 148 | continue; |
149 | 149 | } |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | $number = $m[1]; |
158 | 158 | $amendments[$number] = ''; |
159 | 159 | } elseif (preg_match('#To move the following Clause#', $r)) { |
160 | - preg_match('#\n(.*?)$#', $amendments[$number-1], $m); |
|
161 | - $amendments[$number-1] = preg_replace('#\n(.*?)$#', '', $amendments[$number-1]); |
|
160 | + preg_match('#\n(.*?)$#', $amendments[$number - 1], $m); |
|
161 | + $amendments[$number - 1] = preg_replace('#\n(.*?)$#', '', $amendments[$number - 1]); |
|
162 | 162 | $amendments[$number] .= '*' . trim($m[1]) . "*\n$r"; |
163 | 163 | } else { |
164 | 164 | $amendments[$number] .= $r; |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | $page = $m[1]; $line = $m[2]; $clause = $m[3]; |
183 | 183 | $from_text = $m[4]; $end_line = $m[5]; $insert = $m[6]; |
184 | 184 | unset($amendments[$num]); |
185 | - $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="'.$num.'">' . $insert . '</ins>'; |
|
186 | - for ($i=$line+1; $i<=$end_line; $i++) { |
|
187 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
185 | + $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="' . $num . '">' . $insert . '</ins>'; |
|
186 | + for ($i = $line + 1; $i <= $end_line; $i++) { |
|
187 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | # Page 4, line 9 [Clause 6], leave out from `under' to `creating' and insert `this Part making provision' |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | $insert = $m[7]; |
202 | 202 | unset($amendments[$num]); |
203 | 203 | $bill[$page][$from_line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$from_line]) . '</del>'; |
204 | - for ($i=$from_line+1; $i<$to_line; $i++) { |
|
205 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
204 | + for ($i = $from_line + 1; $i < $to_line; $i++) { |
|
205 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
206 | 206 | } |
207 | - $bill[$page][$to_line] = '<del title="'.$num.'">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]); |
|
207 | + $bill[$page][$to_line] = '<del title="' . $num . '">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]); |
|
208 | 208 | } |
209 | 209 | # Page 3, line 13 [Clause 4], leave out from beginning to `confer' and insert `An order under this Part may not make provision to' |
210 | 210 | if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], leave out from beginning to `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) { |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | $page = $m[1]; $line = $m[3]; $clause = $m[2]; |
226 | 226 | $insert = isset($m[4]) ? $m[4] : null; |
227 | 227 | unset($amendments[$num]); |
228 | - $bill[$page][$line] = '<del title="'.$num.'">'.$bill[$page][$line].'</del>'; |
|
228 | + $bill[$page][$line] = '<del title="' . $num . '">' . $bill[$page][$line] . '</del>'; |
|
229 | 229 | if ($insert) { |
230 | - $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>'; |
|
230 | + $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>'; |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | # Page 8, line 24 [Clause 14], at end insert-- `...' |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $page = $m[1]; $line = $m[2]; $clause = $m[3]; |
236 | 236 | $insert = $m[4]; |
237 | 237 | unset($amendments[$num]); |
238 | - $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>'; |
|
238 | + $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>'; |
|
239 | 239 | } |
240 | 240 | # Title, line 1, leave out `reforming legislation' and insert `...' |
241 | 241 | if (preg_match('#Title, line.*?, leave out `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) { |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | foreach ($clauses[$clause] as $subclause_num => $subclause) { |
252 | 252 | foreach ($subclause as $subsubclause_num => $subsubclause) { |
253 | 253 | $startP = $subsubclause['startP']; |
254 | - if ($startP==$page && $subsubclause['startL']==$line) { |
|
254 | + if ($startP == $page && $subsubclause['startL'] == $line) { |
|
255 | 255 | if ($startP == $subsubclause['endP']) { |
256 | 256 | unset($amendments[$num]); |
257 | - for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) { |
|
258 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
257 | + for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) { |
|
258 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
259 | 259 | } |
260 | 260 | if ($insert) { |
261 | - $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>"; |
|
261 | + $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>"; |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
@@ -274,21 +274,21 @@ discard block |
||
274 | 274 | foreach ($clauses[$clause] as $subclause_num => $subclause) { |
275 | 275 | foreach ($subclause as $subsubclause_num => $subsubclause) { |
276 | 276 | $startP = $subsubclause['startP']; |
277 | - if ($startP==$page && $subsubclause['startL']==$line) { |
|
277 | + if ($startP == $page && $subsubclause['startL'] == $line) { |
|
278 | 278 | if ($startP == $subsubclause['endP']) { |
279 | 279 | unset($amendments[$num]); |
280 | 280 | $finished = true; |
281 | 281 | } |
282 | 282 | } |
283 | 283 | if ($finished) { |
284 | - for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) { |
|
285 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
284 | + for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) { |
|
285 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | } |
289 | 289 | if ($finished) { |
290 | 290 | if ($insert) { |
291 | - $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>"; |
|
291 | + $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>"; |
|
292 | 292 | } |
293 | 293 | break; |
294 | 294 | } |
@@ -300,19 +300,19 @@ discard block |
||
300 | 300 | $finished = false; |
301 | 301 | foreach ($clauses[$clause] as $subclause_num => $subclause) { |
302 | 302 | foreach ($subclause as $subsubclause_num => $subsubclause) { |
303 | - if ($subsubclause['startP']==$page && $subsubclause['startL']==$line) { |
|
303 | + if ($subsubclause['startP'] == $page && $subsubclause['startL'] == $line) { |
|
304 | 304 | unset($amendments[$num]); |
305 | 305 | $finished = true; |
306 | 306 | } |
307 | 307 | if ($finished) { |
308 | - for ($p = $subsubclause['startP']; $p<=$subsubclause['endP']; $p++) { |
|
309 | - if ($p>$subsubclause['startP']) { |
|
308 | + for ($p = $subsubclause['startP']; $p <= $subsubclause['endP']; $p++) { |
|
309 | + if ($p > $subsubclause['startP']) { |
|
310 | 310 | $starti = 1; |
311 | 311 | } else { |
312 | 312 | $starti = $subsubclause['startL']; |
313 | 313 | } |
314 | - for ($i = $starti; $i<=$subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages |
|
315 | - $bill[$p][$i] = '<del title="'.$num.'">' . $bill[$p][$i] . '</del>'; |
|
314 | + for ($i = $starti; $i <= $subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages |
|
315 | + $bill[$p][$i] = '<del title="' . $num . '">' . $bill[$p][$i] . '</del>'; |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | } |
@@ -135,9 +135,9 @@ |
||
135 | 135 | <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php |
136 | 136 | foreach ($mreg as $k => $n) { |
137 | 137 | print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>"; |
138 | - if ($k < count($mreg)-2) { |
|
138 | + if ($k < count($mreg) - 2) { |
|
139 | 139 | print ', '; |
140 | - } elseif ($k == count($mreg)-2) { |
|
140 | + } elseif ($k == count($mreg) - 2) { |
|
141 | 141 | print ' and '; |
142 | 142 | } |
143 | 143 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $out = ''; |
13 | 13 | if (get_http_var('preview')) { |
14 | 14 | preview_featured(); |
15 | -} else if ( get_http_var('confirm') ) { |
|
15 | +} else if (get_http_var('confirm')) { |
|
16 | 16 | $out = update_featured(); |
17 | 17 | } |
18 | 18 | |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | print '</div>'; |
24 | 24 | |
25 | 25 | function gid_to_url($gid) { |
26 | - if ( !$gid ) { |
|
26 | + if (!$gid) { |
|
27 | 27 | return ''; |
28 | 28 | } |
29 | 29 | global $hansardmajors; |
30 | 30 | global $db; |
31 | 31 | |
32 | - $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ))->first(); |
|
32 | + $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid))->first(); |
|
33 | 33 | $url_gid = fix_gid_from_db($gid); |
34 | 34 | $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']); |
35 | 35 | $url->insert(array('id' => $url_gid)); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $related = $featured->get_related(); |
44 | 44 | $context = $featured->get_context(); |
45 | 45 | |
46 | - if ( get_http_var('url') ) { |
|
46 | + if (get_http_var('url')) { |
|
47 | 47 | $url = get_http_var('url'); |
48 | 48 | $title = get_http_var('title'); |
49 | 49 | $context = get_http_var('context'); |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | $related_gid3 = $related3 ? get_gid_from_url($related3) : null; |
114 | 114 | |
115 | 115 | print "<h2>Preview Content</h2>"; |
116 | - if ( $gid !== null ) { |
|
116 | + if ($gid !== null) { |
|
117 | 117 | $h = new MySociety\TheyWorkForYou\Homepage; |
118 | - $featured = $h->getFeaturedDebate($gid, $title, $context, array( $related_gid1, $related_gid2, $related_gid3 )); |
|
118 | + $featured = $h->getFeaturedDebate($gid, $title, $context, array($related_gid1, $related_gid2, $related_gid3)); |
|
119 | 119 | |
120 | 120 | include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php'; |
121 | 121 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $parts = parse_url($url); |
158 | 158 | parse_str($parts['query'], $query); |
159 | 159 | |
160 | - if ( $query['id'] ) { |
|
160 | + if ($query['id']) { |
|
161 | 161 | if (strpos($parts['path'], 'lords') !== false) { |
162 | 162 | $gid = 'uk.org.publicwhip/lords/'; |
163 | 163 | } elseif (strpos($parts['path'], 'whall') !== false) { |
@@ -11,34 +11,34 @@ discard block |
||
11 | 11 | |
12 | 12 | $slug = get_http_var('id'); |
13 | 13 | if ($slug) { |
14 | - $topic = $topics->getTopic($slug); |
|
14 | + $topic = $topics->getTopic($slug); |
|
15 | 15 | } else { |
16 | - $topic = new \MySociety\TheyWorkForYou\Topic(); |
|
16 | + $topic = new \MySociety\TheyWorkForYou\Topic(); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | $action = get_http_var('action'); |
20 | 20 | switch ($action) { |
21 | 21 | case 'add': |
22 | 22 | $success = add_topic($topic); |
23 | - break; |
|
23 | + break; |
|
24 | 24 | case 'update': |
25 | 25 | $success = update_topic($topic); |
26 | - break; |
|
26 | + break; |
|
27 | 27 | case 'setimage': |
28 | 28 | $success = add_image($topic); |
29 | - break; |
|
29 | + break; |
|
30 | 30 | case 'addcontent': |
31 | 31 | $success = add_content($topic); |
32 | - break; |
|
32 | + break; |
|
33 | 33 | case 'deletecontent': |
34 | 34 | $success = delete_content($topic); |
35 | - break; |
|
35 | + break; |
|
36 | 36 | case 'addpolicysets': |
37 | 37 | $success = add_policy_sets($topic); |
38 | - break; |
|
38 | + break; |
|
39 | 39 | case 'addpolicies': |
40 | 40 | $success = add_policies($topic); |
41 | - break; |
|
41 | + break; |
|
42 | 42 | default: |
43 | 43 | $success = null; |
44 | 44 | } |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | <select name="sets[]" multiple> |
126 | 126 | <option value="">None</option> |
127 | 127 | <?php |
128 | - $policies = new \MySociety\TheyWorkForYou\Policies; |
|
129 | - $set_descriptions = $policies->getSetDescriptions(); |
|
130 | - $related_sets = $topic->getPolicySets(); |
|
131 | - foreach ($set_descriptions as $set => $description) { ?> |
|
128 | + $policies = new \MySociety\TheyWorkForYou\Policies; |
|
129 | + $set_descriptions = $policies->getSetDescriptions(); |
|
130 | + $related_sets = $topic->getPolicySets(); |
|
131 | + foreach ($set_descriptions as $set => $description) { ?> |
|
132 | 132 | <option value="<?= $set ?>" <?= in_array($set, $related_sets) ? 'selected' : '' ?>><?= $description ?></option> |
133 | 133 | <?php } ?> |
134 | 134 | <input type="submit" value="Update"> |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | <select name="policies[]" multiple> |
144 | 144 | <option value="">None</option> |
145 | 145 | <?php |
146 | - $policies = new \MySociety\TheyWorkForYou\Policies; |
|
147 | - $all_policies = $policies->getPolicies(); |
|
148 | - $related_policies = $topic->getPolicies(); |
|
149 | - foreach ($all_policies as $number => $description) { ?> |
|
146 | + $policies = new \MySociety\TheyWorkForYou\Policies; |
|
147 | + $all_policies = $policies->getPolicies(); |
|
148 | + $related_policies = $topic->getPolicies(); |
|
149 | + foreach ($all_policies as $number => $description) { ?> |
|
150 | 150 | <option value="<?= $number ?>" <?= in_array($number, $related_policies) ? 'selected' : '' ?>><?= $description ?></option> |
151 | 151 | <?php } ?> |
152 | 152 | |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | $file_info['tmp_name'], |
215 | 215 | $topic->image_path() |
216 | 216 | ); |
217 | - } catch (ErrorException $e) { |
|
217 | + } catch (ErrorException $e) { |
|
218 | 218 | return false; |
219 | - } |
|
219 | + } |
|
220 | 220 | |
221 | 221 | if ($image_saved) { |
222 | 222 | return $topic->save(); |