@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $HANSARDURL = new \MySociety\TheyWorkForYou\Url('hansard'); |
73 | 73 | $MPURL = new \MySociety\TheyWorkForYou\Url('yourmp'); |
74 | 74 | |
75 | -$PAGE->block_start(array ('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:')); |
|
75 | +$PAGE->block_start(array('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:')); |
|
76 | 76 | ?> |
77 | 77 | <ol> |
78 | 78 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } else { |
90 | 90 | $CHANGEURL = new \MySociety\TheyWorkForYou\Url('userchangepc'); |
91 | 91 | } |
92 | - $MEMBER = new MEMBER(array ('postcode'=>$THEUSER->postcode(), 'house'=>1)); |
|
92 | + $MEMBER = new MEMBER(array('postcode'=>$THEUSER->postcode(), 'house'=>1)); |
|
93 | 93 | $mpname = $MEMBER->full_name(); |
94 | 94 | ?> |
95 | 95 | <p><a href="<?php echo $MPURL->generate(); ?>"><strong>Find out more about how <?php echo $mpname; ?>, your ex-MP, represented you over the last parliament</strong></a><br> |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | //$PAGE->block_end(); |
186 | 186 | |
187 | 187 | $PAGE->stripe_end(array( |
188 | - array ( |
|
188 | + array( |
|
189 | 189 | 'type' => 'include', |
190 | 190 | 'content' => 'whatisthissite' |
191 | 191 | ), |
192 | - array ( |
|
192 | + array( |
|
193 | 193 | 'type' => 'include', |
194 | 194 | 'content' => 'sitenews_recent' |
195 | 195 | ) |
@@ -43,17 +43,20 @@ discard block |
||
43 | 43 | if ($todaystime - $debatesdata['timestamp'] == 86400) { |
44 | 44 | $daytext = "yesterday's"; |
45 | 45 | |
46 | - } elseif ($todaystime - $debatesdata['timestamp'] <= (6 * 86400)) { |
|
46 | + } |
|
47 | + elseif ($todaystime - $debatesdata['timestamp'] <= (6 * 86400)) { |
|
47 | 48 | // Less than a week ago, so like "last Tuesday's". |
48 | 49 | $daytext = gmdate('l', $debatesdata['timestamp']) . "'s"; |
49 | 50 | |
50 | - } else { |
|
51 | + } |
|
52 | + else { |
|
51 | 53 | |
52 | 54 | // Over a week ago. |
53 | 55 | $daytext = "the most recent "; |
54 | 56 | } |
55 | 57 | |
56 | - } else { |
|
58 | + } |
|
59 | + else { |
|
57 | 60 | // Debates and Wrans are from different dates. We'll just do this for now: |
58 | 61 | $daytext = "the most recent "; |
59 | 62 | } |
@@ -61,7 +64,8 @@ discard block |
||
61 | 64 | # $hansardline = "Comment on $daytext <ul><li>$debatestext</li><li>$wranstext</li><li>$whalltext</li><li>$wmstext</li></ul>"; |
62 | 65 | $hansardline = "Comment on $daytext $debatestext, $wranstext, $whalltext, and $wmstext"; |
63 | 66 | |
64 | -} else { |
|
67 | +} |
|
68 | +else { |
|
65 | 69 | // We didn't get some or all of the data, so just... |
66 | 70 | $hansardline = "Comment on events in parliament"; |
67 | 71 | } |
@@ -86,7 +90,8 @@ discard block |
||
86 | 90 | |
87 | 91 | if ($THEUSER->isloggedin()) { |
88 | 92 | $CHANGEURL = new \MySociety\TheyWorkForYou\Url('useredit'); |
89 | - } else { |
|
93 | + } |
|
94 | + else { |
|
90 | 95 | $CHANGEURL = new \MySociety\TheyWorkForYou\Url('userchangepc'); |
91 | 96 | } |
92 | 97 | $MEMBER = new MEMBER(array ('postcode'=>$THEUSER->postcode(), 'house'=>1)); |
@@ -96,7 +101,8 @@ discard block |
||
96 | 101 | In <?php echo strtoupper(_htmlentities($THEUSER->postcode())); ?> (<a href="<?php echo $CHANGEURL->generate(); ?>">Change your postcode</a>)</p> |
97 | 102 | <?php |
98 | 103 | |
99 | -} else { |
|
104 | +} |
|
105 | +else { |
|
100 | 106 | // User is not logged in and doesn't have a personal postcode set. |
101 | 107 | ?> |
102 | 108 | <form action="<?php echo $MPURL->generate(); ?>" method="get"> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']); |
41 | 41 | $fragment = ''; |
42 | 42 | if ($id_data['htype'] == '11' || $id_data['htype'] == '10') { |
43 | - $LISTURL->insert( array( 'id' => $id_data['gid'] ) ); |
|
43 | + $LISTURL->insert(array('id' => $id_data['gid'])); |
|
44 | 44 | } else { |
45 | 45 | $parent_epobject_id = $id_data['subsection_id']; |
46 | 46 | $parent_gid = ''; |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | ':epobject_id' => $parent_epobject_id |
51 | 51 | )); |
52 | 52 | if ($r->rows() > 0) { |
53 | - $parent_gid = fix_gid_from_db( $r->field(0, 'gid') ); |
|
53 | + $parent_gid = fix_gid_from_db($r->field(0, 'gid')); |
|
54 | 54 | } |
55 | 55 | if ($parent_gid != '') { |
56 | - $LISTURL->insert( array( 'id' => $parent_gid ) ); |
|
56 | + $LISTURL->insert(array('id' => $parent_gid)); |
|
57 | 57 | $fragment = '#g' . gid_to_anchor($id_data['gid']); |
58 | 58 | } |
59 | 59 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $user = new Renderer\User(); |
44 | 44 | $data = array_merge($user->data, $data); |
45 | 45 | |
46 | - if ( isset($page_errors) ) { |
|
46 | + if (isset($page_errors)) { |
|
47 | 47 | $data['page_errors'] = $page_errors; |
48 | 48 | } |
49 | 49 | |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | |
96 | 96 | private static function addCommonURLs($data) { |
97 | 97 | $urls = array(); |
98 | - if ( isset($data['urls']) ) { |
|
98 | + if (isset($data['urls'])) { |
|
99 | 99 | $urls = $data['urls']; |
100 | 100 | } |
101 | 101 | |
102 | 102 | $common_urls = array('search', 'alert'); |
103 | 103 | |
104 | - foreach ( $common_urls as $path ) { |
|
105 | - if (!isset($urls[$path]) ) { |
|
104 | + foreach ($common_urls as $path) { |
|
105 | + if (!isset($urls[$path])) { |
|
106 | 106 | $url = new Url($path); |
107 | 107 | $urls[$path] = $url->generate(); |
108 | 108 | } |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | if ($hide_question) { |
26 | 26 | $always_ask = 0; |
27 | 27 | $show_survey_qn = $current_question; |
28 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
28 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
29 | 29 | } elseif ($has_answered_question == $current_question && !$always_ask) { |
30 | 30 | $show_survey_qn = $current_question; |
31 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
31 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
32 | 32 | } elseif (isset($_COOKIE['survey'])) { |
33 | 33 | $show_survey_qn = $_COOKIE['survey']; |
34 | 34 | } |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | |
39 | 39 | $page_url = ''; |
40 | 40 | $hide_url = ''; |
41 | - if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) { |
|
41 | + if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) { |
|
42 | 42 | global $MEMBER; |
43 | - if ( $MEMBER ) { |
|
43 | + if ($MEMBER) { |
|
44 | 44 | $page_url = $MEMBER->url(true) . "?answered_survey=$current_question"; |
45 | 45 | $hide_url = $MEMBER->url() . "?hide_survey=$current_question"; |
46 | 46 | } |
47 | 47 | } else { |
48 | 48 | $URL = new Url($this_page); |
49 | - $URL->insert(array('answered_survey' => $current_question )); |
|
49 | + $URL->insert(array('answered_survey' => $current_question)); |
|
50 | 50 | $page_url = 'https://' . DOMAIN . $URL->generate(); |
51 | 51 | $URL = new Url($this_page); |
52 | - $URL->insert(array('hide_survey' => $current_question )); |
|
52 | + $URL->insert(array('hide_survey' => $current_question)); |
|
53 | 53 | $hide_url = $URL->generate(); |
54 | 54 | } |
55 | 55 |
@@ -26,10 +26,12 @@ discard block |
||
26 | 26 | $always_ask = 0; |
27 | 27 | $show_survey_qn = $current_question; |
28 | 28 | setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
29 | - } elseif ($has_answered_question == $current_question && !$always_ask) { |
|
29 | + } |
|
30 | + elseif ($has_answered_question == $current_question && !$always_ask) { |
|
30 | 31 | $show_survey_qn = $current_question; |
31 | 32 | setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
32 | - } elseif (isset($_COOKIE['survey'])) { |
|
33 | + } |
|
34 | + elseif (isset($_COOKIE['survey'])) { |
|
33 | 35 | $show_survey_qn = $_COOKIE['survey']; |
34 | 36 | } |
35 | 37 | |
@@ -44,7 +46,8 @@ discard block |
||
44 | 46 | $page_url = $MEMBER->url(true) . "?answered_survey=$current_question"; |
45 | 47 | $hide_url = $MEMBER->url() . "?hide_survey=$current_question"; |
46 | 48 | } |
47 | - } else { |
|
49 | + } |
|
50 | + else { |
|
48 | 51 | $URL = new Url($this_page); |
49 | 52 | $URL->insert(array('answered_survey' => $current_question )); |
50 | 53 | $page_url = 'https://' . DOMAIN . $URL->generate(); |
@@ -44,7 +44,8 @@ discard block |
||
44 | 44 | return $this->display_section_or_speech(array( |
45 | 45 | 'gid' => $standingprefix . $id, |
46 | 46 | )); |
47 | - } elseif ($bill_id) { |
|
47 | + } |
|
48 | + elseif ($bill_id) { |
|
48 | 49 | # Display the page for a particular bill |
49 | 50 | $this_page = 'pbc_bill'; |
50 | 51 | $args = array ( |
@@ -57,12 +58,14 @@ discard block |
||
57 | 58 | $data['session'] = $this->session; |
58 | 59 | $data['template'] = 'section/pbc_bill'; |
59 | 60 | return $this->addCommonData($data); |
60 | - } elseif ($this->session && $this->bill) { |
|
61 | + } |
|
62 | + elseif ($this->session && $this->bill) { |
|
61 | 63 | # Illegal bill title, redirect to session page |
62 | 64 | $URL = new \MySociety\TheyWorkForYou\Url('pbc_session'); |
63 | 65 | header('Location: ' . $URL->generate() . urlencode($this->session)); |
64 | 66 | exit; |
65 | - } elseif ($this->session) { |
|
67 | + } |
|
68 | + elseif ($this->session) { |
|
66 | 69 | # Display the bills for a particular session |
67 | 70 | $this_page = 'pbc_session'; |
68 | 71 | $DATA->set_page_metadata($this_page, 'title', "Session $this->session"); |
@@ -74,7 +77,8 @@ discard block |
||
74 | 77 | $data['template'] = 'section/pbc_session'; |
75 | 78 | $data['session'] = $this->session; |
76 | 79 | return $this->addCommonData($data); |
77 | - } else { |
|
80 | + } |
|
81 | + else { |
|
78 | 82 | return $this->display_front(); |
79 | 83 | } |
80 | 84 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $data = $this->addCommonData($data); |
33 | 33 | } elseif ($date = get_http_var('d')) { |
34 | 34 | $data = $this->display_day($date); |
35 | - if ( !isset($data['template']) ) { |
|
35 | + if (!isset($data['template'])) { |
|
36 | 36 | $data['template'] = 'section/day'; |
37 | 37 | } |
38 | 38 | $data = $this->addCommonData($data); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $data = $this->display_section_or_speech(); |
41 | 41 | } else { |
42 | 42 | $data = $this->display_front(); |
43 | - if ( !isset($data['template']) ) { |
|
43 | + if (!isset($data['template'])) { |
|
44 | 44 | $data['template'] = 'section/recent'; |
45 | 45 | } |
46 | 46 | $data['search_sections'] = $this->getSearchSections(); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | $data['recess_major'] = $this->getRecessMajor($data); |
60 | 60 | |
61 | 61 | $nextprev = $DATA->page_metadata($this_page, 'nextprev'); |
62 | - if ( isset($nextprev['next']['url']) ) { |
|
62 | + if (isset($nextprev['next']['url'])) { |
|
63 | 63 | $data['next'] = $nextprev['next']; |
64 | 64 | } |
65 | - if ( isset($nextprev['prev']['url']) ) { |
|
65 | + if (isset($nextprev['prev']['url'])) { |
|
66 | 66 | $data['prev'] = $nextprev['prev']; |
67 | 67 | } |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (!isset($data['title']) && $parent_page != '') { |
72 | 72 | $data['title'] = $DATA->page_metadata($parent_page, 'title'); |
73 | 73 | } |
74 | - if ( $parent_page ) { |
|
74 | + if ($parent_page) { |
|
75 | 75 | $data['parent_title'] = $DATA->page_metadata($parent_page, 'title'); |
76 | 76 | } |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $urls = array_merge($urls, $this->getViewUrls()); |
89 | 89 | |
90 | - if ( isset($data['info']['page']) ) { |
|
90 | + if (isset($data['info']['page'])) { |
|
91 | 91 | $day = new \MySociety\TheyWorkForYou\Url($data['info']['page']); |
92 | 92 | $urls['day'] = $day; |
93 | 93 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $DATA->set_page_metadata($this_page, 'title', $year); |
134 | 134 | } |
135 | 135 | |
136 | - $args = array ( 'year' => $year ); |
|
136 | + $args = array('year' => $year); |
|
137 | 137 | $data = $this->list->display('calendar', $args, 'none'); |
138 | 138 | return $data; |
139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function display_column($date, $column) { |
142 | 142 | global $this_page; |
143 | 143 | $this_page = $this->page_base; |
144 | - $args = array( 'date' => $date, 'column' => $column ); |
|
144 | + $args = array('date' => $date, 'column' => $column); |
|
145 | 145 | $content = $this->list->display('column', $args, 'none'); |
146 | 146 | |
147 | 147 | $data = array(); |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | protected function display_day($date) { |
167 | 167 | global $this_page; |
168 | 168 | $this_page = $this->page_base . 'day'; |
169 | - $args = array ( 'date' => get_http_var('d') ); |
|
169 | + $args = array('date' => get_http_var('d')); |
|
170 | 170 | $data = $this->list->display('date', $args, 'none'); |
171 | 171 | list($year, $month, $day) = explode('-', $date); |
172 | - $args = array( 'year' => $year, 'month' => $month, 'day' => $day); |
|
172 | + $args = array('year' => $year, 'month' => $month, 'day' => $day); |
|
173 | 173 | $calendar = $this->list->display('calendar', $args, 'none'); |
174 | - if ( isset($calendar['years']) ) { |
|
174 | + if (isset($calendar['years'])) { |
|
175 | 175 | $data['calendar'] = $calendar['years']; |
176 | 176 | } |
177 | 177 | return $data; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | global $DATA, $this_page, $THEUSER; |
182 | 182 | |
183 | 183 | # += as we *don't* want to override any already supplied argument |
184 | - $args += array ( |
|
184 | + $args += array( |
|
185 | 185 | 'gid' => get_http_var('id'), |
186 | 186 | 's' => get_http_var('s'), // Search terms to be highlighted. |
187 | 187 | 'member_id' => get_http_var('m'), // Member's speeches to be highlighted. |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | if ($this->major == 6) { |
199 | 199 | # Magically (as in I can't remember quite why), pbc_clause will |
200 | 200 | # contain the new URL without any change... |
201 | - $URL->remove( array('id') ); |
|
201 | + $URL->remove(array('id')); |
|
202 | 202 | } else { |
203 | - $URL->insert( array('id'=>$e->getMessage()) ); |
|
203 | + $URL->insert(array('id'=>$e->getMessage())); |
|
204 | 204 | } |
205 | 205 | # put the search term back in so highlighting works. |
206 | 206 | # NB: as we don't see the # part of the URL we lose this :( |
207 | - if ( $args['s'] !== '' ) { |
|
208 | - $URL->insert( array('s'=>$args['s']) ); |
|
207 | + if ($args['s'] !== '') { |
|
208 | + $URL->insert(array('s'=>$args['s'])); |
|
209 | 209 | } |
210 | 210 | redirect($URL->generate('none')); |
211 | 211 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | if (array_key_exists('text_heading', $data['info'])) { |
274 | 274 | // avoid having Clause 1 etc as the alert text search string on PBC pages as it's |
275 | 275 | // almost certainly not what the person wants |
276 | - if ( $this->major == 6 ) { |
|
276 | + if ($this->major == 6) { |
|
277 | 277 | $data['email_alert_text'] = $data['section_title']; |
278 | 278 | } else { |
279 | 279 | $data['email_alert_text'] = $data['info']['text_heading']; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $body = preg_replace('#<phrase class="honfriend" id="uk.org.publicwhip/member/(\d+)" name="([^"]*?)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?m=$1" title="Our page on $2 - \'$3\'">$4</a>', $body); |
321 | 321 | $body = preg_replace('#<phrase class="honfriend" name="([^"]*?)" person_id="uk.org.publicwhip/person/(\d+)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?p=$2" title="Our page on $1 - \'$3\'">$4</a>', $body); |
322 | 322 | $body = preg_replace_callback('#<phrase class="offrep" id="(.*?)/(\d+)-(\d+)-(\d+)\.(.*?)">(.*?)</phrase>#', function($matches) { |
323 | - return '<a href="/search/?pop=1&s=date:' . $matches[2] . $matches[3] . $matches[4] . '+column:' . $matches[5] . '+section:' . $matches[1] .'">' . str_replace("Official Report", "Hansard", $matches[6]) . '</a>'; |
|
323 | + return '<a href="/search/?pop=1&s=date:' . $matches[2] . $matches[3] . $matches[4] . '+column:' . $matches[5] . '+section:' . $matches[1] . '">' . str_replace("Official Report", "Hansard", $matches[6]) . '</a>'; |
|
324 | 324 | }, $body); |
325 | 325 | #$body = preg_replace('#<phrase class="offrep" id="((.*?)/(\d+)-(\d+)-(\d+)\.(.*?))">(.*?)</phrase>#e', "\"<a href='/search/?pop=1&s=date:$3$4$5+column:$6+section:$2&match=$1'>\" . str_replace('Official Report', 'Hansard', '$7') . '</a>'", $body); |
326 | 326 | $bodies[] = $body; |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $first_speech = null; |
353 | 353 | $data['section_title'] = ''; |
354 | 354 | $subsection_title = ''; |
355 | - for ($i=0; $i<count($data['rows']); $i++) { |
|
355 | + for ($i = 0; $i < count($data['rows']); $i++) { |
|
356 | 356 | $row = $data['rows'][$i]; |
357 | 357 | $htype = $row['htype']; |
358 | 358 | // HPOS should be defined below if it's needed; otherwise default to 0 |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | # Voting links |
376 | 376 | $data['rows'][$i]['voting_data'] = ''; |
377 | 377 | if (isset($row['votes'])) { |
378 | - $data['rows'][$i]['voting_data'] = $this->generate_votes( $row['votes'], $row['epobject_id'], $row['gid'] ); |
|
378 | + $data['rows'][$i]['voting_data'] = $this->generate_votes($row['votes'], $row['epobject_id'], $row['gid']); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | # Annotation link |
@@ -416,47 +416,47 @@ discard block |
||
416 | 416 | |
417 | 417 | private function getCountryDetails() { |
418 | 418 | $details = array( |
419 | - 1 => array ( |
|
419 | + 1 => array( |
|
420 | 420 | 'country' => 'UK', |
421 | 421 | 'assembly' => 'uk-commons', |
422 | 422 | 'location' => '– in the House of Commons' |
423 | 423 | ), |
424 | - 2 => array ( |
|
424 | + 2 => array( |
|
425 | 425 | 'country' => 'UK', |
426 | 426 | 'assembly' => 'uk-commons', |
427 | 427 | 'location' => '– in Westminster Hall' |
428 | 428 | ), |
429 | - 3 => array ( |
|
429 | + 3 => array( |
|
430 | 430 | 'country' => 'UK', |
431 | 431 | 'assembly' => 'uk-commons', |
432 | 432 | 'location' => 'written question – answered' |
433 | 433 | ), |
434 | - 4 => array ( |
|
434 | + 4 => array( |
|
435 | 435 | 'country' => 'UK', |
436 | 436 | 'assembly' => 'uk-commons', |
437 | 437 | 'location' => 'written statement – made' |
438 | 438 | ), |
439 | - 5 => array ( |
|
439 | + 5 => array( |
|
440 | 440 | 'country' => 'NORTHERN IRELAND', |
441 | 441 | 'assembly' => 'ni', |
442 | 442 | 'location' => '– in the Northern Ireland Assembly' |
443 | 443 | ), |
444 | - 6 => array ( |
|
444 | + 6 => array( |
|
445 | 445 | 'country' => 'UK', |
446 | 446 | 'assembly' => 'uk-commons', |
447 | 447 | 'location' => '– in a Public Bill Committee' |
448 | 448 | ), |
449 | - 7 => array ( |
|
449 | + 7 => array( |
|
450 | 450 | 'country' => 'SCOTLAND', |
451 | 451 | 'assembly' => 'scotland', |
452 | 452 | 'location' => '– in the Scottish Parliament' |
453 | 453 | ), |
454 | - 8 => array ( |
|
454 | + 8 => array( |
|
455 | 455 | 'country' => 'SCOTLAND', |
456 | 456 | 'assembly' => 'scotland', |
457 | 457 | 'location' => '– Scottish Parliament written question – answered' |
458 | 458 | ), |
459 | - 101 => array ( |
|
459 | + 101 => array( |
|
460 | 460 | 'country' => 'UK', |
461 | 461 | 'assembly' => 'uk-lords', |
462 | 462 | 'location' => '– in the House of Lords' |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | global $DATA, $this_page; |
472 | 472 | $this_page = $this->page_base . 'front'; |
473 | 473 | $data = array(); |
474 | - if ( $this->index_template ) { |
|
474 | + if ($this->index_template) { |
|
475 | 475 | $data['template'] = $this->index_template; |
476 | 476 | } |
477 | 477 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | $content['calendar'] = $class->display('calendar', array('months' => 1), 'none'); |
483 | 483 | |
484 | - if ( $rssurl = $DATA->page_metadata($this_page, 'rss') ) { |
|
484 | + if ($rssurl = $DATA->page_metadata($this_page, 'rss')) { |
|
485 | 485 | $content['rssurl'] = $rssurl; |
486 | 486 | } |
487 | 487 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | //$totalcomments, $comment, $commenturl |
499 | - function generate_commentteaser ($row) { |
|
499 | + function generate_commentteaser($row) { |
|
500 | 500 | // Returns HTML for the one fragment of comment and link for the sidebar. |
501 | 501 | // $totalcomments is the number of comments this item has on it. |
502 | 502 | // $comment is an array like: |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this_page = 'spwransfront'; |
22 | 22 | $data = array(); |
23 | 23 | |
24 | - $args = array( 'months' => 1 ); |
|
24 | + $args = array('months' => 1); |
|
25 | 25 | $WRANSLIST = new \SPWRANSLIST; |
26 | 26 | |
27 | 27 | $wrans = array(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | protected function getSearchSections() { |
45 | 45 | return array( |
46 | - array( 'section' => 'spwrans' ) |
|
46 | + array('section' => 'spwrans') |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
@@ -54,29 +54,29 @@ discard block |
||
54 | 54 | $SPWRANSLIST = new \SPWRANSLIST; |
55 | 55 | $gid = $SPWRANSLIST->get_gid_from_spid($spid); |
56 | 56 | if ($gid) { |
57 | - if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) { |
|
57 | + if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) { |
|
58 | 58 | $URL = new \MySociety\TheyWorkForYou\Url('spwrans'); |
59 | 59 | $URL->reset(); |
60 | - $URL->insert( array('id' => $m[1]) ); |
|
60 | + $URL->insert(array('id' => $m[1])); |
|
61 | 61 | $fragment_identifier = '#g' . $m[2]; |
62 | 62 | header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303); |
63 | 63 | exit; |
64 | - } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) { |
|
64 | + } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) { |
|
65 | 65 | $URL = new \MySociety\TheyWorkForYou\Url('spdebates'); |
66 | 66 | $URL->reset(); |
67 | - $URL->insert( array('id' => $m[1]) ); |
|
67 | + $URL->insert(array('id' => $m[1])); |
|
68 | 68 | $fragment_identifier = '#g' . $m[2]; |
69 | 69 | header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303); |
70 | 70 | exit; |
71 | 71 | } else { |
72 | - $PAGE->error_message ("Strange GID ($gid) for that Scottish Parliament ID."); |
|
72 | + $PAGE->error_message("Strange GID ($gid) for that Scottish Parliament ID."); |
|
73 | 73 | } |
74 | 74 | } |
75 | - $PAGE->error_message ("Couldn't match that Scottish Parliament ID to a GID."); |
|
75 | + $PAGE->error_message("Couldn't match that Scottish Parliament ID to a GID."); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | protected function get_question_mentions_html($row_data) { |
79 | - if( count($row_data) == 0 ) { |
|
79 | + if (count($row_data) == 0) { |
|
80 | 80 | return ''; |
81 | 81 | } |
82 | 82 | $result = ''; |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | $first_difference_output = TRUE; |
86 | 86 | // Keep the references until after the history that's in a timeline: |
87 | 87 | $references = array(); |
88 | - for( $i = 0; $i < $nrows; $i++ ) { |
|
88 | + for ($i = 0; $i < $nrows; $i++) { |
|
89 | 89 | $row = $row_data[$i]; |
90 | - if( ! $row["date"] ) { |
|
90 | + if (!$row["date"]) { |
|
91 | 91 | // If this mention isn't associated with a date, the difference won't be interesting. |
92 | 92 | $last_date = NULL; |
93 | 93 | } |
94 | 94 | $description = ''; |
95 | 95 | if ($last_date && ($last_date != $row["date"])) { |
96 | 96 | // Calculate how long the gap was in days: |
97 | - $daysdiff = (integer)((strtotime($row["date"]) - strtotime($last_date)) / 86400); |
|
97 | + $daysdiff = (integer) ((strtotime($row["date"]) - strtotime($last_date)) / 86400); |
|
98 | 98 | $daysstring = ($daysdiff == 1) ? "day" : "days"; |
99 | 99 | $further = ""; |
100 | - if( $first_difference_output ) { |
|
100 | + if ($first_difference_output) { |
|
101 | 101 | $first_difference_output = FALSE; |
102 | 102 | } else { |
103 | 103 | $further = " a further"; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $inner = "BUG: Unknown mention type $row[type]"; |
109 | 109 | $date = format_date($row['date'], SHORTDATEFORMAT); |
110 | 110 | $url = $row['url']; |
111 | - if ( strpos($url, 'business/businessBulletin') !== FALSE ) { |
|
111 | + if (strpos($url, 'business/businessBulletin') !== FALSE) { |
|
112 | 112 | $url = str_replace('www.scottish', 'archive.scottish', $url); |
113 | 113 | } |
114 | 114 | switch ($row["type"]) { |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | $inner = "Mentioned in <a class=\"debate-speech__meta__link\" href=\"$url\">tabled written questions on $date</a>"; |
123 | 123 | break; |
124 | 124 | case 4: |
125 | - if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['gid'],$m) ) { |
|
125 | + if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['gid'], $m)) { |
|
126 | 126 | $URL = new \MySociety\TheyWorkForYou\Url("spwrans"); |
127 | - $URL->insert( array('spid' => $m[1]) ); |
|
127 | + $URL->insert(array('spid' => $m[1])); |
|
128 | 128 | $relative_url = $URL->generate("none"); |
129 | 129 | $inner = "Given a <a class=\"debate-speech__meta__link\" href=\"$relative_url\">written answer on $date</a>"; |
130 | 130 | } |
@@ -133,25 +133,25 @@ discard block |
||
133 | 133 | $inner = "Given a holding answer on $date"; |
134 | 134 | break; |
135 | 135 | case 6: |
136 | - if( preg_match('/^uk.org.publicwhip\/spor\/(.*)$/',$row['mentioned_gid'],$m) ) { |
|
136 | + if (preg_match('/^uk.org.publicwhip\/spor\/(.*)$/', $row['mentioned_gid'], $m)) { |
|
137 | 137 | $URL = new \MySociety\TheyWorkForYou\Url("spdebates"); |
138 | - $URL->insert( array('id' => $m[1]) ); |
|
138 | + $URL->insert(array('id' => $m[1])); |
|
139 | 139 | $relative_url = $URL->generate("none"); |
140 | 140 | $inner = "<a href=\"$relative_url\">Asked in parliament on $date</a>"; |
141 | 141 | } |
142 | 142 | break; |
143 | 143 | case 7: |
144 | - if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['mentioned_gid'],$m) ) { |
|
144 | + if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['mentioned_gid'], $m)) { |
|
145 | 145 | $referencing_spid = $m[1]; |
146 | 146 | $URL = new \MySociety\TheyWorkForYou\Url("spwrans"); |
147 | - $URL->insert( array('spid' => $referencing_spid) ); |
|
147 | + $URL->insert(array('spid' => $referencing_spid)); |
|
148 | 148 | $relative_url = $URL->generate("none"); |
149 | 149 | $inner = "Referenced in <a href=\"$relative_url\">question $referencing_spid</a>"; |
150 | 150 | $reference = TRUE; |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | } |
154 | - if( $reference ) { |
|
154 | + if ($reference) { |
|
155 | 155 | $references[] = "\n<li>$inner."; |
156 | 156 | } else { |
157 | 157 | $result .= "\n<li class=\"link-to-hansard\">$description$inner</span>"; |
@@ -11,7 +11,8 @@ discard block |
||
11 | 11 | if ($spid = get_http_var('spid')) { |
12 | 12 | $this->spwrans_redirect($spid); |
13 | 13 | $PAGE->page_end(); |
14 | - } else { |
|
14 | + } |
|
15 | + else { |
|
15 | 16 | return parent::display(); |
16 | 17 | } |
17 | 18 | } |
@@ -61,14 +62,16 @@ discard block |
||
61 | 62 | $fragment_identifier = '#g' . $m[2]; |
62 | 63 | header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303); |
63 | 64 | exit; |
64 | - } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) { |
|
65 | + } |
|
66 | + elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) { |
|
65 | 67 | $URL = new \MySociety\TheyWorkForYou\Url('spdebates'); |
66 | 68 | $URL->reset(); |
67 | 69 | $URL->insert( array('id' => $m[1]) ); |
68 | 70 | $fragment_identifier = '#g' . $m[2]; |
69 | 71 | header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303); |
70 | 72 | exit; |
71 | - } else { |
|
73 | + } |
|
74 | + else { |
|
72 | 75 | $PAGE->error_message ("Strange GID ($gid) for that Scottish Parliament ID."); |
73 | 76 | } |
74 | 77 | } |
@@ -99,7 +102,8 @@ discard block |
||
99 | 102 | $further = ""; |
100 | 103 | if( $first_difference_output ) { |
101 | 104 | $first_difference_output = FALSE; |
102 | - } else { |
|
105 | + } |
|
106 | + else { |
|
103 | 107 | $further = " a further"; |
104 | 108 | } |
105 | 109 | $description = "\n<span class=\"question-mention-gap\">After$further $daysdiff $daysstring,</span> "; |
@@ -153,7 +157,8 @@ discard block |
||
153 | 157 | } |
154 | 158 | if( $reference ) { |
155 | 159 | $references[] = "\n<li>$inner."; |
156 | - } else { |
|
160 | + } |
|
161 | + else { |
|
157 | 162 | $result .= "\n<li class=\"link-to-hansard\">$description$inner</span>"; |
158 | 163 | $last_date = $row["date"]; |
159 | 164 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $edittext = $menudata['text']; |
50 | 50 | $edittitle = $menudata['title']; |
51 | 51 | $EDITURL = new \MySociety\TheyWorkForYou\Url('userviewself'); |
52 | - if ($this->page == 'userviewself' || $this->page == 'useredit' ) { |
|
52 | + if ($this->page == 'userviewself' || $this->page == 'useredit') { |
|
53 | 53 | $editclass = 'on'; |
54 | 54 | } else { |
55 | 55 | $editclass = ''; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // The 'Log out' link. |
59 | 59 | $menudata = $this->pagedata->page_metadata('userlogout', 'menu'); |
60 | 60 | $logouttext = $menudata['text']; |
61 | - $logouttitle= $menudata['title']; |
|
61 | + $logouttitle = $menudata['title']; |
|
62 | 62 | |
63 | 63 | $LOGOUTURL = new \MySociety\TheyWorkForYou\Url('userlogout'); |
64 | 64 | if ($this->page != 'userlogout') { |
@@ -38,7 +38,8 @@ discard block |
||
38 | 38 | //user logged in |
39 | 39 | if ($this->user->isloggedin()) { |
40 | 40 | $this->addLoggedInLinks(); |
41 | - } else { |
|
41 | + } |
|
42 | + else { |
|
42 | 43 | $this->addLoggedOutLinks(); |
43 | 44 | } |
44 | 45 | } |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | $EDITURL = new \MySociety\TheyWorkForYou\Url('userviewself'); |
52 | 53 | if ($this->page == 'userviewself' || $this->page == 'useredit' ) { |
53 | 54 | $editclass = 'on'; |
54 | - } else { |
|
55 | + } |
|
56 | + else { |
|
55 | 57 | $editclass = ''; |
56 | 58 | } |
57 | 59 | |
@@ -64,7 +66,8 @@ discard block |
||
64 | 66 | if ($this->page != 'userlogout') { |
65 | 67 | $LOGOUTURL->insert(array("ret"=>$this->returl)); |
66 | 68 | $logoutclass = ''; |
67 | - } else { |
|
69 | + } |
|
70 | + else { |
|
68 | 71 | $logoutclass = 'on'; |
69 | 72 | } |
70 | 73 | |
@@ -105,7 +108,8 @@ discard block |
||
105 | 108 | $JOINURL->insert(array("ret"=>$this->returl)); |
106 | 109 | } |
107 | 110 | $joinclass = ''; |
108 | - } else { |
|
111 | + } |
|
112 | + else { |
|
109 | 113 | $joinclass = 'on'; |
110 | 114 | } |
111 | 115 | |
@@ -127,7 +131,8 @@ discard block |
||
127 | 131 | $LOGINURL->insert(array("ret"=>$this->returl)); |
128 | 132 | } |
129 | 133 | $loginclass = ''; |
130 | - } else { |
|
134 | + } |
|
135 | + else { |
|
131 | 136 | $loginclass = 'on'; |
132 | 137 | } |
133 | 138 | |
@@ -153,7 +158,8 @@ discard block |
||
153 | 158 | $items = array('yourmp'); |
154 | 159 | if (\MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsScottish($this->user->postcode())) { |
155 | 160 | $items[] = 'yourmsp'; |
156 | - } elseif (\MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsNi($this->user->postcode())) { |
|
161 | + } |
|
162 | + elseif (\MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsNi($this->user->postcode())) { |
|
157 | 163 | $items[] = 'yourmla'; |
158 | 164 | } |
159 | 165 |
@@ -38,7 +38,8 @@ discard block |
||
38 | 38 | # Robots header |
39 | 39 | if (DEVSITE) { |
40 | 40 | $this->data['robots'] = 'noindex,nofollow'; |
41 | - } elseif ($robots = $DATA->page_metadata($this_page, 'robots')) { |
|
41 | + } |
|
42 | + elseif ($robots = $DATA->page_metadata($this_page, 'robots')) { |
|
42 | 43 | $this->data['robots'] = $robots; |
43 | 44 | } |
44 | 45 | } |
@@ -71,7 +72,8 @@ discard block |
||
71 | 72 | if ($this_page == 'overview') { |
72 | 73 | $this->data['page_title'] = $sitetitle . ': ' . $DATA->page_metadata($this_page, "title"); |
73 | 74 | |
74 | - } else { |
|
75 | + } |
|
76 | + else { |
|
75 | 77 | |
76 | 78 | if ($page_title = $DATA->page_metadata($this_page, "title")) { |
77 | 79 | $this->data['page_title'] = $page_title; |
@@ -81,13 +83,16 @@ discard block |
||
81 | 83 | |
82 | 84 | $parent_page = $DATA->page_metadata($this_page, 'parent'); |
83 | 85 | if ($parent_title = $DATA->page_metadata($parent_page, 'title')) { |
84 | - if ($this->data['page_title']) $this->data['page_title'] .= ': '; |
|
86 | + if ($this->data['page_title']) { |
|
87 | + $this->data['page_title'] .= ': '; |
|
88 | + } |
|
85 | 89 | $this->data['page_title'] .= $parent_title; |
86 | 90 | } |
87 | 91 | |
88 | 92 | if ($this->data['page_title'] == '') { |
89 | 93 | $this->data['page_title'] = $sitetitle; |
90 | - } else { |
|
94 | + } |
|
95 | + else { |
|
91 | 96 | $this->data['page_title'] .= ' - ' . $sitetitle; |
92 | 97 | } |
93 | 98 | } |
@@ -103,7 +108,9 @@ discard block |
||
103 | 108 | // Meta keywords |
104 | 109 | if (!$this->data['meta_keywords'] = $DATA->page_metadata($this_page, "meta_keywords")) { |
105 | 110 | $this->data['meta_keywords'] = $this->keywords_title; |
106 | - if ($this->data['meta_keywords']) $this->data['meta_keywords'] .= ', '; |
|
111 | + if ($this->data['meta_keywords']) { |
|
112 | + $this->data['meta_keywords'] .= ', '; |
|
113 | + } |
|
107 | 114 | $this->data['meta_keywords'] .= 'Hansard, Official Report, Parliament, government, House of Commons, House of Lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, Scottish Parliament, Northern Ireland Assembly, MSP, MLA, MSPs, MLAs'; |
108 | 115 | } |
109 | 116 | |
@@ -141,7 +148,8 @@ discard block |
||
141 | 148 | $linktitle = $nextprev[$linktype]['speaker']['name'] . ': ' . $linktitle; |
142 | 149 | } |
143 | 150 | |
144 | - } elseif (isset($nextprev[$linktype]['hdate'])) { |
|
151 | + } |
|
152 | + elseif (isset($nextprev[$linktype]['hdate'])) { |
|
145 | 153 | $linktitle = format_date($nextprev[$linktype]['hdate'], SHORTDATEFORMAT); |
146 | 154 | } |
147 | 155 | |
@@ -198,13 +206,16 @@ discard block |
||
198 | 206 | $url = new \MySociety\TheyWorkForYou\Url('hansard'); |
199 | 207 | $selected_top_link['link'] = $url->generate(); |
200 | 208 | |
201 | - } else { |
|
209 | + } |
|
210 | + else { |
|
202 | 211 | |
203 | 212 | $parents = array($parent); |
204 | 213 | $p = $parent; |
205 | 214 | while ($p) { |
206 | 215 | $p = $DATA->page_metadata($p, 'parent'); |
207 | - if ($p) $parents[] = $p; |
|
216 | + if ($p) { |
|
217 | + $parents[] = $p; |
|
218 | + } |
|
208 | 219 | } |
209 | 220 | |
210 | 221 | $top_highlight = array_pop($parents); |
@@ -213,7 +224,8 @@ discard block |
||
213 | 224 | // We're on one of the pages linked to by the bottom menu. |
214 | 225 | // So highlight it and its parent. |
215 | 226 | $bottom_highlight = $this_page; |
216 | - } else { |
|
227 | + } |
|
228 | + else { |
|
217 | 229 | // This page is not in either menu. So highlight its parent |
218 | 230 | // (in the bottom menu) and its grandparent (in the top). |
219 | 231 | $bottom_highlight = array_pop($parents); |
@@ -232,13 +244,16 @@ discard block |
||
232 | 244 | if ($top_highlight == 'hansard') { |
233 | 245 | $section = 'uk'; |
234 | 246 | $selected_top_link['text'] = 'UK'; |
235 | - } elseif ($top_highlight == 'ni_home') { |
|
247 | + } |
|
248 | + elseif ($top_highlight == 'ni_home') { |
|
236 | 249 | $section = 'ni'; |
237 | 250 | $selected_top_link['text'] = 'NORTHERN IRELAND'; |
238 | - } elseif ($top_highlight == 'sp_home') { |
|
251 | + } |
|
252 | + elseif ($top_highlight == 'sp_home') { |
|
239 | 253 | $section = 'scotland'; |
240 | 254 | $selected_top_link['text'] = 'SCOTLAND'; |
241 | - } else { |
|
255 | + } |
|
256 | + else { |
|
242 | 257 | $section = ''; |
243 | 258 | } |
244 | 259 | |
@@ -279,7 +294,9 @@ discard block |
||
279 | 294 | $menudata = $DATA->page_metadata($toppage, 'menu'); |
280 | 295 | $text = $menudata['text']; |
281 | 296 | $title = $menudata['title']; |
282 | - if (!$title) continue; |
|
297 | + if (!$title) { |
|
298 | + continue; |
|
299 | + } |
|
283 | 300 | |
284 | 301 | //get link and description for the menu ans add it to the array |
285 | 302 | $class = $toppage == $this->nav_highlights['top'] ? 'on' : ''; |