@@ -21,31 +21,31 @@ |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function testKeywordOnly() { |
| 24 | - $page = $this->fetch_page([ 'alertsearch' => 'elephant']); |
|
| 24 | + $page = $this->fetch_page(['alertsearch' => 'elephant']); |
|
| 25 | 25 | $this->assertStringContainsString('Receive alerts when [elephant] is mentioned', $page); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function testPostCodeOnly() { |
| 29 | - $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE']); |
|
| 29 | + $page = $this->fetch_page(['alertsearch' => 'SE17 3HE']); |
|
| 30 | 30 | $this->assertStringContainsString('when Mrs Test Current-MP', $page); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function testPostCodeWithKeyWord() { |
| 34 | - $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE elephant']); |
|
| 34 | + $page = $this->fetch_page(['alertsearch' => 'SE17 3HE elephant']); |
|
| 35 | 35 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
| 36 | 36 | $this->assertStringContainsString('Mentions of [elephant] by your MP, Mrs Test Current-MP', $page); |
| 37 | 37 | $this->assertStringNotContainsString('by your MSP', $page); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function testScottishPostcodeWithKeyword() { |
| 41 | - $page = $this->fetch_page([ 'alertsearch' => 'PH6 2DB elephant']); |
|
| 41 | + $page = $this->fetch_page(['alertsearch' => 'PH6 2DB elephant']); |
|
| 42 | 42 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
| 43 | 43 | $this->assertStringContainsString('Mentions of [elephant] by your MP, Mr Test2 Current-MP', $page); |
| 44 | 44 | $this->assertStringContainsString('Mentions of [elephant] by your MSP, Mrs Test Current-MSP', $page); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function testPostcodeAndKeywordWithNoSittingMP() { |
| 48 | - $page = $this->fetch_page([ 'alertsearch' => 'OX1 4LF elephant']); |
|
| 48 | + $page = $this->fetch_page(['alertsearch' => 'OX1 4LF elephant']); |
|
| 49 | 49 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
| 50 | 50 | $this->assertStringNotContainsString('Did you mean to get alerts for when your MP', $page); |
| 51 | 51 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testEditUserInfo() { |
| 43 | - $page = $this->fetch_user_page(['pg' => 'edit' ]); |
|
| 43 | + $page = $this->fetch_user_page(['pg' => 'edit']); |
|
| 44 | 44 | $this->assertStringContainsString('Edit your details', $page); |
| 45 | 45 | $this->assertStringContainsString('name="pg" value="edit"', $page); |
| 46 | 46 | $this->assertStringContainsString('value="Test"', $page); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | private function fetch_votes_page() { |
| 16 | - return $this->fetch_page([ 'pagetype' => 'votes', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/votes' ]); |
|
| 16 | + return $this->fetch_page(['pagetype' => 'votes', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/votes']); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function testVoteSummary() { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | public function escape_comments($data) { |
| 155 | 155 | |
| 156 | - $data = preg_replace_callback("/<!--(.*?)-->/s", function ($matches) { |
|
| 156 | + $data = preg_replace_callback("/<!--(.*?)-->/s", function($matches) { |
|
| 157 | 157 | return '<!--' . HtmlSpecialChars($this->StripSingle($matches[1])) . '-->'; |
| 158 | 158 | }, $data); |
| 159 | 159 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | public function check_tags($data) { |
| 205 | 205 | |
| 206 | - $data = preg_replace_callback("/<(.*?)>/s", function ($matches) { |
|
| 206 | + $data = preg_replace_callback("/<(.*?)>/s", function($matches) { |
|
| 207 | 207 | return $this->process_tag($this->StripSingle($matches[1])); |
| 208 | 208 | }, $data); |
| 209 | 209 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | $data = preg_replace_callback( |
| 393 | 393 | '/(^|[^\w\s\';,\\-])(\s*)([a-z])/', |
| 394 | - function ($m) { |
|
| 394 | + function($m) { |
|
| 395 | 395 | return $m[1] . $m[2] . strtoupper($m[3]); |
| 396 | 396 | }, |
| 397 | 397 | $data |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | $data = preg_replace_callback( |
| 434 | 434 | '!&([^&;]*)(?=(;|&|$))!', |
| 435 | - function ($matches) { |
|
| 435 | + function($matches) { |
|
| 436 | 436 | return $this->check_entity($this->StripSingle($matches[1]), $this->StripSingle($matches[2])); |
| 437 | 437 | }, |
| 438 | 438 | $data |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | # Sort into order, largest first |
| 109 | - usort($phrases, function ($a, $b) { |
|
| 109 | + usort($phrases, function($a, $b) { |
|
| 110 | 110 | return strlen($a) < strlen($b); |
| 111 | 111 | }); |
| 112 | 112 | |
@@ -156,31 +156,31 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | public static function antiTagInTag($content = '', $format = 'htmlhead') { |
| 158 | 158 | $tagend = -1; |
| 159 | - for($tagstart = strpos($content, '<', $tagend + 1) ; $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) { |
|
| 159 | + for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) { |
|
| 160 | 160 | // got the start of a tag. Now find the proper end! |
| 161 | 161 | $walker = $tagstart + 1; |
| 162 | 162 | $open = 1; |
| 163 | - while($open != 0 && $walker < strlen($content)) { |
|
| 163 | + while ($open != 0 && $walker < strlen($content)) { |
|
| 164 | 164 | $nextopen = strpos($content, '<', $walker); |
| 165 | 165 | $nextclose = strpos($content, '>', $walker); |
| 166 | - if($nextclose === false) { |
|
| 166 | + if ($nextclose === false) { |
|
| 167 | 167 | // ERROR! Open waka without close waka! |
| 168 | 168 | // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
| 169 | 169 | return $content; |
| 170 | 170 | } |
| 171 | - if($nextopen === false || $nextopen > $nextclose) { |
|
| 171 | + if ($nextopen === false || $nextopen > $nextclose) { |
|
| 172 | 172 | // No more opens, but there was a close; or, a close happens before the next open. |
| 173 | 173 | // walker goes to the close+1, and open decrements |
| 174 | 174 | $open--; |
| 175 | 175 | $walker = $nextclose + 1; |
| 176 | - } elseif($nextopen < $nextclose) { |
|
| 176 | + } elseif ($nextopen < $nextclose) { |
|
| 177 | 177 | // an open before the next close |
| 178 | 178 | $open++; |
| 179 | 179 | $walker = $nextopen + 1; |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | $tagend = $walker; |
| 183 | - if($tagend > strlen($content)) { |
|
| 183 | + if ($tagend > strlen($content)) { |
|
| 184 | 184 | $tagend = strlen($content); |
| 185 | 185 | } else { |
| 186 | 186 | $tagend--; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $o = get_http_var('o'); |
| 15 | - $args = [ |
|
| 15 | + $args = [ |
|
| 16 | 16 | 's' => $this->searchstring, |
| 17 | 17 | 'p' => $pagenum, |
| 18 | 18 | 'num' => get_http_var('num'), |
@@ -246,22 +246,22 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | if ($page != 1) { |
| 248 | 248 | $prev_page = $page - 1; |
| 249 | - $URL->insert([ 'p' => $prev_page ]); |
|
| 249 | + $URL->insert(['p' => $prev_page]); |
|
| 250 | 250 | $pagelinks['prev'] = [ |
| 251 | 251 | 'url' => $URL->generate(), |
| 252 | 252 | ]; |
| 253 | - $URL->insert([ 'p' => 1 ]); |
|
| 253 | + $URL->insert(['p' => 1]); |
|
| 254 | 254 | $pagelinks['firstpage'] = [ |
| 255 | 255 | 'url' => $URL->generate(), |
| 256 | 256 | ]; |
| 257 | 257 | } |
| 258 | 258 | if ($page != $numpages) { |
| 259 | 259 | $next_page = $page + 1; |
| 260 | - $URL->insert([ 'p' => $next_page ]); |
|
| 260 | + $URL->insert(['p' => $next_page]); |
|
| 261 | 261 | $pagelinks['next'] = [ |
| 262 | 262 | 'url' => $URL->generate(), |
| 263 | 263 | ]; |
| 264 | - $URL->insert([ 'p' => $numpages ]); |
|
| 264 | + $URL->insert(['p' => $numpages]); |
|
| 265 | 265 | $pagelinks['lastpage'] = [ |
| 266 | 266 | 'url' => $URL->generate(), |
| 267 | 267 | ]; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $where = []; |
| 69 | 69 | if ($houses) { |
| 70 | 70 | if (is_string($houses)) { |
| 71 | - $houses = [ $houses ]; |
|
| 71 | + $houses = [$houses]; |
|
| 72 | 72 | } |
| 73 | 73 | $where[] = 'house IN ("' . implode('", "', $houses) . '")'; |
| 74 | 74 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | FROM person_names AS pn |
| 411 | 411 | WHERE person_id = :person_id |
| 412 | 412 | AND start_date <= :division_date AND end_date >= :division_date", |
| 413 | - [ ':person_id' => $vote['proxy'], ':division_date' => $row['division_date'] ] |
|
| 413 | + [':person_id' => $vote['proxy'], ':division_date' => $row['division_date']] |
|
| 414 | 414 | )->first(); |
| 415 | 415 | $detail['proxy'] = ucfirst(member_full_name( |
| 416 | 416 | HOUSE_TYPE_COMMONS, |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) { |
| 440 | 440 | $votes[$vote . '_by_party'] = $votes[$vote]; |
| 441 | - usort($votes[$vote . '_by_party'], function ($a, $b) { |
|
| 441 | + usort($votes[$vote . '_by_party'], function($a, $b) { |
|
| 442 | 442 | return $a['party'] > $b['party']; |
| 443 | 443 | }); |
| 444 | 444 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | private function constructYesNoVoteDescription($direction, $title, $short_text) { |
| 564 | - $text = ' ' ; |
|
| 564 | + $text = ' '; |
|
| 565 | 565 | if ($short_text) { |
| 566 | 566 | $text .= sprintf(gettext('voted %s'), $short_text); |
| 567 | 567 | } else { |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | $gid = get_canonical_gid($gid); |
| 713 | 713 | |
| 714 | - $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", [ ':gid' => $gid ])->first(); |
|
| 714 | + $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", [':gid' => $gid])->first(); |
|
| 715 | 715 | if (!$q) { |
| 716 | 716 | return ''; |
| 717 | 717 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // These stores an associative array of key/value pairs that |
| 43 | 43 | // we'll want passed on to other pages. |
| 44 | - $this->session_vars = []; |
|
| 44 | + $this->session_vars = []; |
|
| 45 | 45 | |
| 46 | 46 | // Prevent things using $DATA running if it hasn't been set, ie in testing |
| 47 | 47 | if (isset($DATA)) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function reset() { |
| 94 | 94 | // Call this to remove all the session_vars. |
| 95 | - $this->session_vars = []; |
|
| 95 | + $this->session_vars = []; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | global $DATA; |
| 167 | 167 | |
| 168 | - $url_args = []; |
|
| 168 | + $url_args = []; |
|
| 169 | 169 | |
| 170 | 170 | foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) { |
| 171 | 171 | if (is_array($var)) { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | class Footer { |
| 13 | 13 | public $data; |
| 14 | 14 | |
| 15 | - private $about_links = ['help', 'about', 'linktous', 'news', 'privacy']; |
|
| 15 | + private $about_links = ['help', 'about', 'linktous', 'news', 'privacy']; |
|
| 16 | 16 | private $assemblies_links = ['hansard', 'sp_home', 'wales_home', 'ni_home', 'london_home']; |
| 17 | 17 | private $international_links = ['australia', 'ireland', 'mzalendo']; |
| 18 | 18 | private $tech_links = ['code', 'api', 'data', 'devmailinglist', 'contact']; |