@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!$dept) { |
13 | 13 | } else { |
14 | - $dept = strtolower(str_replace('_',' ',$dept)); |
|
14 | + $dept = strtolower(str_replace('_', ' ', $dept)); |
|
15 | 15 | $q = $db->query('select epobject.epobject_id from hansard,epobject |
16 | 16 | where hansard.epobject_id=epobject.epobject_id and major=4 and section_id=0 |
17 | 17 | and hdate>(select max(hdate) from hansard where major=4) - interval 7 day |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | order by body'); |
32 | 32 | print '<ul>'; |
33 | 33 | foreach ($q as $row) { |
34 | - print '<li><a href="/wms/?id=' . fix_gid_from_db($row['gid']). '">' . $row['body']. '</a>'; |
|
34 | + print '<li><a href="/wms/?id=' . fix_gid_from_db($row['gid']) . '">' . $row['body'] . '</a>'; |
|
35 | 35 | print '</li>'; |
36 | 36 | } |
37 | 37 | print '</ul>'; |
@@ -11,5 +11,5 @@ |
||
11 | 11 | $gid = fix_gid_from_db($gid); |
12 | 12 | |
13 | 13 | $URL = new \MySociety\TheyWorkForYou\Url('debates'); |
14 | -$URL->insert( array( 'id' => $gid ) ); |
|
14 | +$URL->insert(array('id' => $gid)); |
|
15 | 15 | header('Location: ' . $URL->generate()); |
@@ -24,9 +24,9 @@ |
||
24 | 24 | }); |
25 | 25 | $sections_with_votes = array_values($sections_with_votes); |
26 | 26 | |
27 | -for ($i=0; $i<count($sections_with_votes); $i+=2) { |
|
27 | +for ($i = 0; $i < count($sections_with_votes); $i += 2) { |
|
28 | 28 | $l = $sections_with_votes[$i]; |
29 | - $r = $i+1 < count($sections_with_votes) ? $sections_with_votes[$i+1] : null; |
|
29 | + $r = $i + 1 < count($sections_with_votes) ? $sections_with_votes[$i + 1] : null; |
|
30 | 30 | |
31 | 31 | $vote_title = $vote_sets[$l]['title']; |
32 | 32 | $anchor = $vote_sets[$l]['anchor']; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | $rsspath = BASEDIR . '/rss/mp/'; |
10 | 10 | |
11 | 11 | // Make things group writable. |
12 | -umask (002); |
|
12 | +umask(002); |
|
13 | 13 | |
14 | 14 | $HANSARDLIST = new HANSARDLIST(); |
15 | 15 | $db = $HANSARDLIST->db; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | foreach ($q as $person) { |
23 | 23 | $person_id = $person['person_id']; |
24 | 24 | |
25 | - $args = array ( 'person_id' => $person_id ); |
|
25 | + $args = array('person_id' => $person_id); |
|
26 | 26 | $speeches = $HANSARDLIST->display('person', $args, 'none'); |
27 | 27 | |
28 | 28 | // Some data about this person that we'll need for the feed. |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | fwrite($fh, $rsstext); |
112 | - fclose ($fh); |
|
112 | + fclose($fh); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | #print "Took " . (time()-$starttime) . " seconds\n"; |
@@ -106,7 +106,8 @@ |
||
106 | 106 | // Write the text to the file... |
107 | 107 | $filename = $rsspath . $person_id . '.rdf'; |
108 | 108 | $fh = @fopen($filename, "w"); |
109 | - if (!$fh) { # Problem writing, just carry on |
|
109 | + if (!$fh) { |
|
110 | +# Problem writing, just carry on |
|
110 | 111 | echo "Could not write to file ($filename)\n"; |
111 | 112 | continue; |
112 | 113 | } |
@@ -24,47 +24,47 @@ discard block |
||
24 | 24 | foreach ($q as $person) { |
25 | 25 | $person_id = $person['person_id']; |
26 | 26 | |
27 | - $args = array ( 'person_id' => $person_id ); |
|
28 | - $speeches = $HANSARDLIST->display('person', $args, 'none'); |
|
27 | + $args = array ( 'person_id' => $person_id ); |
|
28 | + $speeches = $HANSARDLIST->display('person', $args, 'none'); |
|
29 | 29 | |
30 | - // Some data about this person that we'll need for the feed. |
|
31 | - $MEMBER = new MEMBER(array('person_id' => $person_id)); |
|
32 | - $MPURL = new \MySociety\TheyWorkForYou\Url('mp'); |
|
33 | - $MPURL->insert(array('pid'=>$person_id)); |
|
34 | - $mpurl = $MPURL->generate(); |
|
30 | + // Some data about this person that we'll need for the feed. |
|
31 | + $MEMBER = new MEMBER(array('person_id' => $person_id)); |
|
32 | + $MPURL = new \MySociety\TheyWorkForYou\Url('mp'); |
|
33 | + $MPURL->insert(array('pid'=>$person_id)); |
|
34 | + $mpurl = $MPURL->generate(); |
|
35 | 35 | |
36 | - $date = gmdate('Y-m-d'); |
|
37 | - $time = gmdate('H:i:s'); |
|
38 | - $datenow = $date . 'T' . $time . '+00:00'; |
|
36 | + $date = gmdate('Y-m-d'); |
|
37 | + $time = gmdate('H:i:s'); |
|
38 | + $datenow = $date . 'T' . $time . '+00:00'; |
|
39 | 39 | |
40 | - // Prepare the meat of the RSS file. |
|
41 | - $items = ''; |
|
42 | - $entries = ''; |
|
43 | - if (isset ($speeches['rows']) && count($speeches['rows']) > 0) { |
|
40 | + // Prepare the meat of the RSS file. |
|
41 | + $items = ''; |
|
42 | + $entries = ''; |
|
43 | + if (isset ($speeches['rows']) && count($speeches['rows']) > 0) { |
|
44 | 44 | |
45 | - foreach ($speeches['rows'] as $n => $row) { |
|
45 | + foreach ($speeches['rows'] as $n => $row) { |
|
46 | 46 | |
47 | - // While we're linking to individual speeches, |
|
48 | - // the text is the body of the parent, ie (sub)section. |
|
49 | - $title = _htmlentities(str_replace('—', '-', $row['parent']['body'])); |
|
47 | + // While we're linking to individual speeches, |
|
48 | + // the text is the body of the parent, ie (sub)section. |
|
49 | + $title = _htmlentities(str_replace('—', '-', $row['parent']['body'])); |
|
50 | 50 | |
51 | - $link = isset($row['listurl']) ? $row['listurl'] : ''; |
|
52 | - $link = 'https://' . DOMAIN . $link; |
|
51 | + $link = isset($row['listurl']) ? $row['listurl'] : ''; |
|
52 | + $link = 'https://' . DOMAIN . $link; |
|
53 | 53 | |
54 | - $description = _htmlentities(trim_characters($row['body'], 0, 200)); |
|
55 | - $contentencoded = $row['body']; |
|
54 | + $description = _htmlentities(trim_characters($row['body'], 0, 200)); |
|
55 | + $contentencoded = $row['body']; |
|
56 | 56 | |
57 | - $hdate = format_date($row['hdate'], '%Y-%m-%d'); |
|
58 | - if ($row['htime'] != null) { |
|
59 | - $htime = format_time($row['htime'], '%H:%M:%S'); |
|
60 | - } else { |
|
61 | - $htime = '00:00:00'; |
|
62 | - } |
|
57 | + $hdate = format_date($row['hdate'], '%Y-%m-%d'); |
|
58 | + if ($row['htime'] != null) { |
|
59 | + $htime = format_time($row['htime'], '%H:%M:%S'); |
|
60 | + } else { |
|
61 | + $htime = '00:00:00'; |
|
62 | + } |
|
63 | 63 | |
64 | - $date = $hdate . 'T' . $htime . '+00:00'; |
|
64 | + $date = $hdate . 'T' . $htime . '+00:00'; |
|
65 | 65 | |
66 | - $items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n"; |
|
67 | - $entries .= "<item rdf:about=\"$link\"> |
|
66 | + $items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n"; |
|
67 | + $entries .= "<item rdf:about=\"$link\"> |
|
68 | 68 | <title>$title</title> |
69 | 69 | <link>$link</link> |
70 | 70 | <description>$description</description> |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | </item> |
74 | 74 | "; |
75 | 75 | |
76 | - } |
|
77 | - } |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | - // Prepare the whole text of the RSS file. |
|
80 | - $rsstext = '<?xml version="1.0" encoding="utf-8"?> |
|
79 | + // Prepare the whole text of the RSS file. |
|
80 | + $rsstext = '<?xml version="1.0" encoding="utf-8"?> |
|
81 | 81 | <rdf:RDF |
82 | 82 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
83 | 83 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | |
104 | 104 | </rdf:RDF>'; |
105 | 105 | |
106 | - // Write the text to the file... |
|
107 | - $filename = $rsspath . $person_id . '.rdf'; |
|
108 | - $fh = @fopen($filename, "w"); |
|
109 | - if (!$fh) { # Problem writing, just carry on |
|
110 | - echo "Could not write to file ($filename)\n"; |
|
111 | - continue; |
|
112 | - } |
|
113 | - fwrite($fh, $rsstext); |
|
114 | - fclose ($fh); |
|
106 | + // Write the text to the file... |
|
107 | + $filename = $rsspath . $person_id . '.rdf'; |
|
108 | + $fh = @fopen($filename, "w"); |
|
109 | + if (!$fh) { # Problem writing, just carry on |
|
110 | + echo "Could not write to file ($filename)\n"; |
|
111 | + continue; |
|
112 | + } |
|
113 | + fwrite($fh, $rsstext); |
|
114 | + fclose ($fh); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | #print "Took " . (time()-$starttime) . " seconds\n"; |
@@ -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 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $data = array(); |
99 | 99 | foreach ($q as $row) { |
100 | - $data[] = array ( |
|
100 | + $data[] = array( |
|
101 | 101 | 'report_id' => $row['report_id'], |
102 | 102 | 'comment_id' => $row['comment_id'], |
103 | 103 | 'firstname' => $row['firstname'], |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ); |
109 | 109 | } |
110 | 110 | foreach ($r as $row) { |
111 | - $data[] = array ( |
|
111 | + $data[] = array( |
|
112 | 112 | 'report_id' => $row['report_id'], |
113 | 113 | 'comment_id' => $row['comment_id'], |
114 | 114 | 'firstname' => $row['firstname'], |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | */ |
27 | 27 | |
28 | -if (defined('XAPIANDB') AND XAPIANDB != '') { |
|
28 | +if (defined('XAPIANDB') and XAPIANDB != '') { |
|
29 | 29 | if (file_exists('/usr/share/php/xapian.php')) { |
30 | 30 | include_once '/usr/share/php/xapian.php'; |
31 | 31 | } else { |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | foreach ($merged as $row) { |
276 | 276 | $from_id = str_replace('uk.org.publicwhip/person/', '', $row['gid_from']); |
277 | 277 | $to_id = str_replace('uk.org.publicwhip/person/', '', $row['gid_to']); |
278 | - $qd = str_replace("(S$from_id OR S$to_id)", "S$to_id", $qd); |
|
279 | - $qd = str_replace("S$from_id OR S$to_id", "S$to_id", $qd); |
|
278 | + $qd = str_replace("(S$from_id OR S$to_id)", "s$to_id", $qd); |
|
279 | + $qd = str_replace("s$from_id OR S$to_id", "s$to_id", $qd); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | preg_match_all('#S(\d+)#', $qd, $m); |
283 | 283 | foreach ($m[1] as $mm) { |
284 | 284 | $member = new MEMBER(array('person_id' => $mm)); |
285 | 285 | $name = $member->full_name(); |
286 | - $qd = str_replace("S$mm", "speaker:$name", $qd); |
|
286 | + $qd = str_replace("s$mm", "speaker:$name", $qd); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | # Simplify display of excluded words |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public $valid = false; |
38 | 38 | public $error; |
39 | 39 | |
40 | - public function __construct($query, $lang='') { |
|
40 | + public function __construct($query, $lang = '') { |
|
41 | 41 | if (!defined('XAPIANDB') || !XAPIANDB) |
42 | 42 | return null; |
43 | 43 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | // Split words up into individual words, and quoted phrases |
97 | 97 | preg_match_all('/(' . |
98 | 98 | '"|' . # match either a quote, or... |
99 | - '(?:(?<![' .$this->wordchars. '])-)?' . # optionally a - (exclude) |
|
99 | + '(?:(?<![' . $this->wordchars . '])-)?' . # optionally a - (exclude) |
|
100 | 100 | # if at start of word (i.e. not preceded by a word character, in |
101 | 101 | # which case it is probably a hyphenated-word) |
102 | - '['.$this->wordchars.']+' . # followed by a string of word-characters |
|
102 | + '[' . $this->wordchars . ']+' . # followed by a string of word-characters |
|
103 | 103 | ')/', $this->query, $all_words); |
104 | 104 | if ($all_words) { |
105 | 105 | $all_words = $all_words[0]; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | if (strpos($word, ':') !== false) { |
125 | 125 | $items = explode(":", strtolower($word)); |
126 | 126 | $type = $items[0]; |
127 | - if (substr($type, 0, 1)=='-') $type = substr($type, 1); |
|
128 | - $value = strtolower(join(":", array_slice($items,1))); |
|
127 | + if (substr($type, 0, 1) == '-') $type = substr($type, 1); |
|
128 | + $value = strtolower(join(":", array_slice($items, 1))); |
|
129 | 129 | if ($type == 'section') { |
130 | 130 | $newv = $value; |
131 | 131 | if ($value == 'debates' || $value == 'debate') $newv = 1; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | elseif ($value == 'sp') $newv = 7; |
139 | 139 | elseif ($value == 'spwrans' || $value == 'spwran') $newv = 8; |
140 | 140 | elseif ($value == 'lmqs') $newv = 9; |
141 | - elseif ($value == 'uk') $newv = array(1,2,3,4,6,101); |
|
142 | - elseif ($value == 'scotland') $newv = array(7,8); |
|
141 | + elseif ($value == 'uk') $newv = array(1, 2, 3, 4, 6, 101); |
|
142 | + elseif ($value == 'scotland') $newv = array(7, 8); |
|
143 | 143 | elseif ($value == 'wales') $newv = ($lang == 'cy' || LANGUAGE == 'cy') ? 11 : 10; |
144 | 144 | elseif ($value == 'future') $newv = 'F'; |
145 | 145 | if (is_array($newv)) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->query .= " $from..$to"; |
175 | 175 | } elseif ($from) { |
176 | 176 | $this->query = str_ireplace("from:$from", '', $this->query); |
177 | - $this->query .= " $from..".date('Ymd'); |
|
177 | + $this->query .= " $from.." . date('Ymd'); |
|
178 | 178 | } elseif ($to) { |
179 | 179 | $this->query = str_ireplace("to:$to", '', $this->query); |
180 | 180 | $this->query .= " 19990101..$to"; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | twfy_debug("SEARCH", "prefixed: " . var_export($this->prefixed, true)); |
193 | 193 | |
194 | - twfy_debug("SEARCH", "query -- ". $this->query); |
|
194 | + twfy_debug("SEARCH", "query -- " . $this->query); |
|
195 | 195 | $flags = XapianQueryParser::FLAG_BOOLEAN | XapianQueryParser::FLAG_LOVEHATE | |
196 | 196 | XapianQueryParser::FLAG_WILDCARD | XapianQueryParser::FLAG_SPELLING_CORRECTION; |
197 | 197 | $flags = $flags | XapianQueryParser::FLAG_PHRASE; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | foreach ($m[1] as $phrase) { |
245 | 245 | $phrase_new = preg_replace('# PHRASE \d+#', '', $phrase); |
246 | 246 | #$this->phrases[] = preg_split('#\s+#', $phrase_new); |
247 | - $qd = str_replace("($phrase)", '"'.$phrase_new.'"', $qd); |
|
247 | + $qd = str_replace("($phrase)", '"' . $phrase_new . '"', $qd); |
|
248 | 248 | } |
249 | 249 | preg_match_all('#\(([^(]*? NEAR [^(]*?)\)#', $qd, $m); |
250 | 250 | foreach ($m[1] as $mm) { |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | // Perform partial query to get a count of number of matches |
377 | - public function run_count($first_result, $results_per_page, $sort_order='relevance') { |
|
377 | + public function run_count($first_result, $results_per_page, $sort_order = 'relevance') { |
|
378 | 378 | if (!defined('XAPIANDB') || !XAPIANDB) |
379 | 379 | return null; |
380 | 380 | |
@@ -447,13 +447,13 @@ discard block |
||
447 | 447 | #} |
448 | 448 | |
449 | 449 | $duration = getmicrotime() - $start; |
450 | - twfy_debug ("SEARCH", "Search count took $duration seconds."); |
|
450 | + twfy_debug("SEARCH", "Search count took $duration seconds."); |
|
451 | 451 | |
452 | 452 | return $count; |
453 | 453 | } |
454 | 454 | |
455 | 455 | // Perform the full search... |
456 | - public function run_search($first_result, $results_per_page, $sort_order='relevance') { |
|
456 | + public function run_search($first_result, $results_per_page, $sort_order = 'relevance') { |
|
457 | 457 | $start = getmicrotime(); |
458 | 458 | |
459 | 459 | #$matches = $this->enquire->get_mset($first_result, $results_per_page); |
@@ -474,13 +474,13 @@ discard block |
||
474 | 474 | array_push($this->created, join('', unpack('N', $doc->get_value(2)))); # XXX Needs fixing |
475 | 475 | } |
476 | 476 | twfy_debug("SEARCH", "gid: $gid relevancy: $relevancy% weight: $weight"); |
477 | - array_push($this->gids, "uk.org.publicwhip/".$gid); |
|
477 | + array_push($this->gids, "uk.org.publicwhip/" . $gid); |
|
478 | 478 | array_push($this->collapsed, $collapsed); |
479 | 479 | array_push($this->relevances, $relevancy); |
480 | 480 | $iter->next(); |
481 | 481 | } |
482 | 482 | $duration = getmicrotime() - $start; |
483 | - twfy_debug ("SEARCH", "Run search took $duration seconds."); |
|
483 | + twfy_debug("SEARCH", "Run search took $duration seconds."); |
|
484 | 484 | } |
485 | 485 | // ... use these to get the results |
486 | 486 | public function get_gids() { |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | $body = str_replace($this->specialchars, $this->specialchars_upper, $body); |
522 | 522 | $body = mb_convert_encoding($body, "UTF-8", "HTML-ENTITIES"); |
523 | 523 | $body = str_replace($this->specialchars_upper, $this->specialchars, $body); |
524 | - $splitextract = preg_split('/(<[^>]*>|[0-9,.]+|['.$this->wordcharsnodigit.']+)/', $body, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
524 | + $splitextract = preg_split('/(<[^>]*>|[0-9,.]+|[' . $this->wordcharsnodigit . ']+)/', $body, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
525 | 525 | $hlextract = ""; |
526 | 526 | foreach ($splitextract as $extractword) { |
527 | 527 | if (preg_match('/^<[^>]*>$/', $extractword)) { |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | |
571 | 571 | foreach ($this->phrases as $phrase) { |
572 | - $phrasematch = join($phrase, '[^'.$this->wordchars.']+'); |
|
572 | + $phrasematch = join($phrase, '[^' . $this->wordchars . ']+'); |
|
573 | 573 | array_push($findwords, "/\b($phrasematch)\b(?!(?>[^<>]*>))/i"); |
574 | 574 | $replacewords[] = "<span class=\"hi\">\\1</span>"; |
575 | 575 | } |
@@ -587,12 +587,12 @@ discard block |
||
587 | 587 | |
588 | 588 | // look for phrases |
589 | 589 | foreach ($this->phrases as $phrase) { |
590 | - $phrasematch = join($phrase, '[^'.$this->wordchars.']+'); |
|
591 | - if (preg_match('/([^'.$this->wordchars.']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) |
|
590 | + $phrasematch = join($phrase, '[^' . $this->wordchars . ']+'); |
|
591 | + if (preg_match('/([^' . $this->wordchars . ']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) |
|
592 | 592 | { |
593 | - $wordpos = strpos( $lcbody, $matches[0] ); |
|
593 | + $wordpos = strpos($lcbody, $matches[0]); |
|
594 | 594 | if ($wordpos) { |
595 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
595 | + if (($wordpos < $pos) || ($pos == -1)) { |
|
596 | 596 | $pos = $wordpos; |
597 | 597 | } |
598 | 598 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | } |
601 | 601 | if ($pos != -1) return $pos; |
602 | 602 | |
603 | - $splitextract = preg_split('/([0-9,.]+|['.$this->wordcharsnodigit.']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
603 | + $splitextract = preg_split('/([0-9,.]+|[' . $this->wordcharsnodigit . ']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
604 | 604 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
605 | 605 | foreach ($splitextract as $extractword) { |
606 | 606 | $extractword = preg_replace('/&$/', '', $extractword); |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | foreach ($stemmed_words as $word) { |
611 | 611 | if ($word == '') continue; |
612 | 612 | $matchword = $this->stem($extractword); |
613 | - if ($matchword == $word && ($wordpos < $pos || $pos==-1)) { |
|
613 | + if ($matchword == $word && ($wordpos < $pos || $pos == -1)) { |
|
614 | 614 | $pos = $wordpos; |
615 | 615 | } |
616 | 616 | } |
@@ -619,11 +619,11 @@ discard block |
||
619 | 619 | if ($pos != -1) return $pos; |
620 | 620 | |
621 | 621 | foreach ($this->words as $word) { |
622 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
623 | - if (preg_match('/([^'.$this->wordchars.']' . $word . '[^'.$this->wordchars. '])/', $lcbody, $matches)) { |
|
624 | - $wordpos = strpos( $lcbody, $matches[0] ); |
|
622 | + if (ctype_digit($word)) $word = '(?:' . $word . '|' . number_format($word) . ')'; |
|
623 | + if (preg_match('/([^' . $this->wordchars . ']' . $word . '[^' . $this->wordchars . '])/', $lcbody, $matches)) { |
|
624 | + $wordpos = strpos($lcbody, $matches[0]); |
|
625 | 625 | if ($wordpos) { |
626 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
626 | + if (($wordpos < $pos) || ($pos == -1)) { |
|
627 | 627 | $pos = $wordpos; |
628 | 628 | } |
629 | 629 | } |
@@ -633,11 +633,11 @@ discard block |
||
633 | 633 | if ($pos != -1) return $pos; |
634 | 634 | |
635 | 635 | foreach ($this->words as $word) { |
636 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
636 | + if (ctype_digit($word)) $word = '(?:' . $word . '|' . number_format($word) . ')'; |
|
637 | 637 | if (preg_match('/(' . $word . ')/', $lcbody, $matches)) { |
638 | - $wordpos = strpos( $lcbody, $matches[0] ); |
|
638 | + $wordpos = strpos($lcbody, $matches[0]); |
|
639 | 639 | if ($wordpos) { |
640 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
640 | + if (($wordpos < $pos) || ($pos == -1)) { |
|
641 | 641 | $pos = $wordpos; |
642 | 642 | } |
643 | 643 | } |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | public $error; |
39 | 39 | |
40 | 40 | public function __construct($query, $lang='') { |
41 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
42 | - return null; |
|
41 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
42 | + return null; |
|
43 | + } |
|
43 | 44 | |
44 | 45 | global $xapiandb, $PAGE; |
45 | 46 | if (!$xapiandb) { |
@@ -54,8 +55,12 @@ discard block |
||
54 | 55 | } |
55 | 56 | } |
56 | 57 | $this->query = $query; |
57 | - if (!isset($this->stemmer)) $this->stemmer = new XapianStem('english'); |
|
58 | - if (!isset($this->enquire)) $this->enquire = new XapianEnquire($xapiandb); |
|
58 | + if (!isset($this->stemmer)) { |
|
59 | + $this->stemmer = new XapianStem('english'); |
|
60 | + } |
|
61 | + if (!isset($this->enquire)) { |
|
62 | + $this->enquire = new XapianEnquire($xapiandb); |
|
63 | + } |
|
59 | 64 | if (!isset($this->queryparser)) { |
60 | 65 | $this->queryparser = new XapianQueryParser(); |
61 | 66 | $this->datevaluerange = new XapianDateValueRangeProcessor(1); |
@@ -111,7 +116,9 @@ discard block |
||
111 | 116 | foreach ($all_words as $word) { |
112 | 117 | if ($word == '"') { |
113 | 118 | $in_quote = !$in_quote; |
114 | - if ($in_quote) array_push($this->phrases, array()); |
|
119 | + if ($in_quote) { |
|
120 | + array_push($this->phrases, array()); |
|
121 | + } |
|
115 | 122 | if (!$in_quote && !count($this->phrases[count($this->phrases) - 1])) { |
116 | 123 | array_pop($this->phrases); |
117 | 124 | } |
@@ -124,24 +131,41 @@ discard block |
||
124 | 131 | if (strpos($word, ':') !== false) { |
125 | 132 | $items = explode(":", strtolower($word)); |
126 | 133 | $type = $items[0]; |
127 | - if (substr($type, 0, 1)=='-') $type = substr($type, 1); |
|
134 | + if (substr($type, 0, 1)=='-') { |
|
135 | + $type = substr($type, 1); |
|
136 | + } |
|
128 | 137 | $value = strtolower(join(":", array_slice($items,1))); |
129 | 138 | if ($type == 'section') { |
130 | 139 | $newv = $value; |
131 | - if ($value == 'debates' || $value == 'debate') $newv = 1; |
|
132 | - elseif ($value == 'whall' || $value == 'westminster' || $value == 'westminhall') $newv = 2; |
|
133 | - elseif ($value == 'wrans' || $value == 'wran') $newv = 3; |
|
134 | - elseif ($value == 'wms' || $value == 'statements' || $value == 'statement') $newv = 4; |
|
135 | - elseif ($value == 'lordsdebates' || $value == 'lords') $newv = 101; |
|
136 | - elseif ($value == 'ni' || $value == 'nidebates') $newv = 5; |
|
137 | - elseif ($value == 'pbc' || $value == 'standing') $newv = 6; |
|
138 | - elseif ($value == 'sp') $newv = 7; |
|
139 | - elseif ($value == 'spwrans' || $value == 'spwran') $newv = 8; |
|
140 | - elseif ($value == 'lmqs') $newv = 9; |
|
141 | - elseif ($value == 'uk') $newv = array(1,2,3,4,6,101); |
|
142 | - elseif ($value == 'scotland') $newv = array(7,8); |
|
143 | - elseif ($value == 'wales') $newv = ($lang == 'cy' || LANGUAGE == 'cy') ? 11 : 10; |
|
144 | - elseif ($value == 'future') $newv = 'F'; |
|
140 | + if ($value == 'debates' || $value == 'debate') { |
|
141 | + $newv = 1; |
|
142 | + } elseif ($value == 'whall' || $value == 'westminster' || $value == 'westminhall') { |
|
143 | + $newv = 2; |
|
144 | + } elseif ($value == 'wrans' || $value == 'wran') { |
|
145 | + $newv = 3; |
|
146 | + } elseif ($value == 'wms' || $value == 'statements' || $value == 'statement') { |
|
147 | + $newv = 4; |
|
148 | + } elseif ($value == 'lordsdebates' || $value == 'lords') { |
|
149 | + $newv = 101; |
|
150 | + } elseif ($value == 'ni' || $value == 'nidebates') { |
|
151 | + $newv = 5; |
|
152 | + } elseif ($value == 'pbc' || $value == 'standing') { |
|
153 | + $newv = 6; |
|
154 | + } elseif ($value == 'sp') { |
|
155 | + $newv = 7; |
|
156 | + } elseif ($value == 'spwrans' || $value == 'spwran') { |
|
157 | + $newv = 8; |
|
158 | + } elseif ($value == 'lmqs') { |
|
159 | + $newv = 9; |
|
160 | + } elseif ($value == 'uk') { |
|
161 | + $newv = array(1,2,3,4,6,101); |
|
162 | + } elseif ($value == 'scotland') { |
|
163 | + $newv = array(7,8); |
|
164 | + } elseif ($value == 'wales') { |
|
165 | + $newv = ($lang == 'cy' || LANGUAGE == 'cy') ? 11 : 10; |
|
166 | + } elseif ($value == 'future') { |
|
167 | + $newv = 'F'; |
|
168 | + } |
|
145 | 169 | if (is_array($newv)) { |
146 | 170 | $newv = 'major:' . join(' major:', $newv); |
147 | 171 | } else { |
@@ -150,8 +174,12 @@ discard block |
||
150 | 174 | $this->query = str_ireplace("$type:$value", $newv, $this->query); |
151 | 175 | } elseif ($type == 'groupby') { |
152 | 176 | $newv = $value; |
153 | - if ($value == 'debates' || $value == 'debate') $newv = 'debate'; |
|
154 | - if ($value == 'speech' || $value == 'speeches') $newv = 'speech'; |
|
177 | + if ($value == 'debates' || $value == 'debate') { |
|
178 | + $newv = 'debate'; |
|
179 | + } |
|
180 | + if ($value == 'speech' || $value == 'speeches') { |
|
181 | + $newv = 'speech'; |
|
182 | + } |
|
155 | 183 | $this->query = str_ireplace("$type:$value", '', $this->query); |
156 | 184 | array_push($this->prefixed, array($type, $newv)); |
157 | 185 | } elseif ($type == 'from') { |
@@ -288,7 +316,9 @@ discard block |
||
288 | 316 | $end = $this->queryparser->unstem_end($mm); |
289 | 317 | while (!$iter->equals($end)) { |
290 | 318 | $tt = $iter->get_term(); |
291 | - if (!in_array($tt, $used)) break; |
|
319 | + if (!in_array($tt, $used)) { |
|
320 | + break; |
|
321 | + } |
|
292 | 322 | $iter->next(); |
293 | 323 | } |
294 | 324 | $used[] = $tt; |
@@ -375,8 +405,9 @@ discard block |
||
375 | 405 | |
376 | 406 | // Perform partial query to get a count of number of matches |
377 | 407 | public function run_count($first_result, $results_per_page, $sort_order='relevance') { |
378 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
379 | - return null; |
|
408 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
409 | + return null; |
|
410 | + } |
|
380 | 411 | |
381 | 412 | $start = getmicrotime(); |
382 | 413 | |
@@ -406,16 +437,18 @@ discard block |
||
406 | 437 | $collapsed = true; |
407 | 438 | if ($items[1] == 'speech') |
408 | 439 | ; // no collapse key |
409 | - elseif ($items[1] == 'debate') |
|
410 | - $this->enquire->set_collapse_key(3); |
|
411 | - else |
|
412 | - $PAGE->error_message("Unknown group by '$items[1]' ignored"); |
|
440 | + elseif ($items[1] == 'debate') { |
|
441 | + $this->enquire->set_collapse_key(3); |
|
442 | + } else { |
|
443 | + $PAGE->error_message("Unknown group by '$items[1]' ignored"); |
|
444 | + } |
|
413 | 445 | } |
414 | 446 | } |
415 | 447 | |
416 | 448 | // default to grouping by subdebate, i.e. by page |
417 | - if (!$collapsed) |
|
418 | - $this->enquire->set_collapse_key(3); |
|
449 | + if (!$collapsed) { |
|
450 | + $this->enquire->set_collapse_key(3); |
|
451 | + } |
|
419 | 452 | |
420 | 453 | /* |
421 | 454 | XXX Helping to debug possible Xapian bug |
@@ -495,8 +528,9 @@ discard block |
||
495 | 528 | |
496 | 529 | // Puts HTML highlighting round all the matching words in the text |
497 | 530 | public function highlight($body) { |
498 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
499 | - return $body; |
|
531 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
532 | + return $body; |
|
533 | + } |
|
500 | 534 | |
501 | 535 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
502 | 536 | if (is_array($body)) { |
@@ -514,8 +548,9 @@ discard block |
||
514 | 548 | private $specialchars_upper = array('<', '>', '"', '&'); |
515 | 549 | |
516 | 550 | public function highlight_internal($body, $stemmed_words) { |
517 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
518 | - return $body; |
|
551 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
552 | + return $body; |
|
553 | + } |
|
519 | 554 | |
520 | 555 | # Does html_entity_decode without the htmlspecialchars |
521 | 556 | $body = str_replace($this->specialchars, $this->specialchars_upper, $body); |
@@ -536,7 +571,9 @@ discard block |
||
536 | 571 | $hl = false; |
537 | 572 | $matchword = $this->stem($extractword); |
538 | 573 | foreach ($stemmed_words as $word) { |
539 | - if ($word == '') continue; |
|
574 | + if ($word == '') { |
|
575 | + continue; |
|
576 | + } |
|
540 | 577 | if ($matchword == $word) { |
541 | 578 | $hl = true; |
542 | 579 | break; |
@@ -588,8 +625,7 @@ discard block |
||
588 | 625 | // look for phrases |
589 | 626 | foreach ($this->phrases as $phrase) { |
590 | 627 | $phrasematch = join($phrase, '[^'.$this->wordchars.']+'); |
591 | - if (preg_match('/([^'.$this->wordchars.']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) |
|
592 | - { |
|
628 | + if (preg_match('/([^'.$this->wordchars.']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) { |
|
593 | 629 | $wordpos = strpos( $lcbody, $matches[0] ); |
594 | 630 | if ($wordpos) { |
595 | 631 | if ( ($wordpos < $pos) || ($pos==-1) ) { |
@@ -598,17 +634,25 @@ discard block |
||
598 | 634 | } |
599 | 635 | } |
600 | 636 | } |
601 | - if ($pos != -1) return $pos; |
|
637 | + if ($pos != -1) { |
|
638 | + return $pos; |
|
639 | + } |
|
602 | 640 | |
603 | 641 | $splitextract = preg_split('/([0-9,.]+|['.$this->wordcharsnodigit.']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE); |
604 | 642 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
605 | 643 | foreach ($splitextract as $extractword) { |
606 | 644 | $extractword = preg_replace('/&$/', '', $extractword); |
607 | - if (!$extractword) continue; |
|
645 | + if (!$extractword) { |
|
646 | + continue; |
|
647 | + } |
|
608 | 648 | $wordpos = strpos($lcbody, $extractword); |
609 | - if (!$wordpos) continue; |
|
649 | + if (!$wordpos) { |
|
650 | + continue; |
|
651 | + } |
|
610 | 652 | foreach ($stemmed_words as $word) { |
611 | - if ($word == '') continue; |
|
653 | + if ($word == '') { |
|
654 | + continue; |
|
655 | + } |
|
612 | 656 | $matchword = $this->stem($extractword); |
613 | 657 | if ($matchword == $word && ($wordpos < $pos || $pos==-1)) { |
614 | 658 | $pos = $wordpos; |
@@ -616,10 +660,14 @@ discard block |
||
616 | 660 | } |
617 | 661 | } |
618 | 662 | // only look for earlier words if phrases weren't found |
619 | - if ($pos != -1) return $pos; |
|
663 | + if ($pos != -1) { |
|
664 | + return $pos; |
|
665 | + } |
|
620 | 666 | |
621 | 667 | foreach ($this->words as $word) { |
622 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
668 | + if (ctype_digit($word)) { |
|
669 | + $word = '(?:'.$word.'|'.number_format($word).')'; |
|
670 | + } |
|
623 | 671 | if (preg_match('/([^'.$this->wordchars.']' . $word . '[^'.$this->wordchars. '])/', $lcbody, $matches)) { |
624 | 672 | $wordpos = strpos( $lcbody, $matches[0] ); |
625 | 673 | if ($wordpos) { |
@@ -630,10 +678,14 @@ discard block |
||
630 | 678 | } |
631 | 679 | } |
632 | 680 | // only look for something containing the word (ie. something stemmed, but doesn't work all the time) if no whole word was found |
633 | - if ($pos != -1) return $pos; |
|
681 | + if ($pos != -1) { |
|
682 | + return $pos; |
|
683 | + } |
|
634 | 684 | |
635 | 685 | foreach ($this->words as $word) { |
636 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
686 | + if (ctype_digit($word)) { |
|
687 | + $word = '(?:'.$word.'|'.number_format($word).')'; |
|
688 | + } |
|
637 | 689 | if (preg_match('/(' . $word . ')/', $lcbody, $matches)) { |
638 | 690 | $wordpos = strpos( $lcbody, $matches[0] ); |
639 | 691 | if ($wordpos) { |
@@ -644,8 +696,9 @@ discard block |
||
644 | 696 | } |
645 | 697 | } |
646 | 698 | |
647 | - if ($pos == -1) |
|
648 | - $pos = 0; |
|
699 | + if ($pos == -1) { |
|
700 | + $pos = 0; |
|
701 | + } |
|
649 | 702 | |
650 | 703 | return $pos; |
651 | 704 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | remove_form(); |
10 | 10 | list_ignored(); |
11 | 11 | $PAGE->stripe_end([ |
12 | - [ 'type' => 'html', 'content' => $PAGE->admin_menu() ], |
|
12 | + ['type' => 'html', 'content' => $PAGE->admin_menu()], |
|
13 | 13 | ]); |
14 | 14 | $PAGE->page_end(); |
15 | 15 |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | // $Id: dbtypes.php,v 1.8 2009-04-28 13:13:04 matthew Exp $ |
4 | 4 | |
5 | 5 | // The type field in the epobject database table |
6 | -define ('EPTYPE_HANSARD', 1); |
|
7 | -define ('EPTYPE_GLOSSARY', 2); |
|
6 | +define('EPTYPE_HANSARD', 1); |
|
7 | +define('EPTYPE_GLOSSARY', 2); |
|
8 | 8 | |
9 | 9 | // The major field in the hansard database table |
10 | 10 | $hansardmajors = array( |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | ); |
122 | 122 | $hansardmajors[104] = $hansardmajors[4]; |
123 | 123 | |
124 | -$parties = array ( |
|
124 | +$parties = array( |
|
125 | 125 | 'Bp' => 'Bishop', |
126 | 126 | 'Con' => 'Conservative', |
127 | 127 | 'CWM' => 'Deputy Speaker', |
@@ -364,7 +364,7 @@ |
||
364 | 364 | $this->extra_info = array(); |
365 | 365 | |
366 | 366 | $q = $this->db->query('SELECT * FROM moffice WHERE person=:person_id ORDER BY from_date DESC, moffice_id', |
367 | - array(':person_id' => $this->person_id)); |
|
367 | + array(':person_id' => $this->person_id)); |
|
368 | 368 | $this->extra_info['office'] = $q->fetchAll(); |
369 | 369 | |
370 | 370 | // Info specific to member id (e.g. attendance during that period of office) |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once INCLUDESPATH."easyparliament/glossary.php"; |
|
3 | +include_once INCLUDESPATH . "easyparliament/glossary.php"; |
|
4 | 4 | |
5 | 5 | use MySociety\TheyWorkForYou\Policies as Policies; |
6 | 6 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | # All the following only happen if the house to display isn't yet set. |
91 | 91 | # TODO: This relies on interpreting the default value of 0 as a false, which may be error-prone. |
92 | - if (! (bool) $this->house_disp) { |
|
92 | + if (!(bool) $this->house_disp) { |
|
93 | 93 | if ($house == HOUSE_TYPE_LONDON_ASSEMBLY # London Assembly |
94 | 94 | || $house == HOUSE_TYPE_SCOTLAND # MSPs and |
95 | 95 | || $house == HOUSE_TYPE_WALES # MSs and |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $this->set_users_mp(); |
234 | 234 | } |
235 | 235 | |
236 | - public function date_in_memberships($house, $date){ |
|
236 | + public function date_in_memberships($house, $date) { |
|
237 | 237 | // Given a date, see if they had any memberships during that time |
238 | 238 | foreach ($this->memberships as $membership) { |
239 | 239 | if ($membership['entered_house'] <= $date && $membership['left_house'] >= $date) { |
@@ -278,13 +278,13 @@ discard block |
||
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
281 | - public function postcode_to_person_id($postcode, $house=null) { |
|
282 | - twfy_debug ('MP', "postcode_to_person_id converting postcode to person"); |
|
281 | + public function postcode_to_person_id($postcode, $house = null) { |
|
282 | + twfy_debug('MP', "postcode_to_person_id converting postcode to person"); |
|
283 | 283 | $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($postcode)); |
284 | 284 | return $this->constituency_to_person_id($constituency, $house); |
285 | 285 | } |
286 | 286 | |
287 | - public function constituency_to_person_id($constituency, $house=null) { |
|
287 | + public function constituency_to_person_id($constituency, $house = null) { |
|
288 | 288 | if ($constituency == '') { |
289 | 289 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, no constituency was found.'); |
290 | 290 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | - public function name_to_person_id($name, $const='') { |
|
328 | + public function name_to_person_id($name, $const = '') { |
|
329 | 329 | global $this_page; |
330 | 330 | if ($name == '') { |
331 | 331 | throw new MySociety\TheyWorkForYou\MemberException('Sorry, no name was found.'); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | OR (title=:given_name AND given_name=:middle_name AND family_name=:family_name) |
369 | 369 | )"; |
370 | 370 | } elseif ($this_page == 'royal') { |
371 | - twfy_debug ('MP', $name); |
|
371 | + twfy_debug('MP', $name); |
|
372 | 372 | if (stripos($name, 'elizabeth') !== false) { |
373 | 373 | $q .= "AND person_id=13935"; |
374 | 374 | } elseif (stripos($name, 'charles') !== false) { |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | global $THEUSER; |
439 | 439 | if (is_object($THEUSER) && $THEUSER->postcode_is_set() && $this->current_member(1)) { |
440 | 440 | $pc = $THEUSER->postcode(); |
441 | - twfy_debug ('MP', "set_users_mp converting postcode to person"); |
|
441 | + twfy_debug('MP', "set_users_mp converting postcode to person"); |
|
442 | 442 | $constituency = strtolower(MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituency($pc)); |
443 | 443 | if ($constituency == strtolower($this->constituency())) { |
444 | 444 | $this->the_users_mp = true; |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | if ($display && array_key_exists('register_member_interests_html', $this->extra_info) && ($this->extra_info['register_member_interests_html'] != '')) { |
520 | - $args = array ( |
|
520 | + $args = array( |
|
521 | 521 | "sort" => "regexp_replace" |
522 | 522 | ); |
523 | 523 | $GLOSSARY = new GLOSSARY($args); |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $GLOSSARY->glossarise($this->extra_info['register_member_interests_html']); |
526 | 526 | } |
527 | 527 | |
528 | - $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:'.$this->person_id.'%" and confirmed and not deleted')->first(); |
|
528 | + $q = $this->db->query('select count(*) as c from alerts where criteria like "%speaker:' . $this->person_id . '%" and confirmed and not deleted')->first(); |
|
529 | 529 | $this->extra_info['number_of_alerts'] = $q['c']; |
530 | 530 | |
531 | 531 | # Public Bill Committees |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $chairman = $row['c']; |
548 | 548 | $this->extra_info['pbc'][$bill_id] = array( |
549 | 549 | 'title' => $title, 'session' => $row['session'], |
550 | - 'attending'=>$attending, 'chairman'=>($chairman>0), 'outof' => $c |
|
550 | + 'attending'=>$attending, 'chairman'=>($chairman > 0), 'outof' => $c |
|
551 | 551 | ); |
552 | 552 | } |
553 | 553 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | public function family_name() { return $this->family_name; } |
563 | 563 | public function full_name($no_mp_title = false) { |
564 | 564 | $title = $this->title; |
565 | - if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND || $this->house_disp==HOUSE_TYPE_WALES)) { |
|
565 | + if ($no_mp_title && ($this->house_disp == HOUSE_TYPE_COMMONS || $this->house_disp == HOUSE_TYPE_NI || $this->house_disp == HOUSE_TYPE_SCOTLAND || $this->house_disp == HOUSE_TYPE_WALES)) { |
|
566 | 566 | $title = ''; |
567 | 567 | } |
568 | 568 | return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname); |
@@ -591,8 +591,8 @@ discard block |
||
591 | 591 | } |
592 | 592 | |
593 | 593 | public function entered_house($house = null) { |
594 | - if ( isset($house) ) { |
|
595 | - if ( array_key_exists($house, $this->entered_house) ) { |
|
594 | + if (isset($house)) { |
|
595 | + if (array_key_exists($house, $this->entered_house)) { |
|
596 | 596 | return $this->entered_house[$house]; |
597 | 597 | } else { |
598 | 598 | return null; |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | return ''; |
607 | 607 | } |
608 | 608 | list($year, $month, $day) = explode('-', $entered_house); |
609 | - if ($month==1 && $day==1 && $this->house(HOUSE_TYPE_LORDS)) { |
|
609 | + if ($month == 1 && $day == 1 && $this->house(HOUSE_TYPE_LORDS)) { |
|
610 | 610 | return $year; |
611 | - } elseif ($month==0 && $day==0) { |
|
611 | + } elseif ($month == 0 && $day == 0) { |
|
612 | 612 | return $year; |
613 | 613 | } elseif (checkdate($month, $day, $year) && $year != '9999') { |
614 | 614 | return format_date($entered_house, LONGDATEFORMAT); |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | } |
619 | 619 | |
620 | 620 | public function left_house($house = null) { |
621 | - if ( isset($house) ) { |
|
622 | - if ( array_key_exists($house, $this->left_house) ) { |
|
621 | + if (isset($house)) { |
|
622 | + if (array_key_exists($house, $this->left_house)) { |
|
623 | 623 | return $this->left_house[$house]; |
624 | 624 | } else { |
625 | 625 | return null; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | list($year, $month, $day) = explode('-', $left_house); |
636 | 636 | if (checkdate($month, $day, $year) && $year != '9999') { |
637 | 637 | return format_date($left_house, LONGDATEFORMAT); |
638 | - } elseif ($month==0 && $day==0) { |
|
638 | + } elseif ($month == 0 && $day == 0) { |
|
639 | 639 | # Left house date is stored as 1942-00-00 to mean "at some point in 1941" |
640 | 640 | return $year - 1; |
641 | 641 | } else { |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $name = $row['given_name'] . ' ' . $row['family_name']; |
762 | 762 | if ($last_pid != $pid) { |
763 | 763 | $mships[] = array( |
764 | - 'href' => WEBPATH . 'mp/?pid='.$pid, |
|
764 | + 'href' => WEBPATH . 'mp/?pid=' . $pid, |
|
765 | 765 | 'text' => $name |
766 | 766 | ); |
767 | 767 | $last_pid = $pid; |