@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | global $hansardmajors; |
| 30 | 30 | global $db; |
| 31 | 31 | |
| 32 | - $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [ ':gid' => $gid ])->first(); |
|
| 32 | + $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [':gid' => $gid])->first(); |
|
| 33 | 33 | $url_gid = fix_gid_from_db($gid); |
| 34 | 34 | $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']); |
| 35 | 35 | $url->insert(['id' => $url_gid]); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | print "<h2>Preview Content</h2>"; |
| 116 | 116 | if ($gid !== null) { |
| 117 | 117 | $h = new MySociety\TheyWorkForYou\Homepage\UK(); |
| 118 | - $featured = $h->getFeaturedDebate($gid, $title, $context, [ $related_gid1, $related_gid2, $related_gid3 ]); |
|
| 118 | + $featured = $h->getFeaturedDebate($gid, $title, $context, [$related_gid1, $related_gid2, $related_gid3]); |
|
| 119 | 119 | |
| 120 | 120 | include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php'; |
| 121 | 121 | } else { |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | protected function getSearchSections() { |
| 35 | 35 | return [ |
| 36 | - [ 'section' => 'ni' ], |
|
| 36 | + ['section' => 'ni'], |
|
| 37 | 37 | ]; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | protected function getSearchSections() { |
| 43 | 43 | return [ |
| 44 | - [ 'section' => 'wales' ], |
|
| 44 | + ['section' => 'wales'], |
|
| 45 | 45 | ]; |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $featured = []; |
| 33 | 33 | if (count($data['debates']['recent'])) { |
| 34 | 34 | $MOREURL = new \MySociety\TheyWorkForYou\Url('senedddebatesfront'); |
| 35 | - $MOREURL->insert([ 'more' => 1 ]); |
|
| 35 | + $MOREURL->insert(['more' => 1]); |
|
| 36 | 36 | $featured = array_shift($data['debates']['recent']); |
| 37 | 37 | $featured['more_url'] = $MOREURL->generate(); |
| 38 | 38 | $featured['desc'] = 'Senedd'; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $instance = new $class(); |
| 48 | 48 | $more_url = new \MySociety\TheyWorkForYou\Url($recent[1]); |
| 49 | 49 | if ($recent[0] == 'recent_pbc_debates') { |
| 50 | - $content = [ 'data' => $instance->display($recent[0], ['num' => 5], 'none') ]; |
|
| 50 | + $content = ['data' => $instance->display($recent[0], ['num' => 5], 'none')]; |
|
| 51 | 51 | } elseif ($recent[1] == 'senedddebatesfront' || $recent[1] == 'nidebatesfront') { |
| 52 | 52 | $content = $instance->display($recent[0], ['days' => 30, 'num' => 6], 'none'); |
| 53 | 53 | # XXX Bit hacky, for now |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $featured = []; |
| 23 | 23 | if (count($data['debates']['recent'])) { |
| 24 | 24 | $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront'); |
| 25 | - $MOREURL->insert([ 'more' => 1 ]); |
|
| 25 | + $MOREURL->insert(['more' => 1]); |
|
| 26 | 26 | $featured = array_shift($data['debates']['recent']); |
| 27 | 27 | $featured['more_url'] = $MOREURL->generate(); |
| 28 | 28 | $featured['desc'] = 'Northern Ireland Assembly debate'; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | class HANSARDLIST { |
| 54 | 54 | // This will be used to cache information about speakers on this page |
| 55 | 55 | // so we don't have to keep fetching the same data from the DB. |
| 56 | - public $speakers = []; |
|
| 56 | + public $speakers = []; |
|
| 57 | 57 | /* |
| 58 | 58 | $this->speakers[ $person_id ] = array ( |
| 59 | 59 | "name" => $name, |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | // This will be used to cache mappings from epobject_id to gid, |
| 68 | 68 | // so we don't have to continually fetch the same data in get_hansard_data(). |
| 69 | - public $epobjectid_to_gid = []; |
|
| 69 | + public $epobjectid_to_gid = []; |
|
| 70 | 70 | /* |
| 71 | 71 | $this->epobjectid_to_gid[ $epobject_id ] => $gid; |
| 72 | 72 | */ |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $validviews = ['calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid']; |
|
| 146 | + $validviews = ['calendar', 'date', 'gid', 'person', 'search', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid']; |
|
| 147 | 147 | if (in_array($view, $validviews)) { |
| 148 | 148 | |
| 149 | 149 | // What function do we call for this view? |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | [$year, $month, $date] = explode('-', $hdate); |
| 235 | 235 | $timestamp = gmmktime(0, 0, 0, $month, $date, $year); |
| 236 | 236 | |
| 237 | - $data = [ |
|
| 237 | + $data = [ |
|
| 238 | 238 | 'hdate' => $hdate, |
| 239 | 239 | 'timestamp' => $timestamp, |
| 240 | 240 | 'listurl' => $URL->generate(), |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | // so get the section info above this item. |
| 278 | 278 | |
| 279 | 279 | // For getting hansard data. |
| 280 | - $input = [ |
|
| 280 | + $input = [ |
|
| 281 | 281 | 'amount' => [ |
| 282 | 282 | 'body' => true, |
| 283 | 283 | ], |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | twfy_debug(get_class($this), "getting an item's subsection"); |
| 312 | 312 | |
| 313 | 313 | // What we return. |
| 314 | - $subsectiondata = []; |
|
| 314 | + $subsectiondata = []; |
|
| 315 | 315 | |
| 316 | 316 | if ($itemdata['htype'] == '12' || $itemdata['htype'] == '13' || $itemdata['htype'] == '14') { |
| 317 | 317 | // This item is a speech or procedural, so get the |
| 318 | 318 | // subsection info above this item. |
| 319 | 319 | |
| 320 | 320 | // For getting hansard data. |
| 321 | - $input = [ |
|
| 321 | + $input = [ |
|
| 322 | 322 | 'amount' => [ |
| 323 | 323 | 'body' => true, |
| 324 | 324 | ], |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $wherearr['hansard.epobject_id='] = $prev_item_id; |
| 417 | 417 | |
| 418 | 418 | // For getting hansard data. |
| 419 | - $input = [ |
|
| 419 | + $input = [ |
|
| 420 | 420 | 'amount' => [ |
| 421 | 421 | 'body' => true, |
| 422 | 422 | 'speaker' => true, |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') { |
| 433 | 433 | // Linking to the prev (sub)section. |
| 434 | 434 | $thing = $hansardmajors[$this->major]['singular']; |
| 435 | - $nextprevdata['prev'] = [ |
|
| 435 | + $nextprevdata['prev'] = [ |
|
| 436 | 436 | 'body' => sprintf(gettext("Previous %s"), $thing), |
| 437 | 437 | 'url' => $prevdata[0]['listurl'], |
| 438 | 438 | 'title' => $prevdata[0]['body'], |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | } else { |
| 446 | 446 | $title = ''; |
| 447 | 447 | } |
| 448 | - $nextprevdata['prev'] = [ |
|
| 448 | + $nextprevdata['prev'] = [ |
|
| 449 | 449 | 'body' => gettext('Previous speaker'), |
| 450 | 450 | 'url' => $prevdata[0]['commentsurl'], |
| 451 | 451 | 'title' => $title, |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $wherearr['hansard.epobject_id='] = $next_item_id; |
| 462 | 462 | |
| 463 | 463 | // For getting hansard data. |
| 464 | - $input = [ |
|
| 464 | + $input = [ |
|
| 465 | 465 | 'amount' => [ |
| 466 | 466 | 'body' => true, |
| 467 | 467 | 'speaker' => true, |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | if ($itemdata['htype'] == '10' || $itemdata['htype'] == '11') { |
| 477 | 477 | // Linking to the next (sub)section. |
| 478 | 478 | $thing = $hansardmajors[$this->major]['singular']; |
| 479 | - $nextprevdata['next'] = [ |
|
| 479 | + $nextprevdata['next'] = [ |
|
| 480 | 480 | 'body' => sprintf(gettext("Next %s"), $thing), |
| 481 | 481 | 'url' => $nextdata[0]['listurl'], |
| 482 | 482 | 'title' => $nextdata[0]['body'], |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | } else { |
| 490 | 490 | $title = ''; |
| 491 | 491 | } |
| 492 | - $nextprevdata['next'] = [ |
|
| 492 | + $nextprevdata['next'] = [ |
|
| 493 | 493 | 'body' => gettext('Next speaker'), |
| 494 | 494 | 'url' => $nextdata[0]['commentsurl'], |
| 495 | 495 | 'title' => $title, |
@@ -536,11 +536,11 @@ discard block |
||
| 536 | 536 | twfy_debug(get_class($this), "getting next/prev dates"); |
| 537 | 537 | |
| 538 | 538 | // What we return. |
| 539 | - $nextprevdata = []; |
|
| 539 | + $nextprevdata = []; |
|
| 540 | 540 | |
| 541 | 541 | $URL = new \MySociety\TheyWorkForYou\Url($this->listpage); |
| 542 | 542 | |
| 543 | - $looper = ["next", "prev"]; |
|
| 543 | + $looper = ["next", "prev"]; |
|
| 544 | 544 | |
| 545 | 545 | foreach ($looper as $n => $nextorprev) { |
| 546 | 546 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | // when displaying the first day of debates. |
| 565 | 565 | if ($q && $q['hdate'] != null) { |
| 566 | 566 | |
| 567 | - $URL->insert([ 'd' => $q['hdate'] ]); |
|
| 567 | + $URL->insert(['d' => $q['hdate']]); |
|
| 568 | 568 | |
| 569 | 569 | if ($nextorprev == 'next') { |
| 570 | 570 | $body = gettext('Next day'); |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | $title = format_date($q['hdate'], SHORTDATEFORMAT); |
| 576 | 576 | |
| 577 | - $nextprevdata[$nextorprev] = [ |
|
| 577 | + $nextprevdata[$nextorprev] = [ |
|
| 578 | 578 | 'hdate' => $q['hdate'], |
| 579 | 579 | 'url' => $URL->generate(), |
| 580 | 580 | 'body' => $body, |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | $thing = $hansardmajors[$this->major]['plural']; |
| 589 | 589 | $URL->insert(['y' => $year]); |
| 590 | 590 | |
| 591 | - $nextprevdata['up'] = [ |
|
| 591 | + $nextprevdata['up'] = [ |
|
| 592 | 592 | 'body' => sprintf(gettext("All of %s’s %s"), $year, $thing), |
| 593 | 593 | 'title' => '', |
| 594 | 594 | 'url' => $URL->generate(), |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | |
| 646 | 646 | |
| 647 | 647 | // Get all the data just for this epobject_id. |
| 648 | - $input = [ |
|
| 648 | + $input = [ |
|
| 649 | 649 | 'amount' => [ |
| 650 | 650 | 'body' => true, |
| 651 | 651 | 'speaker' => true, |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | $this->check_gid_change($args['gid'], 'a', ''); |
| 687 | 687 | |
| 688 | 688 | if (substr($args['gid'], -1) == 'L') { |
| 689 | - $letts = ['a','b','c','d','e']; |
|
| 689 | + $letts = ['a', 'b', 'c', 'd', 'e']; |
|
| 690 | 690 | for ($i = 0; $i < 4; $i++) { |
| 691 | 691 | $this->check_gid_change($args['gid'], $letts[$i], $letts[$i + 1]); |
| 692 | 692 | } |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | private function check_gid_change($gid, $from, $to) { |
| 733 | - $input = [ |
|
| 733 | + $input = [ |
|
| 734 | 734 | 'amount' => [ |
| 735 | 735 | 'body' => true, |
| 736 | 736 | 'speaker' => true, |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | twfy_debug(get_class($this), "getting data by date"); |
| 759 | 759 | |
| 760 | 760 | // Where we'll put all the data we want to render. |
| 761 | - $data = []; |
|
| 761 | + $data = []; |
|
| 762 | 762 | |
| 763 | 763 | $date = $this->_validate_date($args); |
| 764 | 764 | |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | |
| 773 | 773 | // Get all the sections for this date. |
| 774 | 774 | // Then for each of those we'll get the subsections and rows. |
| 775 | - $input = [ |
|
| 775 | + $input = [ |
|
| 776 | 776 | 'amount' => [ |
| 777 | 777 | 'body' => true, |
| 778 | 778 | 'comment' => true, |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | $sectionrow = $this->_get_section($sections[$n]); |
| 802 | 802 | |
| 803 | 803 | // Get the subsections within the section. |
| 804 | - $input = [ |
|
| 804 | + $input = [ |
|
| 805 | 805 | 'amount' => [ |
| 806 | 806 | 'body' => true, |
| 807 | 807 | 'comment' => true, |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | $major = ''; |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | - $data = []; |
|
| 860 | + $data = []; |
|
| 861 | 861 | |
| 862 | 862 | $q = $this->db->query("SELECT DISTINCT(hdate) |
| 863 | 863 | FROM hansard |
@@ -932,7 +932,7 @@ discard block |
||
| 932 | 932 | |
| 933 | 933 | $speeches = []; |
| 934 | 934 | foreach ($q as $row) { |
| 935 | - $speech = [ |
|
| 935 | + $speech = [ |
|
| 936 | 936 | 'subsection_id' => $row['subsection_id'], |
| 937 | 937 | 'section_id' => $row['section_id'], |
| 938 | 938 | 'htype' => $row['htype'], |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | // Cache parent id to speed up _get_listurl |
| 950 | 950 | $this->epobjectid_to_gid[$row['subsection_id']] = fix_gid_from_db($row['gid_subsection']); |
| 951 | 951 | |
| 952 | - $url_args = ['p' => $row['person_id']]; |
|
| 952 | + $url_args = ['p' => $row['person_id']]; |
|
| 953 | 953 | $speech['listurl'] = $this->_get_listurl($speech, $url_args); |
| 954 | 954 | $speeches[] = $speech; |
| 955 | 955 | } |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | // What we'll return. |
| 1000 | - $data = []; |
|
| 1000 | + $data = []; |
|
| 1001 | 1001 | |
| 1002 | 1002 | $data['info']['s'] = $args['s']; |
| 1003 | 1003 | |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | |
| 1058 | 1058 | // Log this query so we can improve them - if it wasn't a "popular |
| 1059 | 1059 | // query" link |
| 1060 | - if (! isset($args['pop']) or $args['pop'] != 1) { |
|
| 1060 | + if (!isset($args['pop']) or $args['pop'] != 1) { |
|
| 1061 | 1061 | global $SEARCHLOG; |
| 1062 | 1062 | $SEARCHLOG->add( |
| 1063 | 1063 | ['query' => $searchstring, |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | ////////////////////////// |
| 1186 | 1186 | // 2. Create the URL to link to this bit of text. |
| 1187 | 1187 | |
| 1188 | - $id_data = [ |
|
| 1188 | + $id_data = [ |
|
| 1189 | 1189 | 'major' => $itemdata['major'], |
| 1190 | 1190 | 'minor' => $itemdata['minor'], |
| 1191 | 1191 | 'htype' => $itemdata['htype'], |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | |
| 1197 | 1197 | // We append the query onto the end of the URL as variable 's' |
| 1198 | 1198 | // so we can highlight them on the debate/wrans list page. |
| 1199 | - $url_args = ['s' => $searchstring]; |
|
| 1199 | + $url_args = ['s' => $searchstring]; |
|
| 1200 | 1200 | |
| 1201 | 1201 | $itemdata['listurl'] = $this->_get_listurl($id_data, $url_args, $encode); |
| 1202 | 1202 | |
@@ -1249,14 +1249,14 @@ discard block |
||
| 1249 | 1249 | } else { |
| 1250 | 1250 | $listurl = ''; |
| 1251 | 1251 | } |
| 1252 | - $itemdata['parent'] = [ |
|
| 1252 | + $itemdata['parent'] = [ |
|
| 1253 | 1253 | 'body' => $body, |
| 1254 | 1254 | 'listurl' => $listurl, |
| 1255 | 1255 | ]; |
| 1256 | 1256 | if ($itemdata['htype'] == 11) { |
| 1257 | 1257 | # Search result was a subsection heading; fetch the first entry |
| 1258 | 1258 | # from the wrans/wms to show under the heading |
| 1259 | - $input = [ |
|
| 1259 | + $input = [ |
|
| 1260 | 1260 | 'amount' => [ |
| 1261 | 1261 | 'body' => true, |
| 1262 | 1262 | 'speaker' => true, |
@@ -1502,7 +1502,7 @@ discard block |
||
| 1502 | 1502 | |
| 1503 | 1503 | $params[':major'] = $this->major; |
| 1504 | 1504 | $params[':firstdate'] = $firstyear . '-' . $firstmonth . '-01'; |
| 1505 | - $q = $this->db->query("SELECT DISTINCT(hdate) AS hdate |
|
| 1505 | + $q = $this->db->query("SELECT DISTINCT(hdate) AS hdate |
|
| 1506 | 1506 | FROM hansard |
| 1507 | 1507 | WHERE major = :major |
| 1508 | 1508 | AND hdate >= :firstdate |
@@ -1570,7 +1570,7 @@ discard block |
||
| 1570 | 1570 | |
| 1571 | 1571 | $YEARURL->insert(['y' => $firstyear - 1]); |
| 1572 | 1572 | |
| 1573 | - $nextprev['prev'] = [ |
|
| 1573 | + $nextprev['prev'] = [ |
|
| 1574 | 1574 | 'body' => 'Previous year', |
| 1575 | 1575 | 'title' => $firstyear - 1, |
| 1576 | 1576 | 'url' => $YEARURL->generate(), |
@@ -1579,8 +1579,8 @@ discard block |
||
| 1579 | 1579 | } else { |
| 1580 | 1580 | // action is 'year'. |
| 1581 | 1581 | |
| 1582 | - $nextprev['prev'] = ['body' => 'Previous year']; |
|
| 1583 | - $nextprev['next'] = ['body' => 'Next year']; |
|
| 1582 | + $nextprev['prev'] = ['body' => 'Previous year']; |
|
| 1583 | + $nextprev['next'] = ['body' => 'Next year']; |
|
| 1584 | 1584 | |
| 1585 | 1585 | $q = $this->db->query("SELECT DATE_FORMAT(hdate, '%Y') AS year |
| 1586 | 1586 | FROM hansard WHERE major = :major |
@@ -1669,13 +1669,13 @@ discard block |
||
| 1669 | 1669 | // $input['limit'] as a string for the $limit clause, eg '21,20'. |
| 1670 | 1670 | |
| 1671 | 1671 | $amount = $input['amount'] ?? []; |
| 1672 | - $wherearr = $input['where'] ?? []; |
|
| 1672 | + $wherearr = $input['where'] ?? []; |
|
| 1673 | 1673 | $order = $input['order'] ?? ''; |
| 1674 | 1674 | $limit = $input['limit'] ?? ''; |
| 1675 | 1675 | |
| 1676 | 1676 | |
| 1677 | 1677 | // The fields to fetch from db. 'table' => array ('field1', 'field2'). |
| 1678 | - $fieldsarr = [ |
|
| 1678 | + $fieldsarr = [ |
|
| 1679 | 1679 | 'hansard' => ['epobject_id', 'htype', 'gid', 'hpos', 'section_id', 'subsection_id', 'hdate', 'htime', 'source_url', 'major', 'minor', 'colnum'], |
| 1680 | 1680 | ]; |
| 1681 | 1681 | |
@@ -1688,14 +1688,14 @@ discard block |
||
| 1688 | 1688 | if ((isset($amount['body']) && $amount['body'] == true) || |
| 1689 | 1689 | (isset($amount['comment']) && $amount['comment'] == true) |
| 1690 | 1690 | ) { |
| 1691 | - $fieldsarr['epobject'] = ['body']; |
|
| 1691 | + $fieldsarr['epobject'] = ['body']; |
|
| 1692 | 1692 | $join = 'LEFT OUTER JOIN epobject ON hansard.epobject_id = epobject.epobject_id'; |
| 1693 | 1693 | } else { |
| 1694 | 1694 | $join = ''; |
| 1695 | 1695 | } |
| 1696 | 1696 | |
| 1697 | 1697 | |
| 1698 | - $fieldsarr2 = []; |
|
| 1698 | + $fieldsarr2 = []; |
|
| 1699 | 1699 | // Construct the $fields clause. |
| 1700 | 1700 | foreach ($fieldsarr as $table => $tablesfields) { |
| 1701 | 1701 | foreach ($tablesfields as $n => $field) { |
@@ -1704,7 +1704,7 @@ discard block |
||
| 1704 | 1704 | } |
| 1705 | 1705 | $fields = implode(', ', $fieldsarr2); |
| 1706 | 1706 | |
| 1707 | - $wherearr2 = []; |
|
| 1707 | + $wherearr2 = []; |
|
| 1708 | 1708 | // Construct the $where clause. |
| 1709 | 1709 | $i = 0; |
| 1710 | 1710 | foreach ($wherearr as $key => $val) { |
@@ -1862,7 +1862,7 @@ discard block |
||
| 1862 | 1862 | // 'commentsurl' is the URL of the item on its own page, with comments. |
| 1863 | 1863 | |
| 1864 | 1864 | // All the things we need to work out a listurl! |
| 1865 | - $item_data = [ |
|
| 1865 | + $item_data = [ |
|
| 1866 | 1866 | 'major' => $this->major, |
| 1867 | 1867 | 'minor' => $item['minor'], |
| 1868 | 1868 | 'htype' => $item['htype'], |
@@ -1910,7 +1910,7 @@ discard block |
||
| 1910 | 1910 | if (isset($amount['comment']) && $amount['comment'] == true) { |
| 1911 | 1911 | |
| 1912 | 1912 | // All the things we need to get the comment data. |
| 1913 | - $item_data = [ |
|
| 1913 | + $item_data = [ |
|
| 1914 | 1914 | 'htype' => $item['htype'], |
| 1915 | 1915 | 'epobject_id' => $item['epobject_id'], |
| 1916 | 1916 | ]; |
@@ -2031,7 +2031,7 @@ discard block |
||
| 2031 | 2031 | $DATA->set_page_metadata('pbc_clause', 'url', "$pbc_url/$id"); |
| 2032 | 2032 | $LISTURL->remove(['id']); |
| 2033 | 2033 | } else { |
| 2034 | - $LISTURL->insert([ 'id' => $id_data['gid'] ]); |
|
| 2034 | + $LISTURL->insert(['id' => $id_data['gid']]); |
|
| 2035 | 2035 | } |
| 2036 | 2036 | } else { |
| 2037 | 2037 | // A debate speech or question/answer, etc. |
@@ -2043,10 +2043,10 @@ discard block |
||
| 2043 | 2043 | // Find the gid of this item's (sub)section. |
| 2044 | 2044 | $parent_gid = ''; |
| 2045 | 2045 | |
| 2046 | - if (isset($this->epobjectid_to_gid[ $parent_epobject_id ])) { |
|
| 2046 | + if (isset($this->epobjectid_to_gid[$parent_epobject_id])) { |
|
| 2047 | 2047 | // We've previously cached the gid for this epobject_id, so use that. |
| 2048 | 2048 | |
| 2049 | - $parent_gid = $this->epobjectid_to_gid[ $parent_epobject_id ]; |
|
| 2049 | + $parent_gid = $this->epobjectid_to_gid[$parent_epobject_id]; |
|
| 2050 | 2050 | |
| 2051 | 2051 | } else { |
| 2052 | 2052 | // We haven't cached the gid, so fetch from db. |
@@ -2064,7 +2064,7 @@ discard block |
||
| 2064 | 2064 | $parent_gid = fix_gid_from_db($r['gid']); |
| 2065 | 2065 | |
| 2066 | 2066 | // Cache it for if we need it again: |
| 2067 | - $this->epobjectid_to_gid[ $parent_epobject_id ] = $parent_gid; |
|
| 2067 | + $this->epobjectid_to_gid[$parent_epobject_id] = $parent_gid; |
|
| 2068 | 2068 | } |
| 2069 | 2069 | } |
| 2070 | 2070 | |
@@ -2075,7 +2075,7 @@ discard block |
||
| 2075 | 2075 | $DATA->set_page_metadata('pbc_clause', 'url', "$pbc_url/$parent_gid"); |
| 2076 | 2076 | $LISTURL->remove(['id']); |
| 2077 | 2077 | } else { |
| 2078 | - $LISTURL->insert([ 'id' => $parent_gid ]); |
|
| 2078 | + $LISTURL->insert(['id' => $parent_gid]); |
|
| 2079 | 2079 | } |
| 2080 | 2080 | // Use a truncated form of this item's gid for the anchor. |
| 2081 | 2081 | $fragment = '#g' . gid_to_anchor($id_data['gid']); |
@@ -2140,7 +2140,7 @@ discard block |
||
| 2140 | 2140 | $URL->insert(['p' => $person_id]); |
| 2141 | 2141 | |
| 2142 | 2142 | $name = member_full_name($member['house'], $member['title'], $member['given_name'], $member['family_name'], $member['lordofname']); |
| 2143 | - $speaker = [ |
|
| 2143 | + $speaker = [ |
|
| 2144 | 2144 | 'member_id' => $member['member_id'], |
| 2145 | 2145 | "name" => $name, |
| 2146 | 2146 | 'house' => $member['house'], |
@@ -2164,7 +2164,7 @@ discard block |
||
| 2164 | 2164 | private function _get_speaker_alone($q, $person_id, $hdate, $htime, $major) { |
| 2165 | 2165 | $members = $q->fetchAll(); |
| 2166 | 2166 | if (count($members) > 1) { |
| 2167 | - $members = array_filter($members, function ($m) use ($major) { |
|
| 2167 | + $members = array_filter($members, function($m) use ($major) { |
|
| 2168 | 2168 | $houses = \MySociety\TheyWorkForYou\Utility\House::majorToHouse($major); |
| 2169 | 2169 | return in_array($m['house'], $houses); |
| 2170 | 2170 | }); |
@@ -2272,7 +2272,7 @@ discard block |
||
| 2272 | 2272 | )->first(); |
| 2273 | 2273 | |
| 2274 | 2274 | // Add this comment to the data structure. |
| 2275 | - $comment = [ |
|
| 2275 | + $comment = [ |
|
| 2276 | 2276 | 'comment_id' => $q['comment_id'], |
| 2277 | 2277 | 'user_id' => $q['user_id'], |
| 2278 | 2278 | 'body' => $q['body'], |
@@ -2287,7 +2287,7 @@ discard block |
||
| 2287 | 2287 | // or subsection itself, only the items within them. So |
| 2288 | 2288 | // we don't get the most recent comment. Because there isn't one. |
| 2289 | 2289 | |
| 2290 | - $return = [ |
|
| 2290 | + $return = [ |
|
| 2291 | 2291 | 'totalcomments' => $totalcomments, |
| 2292 | 2292 | 'comment' => $comment, |
| 2293 | 2293 | ]; |
@@ -2350,7 +2350,7 @@ discard block |
||
| 2350 | 2350 | // If part of a Written Answer (just question or just answer), select the whole thing |
| 2351 | 2351 | if (isset($itemdata['major']) && $hansardmajors[$itemdata['major']]['type'] == 'other' and ($itemdata['htype'] == '12' or $itemdata['htype'] == '13' or $itemdata['htype'] == '14')) { |
| 2352 | 2352 | // find the gid of the subheading which holds this part |
| 2353 | - $input = [ |
|
| 2353 | + $input = [ |
|
| 2354 | 2354 | 'amount' => ['gid' => true], |
| 2355 | 2355 | 'where' => [ |
| 2356 | 2356 | 'epobject_id=' => $itemdata['subsection_id'], |
@@ -2366,7 +2366,7 @@ discard block |
||
| 2366 | 2366 | |
| 2367 | 2367 | # If a WMS main heading, go to next gid |
| 2368 | 2368 | if (isset($itemdata['major']) && $itemdata['major'] == 4 && $itemdata['htype'] == '10') { |
| 2369 | - $input = [ |
|
| 2369 | + $input = [ |
|
| 2370 | 2370 | 'amount' => ['gid' => true], |
| 2371 | 2371 | 'where' => [ |
| 2372 | 2372 | 'section_id=' => $itemdata['epobject_id'], |
@@ -2446,7 +2446,7 @@ discard block |
||
| 2446 | 2446 | $nextprev['up']['url'] = $sectionrow['listurl']; |
| 2447 | 2447 | $nextprev['up']['title'] = $sectionrow['body']; |
| 2448 | 2448 | } |
| 2449 | - $nextprev['up']['body'] = gettext('See the whole debate'); |
|
| 2449 | + $nextprev['up']['body'] = gettext('See the whole debate'); |
|
| 2450 | 2450 | } |
| 2451 | 2451 | |
| 2452 | 2452 | // We can then access this from $PAGE and the templates. |
@@ -2455,7 +2455,7 @@ discard block |
||
| 2455 | 2455 | // Now get all the non-heading rows. |
| 2456 | 2456 | |
| 2457 | 2457 | // What data do we want for each item? |
| 2458 | - $amount = [ |
|
| 2458 | + $amount = [ |
|
| 2459 | 2459 | 'body' => true, |
| 2460 | 2460 | 'speaker' => true, |
| 2461 | 2461 | 'comment' => true, |
@@ -2466,7 +2466,7 @@ discard block |
||
| 2466 | 2466 | // This item is a section, so we're displaying all the items within |
| 2467 | 2467 | // it that aren't within a subsection. |
| 2468 | 2468 | |
| 2469 | - $input = [ |
|
| 2469 | + $input = [ |
|
| 2470 | 2470 | 'amount' => $amount, |
| 2471 | 2471 | 'where' => [ |
| 2472 | 2472 | 'section_id=' => $itemdata['epobject_id'], |
@@ -2478,7 +2478,7 @@ discard block |
||
| 2478 | 2478 | $data['rows'] = $this->_get_hansard_data($input); |
| 2479 | 2479 | if (!count($data['rows']) || (count($data['rows']) == 1 && strstr($data['rows'][0]['body'], 'was asked'))) { |
| 2480 | 2480 | |
| 2481 | - $input = [ |
|
| 2481 | + $input = [ |
|
| 2482 | 2482 | 'amount' => [ |
| 2483 | 2483 | 'body' => true, |
| 2484 | 2484 | 'comment' => true, |
@@ -2500,7 +2500,7 @@ discard block |
||
| 2500 | 2500 | } elseif ($itemdata['htype'] == '11') { |
| 2501 | 2501 | // This item is a subsection, so we're displaying everything within it. |
| 2502 | 2502 | |
| 2503 | - $input = [ |
|
| 2503 | + $input = [ |
|
| 2504 | 2504 | 'amount' => $amount, |
| 2505 | 2505 | 'where' => [ |
| 2506 | 2506 | 'subsection_id=' => $itemdata['epobject_id'], |
@@ -2537,8 +2537,8 @@ discard block |
||
| 2537 | 2537 | |
| 2538 | 2538 | twfy_debug(get_class($this), "getting data by column"); |
| 2539 | 2539 | |
| 2540 | - $input = [ 'amount' => ['body' => true, 'comment' => true, 'speaker' => true], |
|
| 2541 | - 'where' => [ 'hdate=' => $args['date'], 'major=' => $this->major, 'gid LIKE ' => '%.' . $args['column'] . '.%' ], |
|
| 2540 | + $input = ['amount' => ['body' => true, 'comment' => true, 'speaker' => true], |
|
| 2541 | + 'where' => ['hdate=' => $args['date'], 'major=' => $this->major, 'gid LIKE ' => '%.' . $args['column'] . '.%'], |
|
| 2542 | 2542 | 'order' => 'hpos', |
| 2543 | 2543 | ]; |
| 2544 | 2544 | $data = $this->_get_hansard_data($input); |
@@ -2698,10 +2698,10 @@ discard block |
||
| 2698 | 2698 | ", [':major' => $this->major]); |
| 2699 | 2699 | |
| 2700 | 2700 | // What we return. |
| 2701 | - $data = []; |
|
| 2701 | + $data = []; |
|
| 2702 | 2702 | $speeches = []; |
| 2703 | 2703 | foreach ($q as $row) { |
| 2704 | - $speech = [ |
|
| 2704 | + $speech = [ |
|
| 2705 | 2705 | 'subsection_id' => $row['subsection_id'], |
| 2706 | 2706 | 'section_id' => $row['section_id'], |
| 2707 | 2707 | 'htype' => $row['htype'], |
@@ -2746,7 +2746,7 @@ discard block |
||
| 2746 | 2746 | $data['rows'] = $speeches; |
| 2747 | 2747 | |
| 2748 | 2748 | } else { |
| 2749 | - $data['rows'] = []; |
|
| 2749 | + $data['rows'] = []; |
|
| 2750 | 2750 | } |
| 2751 | 2751 | |
| 2752 | 2752 | $data['info']['days'] = $days; |
@@ -2798,7 +2798,7 @@ discard block |
||
| 2798 | 2798 | if ($q) { |
| 2799 | 2799 | |
| 2800 | 2800 | // This array just used for getting further data about this debate. |
| 2801 | - $item_data = [ |
|
| 2801 | + $item_data = [ |
|
| 2802 | 2802 | 'major' => $this->major, |
| 2803 | 2803 | 'minor' => $q['minor'], |
| 2804 | 2804 | 'gid' => fix_gid_from_db($q['gid']), |
@@ -2862,7 +2862,7 @@ discard block |
||
| 2862 | 2862 | ORDER BY hpos |
| 2863 | 2863 | LIMIT 1 |
| 2864 | 2864 | ", |
| 2865 | - [ ':object_id' => $item_data['epobject_id'] ] |
|
| 2865 | + [':object_id' => $item_data['epobject_id']] |
|
| 2866 | 2866 | )->first(); |
| 2867 | 2867 | $childbody = $r['body']; |
| 2868 | 2868 | $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major); |
@@ -2901,7 +2901,7 @@ discard block |
||
| 2901 | 2901 | 'more_url' => $more_url->generate(), |
| 2902 | 2902 | ]; |
| 2903 | 2903 | |
| 2904 | - $data = [ |
|
| 2904 | + $data = [ |
|
| 2905 | 2905 | 'gid' => $args['gid'], |
| 2906 | 2906 | 'major' => $this->major, |
| 2907 | 2907 | 'info' => [], |
@@ -2974,7 +2974,7 @@ discard block |
||
| 2974 | 2974 | foreach ($q as $row) { |
| 2975 | 2975 | |
| 2976 | 2976 | // This array just used for getting further data about this debate. |
| 2977 | - $item_data = [ |
|
| 2977 | + $item_data = [ |
|
| 2978 | 2978 | 'major' => $this->major, |
| 2979 | 2979 | 'gid' => fix_gid_from_db($row['gid']), |
| 2980 | 2980 | 'htype' => $row['htype'], |
@@ -3092,7 +3092,7 @@ discard block |
||
| 3092 | 3092 | foreach ($q as $row) { |
| 3093 | 3093 | |
| 3094 | 3094 | // This array just used for getting further data about this debate. |
| 3095 | - $item_data = [ |
|
| 3095 | + $item_data = [ |
|
| 3096 | 3096 | 'major' => $this->major, |
| 3097 | 3097 | 'gid' => fix_gid_from_db($row['gid']), |
| 3098 | 3098 | 'htype' => $row['htype'], |
@@ -3101,8 +3101,8 @@ discard block |
||
| 3101 | 3101 | 'epobject_id' => $row['epobject_id'], |
| 3102 | 3102 | ]; |
| 3103 | 3103 | |
| 3104 | - $list_url = $this->_get_listurl($item_data); |
|
| 3105 | - $totalcomments = $this->_get_comment_count_for_epobject($item_data); |
|
| 3104 | + $list_url = $this->_get_listurl($item_data); |
|
| 3105 | + $totalcomments = $this->_get_comment_count_for_epobject($item_data); |
|
| 3106 | 3106 | |
| 3107 | 3107 | $contentcount = $row['count']; |
| 3108 | 3108 | $body = $row['body']; |
@@ -3110,7 +3110,7 @@ discard block |
||
| 3110 | 3110 | |
| 3111 | 3111 | |
| 3112 | 3112 | // This array will be added to $data, which is what gets returned. |
| 3113 | - $debate = [ |
|
| 3113 | + $debate = [ |
|
| 3114 | 3114 | 'contentcount' => $contentcount, |
| 3115 | 3115 | 'body' => $body, |
| 3116 | 3116 | 'hdate' => $hdate, |
@@ -3150,7 +3150,7 @@ discard block |
||
| 3150 | 3150 | $data[] = $debate; |
| 3151 | 3151 | } |
| 3152 | 3152 | |
| 3153 | - $data = [ |
|
| 3153 | + $data = [ |
|
| 3154 | 3154 | 'info' => [], |
| 3155 | 3155 | 'data' => $data, |
| 3156 | 3156 | ]; |
@@ -3238,7 +3238,7 @@ discard block |
||
| 3238 | 3238 | |
| 3239 | 3239 | foreach ($q as $row) { |
| 3240 | 3240 | // This array just used for getting further data about this debate. |
| 3241 | - $item_data = [ |
|
| 3241 | + $item_data = [ |
|
| 3242 | 3242 | 'major' => $this->major, |
| 3243 | 3243 | 'gid' => fix_gid_from_db($row['gid']), |
| 3244 | 3244 | 'htype' => $row['htype'], |
@@ -3247,8 +3247,8 @@ discard block |
||
| 3247 | 3247 | 'epobject_id' => $row['epobject_id'], |
| 3248 | 3248 | ]; |
| 3249 | 3249 | |
| 3250 | - $list_url = $this->_get_listurl($item_data); |
|
| 3251 | - $totalcomments = $this->_get_comment_count_for_epobject($item_data); |
|
| 3250 | + $list_url = $this->_get_listurl($item_data); |
|
| 3251 | + $totalcomments = $this->_get_comment_count_for_epobject($item_data); |
|
| 3252 | 3252 | |
| 3253 | 3253 | $body = $row['body']; |
| 3254 | 3254 | $hdate = $row['hdate']; |
@@ -3276,7 +3276,7 @@ discard block |
||
| 3276 | 3276 | $childbody = $r['body']; |
| 3277 | 3277 | $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major); |
| 3278 | 3278 | |
| 3279 | - $data[] = [ |
|
| 3279 | + $data[] = [ |
|
| 3280 | 3280 | 'body' => $body, |
| 3281 | 3281 | 'hdate' => $hdate, |
| 3282 | 3282 | 'list_url' => $list_url, |
@@ -3292,7 +3292,7 @@ discard block |
||
| 3292 | 3292 | |
| 3293 | 3293 | } |
| 3294 | 3294 | |
| 3295 | - $data = [ |
|
| 3295 | + $data = [ |
|
| 3296 | 3296 | 'info' => [], |
| 3297 | 3297 | 'data' => $data, |
| 3298 | 3298 | ]; |
@@ -3352,7 +3352,7 @@ discard block |
||
| 3352 | 3352 | public function _get_data_by_bill($args) { |
| 3353 | 3353 | global $DATA, $this_page; |
| 3354 | 3354 | $data = []; |
| 3355 | - $input = [ |
|
| 3355 | + $input = [ |
|
| 3356 | 3356 | 'amount' => [ |
| 3357 | 3357 | 'body' => true, |
| 3358 | 3358 | 'comment' => true, |
@@ -3374,7 +3374,7 @@ discard block |
||
| 3374 | 3374 | [$sitting, $part] = $this->_get_sitting($sectionrow['gid']); |
| 3375 | 3375 | $sectionrow['sitting'] = $sitting; |
| 3376 | 3376 | $sectionrow['part'] = $part; |
| 3377 | - $input = [ |
|
| 3377 | + $input = [ |
|
| 3378 | 3378 | 'amount' => [ |
| 3379 | 3379 | 'body' => true, |
| 3380 | 3380 | 'comment' => true, |
@@ -3445,8 +3445,8 @@ discard block |
||
| 3445 | 3445 | |
| 3446 | 3446 | $YEARURL = new \MySociety\TheyWorkForYou\Url('pbc_session'); |
| 3447 | 3447 | $nextprev = []; |
| 3448 | - $nextprev['prev'] = ['body' => 'Previous session', 'title' => '']; |
|
| 3449 | - $nextprev['next'] = ['body' => 'Next session', 'title' => '']; |
|
| 3448 | + $nextprev['prev'] = ['body' => 'Previous session', 'title' => '']; |
|
| 3449 | + $nextprev['next'] = ['body' => 'Next session', 'title' => '']; |
|
| 3450 | 3450 | $q = $this->db->query( |
| 3451 | 3451 | "SELECT session FROM bills WHERE session < :session ORDER BY session DESC LIMIT 1", |
| 3452 | 3452 | [':session' => $session] |