@@ -489,6 +489,10 @@ discard block |
||
489 | 489 | public function house_text($house) { |
490 | 490 | return $this->houses_pretty[$house]; |
491 | 491 | } |
492 | + |
|
493 | + /** |
|
494 | + * @return string |
|
495 | + */ |
|
492 | 496 | public function constituency() { return $this->constituency; } |
493 | 497 | public function party() { return $this->party; } |
494 | 498 | public function party_text($party = null) { |
@@ -607,6 +611,9 @@ discard block |
||
607 | 611 | } |
608 | 612 | } |
609 | 613 | |
614 | + /** |
|
615 | + * @param string $direction |
|
616 | + */ |
|
610 | 617 | private function _previous_future_mps_query($direction) { |
611 | 618 | $entered_house = $this->entered_house(HOUSE_TYPE_COMMONS); |
612 | 619 | if (is_null($entered_house)) return ''; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $this->extra_info = array(); |
363 | 363 | |
364 | 364 | $q = $this->db->query('SELECT * FROM moffice WHERE person=:person_id ORDER BY from_date DESC, moffice_id', |
365 | - array(':person_id' => $this->person_id)); |
|
365 | + array(':person_id' => $this->person_id)); |
|
366 | 366 | for ($row=0; $row<$q->rows(); $row++) { |
367 | 367 | $this->extra_info['office'][] = $q->row($row); |
368 | 368 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $q = $this->db->query('select bill_id,session,title,sum(attending) as a,sum(chairman) as c |
451 | 451 | from pbc_members, bills |
452 | 452 | where bill_id = bills.id and person_id = ' . $this->person_id() |
453 | - . ' group by bill_id order by session desc'); |
|
453 | + . ' group by bill_id order by session desc'); |
|
454 | 454 | $this->extra_info['pbc'] = array(); |
455 | 455 | for ($i=0; $i<$q->rows(); $i++) { |
456 | 456 | $bill_id = $q->field($i, 'bill_id'); |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | |
113 | 113 | $this->house_disp = 0; |
114 | 114 | $last_party = null; |
115 | - for ($row=0; $row<$q->rows(); $row++) { |
|
115 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
116 | 116 | $house = $q->field($row, 'house'); |
117 | 117 | if (!in_array($house, $this->houses)) $this->houses[] = $house; |
118 | 118 | $const = $q->field($row, 'constituency'); |
119 | - $party = $q->field($row, 'party'); |
|
120 | - $entered_house = $q->field($row, 'entered_house'); |
|
121 | - $left_house = $q->field($row, 'left_house'); |
|
122 | - $entered_reason = $q->field($row, 'entered_reason'); |
|
123 | - $left_reason = $q->field($row, 'left_reason'); |
|
119 | + $party = $q->field($row, 'party'); |
|
120 | + $entered_house = $q->field($row, 'entered_house'); |
|
121 | + $left_house = $q->field($row, 'left_house'); |
|
122 | + $entered_reason = $q->field($row, 'entered_reason'); |
|
123 | + $left_reason = $q->field($row, 'left_reason'); |
|
124 | 124 | |
125 | 125 | if (!isset($this->entered_house[$house]) || $entered_house < $this->entered_house[$house]['date']) { |
126 | 126 | $this->entered_house[$house] = array( |
@@ -140,22 +140,22 @@ discard block |
||
140 | 140 | ); |
141 | 141 | } |
142 | 142 | |
143 | - if ( $house==HOUSE_TYPE_ROYAL # The Monarch |
|
144 | - || (!$this->house_disp && $house==HOUSE_TYPE_SCOTLAND) # MSPs and |
|
145 | - || (!$this->house_disp && $house==HOUSE_TYPE_NI) # MLAs have lowest priority |
|
146 | - || ($this->house_disp!=HOUSE_TYPE_LORDS && $house==HOUSE_TYPE_LORDS) # Lords have highest priority |
|
147 | - || (!$this->house_disp && $house==HOUSE_TYPE_COMMONS) # MPs |
|
143 | + if ($house == HOUSE_TYPE_ROYAL # The Monarch |
|
144 | + || (!$this->house_disp && $house == HOUSE_TYPE_SCOTLAND) # MSPs and |
|
145 | + || (!$this->house_disp && $house == HOUSE_TYPE_NI) # MLAs have lowest priority |
|
146 | + || ($this->house_disp != HOUSE_TYPE_LORDS && $house == HOUSE_TYPE_LORDS) # Lords have highest priority |
|
147 | + || (!$this->house_disp && $house == HOUSE_TYPE_COMMONS) # MPs |
|
148 | 148 | ) { |
149 | 149 | $this->house_disp = $house; |
150 | 150 | $this->constituency = $const; |
151 | 151 | $this->party = $party; |
152 | 152 | |
153 | - $this->member_id = $q->field($row, 'member_id'); |
|
154 | - $this->title = $q->field($row, 'title'); |
|
153 | + $this->member_id = $q->field($row, 'member_id'); |
|
154 | + $this->title = $q->field($row, 'title'); |
|
155 | 155 | $this->given_name = $q->field($row, 'given_name'); |
156 | 156 | $this->family_name = $q->field($row, 'family_name'); |
157 | 157 | $this->lordofname = $q->field($row, 'lordofname'); |
158 | - $this->person_id = $q->field($row, 'person_id'); |
|
158 | + $this->person_id = $q->field($row, 'person_id'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (($last_party && $party && $party != $last_party) || $left_reason == 'changed_party') { |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | if ($q->rows > 0) { |
196 | 196 | return $q->field(0, 'person_id'); |
197 | 197 | } else { |
198 | - throw new MySociety\TheyWorkForYou\MemberException('Sorry, there is no member with a member ID of "' . _htmlentities($member_id) . '".'); |
|
198 | + throw new MySociety\TheyWorkForYou\MemberException('Sorry, there is no member with a member ID of "'._htmlentities($member_id).'".'); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | - public function postcode_to_person_id($postcode, $house=null) { |
|
203 | - twfy_debug ('MP', "postcode_to_person_id converting postcode to person"); |
|
202 | + public function postcode_to_person_id($postcode, $house = null) { |
|
203 | + twfy_debug('MP', "postcode_to_person_id converting postcode to person"); |
|
204 | 204 | $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($postcode)); |
205 | 205 | return $this->constituency_to_person_id($constituency, $house); |
206 | 206 | } |
207 | 207 | |
208 | - public function constituency_to_person_id($constituency, $house=null) { |
|
208 | + public function constituency_to_person_id($constituency, $house = null) { |
|
209 | 209 | if ($constituency == '') { |
210 | 210 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, no constituency was found.'); |
211 | 211 | } |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | if ($q->rows > 0) { |
241 | 241 | return $q->field(0, 'person_id'); |
242 | 242 | } else { |
243 | - throw new MySociety\TheyWorkForYou\MemberException('Sorry, there is no current member for the "' . _htmlentities(ucwords($constituency)) . '" constituency.'); |
|
243 | + throw new MySociety\TheyWorkForYou\MemberException('Sorry, there is no current member for the "'._htmlentities(ucwords($constituency)).'" constituency.'); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | - public function name_to_person_id($name, $const='') { |
|
247 | + public function name_to_person_id($name, $const = '') { |
|
248 | 248 | global $this_page; |
249 | 249 | if ($name == '') { |
250 | 250 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, no name was found.'); |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | $params[':given_name'] = $m[1]; |
276 | 276 | $params[':middle_name'] = $m[2]; |
277 | 277 | $params[':family_name'] = $m[3]; |
278 | - $params[':first_and_middle_names'] = $m[1] . ' ' . $m[2]; |
|
279 | - $params[':middle_and_last_names'] = $m[2] . ' ' . $m[3]; |
|
278 | + $params[':first_and_middle_names'] = $m[1].' '.$m[2]; |
|
279 | + $params[':middle_and_last_names'] = $m[2].' '.$m[3]; |
|
280 | 280 | # Note this works only because MySQL ignores trailing whitespace |
281 | 281 | $q .= "AND ( |
282 | 282 | (given_name=:first_and_middle_names AND family_name=:family_name) |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | # More than one person ID matching the given name |
296 | 296 | $person_ids = array(); |
297 | - for ($i=0; $i<$q->rows; ++$i) { |
|
297 | + for ($i = 0; $i < $q->rows; ++$i) { |
|
298 | 298 | $pid = $q->field($i, 'person_id'); |
299 | 299 | $person_ids[$pid] = 1; |
300 | 300 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $q = $this->db->query($q, $params); |
325 | 325 | if ($q->rows > 1) { |
326 | 326 | $person_ids = array(); |
327 | - for ($i=0; $i<$q->rows(); ++$i) { |
|
327 | + for ($i = 0; $i < $q->rows(); ++$i) { |
|
328 | 328 | $person_ids[$q->field($i, 'person_id')] = $q->field($i, 'constituency'); |
329 | 329 | } |
330 | 330 | throw new MySociety\TheyWorkForYou\MemberMultipleException($person_ids); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | global $THEUSER; |
343 | 343 | if (is_object($THEUSER) && $THEUSER->postcode_is_set() && $this->current_member(1)) { |
344 | 344 | $pc = $THEUSER->postcode(); |
345 | - twfy_debug ('MP', "set_users_mp converting postcode to person"); |
|
345 | + twfy_debug('MP', "set_users_mp converting postcode to person"); |
|
346 | 346 | $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc)); |
347 | 347 | if ($constituency == strtolower($this->constituency())) { |
348 | 348 | $this->the_users_mp = true; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | # DISPLAY is whether it's to be displayed on MP page. |
355 | 355 | public function load_extra_info($display = false) { |
356 | 356 | $memcache = new MySociety\TheyWorkForYou\Memcache; |
357 | - $memcache_key = 'extra_info:' . $this->person_id . ($display ? '' : ':plain'); |
|
357 | + $memcache_key = 'extra_info:'.$this->person_id.($display ? '' : ':plain'); |
|
358 | 358 | $this->extra_info = $memcache->get($memcache_key); |
359 | 359 | if (!DEVSITE && $this->extra_info) { |
360 | 360 | return; |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | |
364 | 364 | $q = $this->db->query('SELECT * FROM moffice WHERE person=:person_id ORDER BY from_date DESC, moffice_id', |
365 | 365 | array(':person_id' => $this->person_id)); |
366 | - for ($row=0; $row<$q->rows(); $row++) { |
|
366 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
367 | 367 | $this->extra_info['office'][] = $q->row($row); |
368 | 368 | } |
369 | 369 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $prefix = ($this->house(HOUSE_TYPE_LORDS) ? 'L' : ''); |
421 | 421 | $this->extra_info[$prefix.'public_whip_division_attendance_rank'] = $this->extra_info['public_whip_attendrank']; |
422 | 422 | $this->extra_info[$prefix.'public_whip_division_attendance_rank_outof'] = $this->extra_info['public_whip_attendrank_outof']; |
423 | - $this->extra_info[$prefix.'public_whip_division_attendance_quintile'] = floor($this->extra_info['public_whip_attendrank'] / ($this->extra_info['public_whip_attendrank_outof']+1) * 5); |
|
423 | + $this->extra_info[$prefix.'public_whip_division_attendance_quintile'] = floor($this->extra_info['public_whip_attendrank'] / ($this->extra_info['public_whip_attendrank_outof'] + 1) * 5); |
|
424 | 424 | } |
425 | 425 | if ($this->house(HOUSE_TYPE_LORDS) && isset($this->extra_info['public_whip_division_attendance'])) { |
426 | 426 | $this->extra_info['Lpublic_whip_division_attendance'] = $this->extra_info['public_whip_division_attendance']; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | if ($display && array_key_exists('register_member_interests_html', $this->extra_info) && ($this->extra_info['register_member_interests_html'] != '')) { |
431 | - $args = array ( |
|
431 | + $args = array( |
|
432 | 432 | "sort" => "regexp_replace" |
433 | 433 | ); |
434 | 434 | $GLOSSARY = new GLOSSARY($args); |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $this->extra_info['reading_ease'] = round($this->extra_info['reading_ease'], 2); |
444 | 444 | $this->extra_info['reading_year'] = round($this->extra_info['reading_year'], 0); |
445 | 445 | $this->extra_info['reading_age'] = $this->extra_info['reading_year'] + 4; |
446 | - $this->extra_info['reading_age'] .= '–' . ($this->extra_info['reading_year'] + 5); |
|
446 | + $this->extra_info['reading_age'] .= '–'.($this->extra_info['reading_year'] + 5); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | # Public Bill Committees |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | where bill_id = bills.id and person_id = ' . $this->person_id() |
453 | 453 | . ' group by bill_id order by session desc'); |
454 | 454 | $this->extra_info['pbc'] = array(); |
455 | - for ($i=0; $i<$q->rows(); $i++) { |
|
455 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
456 | 456 | $bill_id = $q->field($i, 'bill_id'); |
457 | 457 | $c = $this->db->query('select count(*) as c from hansard where major=6 and minor='.$bill_id.' and htype=10'); |
458 | 458 | $c = $c->field(0, 'c'); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $chairman = $q->field($i, 'c'); |
462 | 462 | $this->extra_info['pbc'][$bill_id] = array( |
463 | 463 | 'title' => $title, 'session' => $q->field($i, 'session'), |
464 | - 'attending'=>$attending, 'chairman'=>($chairman>0), 'outof' => $c |
|
464 | + 'attending'=>$attending, 'chairman'=>($chairman > 0), 'outof' => $c |
|
465 | 465 | ); |
466 | 466 | } |
467 | 467 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | public function family_name() { return $this->family_name; } |
477 | 477 | public function full_name($no_mp_title = false) { |
478 | 478 | $title = $this->title; |
479 | - if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND)) |
|
479 | + if ($no_mp_title && ($this->house_disp == HOUSE_TYPE_COMMONS || $this->house_disp == HOUSE_TYPE_NI || $this->house_disp == HOUSE_TYPE_SCOTLAND)) |
|
480 | 480 | $title = ''; |
481 | 481 | return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname); |
482 | 482 | } |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | public function entered_house_text($entered_house) { |
510 | 510 | if (!$entered_house) return ''; |
511 | 511 | list($year, $month, $day) = explode('-', $entered_house); |
512 | - if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) { |
|
512 | + if ($month == 1 && $day == 1 && $this->house(HOUSE_TYPE_LORDS)) { |
|
513 | 513 | return $year; |
514 | - } elseif ($month==0 && $day==0) { |
|
514 | + } elseif ($month == 0 && $day == 0) { |
|
515 | 515 | return $year; |
516 | 516 | } elseif (checkdate($month, $day, $year) && $year != '9999') { |
517 | 517 | return format_date($entered_house, LONGDATEFORMAT); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | list($year, $month, $day) = explode('-', $left_house); |
532 | 532 | if (checkdate($month, $day, $year) && $year != '9999') { |
533 | 533 | return format_date($left_house, LONGDATEFORMAT); |
534 | - } elseif ($month==0 && $day==0) { |
|
534 | + } elseif ($month == 0 && $day == 0) { |
|
535 | 535 | # Left house date is stored as 1942-00-00 to mean "at some point in 1941" |
536 | 536 | return $year - 1; |
537 | 537 | } else { |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | if (DEVSITE) { |
602 | 602 | $protocol = 'http://'; |
603 | 603 | } |
604 | - return $protocol . DOMAIN . $URL->generate('none') . $member_url; |
|
604 | + return $protocol.DOMAIN.$URL->generate('none').$member_url; |
|
605 | 605 | } else { |
606 | - return $URL->generate('none') . $member_url; |
|
606 | + return $URL->generate('none').$member_url; |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | WHERE member.person_id = pn.person_id AND pn.type = "name" |
621 | 621 | AND pn.start_date <= member.left_house AND member.left_house <= pn.end_date |
622 | 622 | AND house = :house AND constituency = :cons |
623 | - AND member.person_id != :pid AND entered_house ' . $direction . ' :date ORDER BY entered_house ' . $order, |
|
623 | + AND member.person_id != :pid AND entered_house ' . $direction.' :date ORDER BY entered_house '.$order, |
|
624 | 624 | array( |
625 | 625 | ':house' => HOUSE_TYPE_COMMONS, |
626 | 626 | ':cons' => $this->constituency(), |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | $mships = array(); $last_pid = null; |
631 | 631 | for ($r = 0; $r < $q->rows(); $r++) { |
632 | 632 | $pid = $q->field($r, 'person_id'); |
633 | - $name = $q->field($r, 'given_name') . ' ' . $q->field($r, 'family_name'); |
|
633 | + $name = $q->field($r, 'given_name').' '.$q->field($r, 'family_name'); |
|
634 | 634 | if ($last_pid != $pid) { |
635 | 635 | $mships[] = array( |
636 | - 'href' => WEBPATH . 'mp/?pid='.$pid, |
|
636 | + 'href' => WEBPATH.'mp/?pid='.$pid, |
|
637 | 637 | 'text' => $name |
638 | 638 | ); |
639 | 639 | $last_pid = $pid; |
@@ -114,7 +114,9 @@ discard block |
||
114 | 114 | $last_party = null; |
115 | 115 | for ($row=0; $row<$q->rows(); $row++) { |
116 | 116 | $house = $q->field($row, 'house'); |
117 | - if (!in_array($house, $this->houses)) $this->houses[] = $house; |
|
117 | + if (!in_array($house, $this->houses)) { |
|
118 | + $this->houses[] = $house; |
|
119 | + } |
|
118 | 120 | $const = $q->field($row, 'constituency'); |
119 | 121 | $party = $q->field($row, 'party'); |
120 | 122 | $entered_house = $q->field($row, 'entered_house'); |
@@ -215,7 +217,9 @@ discard block |
||
215 | 217 | } |
216 | 218 | |
217 | 219 | $normalised = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($constituency); |
218 | - if ($normalised) $constituency = $normalised; |
|
220 | + if ($normalised) { |
|
221 | + $constituency = $normalised; |
|
222 | + } |
|
219 | 223 | |
220 | 224 | $params = array(); |
221 | 225 | |
@@ -254,10 +258,12 @@ discard block |
||
254 | 258 | $q = "SELECT person_id FROM person_names WHERE type = 'name' "; |
255 | 259 | if ($this_page == 'peer') { |
256 | 260 | $success = preg_match('#^(.*?) (.*?) of (.*?)$#', $name, $m); |
257 | - if (!$success) |
|
258 | - $success = preg_match('#^(.*?)() of (.*?)$#', $name, $m); |
|
259 | - if (!$success) |
|
260 | - $success = preg_match('#^(.*?) (.*?)()$#', $name, $m); |
|
261 | + if (!$success) { |
|
262 | + $success = preg_match('#^(.*?)() of (.*?)$#', $name, $m); |
|
263 | + } |
|
264 | + if (!$success) { |
|
265 | + $success = preg_match('#^(.*?) (.*?)()$#', $name, $m); |
|
266 | + } |
|
261 | 267 | if (!$success) { |
262 | 268 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, that name was not recognised.'); |
263 | 269 | } |
@@ -267,8 +273,9 @@ discard block |
||
267 | 273 | $q .= "AND title = :title AND family_name = :family_name AND lordofname = :lordofname"; |
268 | 274 | } elseif ($this_page == 'msp' || $this_page == 'mla' || strstr($this_page, 'mp')) { |
269 | 275 | $success = preg_match('#^(.*?) (.*?) (.*?)$#', $name, $m); |
270 | - if (!$success) |
|
271 | - $success = preg_match('#^(.*?)() (.*)$#', $name, $m); |
|
276 | + if (!$success) { |
|
277 | + $success = preg_match('#^(.*?)() (.*)$#', $name, $m); |
|
278 | + } |
|
272 | 279 | if (!$success) { |
273 | 280 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, that name was not recognised.'); |
274 | 281 | } |
@@ -403,16 +410,17 @@ discard block |
||
403 | 410 | if (array_key_exists('public_whip_rebellions', $this->extra_info)) { |
404 | 411 | $rebellions = $this->extra_info['public_whip_rebellions']; |
405 | 412 | $rebel_desc = "<unknown>"; |
406 | - if ($rebellions == 0) |
|
407 | - $rebel_desc = "never"; |
|
408 | - elseif ($rebellions <= 1) |
|
409 | - $rebel_desc = "hardly ever"; |
|
410 | - elseif ($rebellions <= 3) |
|
411 | - $rebel_desc = "occasionally"; |
|
412 | - elseif ($rebellions <= 5) |
|
413 | - $rebel_desc = "sometimes"; |
|
414 | - elseif ($rebellions > 5) |
|
415 | - $rebel_desc = "quite often"; |
|
413 | + if ($rebellions == 0) { |
|
414 | + $rebel_desc = "never"; |
|
415 | + } elseif ($rebellions <= 1) { |
|
416 | + $rebel_desc = "hardly ever"; |
|
417 | + } elseif ($rebellions <= 3) { |
|
418 | + $rebel_desc = "occasionally"; |
|
419 | + } elseif ($rebellions <= 5) { |
|
420 | + $rebel_desc = "sometimes"; |
|
421 | + } elseif ($rebellions > 5) { |
|
422 | + $rebel_desc = "quite often"; |
|
423 | + } |
|
416 | 424 | $this->extra_info['public_whip_rebel_description'] = $rebel_desc; |
417 | 425 | } |
418 | 426 | |
@@ -476,8 +484,9 @@ discard block |
||
476 | 484 | public function family_name() { return $this->family_name; } |
477 | 485 | public function full_name($no_mp_title = false) { |
478 | 486 | $title = $this->title; |
479 | - if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND)) |
|
480 | - $title = ''; |
|
487 | + if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND)) { |
|
488 | + $title = ''; |
|
489 | + } |
|
481 | 490 | return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname); |
482 | 491 | } |
483 | 492 | public function houses() { |
@@ -493,8 +502,9 @@ discard block |
||
493 | 502 | public function party() { return $this->party; } |
494 | 503 | public function party_text($party = null) { |
495 | 504 | global $parties; |
496 | - if (!$party) |
|
497 | - $party = $this->party; |
|
505 | + if (!$party) { |
|
506 | + $party = $this->party; |
|
507 | + } |
|
498 | 508 | if (isset($parties[$party])) { |
499 | 509 | return $parties[$party]; |
500 | 510 | } else { |
@@ -503,11 +513,15 @@ discard block |
||
503 | 513 | } |
504 | 514 | |
505 | 515 | public function entered_house($house = 0) { |
506 | - if ($house) return array_key_exists($house, $this->entered_house) ? $this->entered_house[$house] : null; |
|
516 | + if ($house) { |
|
517 | + return array_key_exists($house, $this->entered_house) ? $this->entered_house[$house] : null; |
|
518 | + } |
|
507 | 519 | return $this->entered_house; |
508 | 520 | } |
509 | 521 | public function entered_house_text($entered_house) { |
510 | - if (!$entered_house) return ''; |
|
522 | + if (!$entered_house) { |
|
523 | + return ''; |
|
524 | + } |
|
511 | 525 | list($year, $month, $day) = explode('-', $entered_house); |
512 | 526 | if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) { |
513 | 527 | return $year; |
@@ -521,13 +535,16 @@ discard block |
||
521 | 535 | } |
522 | 536 | |
523 | 537 | public function left_house($house = null) { |
524 | - if (!is_null($house)) |
|
525 | - return array_key_exists($house, $this->left_house) ? $this->left_house[$house] : null; |
|
538 | + if (!is_null($house)) { |
|
539 | + return array_key_exists($house, $this->left_house) ? $this->left_house[$house] : null; |
|
540 | + } |
|
526 | 541 | return $this->left_house; |
527 | 542 | } |
528 | 543 | |
529 | 544 | public function left_house_text($left_house) { |
530 | - if (!$left_house) return ''; |
|
545 | + if (!$left_house) { |
|
546 | + return ''; |
|
547 | + } |
|
531 | 548 | list($year, $month, $day) = explode('-', $left_house); |
532 | 549 | if (checkdate($month, $day, $year) && $year != '9999') { |
533 | 550 | return format_date($left_house, LONGDATEFORMAT); |
@@ -576,7 +593,9 @@ discard block |
||
576 | 593 | $lh = $this->left_house($h); |
577 | 594 | $current[$h] = ($lh['date'] == '9999-12-31'); |
578 | 595 | } |
579 | - if ($house) return $current[$house]; |
|
596 | + if ($house) { |
|
597 | + return $current[$house]; |
|
598 | + } |
|
580 | 599 | return $current; |
581 | 600 | } |
582 | 601 | |
@@ -609,7 +628,9 @@ discard block |
||
609 | 628 | |
610 | 629 | private function _previous_future_mps_query($direction) { |
611 | 630 | $entered_house = $this->entered_house(HOUSE_TYPE_COMMONS); |
612 | - if (is_null($entered_house)) return ''; |
|
631 | + if (is_null($entered_house)) { |
|
632 | + return ''; |
|
633 | + } |
|
613 | 634 | if ($direction == '>') { |
614 | 635 | $order = ''; |
615 | 636 | } else { |
@@ -23,6 +23,9 @@ |
||
23 | 23 | return $this->fb; |
24 | 24 | } |
25 | 25 | |
26 | + /** |
|
27 | + * @return string |
|
28 | + */ |
|
26 | 29 | public function getLoginURL() { |
27 | 30 | $helper = $this->getFacebookObject()->getRedirectLoginHelper(); |
28 | 31 | $permissions = ['email']; |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | |
14 | 14 | public function getFacebookObject() { |
15 | 15 | if (!isset($this->fb)) { |
16 | - $this->fb = new \Facebook\Facebook([ |
|
16 | + $this->fb = new \Facebook\Facebook([ |
|
17 | 17 | 'app_id' => FACEBOOK_APP_ID, |
18 | 18 | 'app_secret' => FACEBOOK_APP_SECRET, |
19 | 19 | 'default_graph_version' => 'v2.2', |
20 | - ]); |
|
20 | + ]); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | return $this->fb; |
@@ -30,46 +30,46 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | public function handleFacebookRedirect() { |
33 | - $helper = $this->getFacebookObject()->getRedirectLoginHelper(); |
|
33 | + $helper = $this->getFacebookObject()->getRedirectLoginHelper(); |
|
34 | 34 | |
35 | - $data = array('login_url' => $this->getLoginURL()); |
|
35 | + $data = array('login_url' => $this->getLoginURL()); |
|
36 | 36 | |
37 | - try { |
|
37 | + try { |
|
38 | 38 | $accessToken = $helper->getAccessToken(); |
39 | - } catch(\Facebook\Exceptions\FacebookResponseException $e) { |
|
39 | + } catch(\Facebook\Exceptions\FacebookResponseException $e) { |
|
40 | 40 | $data['error'] = 'Graph returned an error: ' . $e->getMessage(); |
41 | 41 | return $data; |
42 | - } catch(\Facebook\Exceptions\FacebookSDKException $e) { |
|
42 | + } catch(\Facebook\Exceptions\FacebookSDKException $e) { |
|
43 | 43 | $data['error'] = 'Facebook SDK returned an error: ' . $e->getMessage(); |
44 | 44 | return $data; |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - $token = $this->checkAccessToken($accessToken); |
|
47 | + $token = $this->checkAccessToken($accessToken); |
|
48 | 48 | |
49 | - if ($token) { |
|
50 | - return array('token' => $token); |
|
51 | - } else { |
|
52 | - $data['error'] = 'Problem getting Facebook token'; |
|
53 | - return $data; |
|
54 | - } |
|
49 | + if ($token) { |
|
50 | + return array('token' => $token); |
|
51 | + } else { |
|
52 | + $data['error'] = 'Problem getting Facebook token'; |
|
53 | + return $data; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
58 | 58 | private function checkAccessToken($accessToken) { |
59 | - if (!isset($accessToken)) { |
|
60 | - return False; |
|
61 | - } |
|
59 | + if (!isset($accessToken)) { |
|
60 | + return False; |
|
61 | + } |
|
62 | 62 | |
63 | - if (! $accessToken->isLongLived()) { |
|
63 | + if (! $accessToken->isLongLived()) { |
|
64 | 64 | $oAuth2Client = $this->getFacebookObject()->getOAuth2Client(); |
65 | 65 | try { |
66 | - $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
|
66 | + $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
|
67 | 67 | } catch (\Facebook\Exceptions\FacebookSDKException $e) { |
68 | - return False; |
|
68 | + return False; |
|
69 | + } |
|
69 | 70 | } |
70 | - } |
|
71 | 71 | |
72 | - return $accessToken; |
|
72 | + return $accessToken; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function loginUser($accessToken) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | 'optin' => $THEUSER->optin(), |
159 | 159 | 'emailpublic' => False, |
160 | 160 | 'password' => '', |
161 | - ); |
|
161 | + ); |
|
162 | 162 | |
163 | 163 | $THEUSER->update_self_no_confirm($details); |
164 | 164 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | private function checkAccessToken($accessToken) { |
59 | 59 | if (!isset($accessToken)) { |
60 | - return False; |
|
60 | + return false; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | if (! $accessToken->isLongLived()) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | try { |
66 | 66 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
67 | 67 | } catch (\Facebook\Exceptions\FacebookSDKException $e) { |
68 | - return False; |
|
68 | + return false; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $expires = intval($accessToken->getExpiresAt()->format('U')); |
87 | 87 | twfy_debug("THEUSER", "Facebook access token expires at " . $expires); |
88 | 88 | |
89 | - $success = False; |
|
89 | + $success = false; |
|
90 | 90 | if ($user_id) { |
91 | 91 | twfy_debug("THEUSER", "Faceook user exists in the database: " . $user_id); |
92 | 92 | $success = $THEUSER->init($user_id); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | return $logged_in; |
113 | 113 | } |
114 | 114 | |
115 | - return False; |
|
115 | + return false; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public function createUser($accessToken, $user) { |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | 'url' => '', |
129 | 129 | 'status' => '', |
130 | 130 | 'password' => '', |
131 | - 'optin' => False, |
|
132 | - 'emailpublic' => False, |
|
133 | - 'mp_alert' => False, |
|
131 | + 'optin' => false, |
|
132 | + 'emailpublic' => false, |
|
133 | + 'mp_alert' => false, |
|
134 | 134 | 'facebook_id' => $user['id'] |
135 | 135 | ); |
136 | 136 | $added = $THEUSER->add($details, false); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'postcode' => $THEUSER->postcode(), |
157 | 157 | 'url' => $THEUSER->url(), |
158 | 158 | 'optin' => $THEUSER->optin(), |
159 | - 'emailpublic' => False, |
|
159 | + 'emailpublic' => false, |
|
160 | 160 | 'password' => '', |
161 | 161 | ); |
162 | 162 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function getLoginURL() { |
27 | 27 | $helper = $this->getFacebookObject()->getRedirectLoginHelper(); |
28 | 28 | $permissions = ['email']; |
29 | - return $helper->getLoginUrl('https://' . DOMAIN . '/user/login/fb.php', $permissions); |
|
29 | + return $helper->getLoginUrl('https://'.DOMAIN.'/user/login/fb.php', $permissions); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function handleFacebookRedirect() { |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | |
37 | 37 | try { |
38 | 38 | $accessToken = $helper->getAccessToken(); |
39 | - } catch(\Facebook\Exceptions\FacebookResponseException $e) { |
|
40 | - $data['error'] = 'Graph returned an error: ' . $e->getMessage(); |
|
39 | + } catch (\Facebook\Exceptions\FacebookResponseException $e) { |
|
40 | + $data['error'] = 'Graph returned an error: '.$e->getMessage(); |
|
41 | 41 | return $data; |
42 | - } catch(\Facebook\Exceptions\FacebookSDKException $e) { |
|
43 | - $data['error'] = 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
42 | + } catch (\Facebook\Exceptions\FacebookSDKException $e) { |
|
43 | + $data['error'] = 'Facebook SDK returned an error: '.$e->getMessage(); |
|
44 | 44 | return $data; |
45 | 45 | } |
46 | 46 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return False; |
61 | 61 | } |
62 | 62 | |
63 | - if (! $accessToken->isLongLived()) { |
|
63 | + if (!$accessToken->isLongLived()) { |
|
64 | 64 | $oAuth2Client = $this->getFacebookObject()->getOAuth2Client(); |
65 | 65 | try { |
66 | 66 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | $expires = intval($accessToken->getExpiresAt()->format('U')); |
87 | - twfy_debug("THEUSER", "Facebook access token expires at " . $expires); |
|
87 | + twfy_debug("THEUSER", "Facebook access token expires at ".$expires); |
|
88 | 88 | |
89 | 89 | $success = False; |
90 | 90 | if ($user_id) { |
91 | - twfy_debug("THEUSER", "Faceook user exists in the database: " . $user_id); |
|
91 | + twfy_debug("THEUSER", "Faceook user exists in the database: ".$user_id); |
|
92 | 92 | $success = $THEUSER->init($user_id); |
93 | - twfy_debug("THEUSER", "user inited: " . $success); |
|
93 | + twfy_debug("THEUSER", "user inited: ".$success); |
|
94 | 94 | if ($THEUSER->facebook_id() == "") { |
95 | 95 | $THEUSER->add_facebook_id($user['id']); |
96 | 96 | } |
97 | - twfy_debug("THEUSER", "inited user has id : " . $THEUSER->user_id()); |
|
97 | + twfy_debug("THEUSER", "inited user has id : ".$THEUSER->user_id()); |
|
98 | 98 | } else { |
99 | 99 | twfy_debug("THEUSER", "Faceook user does not exist in the database"); |
100 | 100 | $success = $this->createUser($accessToken, $user); |
101 | 101 | } |
102 | 102 | |
103 | 103 | if ($success) { |
104 | - twfy_debug("THEUSER", "logging in user: " . $THEUSER->user_id()); |
|
104 | + twfy_debug("THEUSER", "logging in user: ".$THEUSER->user_id()); |
|
105 | 105 | $logged_in = $THEUSER->facebook_login("/user/", $expires, $accessToken); |
106 | 106 | |
107 | 107 | if ($THEUSER->email() != $user['email']) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ); |
136 | 136 | $added = $THEUSER->add($details, false); |
137 | 137 | if ($added) { |
138 | - twfy_debug("THEUSER", "Added new user from facebook details " . $THEUSER->user_id()); |
|
138 | + twfy_debug("THEUSER", "Added new user from facebook details ".$THEUSER->user_id()); |
|
139 | 139 | return $THEUSER->confirm_without_token(); |
140 | 140 | } |
141 | 141 |
@@ -52,6 +52,11 @@ discard block |
||
52 | 52 | $this->_set('featured_related', $related); |
53 | 53 | } |
54 | 54 | |
55 | + /** |
|
56 | + * @param string $key |
|
57 | + * |
|
58 | + * @return string |
|
59 | + */ |
|
55 | 60 | private function _get($key) { |
56 | 61 | $text = NULL; |
57 | 62 | |
@@ -72,6 +77,9 @@ discard block |
||
72 | 77 | return $text; |
73 | 78 | } |
74 | 79 | |
80 | + /** |
|
81 | + * @param string $key |
|
82 | + */ |
|
75 | 83 | private function _set($key, $value) { |
76 | 84 | if ( trim($value) == '' ) { |
77 | 85 | $value = NULL; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | if ($q->rows) { |
66 | 66 | $text = $q->field(0, 'value'); |
67 | - if ( trim($text) == '' ) { |
|
67 | + if (trim($text) == '') { |
|
68 | 68 | $text = NULL; |
69 | 69 | } |
70 | 70 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | private function _set($key, $value) { |
76 | - if ( trim($value) == '' ) { |
|
76 | + if (trim($value) == '') { |
|
77 | 77 | $value = NULL; |
78 | 78 | } |
79 | 79 | $check_q = $this->db->query( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ':key' => $key |
83 | 83 | ) |
84 | 84 | ); |
85 | - if ( $check_q->rows ) { |
|
85 | + if ($check_q->rows) { |
|
86 | 86 | $set_q = $this->db->query("UPDATE editorial set value = :value WHERE item = :key", |
87 | 87 | array( |
88 | 88 | ':key' => $key, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | - if ( $set_q->success() ) { |
|
101 | + if ($set_q->success()) { |
|
102 | 102 | return true; |
103 | 103 | } |
104 | 104 | return false; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | private function _get($key) { |
56 | - $text = NULL; |
|
56 | + $text = null; |
|
57 | 57 | |
58 | 58 | $q = $this->db->query( |
59 | 59 | "SELECT value FROM editorial WHERE item = :key", |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($q->rows) { |
66 | 66 | $text = $q->field(0, 'value'); |
67 | 67 | if ( trim($text) == '' ) { |
68 | - $text = NULL; |
|
68 | + $text = null; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | private function _set($key, $value) { |
76 | 76 | if ( trim($value) == '' ) { |
77 | - $value = NULL; |
|
77 | + $value = null; |
|
78 | 78 | } |
79 | 79 | $check_q = $this->db->query( |
80 | 80 | "SELECT value FROM editorial WHERE item = :key", |
@@ -12,11 +12,11 @@ |
||
12 | 12 | |
13 | 13 | class UtilityTest extends UnitTestCase{ |
14 | 14 | |
15 | - public function testVerpEnvelopeSenderCanCreateStandardSender() { |
|
15 | + public function testVerpEnvelopeSenderCanCreateStandardSender() { |
|
16 | 16 | $sender = twfy_verp_envelope_sender('[email protected]'); |
17 | 17 | $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; |
18 | 18 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | 21 | } |
22 | 22 |
@@ -3,18 +3,18 @@ |
||
3 | 3 | * SimpleTest tests for the functions in utility.php |
4 | 4 | * $Id: utility_test.php,v 1.3 2009-06-25 12:23:58 louise Exp $ |
5 | 5 | */ |
6 | -error_reporting (E_ALL); |
|
6 | +error_reporting(E_ALL); |
|
7 | 7 | ini_set("display_errors", 1); |
8 | -include_once dirname(__FILE__) . '/../../../conf/general'; |
|
8 | +include_once dirname(__FILE__).'/../../../conf/general'; |
|
9 | 9 | include_once '../utility.php'; |
10 | 10 | include_once 'simpletest/unit_tester.php'; |
11 | 11 | include_once 'simpletest/reporter.php'; |
12 | 12 | |
13 | -class UtilityTest extends UnitTestCase{ |
|
13 | +class UtilityTest extends UnitTestCase { |
|
14 | 14 | |
15 | 15 | public function testVerpEnvelopeSenderCanCreateStandardSender() { |
16 | 16 | $sender = twfy_verp_envelope_sender('[email protected]'); |
17 | - $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; |
|
17 | + $expected_sender = 'twfy+aperson=a.nother.dom@' +EMAILDOMAIN; |
|
18 | 18 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); |
19 | 19 | } |
20 | 20 |
@@ -41,7 +41,9 @@ |
||
41 | 41 | twfy_debug_timestamp("after including utility.php"); |
42 | 42 | |
43 | 43 | // Set the default timezone |
44 | -if(function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
44 | +if(function_exists('date_default_timezone_set')) { |
|
45 | + date_default_timezone_set(TIMEZONE); |
|
46 | +} |
|
45 | 47 | |
46 | 48 | // Only do clever things with errors if we're not testing, otherwise show as default |
47 | 49 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | First some things to help make our PHP nicer and betterer |
5 | 5 | ********************************************************************************/ |
6 | 6 | |
7 | -error_reporting (E_ALL); |
|
7 | +error_reporting(E_ALL); |
|
8 | 8 | |
9 | 9 | /******************************************************************************** |
10 | 10 | Now some constants that are the same for live and dev versions |
@@ -12,36 +12,36 @@ discard block |
||
12 | 12 | ********************************************************************************/ |
13 | 13 | |
14 | 14 | // In case we need to switch these off globally at some point... |
15 | -define ("ALLOWCOMMENTS", true); |
|
16 | -define ("ALLOWTRACKBACKS", true); |
|
15 | +define("ALLOWCOMMENTS", true); |
|
16 | +define("ALLOWTRACKBACKS", true); |
|
17 | 17 | |
18 | 18 | // These variables are so we can keep date/time formats consistent across the site |
19 | 19 | // and change them easily. |
20 | 20 | // Formats here: http://www.php.net/manual/en/function.date.php |
21 | -define ("LONGERDATEFORMAT", "l, j F Y");// Monday, 31 December 2003 |
|
22 | -define ("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
23 | -define ("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
24 | -define ("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
21 | +define("LONGERDATEFORMAT", "l, j F Y"); // Monday, 31 December 2003 |
|
22 | +define("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
23 | +define("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
24 | +define("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
25 | 25 | |
26 | -define ("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
27 | -define ("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
26 | +define("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
27 | +define("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
28 | 28 | |
29 | 29 | // Where we store the postcode of users if they search for an MP by postcode. |
30 | -define ('POSTCODE_COOKIE', 'eppc'); |
|
30 | +define('POSTCODE_COOKIE', 'eppc'); |
|
31 | 31 | |
32 | 32 | /******************************************************************************** |
33 | 33 | And now all the files we'll include on every page. |
34 | 34 | ********************************************************************************/ |
35 | 35 | |
36 | 36 | // The Composer autoloader, which also handles our internal autoloading magic. |
37 | -require_once dirname(__FILE__) . '/../../../vendor/autoload.php'; |
|
37 | +require_once dirname(__FILE__).'/../../../vendor/autoload.php'; |
|
38 | 38 | |
39 | -include_once dirname(__FILE__) . '/../../../conf/general'; |
|
40 | -include_once INCLUDESPATH . 'utility.php'; |
|
39 | +include_once dirname(__FILE__).'/../../../conf/general'; |
|
40 | +include_once INCLUDESPATH.'utility.php'; |
|
41 | 41 | twfy_debug_timestamp("after including utility.php"); |
42 | 42 | |
43 | 43 | // Set the default timezone |
44 | -if(function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
44 | +if (function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
45 | 45 | |
46 | 46 | // Only do clever things with errors if we're not testing, otherwise show as default |
47 | 47 | |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | |
71 | 71 | // The time the page starts, so we can display the total at the end. |
72 | 72 | // getmicrotime() is in utiltity.php. |
73 | -define ("STARTTIME", getmicrotime()); |
|
73 | +define("STARTTIME", getmicrotime()); |
|
74 | 74 | if (!isset($_SERVER['WINDIR'])) { |
75 | 75 | $rusage = getrusage(); |
76 | - define ('STARTTIMES', $rusage['ru_stime.tv_sec']*1000000 + $rusage['ru_stime.tv_usec']); |
|
77 | - define ('STARTTIMEU', $rusage['ru_utime.tv_sec']*1000000 + $rusage['ru_utime.tv_usec']); |
|
76 | + define('STARTTIMES', $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec']); |
|
77 | + define('STARTTIMEU', $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec']); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $DATA = new \MySociety\TheyWorkForYou\Data; |
81 | 81 | |
82 | 82 | class ParlDB extends \MySociety\TheyWorkForYou\Db\Connection { |
83 | 83 | public function __construct() { |
84 | - $this->init (OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
84 | + $this->init(OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | include_once (INCLUDESPATH."easyparliament/user.php"); |
93 | 93 | |
94 | 94 | // Test to see if this is a new-style template using the renderer class. |
95 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
95 | +if (!isset($new_style_template) OR $new_style_template !== TRUE) { |
|
96 | 96 | |
97 | 97 | // This is an old-style page. Use the old page classes. |
98 | 98 | include_once (INCLUDESPATH."easyparliament/page.php"); |
@@ -92,7 +92,7 @@ |
||
92 | 92 | include_once (INCLUDESPATH."easyparliament/user.php"); |
93 | 93 | |
94 | 94 | // Test to see if this is a new-style template using the renderer class. |
95 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
95 | +if (! isset($new_style_template) or $new_style_template !== true) { |
|
96 | 96 | |
97 | 97 | // This is an old-style page. Use the old page classes. |
98 | 98 | include_once (INCLUDESPATH."easyparliament/page.php"); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | 'url' => 'peer/' |
531 | 531 | ), |
532 | 532 | 'peers' => array ( |
533 | - 'menu' => array ( |
|
533 | + 'menu' => array ( |
|
534 | 534 | 'text' => 'Lords', |
535 | 535 | 'title' => "List of all Lords" |
536 | 536 | ), |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | 'url' => 'peers/' |
540 | 540 | ), |
541 | 541 | 'overview' => array ( |
542 | - 'menu' => array ( |
|
542 | + 'menu' => array ( |
|
543 | 543 | 'text' => 'Overview', |
544 | 544 | 'title' => "Overview of the UK Parliament" |
545 | 545 | ), |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | 'url' => 'rss/mp/' |
592 | 592 | ), |
593 | 593 | 'mps' => array ( |
594 | - 'menu' => array ( |
|
594 | + 'menu' => array ( |
|
595 | 595 | 'text' => 'MPs', |
596 | 596 | 'title' => "List of all Members of Parliament (MPs)" |
597 | 597 | ), |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | |
66 | 66 | */ |
67 | 67 | |
68 | -$this->page = array ( |
|
68 | +$this->page = array( |
|
69 | 69 | |
70 | 70 | // Things used on EVERY page, unless overridden for a page: |
71 | - 'default' => array ( |
|
71 | + 'default' => array( |
|
72 | 72 | 'parent' => '', |
73 | 73 | 'session_vars' => array('super_debug'), |
74 | 74 | 'sitetitle' => 'TheyWorkForYou', |
@@ -78,117 +78,117 @@ discard block |
||
78 | 78 | |
79 | 79 | // KEEP THE PAGES IN ALPHABETICAL ORDER! TA. |
80 | 80 | |
81 | - 'about' => array ( |
|
81 | + 'about' => array( |
|
82 | 82 | 'title' => 'About us', |
83 | 83 | 'url' => 'about/' |
84 | 84 | ), |
85 | - 'parliaments' => array ( |
|
85 | + 'parliaments' => array( |
|
86 | 86 | 'title' => 'Parliaments and assemblies', |
87 | 87 | 'url' => 'parliaments/' |
88 | 88 | ), |
89 | 89 | |
90 | - 'alert_stats' => array ( |
|
90 | + 'alert_stats' => array( |
|
91 | 91 | 'title' => 'Email alerts statistics', |
92 | 92 | 'parent' => 'admin', |
93 | 93 | 'url' => 'admin/alert_stats.php', |
94 | 94 | ), |
95 | - 'admin_badusers' => array ( |
|
95 | + 'admin_badusers' => array( |
|
96 | 96 | 'title' => 'Bad users', |
97 | 97 | 'parent' => 'admin', |
98 | 98 | 'url' => 'admin/badusers.php' |
99 | 99 | ), |
100 | - 'admin_home' => array ( |
|
100 | + 'admin_home' => array( |
|
101 | 101 | 'title' => 'Home', |
102 | 102 | 'parent' => 'admin', |
103 | 103 | 'url' => 'admin/' |
104 | 104 | ), |
105 | - 'admin_comments' => array ( |
|
105 | + 'admin_comments' => array( |
|
106 | 106 | 'title' => 'Recent comments', |
107 | 107 | 'parent' => 'admin', |
108 | 108 | 'url' => 'admin/comments.php' |
109 | 109 | ), |
110 | - 'admin_commentreport' => array ( |
|
110 | + 'admin_commentreport' => array( |
|
111 | 111 | 'title' => 'Processing a comment report', |
112 | 112 | 'parent' => 'admin', |
113 | 113 | 'url' => 'admin/report.php', |
114 | - 'session_vars' => array ('rid', 'cid') |
|
114 | + 'session_vars' => array('rid', 'cid') |
|
115 | 115 | ), |
116 | - 'admin_commentreports' => array ( |
|
116 | + 'admin_commentreports' => array( |
|
117 | 117 | 'title' => 'Outstanding comment reports', |
118 | 118 | 'parent' => 'admin', |
119 | 119 | 'url' => 'admin/reports.php' |
120 | 120 | ), |
121 | - 'admin_failedsearches' => array ( |
|
121 | + 'admin_failedsearches' => array( |
|
122 | 122 | 'title' => 'Failed searches', |
123 | 123 | 'parent' => 'admin', |
124 | 124 | 'url' => 'admin/failedsearches.php' |
125 | 125 | ), |
126 | - 'admin_glossary' => array ( |
|
126 | + 'admin_glossary' => array( |
|
127 | 127 | 'title' => 'Manage glossary entries', |
128 | 128 | 'parent' => 'admin', |
129 | 129 | 'url' => 'admin/glossary.php' |
130 | 130 | ), |
131 | - 'admin_glossary_pending' => array ( |
|
131 | + 'admin_glossary_pending' => array( |
|
132 | 132 | 'title' => 'Review pending glossary entries', |
133 | 133 | 'parent' => 'admin', |
134 | 134 | 'url' => 'admin/glossary_pending.php' |
135 | 135 | ), |
136 | - 'admin_searchlogs' => array ( |
|
136 | + 'admin_searchlogs' => array( |
|
137 | 137 | 'title' => 'Recent searches', |
138 | 138 | 'parent' => 'admin', |
139 | 139 | 'url' => 'admin/searchlogs.php' |
140 | 140 | ), |
141 | - 'admin_popularsearches' => array ( |
|
141 | + 'admin_popularsearches' => array( |
|
142 | 142 | 'title' => 'Popular searches in last 30 days (first 1000)', |
143 | 143 | 'parent' => 'admin', |
144 | 144 | 'url' => 'admin/popularsearches.php' |
145 | 145 | ), |
146 | - 'admin_statistics' => array ( |
|
146 | + 'admin_statistics' => array( |
|
147 | 147 | 'title' => 'General statistics', |
148 | 148 | 'parent' => 'admin', |
149 | 149 | 'url' => 'admin/statistics.php' |
150 | 150 | ), |
151 | - 'admin_reportstats' => array ( |
|
151 | + 'admin_reportstats' => array( |
|
152 | 152 | 'title' => 'Reporting statistics', |
153 | 153 | 'parent' => 'admin', |
154 | 154 | 'url' => 'admin/reporting_stats.php' |
155 | 155 | ), |
156 | - 'admin_trackbacks' => array ( |
|
156 | + 'admin_trackbacks' => array( |
|
157 | 157 | 'title' => 'Recent trackbacks', |
158 | 158 | 'parent' => 'admin', |
159 | 159 | 'url' => 'admin/trackbacks.php' |
160 | 160 | ), |
161 | - 'admin_photos' => array ( |
|
161 | + 'admin_photos' => array( |
|
162 | 162 | 'title' => 'Photo upload/attribution', |
163 | 163 | 'parent' => 'admin', |
164 | 164 | 'url' => 'admin/photos.php', |
165 | 165 | ), |
166 | - 'admin_mpurls' => array ( |
|
166 | + 'admin_mpurls' => array( |
|
167 | 167 | 'title' => 'MP Websites', |
168 | 168 | 'parent' => 'admin', |
169 | 169 | 'url' => 'admin/websites.php', |
170 | 170 | ), |
171 | - 'admin_policies' => array ( |
|
171 | + 'admin_policies' => array( |
|
172 | 172 | 'title' => 'MP Policy details', |
173 | 173 | 'parent' => 'admin', |
174 | 174 | 'url' => 'admin/policies.php', |
175 | 175 | ), |
176 | - 'admin_banner' => array ( |
|
176 | + 'admin_banner' => array( |
|
177 | 177 | 'title' => 'Edit Banner', |
178 | 178 | 'parent' => 'admin', |
179 | 179 | 'url' => 'admin/banner.php', |
180 | 180 | ), |
181 | - 'admin_featured' => array ( |
|
181 | + 'admin_featured' => array( |
|
182 | 182 | 'title' => 'Featured debates', |
183 | 183 | 'parent' => 'admin', |
184 | 184 | 'url' => 'admin/featured.php', |
185 | 185 | ), |
186 | - 'admin_topics' => array ( |
|
186 | + 'admin_topics' => array( |
|
187 | 187 | 'title' => 'Topics', |
188 | 188 | 'parent' => 'admin', |
189 | 189 | 'url' => 'admin/topics.php', |
190 | 190 | ), |
191 | - 'admin_edittopics' => array ( |
|
191 | + 'admin_edittopics' => array( |
|
192 | 192 | 'title' => 'Edit Topic', |
193 | 193 | 'parent' => 'admin_topics', |
194 | 194 | 'url' => 'admin/edittopic.php', |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | |
197 | 197 | // Added by Richard Allan for email alert functions |
198 | 198 | |
199 | - 'alert' => array ( |
|
200 | - 'menu' => array ( |
|
199 | + 'alert' => array( |
|
200 | + 'menu' => array( |
|
201 | 201 | 'text' => 'Email Alerts', |
202 | 202 | 'title' => "Set up alerts for updates on an MP or Peer by email", |
203 | 203 | 'sidebar' => 'alert' |
@@ -206,30 +206,30 @@ discard block |
||
206 | 206 | 'title' => 'TheyWorkForYou Email Alerts', |
207 | 207 | 'url' => 'alert/', |
208 | 208 | ), |
209 | - 'alertwelcome' => array ( |
|
209 | + 'alertwelcome' => array( |
|
210 | 210 | 'title' => 'Email Alerts', |
211 | 211 | 'url' => 'alert/', |
212 | 212 | ), |
213 | 213 | |
214 | 214 | // End of ALERTS additions |
215 | 215 | |
216 | - 'api_front' => array ( |
|
217 | - 'menu' => array ( |
|
216 | + 'api_front' => array( |
|
217 | + 'menu' => array( |
|
218 | 218 | 'text' => 'API', |
219 | 219 | 'title' => 'Access our data' |
220 | 220 | ), |
221 | 221 | 'title' => 'TheyWorkForYou API', |
222 | 222 | 'url' => 'api/' |
223 | 223 | ), |
224 | - 'api_doc_front' => array ( |
|
225 | - 'menu' => array ( |
|
224 | + 'api_doc_front' => array( |
|
225 | + 'menu' => array( |
|
226 | 226 | 'text' => 'API', |
227 | 227 | 'title' => 'Access our data' |
228 | 228 | ), |
229 | 229 | 'parent' => 'api_front', |
230 | 230 | 'url' => 'api/' |
231 | 231 | ), |
232 | - 'api_key' => array ( |
|
232 | + 'api_key' => array( |
|
233 | 233 | 'title' => 'API Keys', |
234 | 234 | 'parent' => 'api_front', |
235 | 235 | 'url' => 'api/key' |
@@ -240,69 +240,69 @@ discard block |
||
240 | 240 | 'url' => 'boundaries/', |
241 | 241 | ), |
242 | 242 | |
243 | - 'calendar_summary' => array ( |
|
244 | - 'menu' => array ( |
|
243 | + 'calendar_summary' => array( |
|
244 | + 'menu' => array( |
|
245 | 245 | 'text' => 'Upcoming', |
246 | 246 | 'title' => '', |
247 | 247 | ), |
248 | 248 | 'parent' => 'hansard', |
249 | 249 | 'url' => 'calendar/' |
250 | 250 | ), |
251 | - 'calendar_future_head' => array ( |
|
251 | + 'calendar_future_head' => array( |
|
252 | 252 | 'parent' => 'calendar_summary', |
253 | 253 | 'title' => 'Upcoming business', |
254 | 254 | 'url' => 'calendar/' |
255 | 255 | ), |
256 | - 'calendar_future' => array ( |
|
256 | + 'calendar_future' => array( |
|
257 | 257 | 'parent' => 'calendar_future_head', |
258 | 258 | 'url' => 'calendar/' |
259 | 259 | ), |
260 | - 'calendar_today_head' => array ( |
|
260 | + 'calendar_today_head' => array( |
|
261 | 261 | 'parent' => 'calendar_summary', |
262 | 262 | 'title' => 'Today’s business', |
263 | 263 | 'url' => 'calendar/' |
264 | 264 | ), |
265 | - 'calendar_today' => array ( |
|
265 | + 'calendar_today' => array( |
|
266 | 266 | 'parent' => 'calendar_today_head', |
267 | 267 | 'url' => 'calendar/' |
268 | 268 | ), |
269 | - 'calendar_past_head' => array ( |
|
269 | + 'calendar_past_head' => array( |
|
270 | 270 | 'parent' => 'calendar_summary', |
271 | 271 | 'title' => 'Previous business', |
272 | 272 | 'url' => 'calendar/' |
273 | 273 | ), |
274 | - 'calendar_past' => array ( |
|
274 | + 'calendar_past' => array( |
|
275 | 275 | 'parent' => 'calendar_past_head', |
276 | 276 | 'url' => 'calendar/' |
277 | 277 | ), |
278 | 278 | |
279 | - 'cards' => array ( |
|
279 | + 'cards' => array( |
|
280 | 280 | 'title' => 'MP Stats Cards', |
281 | 281 | 'url' => 'cards/' |
282 | 282 | ), |
283 | 283 | |
284 | - 'campaign_foi' => array ( |
|
284 | + 'campaign_foi' => array( |
|
285 | 285 | 'title' => 'Freedom of Information (Parliament) Order 2009', |
286 | 286 | 'url' => 'foiorder2009/' |
287 | 287 | ), |
288 | - 'campaign' => array ( |
|
288 | + 'campaign' => array( |
|
289 | 289 | 'title' => '', #Free Our Bills!', |
290 | 290 | 'url' => 'freeourbills/' |
291 | 291 | ), |
292 | - 'campaign_edm' => array ( |
|
292 | + 'campaign_edm' => array( |
|
293 | 293 | 'title' => 'Early Day Motion', |
294 | 294 | 'parent' => 'campaign', |
295 | 295 | 'url' => 'freeourbills/' |
296 | 296 | ), |
297 | 297 | |
298 | - 'commentreport' => array ( |
|
298 | + 'commentreport' => array( |
|
299 | 299 | 'title' => 'Reporting a comment', |
300 | 300 | 'url' => 'report/', |
301 | - 'session_vars' => array ('id') |
|
301 | + 'session_vars' => array('id') |
|
302 | 302 | ), |
303 | 303 | |
304 | - 'comments_recent' => array ( |
|
305 | - 'menu' => array ( |
|
304 | + 'comments_recent' => array( |
|
305 | + 'menu' => array( |
|
306 | 306 | 'text' => 'Recent comments', |
307 | 307 | 'title' => "Recently posted comments" |
308 | 308 | ), |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | 'url' => 'comments/recent/' |
312 | 312 | ), |
313 | 313 | |
314 | - 'contact' => array ( |
|
315 | - 'menu' => array ( |
|
314 | + 'contact' => array( |
|
315 | + 'menu' => array( |
|
316 | 316 | 'text' => 'Contact', |
317 | 317 | 'title' => '', |
318 | 318 | ), |
@@ -323,23 +323,23 @@ discard block |
||
323 | 323 | 'title' => 'News', |
324 | 324 | 'url' => 'https://www.mysociety.org/category/projects/theyworkforyou/' |
325 | 325 | ), |
326 | - 'debate' => array ( |
|
326 | + 'debate' => array( |
|
327 | 327 | 'parent' => 'debatesfront', |
328 | 328 | 'url' => 'debates/', |
329 | - 'session_vars' => array ('id'), |
|
329 | + 'session_vars' => array('id'), |
|
330 | 330 | ), |
331 | - 'debates' => array ( |
|
331 | + 'debates' => array( |
|
332 | 332 | 'parent' => 'debatesfront', |
333 | 333 | 'url' => 'debates/', |
334 | - 'session_vars' => array ('id'), |
|
334 | + 'session_vars' => array('id'), |
|
335 | 335 | ), |
336 | - 'debatesday' => array ( |
|
336 | + 'debatesday' => array( |
|
337 | 337 | 'parent' => 'debatesfront', |
338 | - 'session_vars' => array ('d'), |
|
338 | + 'session_vars' => array('d'), |
|
339 | 339 | 'url' => 'debates/', |
340 | 340 | ), |
341 | - 'alldebatesfront' => array ( |
|
342 | - 'menu' => array ( |
|
341 | + 'alldebatesfront' => array( |
|
342 | + 'menu' => array( |
|
343 | 343 | 'text' => 'Debates', |
344 | 344 | 'title' => "Debates in the House of Commons, Westminster Hall, and the House of Lords" |
345 | 345 | ), |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | 'rss' => 'rss/debates.rss', |
349 | 349 | 'url' => 'debates/' |
350 | 350 | ), |
351 | - 'debatesfront' => array ( |
|
352 | - 'menu' => array ( |
|
351 | + 'debatesfront' => array( |
|
352 | + 'menu' => array( |
|
353 | 353 | 'text' => 'Commons debates', |
354 | 354 | 'title' => "Debates in the House of Commons" |
355 | 355 | ), |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | 'rss' => 'rss/debates.rss', |
359 | 359 | 'url' => 'debates/' |
360 | 360 | ), |
361 | - 'debatesyear' => array ( |
|
361 | + 'debatesyear' => array( |
|
362 | 362 | 'parent' => 'debatesfront', |
363 | 363 | 'url' => 'debates/' |
364 | 364 | ), |
365 | - 'divisions_recent' => array ( |
|
366 | - 'menu' => array ( |
|
365 | + 'divisions_recent' => array( |
|
366 | + 'menu' => array( |
|
367 | 367 | 'text' => 'Recent Votes', |
368 | 368 | 'title' => '' |
369 | 369 | ), |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | 'title' => 'Recent Votes', |
372 | 372 | 'url' => 'divisions/' |
373 | 373 | ), |
374 | - 'divisions_vote' => array ( |
|
374 | + 'divisions_vote' => array( |
|
375 | 375 | 'parent' => 'divisions_recent', |
376 | 376 | 'title' => 'Vote', |
377 | 377 | 'url' => 'divisions/division.php' |
378 | 378 | ), |
379 | - 'epvote' => array ( |
|
379 | + 'epvote' => array( |
|
380 | 380 | 'url' => 'vote/' |
381 | 381 | ), |
382 | 382 | |
@@ -385,19 +385,19 @@ discard block |
||
385 | 385 | 'title' => 'TheyWorkForYou Google gadget', |
386 | 386 | ), |
387 | 387 | |
388 | - 'glossary' => array ( |
|
388 | + 'glossary' => array( |
|
389 | 389 | 'heading' => 'Glossary', |
390 | 390 | 'parent' => 'help_us_out', |
391 | 391 | 'url' => 'glossary/' |
392 | 392 | ), |
393 | - 'glossary_item' => array ( |
|
393 | + 'glossary_item' => array( |
|
394 | 394 | 'heading' => 'Glossary heading', |
395 | 395 | 'parent' => 'help_us_out', |
396 | 396 | 'url' => 'glossary/', |
397 | - 'session_vars' => array ('g') |
|
397 | + 'session_vars' => array('g') |
|
398 | 398 | ), |
399 | - 'hansard' => array ( |
|
400 | - 'menu' => array ( |
|
399 | + 'hansard' => array( |
|
400 | + 'menu' => array( |
|
401 | 401 | 'text' => 'UK Parliament', |
402 | 402 | 'title' => "Houses of Parliament debates, Written Answers, Statements, Westminster Hall debates, and Bill Committees" |
403 | 403 | ), |
@@ -405,16 +405,16 @@ discard block |
||
405 | 405 | 'url' => '' |
406 | 406 | ), |
407 | 407 | // Hansard landing page |
408 | - 'hansard_landing' => array ( |
|
408 | + 'hansard_landing' => array( |
|
409 | 409 | 'title' => 'Hansard', |
410 | 410 | 'url' => 'search-hansard/', |
411 | 411 | ), |
412 | - 'help' => array ( |
|
412 | + 'help' => array( |
|
413 | 413 | 'title' => 'Help - Frequently Asked Questions', |
414 | 414 | 'url' => 'help/' |
415 | 415 | ), |
416 | - 'help_us_out' => array ( |
|
417 | - 'menu' => array ( |
|
416 | + 'help_us_out' => array( |
|
417 | + 'menu' => array( |
|
418 | 418 | 'text' => 'Glossary', |
419 | 419 | 'title' => "Parliament's jargon explained" |
420 | 420 | ), |
@@ -423,88 +423,88 @@ discard block |
||
423 | 423 | 'url' => 'addterm/', |
424 | 424 | 'sidebar' => 'glossary_add' |
425 | 425 | ), |
426 | - 'home' => array ( |
|
426 | + 'home' => array( |
|
427 | 427 | 'title' => "UK Parliament", |
428 | 428 | 'rss' => 'news/index.rdf', |
429 | 429 | 'url' => '' |
430 | 430 | ), |
431 | - 'houserules' => array ( |
|
431 | + 'houserules' => array( |
|
432 | 432 | 'title' => 'House rules', |
433 | 433 | 'url' => 'houserules/' |
434 | 434 | ), |
435 | 435 | |
436 | - 'linktous' => array ( |
|
436 | + 'linktous' => array( |
|
437 | 437 | 'title' => 'Link to us', |
438 | 438 | 'heading' => 'How to link to us', |
439 | 439 | 'url' => 'help/linktous/' |
440 | 440 | ), |
441 | - 'api' => array ( |
|
441 | + 'api' => array( |
|
442 | 442 | 'title' => 'API', |
443 | 443 | 'heading' => 'API - Query the TheyWorkForYou database', |
444 | 444 | 'url' => 'api/' |
445 | 445 | ), |
446 | - 'data' => array ( |
|
446 | + 'data' => array( |
|
447 | 447 | 'title' => 'Raw Data', |
448 | 448 | 'heading' => 'Raw data (XML) - the data behind TheyWorkForYou and Public Whip', |
449 | 449 | 'url' => 'http://parser.theyworkforyou.com' |
450 | 450 | ), |
451 | - 'pombola' => array ( |
|
451 | + 'pombola' => array( |
|
452 | 452 | 'title' => 'Pombola', |
453 | 453 | 'heading' => 'mySociety\'s platform for running a Parliamentary monitoring site like this', |
454 | 454 | 'url' => 'https://www.mysociety.org/projects/parliamentarymonitoring/pombola' |
455 | 455 | ), |
456 | - 'devmailinglist' => array ( |
|
456 | + 'devmailinglist' => array( |
|
457 | 457 | 'title' => 'Developer mailing list', |
458 | 458 | 'heading' => 'Developer mailing list', |
459 | 459 | 'url' => 'https://groups.google.com/a/mysociety.org/forum/#!forum/theyworkforyou' |
460 | 460 | ), |
461 | - 'code' => array ( |
|
461 | + 'code' => array( |
|
462 | 462 | 'title' => 'Source code', |
463 | 463 | 'heading' => 'TheyWorkForYou Source code', |
464 | 464 | 'url' => 'https://github.com/mysociety/theyworkforyou' |
465 | 465 | ), |
466 | - 'irc' => array ( |
|
466 | + 'irc' => array( |
|
467 | 467 | 'title' => 'IRC chat channel', |
468 | 468 | 'heading' => 'IRC chat channel', |
469 | 469 | 'url' => 'http://www.irc.mysociety.org/' |
470 | 470 | ), |
471 | - 'newzealand' => array ( |
|
471 | + 'newzealand' => array( |
|
472 | 472 | 'title' => 'New Zealand', |
473 | 473 | 'heading' => 'They Work For You - New Zealand', |
474 | 474 | 'url' => 'http://www.theyworkforyou.co.nz/' |
475 | 475 | ), |
476 | - 'australia' => array ( |
|
476 | + 'australia' => array( |
|
477 | 477 | 'title' => 'Australia', |
478 | 478 | 'heading' => 'Open Australia', |
479 | 479 | 'url' => 'http://www.openaustralia.org/' |
480 | 480 | ), |
481 | - 'ireland' => array ( |
|
481 | + 'ireland' => array( |
|
482 | 482 | 'title' => 'Ireland', |
483 | 483 | 'heading' => 'TheyWorkForYou for the Houses of the Oireachtas', |
484 | 484 | 'url' => 'http://www.kildarestreet.com/' |
485 | 485 | ), |
486 | - 'mzalendo' => array ( |
|
486 | + 'mzalendo' => array( |
|
487 | 487 | 'title' => 'Mzalendo', |
488 | 488 | 'heading' => 'Keeping an eye on the Kenyan Parliament', |
489 | 489 | 'url' => 'http://info.mzalendo.com/' |
490 | 490 | ), |
491 | - 'lordsdebate' => array ( |
|
491 | + 'lordsdebate' => array( |
|
492 | 492 | 'parent' => 'lordsdebatesfront', |
493 | 493 | 'url' => 'lords/', |
494 | - 'session_vars' => array ('id'), |
|
494 | + 'session_vars' => array('id'), |
|
495 | 495 | ), |
496 | - 'lordsdebates' => array ( |
|
496 | + 'lordsdebates' => array( |
|
497 | 497 | 'parent' => 'lordsdebatesfront', |
498 | 498 | 'url' => 'lords/', |
499 | - 'session_vars' => array ('id'), |
|
499 | + 'session_vars' => array('id'), |
|
500 | 500 | ), |
501 | - 'lordsdebatesday' => array ( |
|
501 | + 'lordsdebatesday' => array( |
|
502 | 502 | 'parent' => 'lordsdebatesfront', |
503 | - 'session_vars' => array ('d'), |
|
503 | + 'session_vars' => array('d'), |
|
504 | 504 | 'url' => 'lords/', |
505 | 505 | ), |
506 | - 'lordsdebatesfront' => array ( |
|
507 | - 'menu' => array ( |
|
506 | + 'lordsdebatesfront' => array( |
|
507 | + 'menu' => array( |
|
508 | 508 | 'text' => 'Lords debates', |
509 | 509 | 'title' => "House of Lords debates" |
510 | 510 | ), |
@@ -513,24 +513,24 @@ discard block |
||
513 | 513 | 'rss' => 'rss/lords.rss', |
514 | 514 | 'url' => 'lords/' |
515 | 515 | ), |
516 | - 'lordsdebatesyear' => array ( |
|
516 | + 'lordsdebatesyear' => array( |
|
517 | 517 | 'parent' => 'lordsdebatesfront', |
518 | 518 | 'url' => 'lords/' |
519 | 519 | ), |
520 | 520 | |
521 | 521 | // Parliament landing page |
522 | - 'parliament_landing' => array ( |
|
522 | + 'parliament_landing' => array( |
|
523 | 523 | 'title' => 'Parliament', |
524 | 524 | 'url' => 'parliament/', |
525 | 525 | ), |
526 | 526 | |
527 | - 'peer' => array ( |
|
527 | + 'peer' => array( |
|
528 | 528 | 'parent' => 'peers', |
529 | 529 | 'title' => 'Peer', |
530 | 530 | 'url' => 'peer/' |
531 | 531 | ), |
532 | - 'peers' => array ( |
|
533 | - 'menu' => array ( |
|
532 | + 'peers' => array( |
|
533 | + 'menu' => array( |
|
534 | 534 | 'text' => 'Lords', |
535 | 535 | 'title' => "List of all Lords" |
536 | 536 | ), |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | 'title' => '', |
539 | 539 | 'url' => 'peers/' |
540 | 540 | ), |
541 | -'overview' => array ( |
|
542 | - 'menu' => array ( |
|
541 | +'overview' => array( |
|
542 | + 'menu' => array( |
|
543 | 543 | 'text' => 'Overview', |
544 | 544 | 'title' => "Overview of the UK Parliament" |
545 | 545 | ), |
@@ -548,50 +548,50 @@ discard block |
||
548 | 548 | 'rss' => 'news/index.rdf', |
549 | 549 | 'url' => '' |
550 | 550 | ), |
551 | - 'mla' => array ( |
|
551 | + 'mla' => array( |
|
552 | 552 | 'parent' => 'mlas', |
553 | 553 | 'title' => 'Find your MLA', |
554 | 554 | 'url' => 'mla/' |
555 | 555 | ), |
556 | - 'mlas' => array ( |
|
556 | + 'mlas' => array( |
|
557 | 557 | 'parent' => 'ni_home', |
558 | - 'menu' => array ( |
|
558 | + 'menu' => array( |
|
559 | 559 | 'text' => 'MLAs', |
560 | 560 | 'title' => "List of all Members of the Northern Ireland Assembly (MLAs)" |
561 | 561 | ), |
562 | 562 | 'title' => '', |
563 | 563 | 'url' => 'mlas/' |
564 | 564 | ), |
565 | - 'msps' => array ( |
|
565 | + 'msps' => array( |
|
566 | 566 | 'parent' => 'sp_home', |
567 | - 'menu' => array ( |
|
567 | + 'menu' => array( |
|
568 | 568 | 'text' => 'MSPs', |
569 | 569 | 'title' => "List of Members of the Scottish Parliament (MSPs)" |
570 | 570 | ), |
571 | 571 | 'title' => '', |
572 | 572 | 'url' => 'msps/' |
573 | 573 | ), |
574 | - 'msp' => array ( |
|
574 | + 'msp' => array( |
|
575 | 575 | 'parent' => 'msps', |
576 | 576 | 'title' => 'Find your MSP', |
577 | 577 | 'url' => 'msp/' |
578 | 578 | ), |
579 | 579 | /* Not 'Your MP', whose name is 'yourmp'... */ |
580 | - 'mp' => array ( |
|
580 | + 'mp' => array( |
|
581 | 581 | 'parent' => 'mps', |
582 | 582 | 'title' => 'Find your MP', |
583 | 583 | 'url' => 'mp/' |
584 | 584 | ), |
585 | - 'emailfriend' => array ( |
|
585 | + 'emailfriend' => array( |
|
586 | 586 | 'title' => 'Send this page to a friend', |
587 | 587 | 'url' => 'email/' |
588 | 588 | ), |
589 | 589 | // The directory MPs' RSS feeds are stored in. |
590 | - 'mp_rss' => array ( |
|
590 | + 'mp_rss' => array( |
|
591 | 591 | 'url' => 'rss/mp/' |
592 | 592 | ), |
593 | - 'mps' => array ( |
|
594 | - 'menu' => array ( |
|
593 | + 'mps' => array( |
|
594 | + 'menu' => array( |
|
595 | 595 | 'text' => 'MPs', |
596 | 596 | 'title' => "List of all Members of Parliament (MPs)" |
597 | 597 | ), |
@@ -602,16 +602,16 @@ discard block |
||
602 | 602 | |
603 | 603 | /* Northern Ireland Assembly */ |
604 | 604 | 'ni_home' => array( |
605 | - 'menu' => array ( |
|
605 | + 'menu' => array( |
|
606 | 606 | 'text' => 'Northern Ireland Assembly', |
607 | 607 | 'title' => 'Full authority over <em>transferred matters</em>, which include agriculture, education, employment, the environment and health' |
608 | 608 | ), |
609 | 609 | 'title' => 'Northern Ireland Assembly', |
610 | 610 | 'url' => 'ni/' |
611 | 611 | ), |
612 | - 'nioverview' => array ( |
|
612 | + 'nioverview' => array( |
|
613 | 613 | 'parent' => 'ni_home', |
614 | - 'menu' => array ( |
|
614 | + 'menu' => array( |
|
615 | 615 | 'text' => 'Debates', |
616 | 616 | 'title' => "Overview of the Northern Ireland Assembly debates" |
617 | 617 | ), |
@@ -619,23 +619,23 @@ discard block |
||
619 | 619 | 'rss' => 'rss/ni.rss', |
620 | 620 | 'url' => 'ni/' |
621 | 621 | ), |
622 | - 'nidebate' => array ( |
|
622 | + 'nidebate' => array( |
|
623 | 623 | 'parent' => 'nidebatesfront', |
624 | 624 | 'url' => 'ni/', |
625 | - 'session_vars' => array ('id'), |
|
625 | + 'session_vars' => array('id'), |
|
626 | 626 | ), |
627 | - 'nidebates' => array ( |
|
627 | + 'nidebates' => array( |
|
628 | 628 | 'parent' => 'nidebatesfront', |
629 | 629 | 'url' => 'ni/', |
630 | - 'session_vars' => array ('id'), |
|
630 | + 'session_vars' => array('id'), |
|
631 | 631 | ), |
632 | - 'nidebatesday' => array ( |
|
632 | + 'nidebatesday' => array( |
|
633 | 633 | 'parent' => 'nidebatesfront', |
634 | - 'session_vars' => array ('d'), |
|
634 | + 'session_vars' => array('d'), |
|
635 | 635 | 'url' => 'ni/', |
636 | 636 | ), |
637 | - 'nidebatesfront' => array ( |
|
638 | - 'menu' => array ( |
|
637 | + 'nidebatesfront' => array( |
|
638 | + 'menu' => array( |
|
639 | 639 | 'text' => 'Debates', |
640 | 640 | 'title' => "Northern Ireland Assembly debates" |
641 | 641 | ), |
@@ -644,24 +644,24 @@ discard block |
||
644 | 644 | 'rss' => 'rss/ni.rss', |
645 | 645 | 'url' => 'ni/' |
646 | 646 | ), |
647 | - 'nidebatesyear' => array ( |
|
647 | + 'nidebatesyear' => array( |
|
648 | 648 | 'parent' => 'nidebatesfront', |
649 | 649 | 'url' => 'ni/' |
650 | 650 | ), |
651 | 651 | |
652 | - 'otheruseredit' => array ( |
|
652 | + 'otheruseredit' => array( |
|
653 | 653 | 'pg' => 'editother', |
654 | 654 | 'title' => "Editing a user's data", |
655 | 655 | 'url' => 'user/' |
656 | 656 | ), |
657 | - 'privacy' => array ( |
|
657 | + 'privacy' => array( |
|
658 | 658 | 'title' => 'Privacy Policy', |
659 | 659 | 'url' => 'privacy/' |
660 | 660 | ), |
661 | 661 | |
662 | 662 | /* Public bill committees */ |
663 | - 'pbc_front' => array ( |
|
664 | - 'menu' => array ( |
|
663 | + 'pbc_front' => array( |
|
664 | + 'menu' => array( |
|
665 | 665 | 'text' => 'Bill Committees', |
666 | 666 | 'title' => "Public Bill Committees (formerly Standing Committees) debates" |
667 | 667 | ), |
@@ -679,17 +679,17 @@ discard block |
||
679 | 679 | 'title' => '', |
680 | 680 | 'url' => 'pbc/', |
681 | 681 | 'parent' => 'pbc_front', |
682 | - 'session_vars' => array ('bill'), |
|
682 | + 'session_vars' => array('bill'), |
|
683 | 683 | ), |
684 | 684 | 'pbc_clause' => array( |
685 | 685 | 'parent' => 'pbc_front', |
686 | 686 | 'url' => 'pbc/', |
687 | - 'session_vars' => array ('id'), |
|
687 | + 'session_vars' => array('id'), |
|
688 | 688 | ), |
689 | 689 | 'pbc_speech' => array( |
690 | 690 | 'parent' => 'pbc_front', |
691 | 691 | 'url' => 'pbc/', |
692 | - 'session_vars' => array ('id'), |
|
692 | + 'session_vars' => array('id'), |
|
693 | 693 | ), |
694 | 694 | |
695 | 695 | 'people' => array( |
@@ -701,62 +701,62 @@ discard block |
||
701 | 701 | 'url' => '', |
702 | 702 | ), |
703 | 703 | |
704 | - 'raw' => array ( |
|
704 | + 'raw' => array( |
|
705 | 705 | 'title' => 'Raw data', |
706 | 706 | 'url' => 'raw/' |
707 | 707 | ), |
708 | 708 | |
709 | - 'regmem' => array ( |
|
709 | + 'regmem' => array( |
|
710 | 710 | 'title' => 'Changes to the Register of Members\' Interests', |
711 | 711 | 'url' => 'regmem/' |
712 | 712 | ), |
713 | 713 | |
714 | - 'regmem_date' => array ( |
|
714 | + 'regmem_date' => array( |
|
715 | 715 | 'url' => 'regmem/', |
716 | 716 | 'parent' => 'regmem' |
717 | 717 | ), |
718 | 718 | |
719 | - 'regmem_mp' => array ( |
|
719 | + 'regmem_mp' => array( |
|
720 | 720 | 'url' => 'regmem/', |
721 | 721 | 'parent' => 'regmem' |
722 | 722 | ), |
723 | 723 | |
724 | - 'regmem_diff' => array ( |
|
724 | + 'regmem_diff' => array( |
|
725 | 725 | 'url' => 'regmem/', |
726 | 726 | 'parent' => 'regmem' |
727 | 727 | ), |
728 | 728 | |
729 | - 'royal' => array ( |
|
729 | + 'royal' => array( |
|
730 | 730 | 'parent' => 'hansard', |
731 | 731 | 'title' => 'Royal', |
732 | 732 | 'url' => 'royal/', |
733 | 733 | ), |
734 | 734 | |
735 | - 'topic' => array ( |
|
735 | + 'topic' => array( |
|
736 | 736 | 'parent' => 'topics', |
737 | 737 | 'url' => 'topic/topic.php', |
738 | 738 | ), |
739 | 739 | |
740 | - 'topics' => array ( |
|
740 | + 'topics' => array( |
|
741 | 741 | 'title' => 'Topics', |
742 | 742 | 'url' => 'topic/', |
743 | 743 | ), |
744 | 744 | |
745 | - 'search' => array ( |
|
745 | + 'search' => array( |
|
746 | 746 | 'sidebar' => 'search', |
747 | 747 | 'url' => 'search/', |
748 | 748 | 'robots' => 'noindex, nofollow', |
749 | 749 | 'heading' => '', |
750 | - 'session_vars' => array ('q', 's', 'pid', 'o', 'pop') |
|
750 | + 'session_vars' => array('q', 's', 'pid', 'o', 'pop') |
|
751 | 751 | ), |
752 | - 'search_help' => array ( |
|
752 | + 'search_help' => array( |
|
753 | 753 | 'sidebar' => 'search', |
754 | 754 | 'title' => 'Help with searching', |
755 | 755 | 'url' => 'search/' |
756 | 756 | ), |
757 | 757 | |
758 | - 'sitenews' => array ( |
|
759 | - 'menu' => array ( |
|
758 | + 'sitenews' => array( |
|
759 | + 'menu' => array( |
|
760 | 760 | 'text' => 'TheyWorkForYou news', |
761 | 761 | 'title' => "News about changes to this website" |
762 | 762 | ), |
@@ -766,68 +766,68 @@ discard block |
||
766 | 766 | 'title' => 'TheyWorkForYou news', |
767 | 767 | 'url' => 'news/' |
768 | 768 | ), |
769 | - 'sitenews_archive' => array ( |
|
769 | + 'sitenews_archive' => array( |
|
770 | 770 | 'parent' => 'sitenews', |
771 | 771 | 'rss' => 'news/index.rdf', |
772 | 772 | 'sidebar' => 'sitenews', |
773 | 773 | 'title' => 'Archive', |
774 | 774 | 'url' => 'news/archives/' |
775 | 775 | ), |
776 | - 'sitenews_atom' => array ( |
|
776 | + 'sitenews_atom' => array( |
|
777 | 777 | 'url' => 'news/atom.xml' |
778 | 778 | ), |
779 | - 'sitenews_date' => array ( |
|
779 | + 'sitenews_date' => array( |
|
780 | 780 | 'parent' => 'sitenews', |
781 | 781 | 'rss' => 'news/index.rdf', |
782 | 782 | 'sidebar' => 'sitenews' |
783 | 783 | ), |
784 | - 'sitenews_individual' => array ( |
|
784 | + 'sitenews_individual' => array( |
|
785 | 785 | 'parent' => 'sitenews', |
786 | 786 | 'rss' => 'news/index.rdf', |
787 | 787 | 'sidebar' => 'sitenews', |
788 | 788 | ), |
789 | - 'sitenews_rss1' => array ( |
|
789 | + 'sitenews_rss1' => array( |
|
790 | 790 | 'url' => 'news/index.rdf' |
791 | 791 | ), |
792 | - 'sitenews_rss2' => array ( |
|
792 | + 'sitenews_rss2' => array( |
|
793 | 793 | 'url' => 'news/index.xml' |
794 | 794 | ), |
795 | 795 | |
796 | 796 | /* Scottish Parliament */ |
797 | 797 | 'sp_home' => array( |
798 | - 'menu' => array ( |
|
798 | + 'menu' => array( |
|
799 | 799 | 'text' => 'Scottish Parliament', |
800 | 800 | 'title' => 'Scottish education, health, agriculture, justice, prisons and other devolved areas. Some tax-varying powers' |
801 | 801 | ), |
802 | 802 | 'title' => 'Scottish Parliament', |
803 | 803 | 'url' => 'scotland/' |
804 | 804 | ), |
805 | - 'spoverview' => array ( |
|
805 | + 'spoverview' => array( |
|
806 | 806 | 'parent' => 'sp_home', |
807 | - 'menu' => array ( |
|
807 | + 'menu' => array( |
|
808 | 808 | 'text' => 'Overview', |
809 | 809 | 'title' => "Overview of the Scottish Parliament" |
810 | 810 | ), |
811 | 811 | 'title' => '', |
812 | 812 | 'url' => 'scotland/' |
813 | 813 | ), |
814 | - 'spdebate' => array ( |
|
814 | + 'spdebate' => array( |
|
815 | 815 | 'parent' => 'spdebatesfront', |
816 | 816 | 'url' => 'sp/', |
817 | - 'session_vars' => array ('id'), |
|
817 | + 'session_vars' => array('id'), |
|
818 | 818 | ), |
819 | - 'spdebates' => array ( |
|
819 | + 'spdebates' => array( |
|
820 | 820 | 'parent' => 'spdebatesfront', |
821 | 821 | 'url' => 'sp/', |
822 | - 'session_vars' => array ('id'), |
|
822 | + 'session_vars' => array('id'), |
|
823 | 823 | ), |
824 | - 'spdebatesday' => array ( |
|
824 | + 'spdebatesday' => array( |
|
825 | 825 | 'parent' => 'spdebatesfront', |
826 | - 'session_vars' => array ('d'), |
|
826 | + 'session_vars' => array('d'), |
|
827 | 827 | 'url' => 'sp/', |
828 | 828 | ), |
829 | - 'spdebatesfront' => array ( |
|
830 | - 'menu' => array ( |
|
829 | + 'spdebatesfront' => array( |
|
830 | + 'menu' => array( |
|
831 | 831 | 'text' => 'Debates', |
832 | 832 | 'title' => '' |
833 | 833 | ), |
@@ -836,21 +836,21 @@ discard block |
||
836 | 836 | 'url' => 'sp/' |
837 | 837 | ), |
838 | 838 | |
839 | - 'spdebatesyear' => array ( |
|
839 | + 'spdebatesyear' => array( |
|
840 | 840 | 'parent' => 'spdebatesfront', |
841 | 841 | 'url' => 'sp/' |
842 | 842 | ), |
843 | - 'spwrans' => array ( |
|
843 | + 'spwrans' => array( |
|
844 | 844 | 'parent' => 'spwransfront', |
845 | 845 | 'url' => 'spwrans/', |
846 | 846 | #'session_vars' => array ('id'), |
847 | 847 | ), |
848 | - 'spwransday' => array ( |
|
848 | + 'spwransday' => array( |
|
849 | 849 | 'parent' => 'spwransfront', |
850 | 850 | 'url' => 'spwrans/' |
851 | 851 | ), |
852 | - 'spwransfront' => array ( |
|
853 | - 'menu' => array ( |
|
852 | + 'spwransfront' => array( |
|
853 | + 'menu' => array( |
|
854 | 854 | 'text' => 'Written Answers', |
855 | 855 | 'title' => '' |
856 | 856 | ), |
@@ -863,38 +863,38 @@ discard block |
||
863 | 863 | 'title' => 'For questions asked by ', |
864 | 864 | 'url' => 'spwrans/' |
865 | 865 | ), |
866 | - 'spwransyear' => array ( |
|
866 | + 'spwransyear' => array( |
|
867 | 867 | 'parent' => 'spwransfront', |
868 | 868 | 'url' => 'spwrans/' |
869 | 869 | ), |
870 | 870 | |
871 | 871 | // Topic pages |
872 | 872 | |
873 | - 'topic' => array ( |
|
873 | + 'topic' => array( |
|
874 | 874 | 'url' => 'topic/', |
875 | 875 | 'title' => 'Topics' |
876 | 876 | ), |
877 | 877 | |
878 | - 'topicbenefits' => array ( |
|
878 | + 'topicbenefits' => array( |
|
879 | 879 | 'url' => 'topic/benefits', |
880 | 880 | 'parent' => 'topic', |
881 | 881 | 'title' => 'Benefits' |
882 | 882 | ), |
883 | 883 | |
884 | - 'topiccrimestats' => array ( |
|
884 | + 'topiccrimestats' => array( |
|
885 | 885 | 'url' => 'topic/crime-stats', |
886 | 886 | 'parent' => 'topic', |
887 | 887 | 'title' => 'Crime Statistics' |
888 | 888 | ), |
889 | 889 | |
890 | - 'topicnhs' => array ( |
|
890 | + 'topicnhs' => array( |
|
891 | 891 | 'url' => 'topic/nhs', |
892 | 892 | 'parent' => 'topic', |
893 | 893 | 'title' => 'NHS' |
894 | 894 | ), |
895 | 895 | |
896 | 896 | // The URL 3rd parties need to ping something here. |
897 | - 'trackback' => array ( |
|
897 | + 'trackback' => array( |
|
898 | 898 | 'url' => 'trackback/' |
899 | 899 | ), |
900 | 900 | |
@@ -907,29 +907,29 @@ discard block |
||
907 | 907 | 'url' => 'user/alerts/', |
908 | 908 | 'parent' => 'userviewself' |
909 | 909 | ), |
910 | - 'userchangepc' => array ( |
|
910 | + 'userchangepc' => array( |
|
911 | 911 | 'title' => 'Change your postcode', |
912 | 912 | 'url' => 'user/changepc/' |
913 | 913 | ), |
914 | - 'userconfirm' => array ( |
|
914 | + 'userconfirm' => array( |
|
915 | 915 | 'url' => 'user/confirm/' |
916 | 916 | ), |
917 | - 'userconfirmed' => array ( |
|
917 | + 'userconfirmed' => array( |
|
918 | 918 | 'sidebar' => 'userconfirmed', |
919 | 919 | 'title' => 'Welcome to TheyWorkForYou!', |
920 | 920 | 'url' => 'user/confirm/' |
921 | 921 | ), |
922 | - 'userconfirmfailed' => array ( |
|
922 | + 'userconfirmfailed' => array( |
|
923 | 923 | 'title' => 'Oops!', |
924 | 924 | 'url' => 'user/confirm/' |
925 | 925 | ), |
926 | - 'useredit' => array ( |
|
926 | + 'useredit' => array( |
|
927 | 927 | 'pg' => 'edit', |
928 | 928 | 'title' => 'Edit your details', |
929 | 929 | 'url' => 'user/' |
930 | 930 | ), |
931 | - 'userjoin' => array ( |
|
932 | - 'menu' => array ( |
|
931 | + 'userjoin' => array( |
|
932 | + 'menu' => array( |
|
933 | 933 | 'text' => 'Join', |
934 | 934 | 'title' => "Joining is free and allows you to annotate speeches" |
935 | 935 | ), |
@@ -938,8 +938,8 @@ discard block |
||
938 | 938 | 'title' => 'Join TheyWorkForYou', |
939 | 939 | 'url' => 'user/' |
940 | 940 | ), |
941 | - 'getinvolved' => array ( |
|
942 | - 'menu' => array ( |
|
941 | + 'getinvolved' => array( |
|
942 | + 'menu' => array( |
|
943 | 943 | 'text' => 'Get involved', |
944 | 944 | 'title' => "Contribute to TheyWorkForYou" |
945 | 945 | ), |
@@ -948,8 +948,8 @@ discard block |
||
948 | 948 | 'title' => 'Contribute to TheyWorkForYou', |
949 | 949 | 'url' => 'getinvolved/' |
950 | 950 | ), |
951 | - 'userlogin' => array ( |
|
952 | - 'menu' => array ( |
|
951 | + 'userlogin' => array( |
|
952 | + 'menu' => array( |
|
953 | 953 | 'text' => 'Sign in', |
954 | 954 | 'title' => "If you've already joined , sign in to add annotations" |
955 | 955 | ), |
@@ -958,33 +958,33 @@ discard block |
||
958 | 958 | 'url' => 'user/login/' |
959 | 959 | ), |
960 | 960 | |
961 | - 'userlogout' => array ( |
|
962 | - 'menu' => array ( |
|
961 | + 'userlogout' => array( |
|
962 | + 'menu' => array( |
|
963 | 963 | 'text' => 'Sign out', |
964 | 964 | 'title' => "Sign out" |
965 | 965 | ), |
966 | 966 | 'url' => 'user/logout/' |
967 | 967 | ), |
968 | - 'userpassword' => array ( |
|
968 | + 'userpassword' => array( |
|
969 | 969 | 'title' => 'Change password', |
970 | 970 | 'url' => 'user/password/' |
971 | 971 | ), |
972 | - 'userprompt' => array ( |
|
972 | + 'userprompt' => array( |
|
973 | 973 | 'title' => 'Please sign in', |
974 | 974 | 'url' => 'user/prompt/' |
975 | 975 | ), |
976 | - 'userview' => array ( |
|
976 | + 'userview' => array( |
|
977 | 977 | 'session_vars' => array('u'), |
978 | 978 | 'url' => 'user/' |
979 | 979 | ), |
980 | - 'userviewself' => array ( |
|
981 | - 'menu' => array ( |
|
980 | + 'userviewself' => array( |
|
981 | + 'menu' => array( |
|
982 | 982 | 'text' => 'Your details', |
983 | 983 | 'title' => "View and edit your details" |
984 | 984 | ), |
985 | 985 | 'url' => 'user/' |
986 | 986 | ), |
987 | - 'userwelcome' => array ( |
|
987 | + 'userwelcome' => array( |
|
988 | 988 | 'title' => 'Welcome!', |
989 | 989 | 'url' => 'user/' |
990 | 990 | ), |
@@ -1012,23 +1012,23 @@ discard block |
||
1012 | 1012 | ), |
1013 | 1013 | |
1014 | 1014 | /* Westminster Hall */ |
1015 | - 'whall' => array ( |
|
1015 | + 'whall' => array( |
|
1016 | 1016 | 'parent' => 'whallfront', |
1017 | 1017 | 'url' => 'whall/', |
1018 | - 'session_vars' => array ('id'), |
|
1018 | + 'session_vars' => array('id'), |
|
1019 | 1019 | ), |
1020 | - 'whalls' => array ( |
|
1020 | + 'whalls' => array( |
|
1021 | 1021 | 'parent' => 'whallfront', |
1022 | 1022 | 'url' => 'whall/', |
1023 | - 'session_vars' => array ('id'), |
|
1023 | + 'session_vars' => array('id'), |
|
1024 | 1024 | ), |
1025 | - 'whallday' => array ( |
|
1025 | + 'whallday' => array( |
|
1026 | 1026 | 'parent' => 'whallfront', |
1027 | - 'session_vars' => array ('d'), |
|
1027 | + 'session_vars' => array('d'), |
|
1028 | 1028 | 'url' => 'whall/', |
1029 | 1029 | ), |
1030 | - 'whallfront' => array ( |
|
1031 | - 'menu' => array ( |
|
1030 | + 'whallfront' => array( |
|
1031 | + 'menu' => array( |
|
1032 | 1032 | 'text' => 'Westminster Hall', |
1033 | 1033 | 'title' => "Westminster Hall debates" |
1034 | 1034 | ), |
@@ -1037,23 +1037,23 @@ discard block |
||
1037 | 1037 | 'rss' => 'rss/whall.rss', |
1038 | 1038 | 'url' => 'whall/' |
1039 | 1039 | ), |
1040 | - 'whallyear' => array ( |
|
1040 | + 'whallyear' => array( |
|
1041 | 1041 | 'parent' => 'whallfront', |
1042 | 1042 | 'url' => 'whall/' |
1043 | 1043 | ), |
1044 | 1044 | |
1045 | - 'wms' => array ( |
|
1045 | + 'wms' => array( |
|
1046 | 1046 | 'parent' => 'wranswmsfront', |
1047 | 1047 | 'url' => 'wms/', |
1048 | 1048 | 'session_vars' => array('id') |
1049 | 1049 | ), |
1050 | - 'wmsday' => array ( |
|
1050 | + 'wmsday' => array( |
|
1051 | 1051 | 'parent' => 'wmsfront', |
1052 | 1052 | 'session_vars' => array('d'), |
1053 | 1053 | 'url' => 'wms/' |
1054 | 1054 | ), |
1055 | - 'wmsfront' => array ( |
|
1056 | - 'menu' => array ( |
|
1055 | + 'wmsfront' => array( |
|
1056 | + 'menu' => array( |
|
1057 | 1057 | 'text' => 'Written Ministerial Statements', |
1058 | 1058 | 'title' => '' |
1059 | 1059 | ), |
@@ -1062,22 +1062,22 @@ discard block |
||
1062 | 1062 | 'rss' => 'rss/wms.rss', |
1063 | 1063 | 'url' => 'wms/' |
1064 | 1064 | ), |
1065 | - 'wmsyear' => array ( |
|
1065 | + 'wmsyear' => array( |
|
1066 | 1066 | 'parent' => 'wmsfront', |
1067 | 1067 | 'url' => 'wms/' |
1068 | 1068 | ), |
1069 | 1069 | |
1070 | - 'wrans' => array ( |
|
1070 | + 'wrans' => array( |
|
1071 | 1071 | 'parent' => 'wranswmsfront', |
1072 | 1072 | 'url' => 'wrans/', |
1073 | - 'session_vars' => array ('id') |
|
1073 | + 'session_vars' => array('id') |
|
1074 | 1074 | ), |
1075 | - 'wransday' => array ( |
|
1075 | + 'wransday' => array( |
|
1076 | 1076 | 'parent' => 'wransfront', |
1077 | 1077 | 'url' => 'wrans/' |
1078 | 1078 | ), |
1079 | - 'wransfront' => array ( |
|
1080 | - 'menu' => array ( |
|
1079 | + 'wransfront' => array( |
|
1080 | + 'menu' => array( |
|
1081 | 1081 | 'text' => 'Written Answers', |
1082 | 1082 | 'title' => "Written Answers" |
1083 | 1083 | ), |
@@ -1090,13 +1090,13 @@ discard block |
||
1090 | 1090 | 'title' => 'For questions asked by ', |
1091 | 1091 | 'url' => 'wrans/' |
1092 | 1092 | ), |
1093 | - 'wransyear' => array ( |
|
1093 | + 'wransyear' => array( |
|
1094 | 1094 | 'parent' => 'wransfront', |
1095 | 1095 | 'url' => 'wrans/' |
1096 | 1096 | ), |
1097 | 1097 | |
1098 | - 'wranswmsfront' => array ( |
|
1099 | - 'menu' => array ( |
|
1098 | + 'wranswmsfront' => array( |
|
1099 | + 'menu' => array( |
|
1100 | 1100 | 'text' => 'Written Answers', |
1101 | 1101 | 'title' => 'Written Answers and Statements', |
1102 | 1102 | ), |
@@ -1113,8 +1113,8 @@ discard block |
||
1113 | 1113 | 'title' => 'Your representative', |
1114 | 1114 | 'url' => 'your/', |
1115 | 1115 | ), |
1116 | - 'yourmp' => array ( |
|
1117 | - 'menu' => array ( |
|
1116 | + 'yourmp' => array( |
|
1117 | + 'menu' => array( |
|
1118 | 1118 | 'text' => 'Your MP', |
1119 | 1119 | 'title' => "Find out about your Member of Parliament" |
1120 | 1120 | ), |
@@ -1123,8 +1123,8 @@ discard block |
||
1123 | 1123 | 'url' => 'mp/', |
1124 | 1124 | 'parent' => 'mps', |
1125 | 1125 | ), |
1126 | - 'yourmp_recent' => array ( |
|
1127 | - 'menu' => array ( |
|
1126 | + 'yourmp_recent' => array( |
|
1127 | + 'menu' => array( |
|
1128 | 1128 | 'text' => 'Recent appearances', |
1129 | 1129 | 'title' => "Recent speeches and written answers by this MP" |
1130 | 1130 | ), |
@@ -1132,8 +1132,8 @@ discard block |
||
1132 | 1132 | 'title' => "Your MP's recent appearances in parliament", |
1133 | 1133 | 'url' => 'mp/?recent=1' |
1134 | 1134 | ), |
1135 | - 'yourmsp' => array ( |
|
1136 | - 'menu' => array ( |
|
1135 | + 'yourmsp' => array( |
|
1136 | + 'menu' => array( |
|
1137 | 1137 | 'text' => 'Your MSPs', |
1138 | 1138 | 'title' => "Find out about your Members of the Scottish Parliament" |
1139 | 1139 | ), |
@@ -1142,8 +1142,8 @@ discard block |
||
1142 | 1142 | 'title' => 'Your MSPs', |
1143 | 1143 | 'url' => 'msp/' |
1144 | 1144 | ), |
1145 | - 'yourmla' => array ( |
|
1146 | - 'menu' => array ( |
|
1145 | + 'yourmla' => array( |
|
1146 | + 'menu' => array( |
|
1147 | 1147 | 'text' => 'Your MLAs', |
1148 | 1148 | 'title' => "Find out about your Members of the Legislative Assembly" |
1149 | 1149 | ), |
@@ -1159,38 +1159,38 @@ discard block |
||
1159 | 1159 | // The text displayed on the page itself will also be this, |
1160 | 1160 | // UNLESS the section has a 'heading', in which case that's used instead. |
1161 | 1161 | |
1162 | -$this->section = array ( |
|
1162 | +$this->section = array( |
|
1163 | 1163 | |
1164 | 1164 | |
1165 | - 'about' => array ( |
|
1165 | + 'about' => array( |
|
1166 | 1166 | 'title' => 'About Us' |
1167 | 1167 | ), |
1168 | - 'admin' => array ( |
|
1168 | + 'admin' => array( |
|
1169 | 1169 | 'title' => 'Admin' |
1170 | 1170 | ), |
1171 | - 'debates' => array ( |
|
1171 | + 'debates' => array( |
|
1172 | 1172 | 'title' => 'Debates', |
1173 | 1173 | 'heading' => 'House of Commons Debates' |
1174 | 1174 | ), |
1175 | - 'help_us_out' => array ( |
|
1175 | + 'help_us_out' => array( |
|
1176 | 1176 | 'title' => 'Help Us Out' |
1177 | 1177 | ), |
1178 | - 'hansard' => array ( |
|
1178 | + 'hansard' => array( |
|
1179 | 1179 | 'title' => 'Hansard' |
1180 | 1180 | ), |
1181 | - 'home' => array ( |
|
1181 | + 'home' => array( |
|
1182 | 1182 | 'title' => 'Home' |
1183 | 1183 | ), |
1184 | - 'mp' => array ( |
|
1184 | + 'mp' => array( |
|
1185 | 1185 | 'title' => 'Your MP' |
1186 | 1186 | ), |
1187 | - 'search' => array ( |
|
1187 | + 'search' => array( |
|
1188 | 1188 | 'title' => 'Search' |
1189 | 1189 | ), |
1190 | - 'sitenews' => array ( |
|
1190 | + 'sitenews' => array( |
|
1191 | 1191 | 'title' => 'TheyWorkForYou news' |
1192 | 1192 | ), |
1193 | - 'wrans' => array ( |
|
1193 | + 'wrans' => array( |
|
1194 | 1194 | 'title' => 'Written Answers' |
1195 | 1195 | ) |
1196 | 1196 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $this->db = new ParlDB; |
15 | 15 | } |
16 | 16 | |
17 | - public function display ($view, $args=array(), $format='html') { |
|
17 | + public function display($view, $args = array(), $format = 'html') { |
|
18 | 18 | global $PAGE; |
19 | 19 | |
20 | 20 | $validviews = array('mps', 'peers', 'mlas', 'msps'); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $data = $this->$function($args); |
29 | 29 | |
30 | 30 | } else { |
31 | - $PAGE->error_message ("You haven't specified a view type."); |
|
31 | + $PAGE->error_message("You haven't specified a view type."); |
|
32 | 32 | return false; |
33 | 33 | } |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | - public function render($view, $data, $format='html') { |
|
42 | + public function render($view, $data, $format = 'html') { |
|
43 | 43 | // Once we have the data that's to be rendered, |
44 | 44 | // include the template. |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | //This should really be a single template? (rjp) |
52 | - include (INCLUDESPATH."easyparliament/templates/$format/people_$view" . ".php"); |
|
52 | + include (INCLUDESPATH."easyparliament/templates/$format/people_$view".".php"); |
|
53 | 53 | return true; |
54 | 54 | |
55 | 55 | } |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | $query .= 'AND to_date="9999-12-31" '; |
105 | 105 | } |
106 | 106 | if ($use_personinfo) { |
107 | - $query .= 'LEFT OUTER JOIN personinfo ON member.person_id = personinfo.person_id AND data_key="' . $personinfo_key . '" '; |
|
107 | + $query .= 'LEFT OUTER JOIN personinfo ON member.person_id = personinfo.person_id AND data_key="'.$personinfo_key.'" '; |
|
108 | 108 | } |
109 | 109 | $query .= ' JOIN person_names p ON p.person_id = member.person_id AND p.type = "name" '; |
110 | 110 | if (isset($args['date'])) |
111 | 111 | $query .= 'AND start_date <= :date AND :date <= end_date '; |
112 | 112 | else |
113 | 113 | $query .= 'AND end_date="9999-12-31" '; |
114 | - $query .= 'WHERE house=' . $args['house'] . ' '; |
|
114 | + $query .= 'WHERE house='.$args['house'].' '; |
|
115 | 115 | if (isset($args['date'])) |
116 | 116 | $query .= 'AND entered_house <= :date AND :date <= left_house '; |
117 | 117 | elseif (!isset($args['all']) || $args['house'] == 1) |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - $q = $this->db->query($query . "ORDER BY $sqlorder", $params); |
|
131 | + $q = $this->db->query($query."ORDER BY $sqlorder", $params); |
|
132 | 132 | |
133 | 133 | $data = array(); |
134 | - for ($row=0; $row<$q->rows(); $row++) { |
|
134 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
135 | 135 | $p_id = $q->field($row, 'person_id'); |
136 | 136 | $dept = $q->field($row, 'dept'); |
137 | 137 | $pos = $q->field($row, 'position'); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $q->field($row, 'lordofname')); |
145 | 145 | $constituency = $q->field($row, 'constituency'); |
146 | 146 | $url = make_member_url($name, $constituency, $args['house'], $p_id); |
147 | - $narray = array ( |
|
147 | + $narray = array( |
|
148 | 148 | 'person_id' => $p_id, |
149 | 149 | 'given_name' => $q->field($row, 'given_name'), |
150 | 150 | 'family_name' => $q->field($row, 'family_name'), |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | if ($args['house'] == 2 && ($order == 'name' || $order == 'constituency')) |
178 | 178 | uasort($data, array($this, 'by_peer_name')); |
179 | 179 | |
180 | - $data = array ( |
|
181 | - 'info' => array ( |
|
180 | + $data = array( |
|
181 | + 'info' => array( |
|
182 | 182 | 'order' => $order |
183 | 183 | ), |
184 | 184 | 'data' => $data |
@@ -107,15 +107,17 @@ discard block |
||
107 | 107 | $query .= 'LEFT OUTER JOIN personinfo ON member.person_id = personinfo.person_id AND data_key="' . $personinfo_key . '" '; |
108 | 108 | } |
109 | 109 | $query .= ' JOIN person_names p ON p.person_id = member.person_id AND p.type = "name" '; |
110 | - if (isset($args['date'])) |
|
111 | - $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
112 | - else |
|
113 | - $query .= 'AND end_date="9999-12-31" '; |
|
110 | + if (isset($args['date'])) { |
|
111 | + $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
112 | + } else { |
|
113 | + $query .= 'AND end_date="9999-12-31" '; |
|
114 | + } |
|
114 | 115 | $query .= 'WHERE house=' . $args['house'] . ' '; |
115 | - if (isset($args['date'])) |
|
116 | - $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
117 | - elseif (!isset($args['all']) || $args['house'] == 1) |
|
118 | - $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
116 | + if (isset($args['date'])) { |
|
117 | + $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
118 | + } elseif (!isset($args['all']) || $args['house'] == 1) { |
|
119 | + $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
120 | + } |
|
119 | 121 | |
120 | 122 | if (isset($args['order'])) { |
121 | 123 | $order = $args['order']; |
@@ -174,8 +176,9 @@ discard block |
||
174 | 176 | $data[$p_id] = $narray; |
175 | 177 | } |
176 | 178 | } |
177 | - if ($args['house'] == 2 && ($order == 'name' || $order == 'constituency')) |
|
178 | - uasort($data, array($this, 'by_peer_name')); |
|
179 | + if ($args['house'] == 2 && ($order == 'name' || $order == 'constituency')) { |
|
180 | + uasort($data, array($this, 'by_peer_name')); |
|
181 | + } |
|
179 | 182 | |
180 | 183 | $data = array ( |
181 | 184 | 'info' => array ( |
@@ -188,14 +191,18 @@ discard block |
||
188 | 191 | |
189 | 192 | } |
190 | 193 | public function by_peer_name($a, $b) { |
191 | - if (!$a['family_name'] && !$b['family_name']) |
|
192 | - return strcmp($a['lordofname'], $b['lordofname']); |
|
193 | - if (!$a['family_name']) |
|
194 | - return strcmp($a['lordofname'], $b['family_name']); |
|
195 | - if (!$b['family_name']) |
|
196 | - return strcmp($a['family_name'], $b['lordofname']); |
|
197 | - if (strcmp($a['family_name'], $b['family_name'])) |
|
198 | - return strcmp($a['family_name'], $b['family_name']); |
|
194 | + if (!$a['family_name'] && !$b['family_name']) { |
|
195 | + return strcmp($a['lordofname'], $b['lordofname']); |
|
196 | + } |
|
197 | + if (!$a['family_name']) { |
|
198 | + return strcmp($a['lordofname'], $b['family_name']); |
|
199 | + } |
|
200 | + if (!$b['family_name']) { |
|
201 | + return strcmp($a['family_name'], $b['lordofname']); |
|
202 | + } |
|
203 | + if (strcmp($a['family_name'], $b['family_name'])) { |
|
204 | + return strcmp($a['family_name'], $b['family_name']); |
|
205 | + } |
|
199 | 206 | return strcmp($a['lordofname'], $b['lordofname']); |
200 | 207 | } |
201 | 208 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // available for editing, it's accurate. |
25 | 25 | $this->_update_locked(); |
26 | 26 | |
27 | - $data = $this->_get_data_by_recent (); |
|
27 | + $data = $this->_get_data_by_recent(); |
|
28 | 28 | |
29 | 29 | $this->render($data); |
30 | 30 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $q = $this->db->query("SELECT comments.comment_id, |
68 | 68 | commentreports.report_id, |
69 | 69 | commentreports.body, |
70 | - DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS reported, |
|
70 | + DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS reported, |
|
71 | 71 | commentreports.locked, |
72 | 72 | users.firstname, |
73 | 73 | users.lastname |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $r = $this->db->query("SELECT comments.comment_id, |
85 | 85 | commentreports.report_id, |
86 | 86 | commentreports.body, |
87 | - DATE_FORMAT(commentreports.reported, '". SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS reported, |
|
87 | + DATE_FORMAT(commentreports.reported, '". SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS reported, |
|
88 | 88 | commentreports.locked, |
89 | 89 | commentreports.firstname, |
90 | 90 | commentreports.lastname |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | |
100 | 100 | if ($q->rows() > 0) { |
101 | 101 | |
102 | - for ($n=0; $n<$q->rows(); $n++) { |
|
102 | + for ($n = 0; $n < $q->rows(); $n++) { |
|
103 | 103 | |
104 | - $data[] = array ( |
|
105 | - 'report_id' => $q->field($n,'report_id'), |
|
106 | - 'comment_id' => $q->field($n,'comment_id'), |
|
104 | + $data[] = array( |
|
105 | + 'report_id' => $q->field($n, 'report_id'), |
|
106 | + 'comment_id' => $q->field($n, 'comment_id'), |
|
107 | 107 | 'firstname' => $q->field($n, 'firstname'), |
108 | 108 | 'lastname' => $q->field($n, 'lastname'), |
109 | 109 | 'body' => $q->field($n, 'body'), |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | |
115 | 115 | } |
116 | 116 | if ($r->rows() > 0) { |
117 | - for ($n=0; $n<$r->rows(); $n++) { |
|
118 | - $data[] = array ( |
|
119 | - 'report_id' => $r->field($n,'report_id'), |
|
120 | - 'comment_id' => $r->field($n,'comment_id'), |
|
117 | + for ($n = 0; $n < $r->rows(); $n++) { |
|
118 | + $data[] = array( |
|
119 | + 'report_id' => $r->field($n, 'report_id'), |
|
120 | + 'comment_id' => $r->field($n, 'comment_id'), |
|
121 | 121 | 'firstname' => $r->field($n, 'firstname'), |
122 | 122 | 'lastname' => $r->field($n, 'lastname'), |
123 | 123 | 'body' => $r->field($n, 'body'), |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function moderate_trackbacks() { return $this->moderate_trackbacks; } |
52 | 52 | |
53 | 53 | |
54 | - public function display ($view, $args=array(), $format='html') { |
|
54 | + public function display($view, $args = array(), $format = 'html') { |
|
55 | 55 | // $view is one of: |
56 | 56 | // 'epobject_id' - display the pings for one epobject. |
57 | 57 | // 'recent' - to get the most recent pings to anywhere. |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $trackbackdata = $this->$function($args); |
70 | 70 | |
71 | 71 | } else { |
72 | - $PAGE->error_message ("You haven't specified a valid view type."); |
|
72 | + $PAGE->error_message("You haven't specified a valid view type."); |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - $data = array ( |
|
76 | + $data = array( |
|
77 | 77 | 'data' => $trackbackdata, |
78 | - 'info' => array ( |
|
78 | + 'info' => array( |
|
79 | 79 | 'view' => $view |
80 | 80 | ) |
81 | 81 | ); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->render($view, $data, $format); |
87 | 87 | } |
88 | 88 | |
89 | - public function render($view, $data, $format='html') { |
|
89 | + public function render($view, $data, $format = 'html') { |
|
90 | 90 | |
91 | 91 | if ($format != 'html') { |
92 | 92 | $format = 'html'; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // We currently only have one kind of trackback template, so |
96 | 96 | // we're ignoring $view here I'm afraid... |
97 | 97 | |
98 | - include (INCLUDESPATH."easyparliament/templates/$format/trackbacks" . ".php"); |
|
98 | + include (INCLUDESPATH."easyparliament/templates/$format/trackbacks".".php"); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // Check this epobject_id exists. |
124 | 124 | $q = $this->db->query("SELECT epobject_id |
125 | 125 | FROM epobject |
126 | - WHERE epobject_id = '" . addslashes($epobject_id) . "'"); |
|
126 | + WHERE epobject_id = '" . addslashes($epobject_id)."'"); |
|
127 | 127 | |
128 | 128 | if ($q->rows() == 0) { |
129 | 129 | $this->_trackback_response(1, "Sorry, we don't have a valid epobject_id."); |
@@ -131,24 +131,24 @@ discard block |
||
131 | 131 | |
132 | 132 | |
133 | 133 | // Still here? Then we're trackbacking to a valid hansard item. |
134 | - $url = $trackbackdata['url']; |
|
135 | - $source_ip = $trackbackdata['source_ip']; |
|
134 | + $url = $trackbackdata['url']; |
|
135 | + $source_ip = $trackbackdata['source_ip']; |
|
136 | 136 | // These all strip_tags too. |
137 | - $title = trim_characters(html_entity_decode($trackbackdata['title']), 0, 255); |
|
138 | - $excerpt = trim_characters(html_entity_decode($trackbackdata['excerpt']), 0, 255); |
|
139 | - $blog_name = trim_characters(html_entity_decode($trackbackdata['blog_name']), 0, 255); |
|
137 | + $title = trim_characters(html_entity_decode($trackbackdata['title']), 0, 255); |
|
138 | + $excerpt = trim_characters(html_entity_decode($trackbackdata['excerpt']), 0, 255); |
|
139 | + $blog_name = trim_characters(html_entity_decode($trackbackdata['blog_name']), 0, 255); |
|
140 | 140 | |
141 | - $visible = $this->moderate_trackbacks ? 0 : 1; |
|
141 | + $visible = $this->moderate_trackbacks ? 0 : 1; |
|
142 | 142 | |
143 | 143 | $q = $this->db->query("INSERT INTO trackbacks |
144 | 144 | (epobject_id, blog_name, title, excerpt, url, source_ip, posted, visible) |
145 | 145 | VALUES |
146 | - ('" . addslashes($epobject_id) . "', |
|
147 | - '" . addslashes($blog_name) . "', |
|
148 | - '" . addslashes($title) . "', |
|
149 | - '" . addslashes($excerpt) . "', |
|
150 | - '" . addslashes($url) . "', |
|
151 | - '" . addslashes($source_ip) . "', |
|
146 | + ('" . addslashes($epobject_id)."', |
|
147 | + '" . addslashes($blog_name)."', |
|
148 | + '" . addslashes($title)."', |
|
149 | + '" . addslashes($excerpt)."', |
|
150 | + '" . addslashes($url)."', |
|
151 | + '" . addslashes($source_ip)."', |
|
152 | 152 | NOW(), |
153 | 153 | '$visible') |
154 | 154 | "); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->_trackback_response(0); |
159 | 159 | |
160 | 160 | } else { |
161 | - die ("Sorry, we could not save the trackback to the database. Please <a href=\"mailto:" . CONTACTEMAIL . "\">email us</a> to let us know. Thanks."); |
|
161 | + die ("Sorry, we could not save the trackback to the database. Please <a href=\"mailto:".CONTACTEMAIL."\">email us</a> to let us know. Thanks."); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | url, |
193 | 193 | posted |
194 | 194 | FROM trackbacks |
195 | - WHERE epobject_id = '" . addslashes($epobject_id) . "' |
|
195 | + WHERE epobject_id = '" . addslashes($epobject_id)."' |
|
196 | 196 | AND visible = 1 |
197 | 197 | ORDER BY posted ASC |
198 | 198 | "); |
199 | 199 | |
200 | 200 | if ($q->rows() > 0) { |
201 | - for ($row=0; $row<$q->rows(); $row++) { |
|
202 | - $trackbackdata[] = array ( |
|
201 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
202 | + $trackbackdata[] = array( |
|
203 | 203 | 'trackback_id' => $q->field($row, 'trackback_id'), |
204 | 204 | 'epobject_id' => $q->field($row, 'epobject_id'), |
205 | 205 | 'blog_name' => $q->field($row, 'blog_name'), |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | "); |
248 | 248 | |
249 | 249 | if ($q->rows() > 0) { |
250 | - for ($row=0; $row<$q->rows(); $row++) { |
|
251 | - $trackbackdata[] = array ( |
|
250 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
251 | + $trackbackdata[] = array( |
|
252 | 252 | 'trackback_id' => $q->field($row, 'trackback_id'), |
253 | 253 | 'epobject_id' => $q->field($row, 'epobject_id'), |
254 | 254 | 'blog_name' => $q->field($row, 'blog_name'), |