@@ -127,7 +127,9 @@ |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $text = $this->data['alertsearch']; |
| 130 | - if (!$text) $text = $this->data['keyword']; |
|
| 130 | + if (!$text) { |
|
| 131 | + $text = $this->data['keyword']; |
|
| 132 | + } |
|
| 131 | 133 | |
| 132 | 134 | if ($this->data['submitted'] && !$this->data['pid'] && !$text) { |
| 133 | 135 | $errors['alertsearch'] = 'Please enter what you want to be alerted about'; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | class Standard extends \MySociety\TheyWorkForYou\AlertView { |
| 13 | 13 | public $data; |
| 14 | 14 | |
| 15 | - public function __construct($THEUSER = NULL) { |
|
| 15 | + public function __construct($THEUSER = null) { |
|
| 16 | 16 | parent::__construct($THEUSER); |
| 17 | 17 | $this->data = array(); |
| 18 | 18 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | try { |
| 178 | 178 | $MEMBER = new \MEMBER(array('constituency'=>$constituency, 'house' => 1)); |
| 179 | 179 | $cons[$constituency] = $MEMBER; |
| 180 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
| 180 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
| 181 | 181 | // do nothing |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -197,17 +197,17 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | // If this goes well, the alert will be added to the database and a confirmation email |
| 199 | 199 | // will be sent to them. |
| 200 | - $success = $this->alert->add( $this->data, $confirm ); |
|
| 200 | + $success = $this->alert->add($this->data, $confirm); |
|
| 201 | 201 | |
| 202 | - if ($success>0 && !$confirm) { |
|
| 202 | + if ($success > 0 && !$confirm) { |
|
| 203 | 203 | $result = 'alert-added'; |
| 204 | - } elseif ($success>0) { |
|
| 204 | + } elseif ($success > 0) { |
|
| 205 | 205 | $result = 'alert-confirmation'; |
| 206 | 206 | } elseif ($success == -2) { |
| 207 | 207 | // we need to make sure we know that the person attempting to sign up |
| 208 | 208 | // for the alert has that email address to stop people trying to work |
| 209 | 209 | // out what alerts they are signed up to |
| 210 | - if ( $this->data['email_verified'] || ( $this->user->loggedin && $this->user->email() == $this->data['email'] ) ) { |
|
| 210 | + if ($this->data['email_verified'] || ($this->user->loggedin && $this->user->email() == $this->data['email'])) { |
|
| 211 | 211 | $result = 'alert-exists'; |
| 212 | 212 | } else { |
| 213 | 213 | // don't throw an error message as that implies that they have already signed |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | |
| 234 | 234 | private function formatSearchTerms() { |
| 235 | - if ( $this->data['alertsearch'] ) { |
|
| 235 | + if ($this->data['alertsearch']) { |
|
| 236 | 236 | $this->data['alertsearch_pretty'] = \MySociety\TheyWorkForYou\Utility\Alert::prettifyCriteria($this->data['alertsearch']); |
| 237 | 237 | $this->data['search_text'] = $this->data['alertsearch']; |
| 238 | 238 | } else { |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | private function formatSearchMemberData() { |
| 268 | - if ( isset($this->data['postcode']) ) { |
|
| 268 | + if (isset($this->data['postcode'])) { |
|
| 269 | 269 | try { |
| 270 | 270 | $postcode = $this->data['postcode']; |
| 271 | 271 | |
| 272 | - $MEMBER = new \MEMBER( array('postcode' => $postcode) ); |
|
| 272 | + $MEMBER = new \MEMBER(array('postcode' => $postcode)); |
|
| 273 | 273 | // move the postcode to the front just to be tidy |
| 274 | 274 | $tidy_alertsearch = $postcode . " " . trim(str_replace("$postcode", "", $this->data['alertsearch'])); |
| 275 | 275 | $alertsearch_display = str_replace("$postcode ", "", $tidy_alertsearch); |
@@ -278,25 +278,25 @@ discard block |
||
| 278 | 278 | $this->data['member_displaysearch'] = $alertsearch_display; |
| 279 | 279 | $this->data['member'] = $MEMBER; |
| 280 | 280 | |
| 281 | - if ( $this->data['scottish_text'] ) { |
|
| 281 | + if ($this->data['scottish_text']) { |
|
| 282 | 282 | $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($postcode); |
| 283 | - if ( isset($constituencies['SPC']) ) { |
|
| 283 | + if (isset($constituencies['SPC'])) { |
|
| 284 | 284 | $MEMBER = new \MEMBER(array('constituency' => $constituencies['SPC'], 'house' => 4)); |
| 285 | 285 | $this->data['scottish_alertsearch'] = str_replace("$postcode", "speaker:" . $MEMBER->person_id, $tidy_alertsearch); |
| 286 | 286 | $this->data['scottish_member'] = $MEMBER; |
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
| 289 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
| 290 | 290 | $this->data['member_error'] = 1; |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - if ( $this->data['pid'] ) { |
|
| 295 | - $MEMBER = new \MEMBER( array('person_id' => $this->data['pid']) ); |
|
| 294 | + if ($this->data['pid']) { |
|
| 295 | + $MEMBER = new \MEMBER(array('person_id' => $this->data['pid'])); |
|
| 296 | 296 | $this->data['pid_member'] = $MEMBER; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if ( $this->data['keyword'] ) { |
|
| 299 | + if ($this->data['keyword']) { |
|
| 300 | 300 | $this->data['display_keyword'] = \MySociety\TheyWorkForYou\Utility\Alert::prettifyCriteria($this->data['keyword']); |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | private function get_page_url() { |
| 50 | 50 | $protocol = 'https://'; |
| 51 | 51 | if (DEVSITE) { |
| 52 | - $protocol = 'http://'; |
|
| 52 | + $protocol = 'http://'; |
|
| 53 | 53 | } |
| 54 | 54 | $url = $protocol . DOMAIN; |
| 55 | 55 | if (array_key_exists('REQUEST_URI', $_SERVER)) { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if (isset($nextprev[$linktype]) && isset($nextprev[$linktype]['url'])) { |
| 136 | 136 | |
| 137 | 137 | if (isset($nextprev[$linktype]['body'])) { |
| 138 | - $linktitle = _htmlentities( trim_characters($nextprev[$linktype]['body'], 0, 40) ); |
|
| 138 | + $linktitle = _htmlentities(trim_characters($nextprev[$linktype]['body'], 0, 40)); |
|
| 139 | 139 | if (isset($nextprev[$linktype]['speaker']) && |
| 140 | 140 | count($nextprev[$linktype]['speaker']) > 0) { |
| 141 | 141 | $linktitle = $nextprev[$linktype]['speaker']['name'] . ': ' . $linktitle; |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($nextprev) { |
| 164 | 164 | // Four different kinds of back/forth links we might build. |
| 165 | - $links = array ("first", "prev", "up", "next", "last"); |
|
| 165 | + $links = array("first", "prev", "up", "next", "last"); |
|
| 166 | 166 | |
| 167 | 167 | foreach ($links as $type) { |
| 168 | - if ( $link = $this->generate_next_prev_link( $nextprev, $type ) ) { |
|
| 168 | + if ($link = $this->generate_next_prev_link($nextprev, $type)) { |
|
| 169 | 169 | |
| 170 | 170 | $this->data['header_links'][] = $link; |
| 171 | 171 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | // Page names mapping to those in metadata.php. |
| 259 | 259 | // Links in the top menu, and the sublinks we see if |
| 260 | 260 | // we're within that section. |
| 261 | - $nav_items = array ( |
|
| 261 | + $nav_items = array( |
|
| 262 | 262 | array('home'), |
| 263 | 263 | array('hansard', 'mps', 'peers', 'alldebatesfront', 'wranswmsfront', 'pbc_front', 'divisions_recent', 'calendar_summary'), |
| 264 | 264 | array('sp_home', 'spoverview', 'msps', 'spdebatesfront', 'spwransfront'), |
@@ -81,7 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $parent_page = $DATA->page_metadata($this_page, 'parent'); |
| 83 | 83 | if ($parent_title = $DATA->page_metadata($parent_page, 'title')) { |
| 84 | - if ($this->data['page_title']) $this->data['page_title'] .= ': '; |
|
| 84 | + if ($this->data['page_title']) { |
|
| 85 | + $this->data['page_title'] .= ': '; |
|
| 86 | + } |
|
| 85 | 87 | $this->data['page_title'] .= $parent_title; |
| 86 | 88 | } |
| 87 | 89 | |
@@ -103,7 +105,9 @@ discard block |
||
| 103 | 105 | // Meta keywords |
| 104 | 106 | if (!$this->data['meta_keywords'] = $DATA->page_metadata($this_page, "meta_keywords")) { |
| 105 | 107 | $this->data['meta_keywords'] = $this->keywords_title; |
| 106 | - if ($this->data['meta_keywords']) $this->data['meta_keywords'] .= ', '; |
|
| 108 | + if ($this->data['meta_keywords']) { |
|
| 109 | + $this->data['meta_keywords'] .= ', '; |
|
| 110 | + } |
|
| 107 | 111 | $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 | 112 | } |
| 109 | 113 | |
@@ -204,7 +208,9 @@ discard block |
||
| 204 | 208 | $p = $parent; |
| 205 | 209 | while ($p) { |
| 206 | 210 | $p = $DATA->page_metadata($p, 'parent'); |
| 207 | - if ($p) $parents[] = $p; |
|
| 211 | + if ($p) { |
|
| 212 | + $parents[] = $p; |
|
| 213 | + } |
|
| 208 | 214 | } |
| 209 | 215 | |
| 210 | 216 | $top_highlight = array_pop($parents); |
@@ -279,7 +285,9 @@ discard block |
||
| 279 | 285 | $menudata = $DATA->page_metadata($toppage, 'menu'); |
| 280 | 286 | $text = $menudata['text']; |
| 281 | 287 | $title = $menudata['title']; |
| 282 | - if (!$title) continue; |
|
| 288 | + if (!$title) { |
|
| 289 | + continue; |
|
| 290 | + } |
|
| 283 | 291 | |
| 284 | 292 | //get link and description for the menu ans add it to the array |
| 285 | 293 | $class = $toppage == $this->nav_highlights['top'] ? 'on' : ''; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public $data; |
| 16 | 16 | |
| 17 | - private $about_links = array ('help', 'about', 'linktous', 'houserules', 'blog', 'news', 'contact', 'privacy'); |
|
| 17 | + private $about_links = array('help', 'about', 'linktous', 'houserules', 'blog', 'news', 'contact', 'privacy'); |
|
| 18 | 18 | private $assemblies_links = array('hansard', 'sp_home', 'ni_home', 'wales_home'); |
| 19 | 19 | private $international_links = array('newzealand', 'australia', 'ireland', 'mzalendo'); |
| 20 | 20 | private $tech_links = array('code', 'api', 'data', 'pombola', 'devmailinglist', 'irc'); |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->data = array(); |
| 30 | 30 | |
| 31 | - $this->data['about'] = $this->get_menu_links( $this->about_links ); |
|
| 32 | - $this->data['assemblies'] = $this->get_menu_links( $this->assemblies_links ); |
|
| 33 | - $this->data['international'] = $this->get_menu_links( $this->international_links ); |
|
| 34 | - $this->data['tech'] = $this->get_menu_links( $this->tech_links ); |
|
| 31 | + $this->data['about'] = $this->get_menu_links($this->about_links); |
|
| 32 | + $this->data['assemblies'] = $this->get_menu_links($this->assemblies_links); |
|
| 33 | + $this->data['international'] = $this->get_menu_links($this->international_links); |
|
| 34 | + $this->data['tech'] = $this->get_menu_links($this->tech_links); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | public $source; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * To String |
|
| 23 | - * |
|
| 24 | - * Return the office title as a string. |
|
| 25 | - * |
|
| 26 | - * @return string The title of the office, or "Unnamed Office" |
|
| 27 | - */ |
|
| 22 | + * To String |
|
| 23 | + * |
|
| 24 | + * Return the office title as a string. |
|
| 25 | + * |
|
| 26 | + * @return string The title of the office, or "Unnamed Office" |
|
| 27 | + */ |
|
| 28 | 28 | |
| 29 | 29 | public function __toString() { |
| 30 | 30 | if (isset ($this->title)){ |
@@ -35,25 +35,25 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Pretty Dates |
|
| 39 | - * |
|
| 40 | - * Return a string containing prettified dates of this office. |
|
| 41 | - * |
|
| 42 | - * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the |
|
| 43 | - * old selctee/privsec pages on parliament.uk (you can see this in |
|
| 44 | - * cmpages/chgpages' privsec0001_2004-06-08.html and |
|
| 45 | - * selctee0001_2004-06-08.html). So if the date is those dates for those two |
|
| 46 | - * things, you don't want to display it because it's not a known start date, |
|
| 47 | - * it could have been before that date. 2005-11-10 is because the PPS changes |
|
| 48 | - * did not all happen on that date but the website did not update until that |
|
| 49 | - * date so it outputs "before" in either from/to date in that case. |
|
| 50 | - * 2009-01-16 is the last date before the page disappeared off parliament.uk |
|
| 51 | - * entirely so that displays that fact that after then we don't know. |
|
| 52 | - * |
|
| 53 | - * @todo https://github.com/mysociety/theyworkforyou/issues/632 |
|
| 54 | - * |
|
| 55 | - * @return string The dates of this office in a readable form. |
|
| 56 | - */ |
|
| 38 | + * Pretty Dates |
|
| 39 | + * |
|
| 40 | + * Return a string containing prettified dates of this office. |
|
| 41 | + * |
|
| 42 | + * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the |
|
| 43 | + * old selctee/privsec pages on parliament.uk (you can see this in |
|
| 44 | + * cmpages/chgpages' privsec0001_2004-06-08.html and |
|
| 45 | + * selctee0001_2004-06-08.html). So if the date is those dates for those two |
|
| 46 | + * things, you don't want to display it because it's not a known start date, |
|
| 47 | + * it could have been before that date. 2005-11-10 is because the PPS changes |
|
| 48 | + * did not all happen on that date but the website did not update until that |
|
| 49 | + * date so it outputs "before" in either from/to date in that case. |
|
| 50 | + * 2009-01-16 is the last date before the page disappeared off parliament.uk |
|
| 51 | + * entirely so that displays that fact that after then we don't know. |
|
| 52 | + * |
|
| 53 | + * @todo https://github.com/mysociety/theyworkforyou/issues/632 |
|
| 54 | + * |
|
| 55 | + * @return string The dates of this office in a readable form. |
|
| 56 | + */ |
|
| 57 | 57 | |
| 58 | 58 | public function pretty_dates() { |
| 59 | 59 | |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | $output = ''; |
| 65 | 65 | |
| 66 | 66 | if ( |
| 67 | - !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') AND |
|
| 67 | + !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') and |
|
| 68 | 68 | !($this->source == 'chgpages/privsec' && $this->from_date == '2004-05-13') |
| 69 | 69 | ) { |
| 70 | 70 | if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | public function __toString() { |
| 30 | - if (isset ($this->title)){ |
|
| 30 | + if (isset ($this->title)) { |
|
| 31 | 31 | return (string) $this->title; |
| 32 | 32 | } else { |
| 33 | 33 | return 'Unnamed Office'; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') { |
| 71 | 71 | $output .= 'before '; |
| 72 | 72 | } |
| 73 | - $output .= format_date($this->from_date,SHORTDATEFORMAT) . ' '; |
|
| 73 | + $output .= format_date($this->from_date, SHORTDATEFORMAT) . ' '; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $output .= 'to '; |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | public function __toString() { |
| 30 | - if (isset ($this->title)){ |
|
| 30 | + if (isset ($this->title)) { |
|
| 31 | 31 | return (string) $this->title; |
| 32 | 32 | } else { |
| 33 | 33 | return 'Unnamed Office'; |
@@ -141,7 +141,9 @@ |
||
| 141 | 141 | |
| 142 | 142 | private function find_members() { |
| 143 | 143 | $searchstring = trim(preg_replace('#-?[a-z]+:[a-z0-9]+#', '', $this->searchstring)); |
| 144 | - if (!$searchstring) return array(); |
|
| 144 | + if (!$searchstring) { |
|
| 145 | + return array(); |
|
| 146 | + } |
|
| 145 | 147 | |
| 146 | 148 | $members = array(); |
| 147 | 149 | |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $o = get_http_var('o'); |
| 15 | - $args = array ( |
|
| 15 | + $args = array( |
|
| 16 | 16 | 's' => $this->searchstring, |
| 17 | 17 | 'p' => $pagenum, |
| 18 | 18 | 'num' => get_http_var('num'), |
| 19 | 19 | 'pop' => get_http_var('pop'), |
| 20 | - 'o' => ($o=='d' || $o=='r' || $o=='o') ? $o : 'd', |
|
| 20 | + 'o' => ($o == 'd' || $o == 'r' || $o == 'o') ? $o : 'd', |
|
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | return $args; |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $sort_order = 'newest'; |
| 58 | - if ( $args['o'] == 'o' ) { |
|
| 58 | + if ($args['o'] == 'o') { |
|
| 59 | 59 | $sort_order = 'oldest'; |
| 60 | - } else if ( $args['o'] == 'r' ) { |
|
| 60 | + } else if ($args['o'] == 'r') { |
|
| 61 | 61 | $sort_order = 'relevance'; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | return array('error' => $SEARCHENGINE->error); |
| 74 | 74 | } else { |
| 75 | 75 | $LIST = new \HANSARDLIST(); |
| 76 | - $data = $LIST->display('search', $args , 'none'); |
|
| 76 | + $data = $LIST->display('search', $args, 'none'); |
|
| 77 | 77 | $data['search_type'] = 'normal'; |
| 78 | 78 | $data['sort_order'] = $sort_order; |
| 79 | 79 | $data['members'] = $members; |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - list ($constituencies, ) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm); |
|
| 96 | + list ($constituencies,) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm); |
|
| 97 | 97 | |
| 98 | 98 | $constituency = ""; |
| 99 | - if (count($constituencies)==1) { |
|
| 99 | + if (count($constituencies) == 1) { |
|
| 100 | 100 | $constituency = $constituencies[0]; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1)); |
| 114 | 114 | $cons[] = $MEMBER; |
| 115 | - if ( $MEMBER->current_member(1) ) { |
|
| 115 | + if ($MEMBER->current_member(1)) { |
|
| 116 | 116 | $mp_types['mp']++; |
| 117 | 117 | } else { |
| 118 | 118 | $mp_types['former']++; |
| 119 | 119 | } |
| 120 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
| 120 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
| 121 | 121 | $cons = array(); |
| 122 | 122 | } |
| 123 | 123 | } elseif (count($constituencies)) { |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | try { |
| 126 | 126 | $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1)); |
| 127 | 127 | $cons[] = $MEMBER; |
| 128 | - if ( $MEMBER->current_member(1) ) { |
|
| 128 | + if ($MEMBER->current_member(1)) { |
|
| 129 | 129 | $mp_types['mp']++; |
| 130 | 130 | } else { |
| 131 | 131 | $mp_types['former']++; |
| 132 | 132 | } |
| 133 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
| 133 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
| 134 | 134 | continue; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $link = array( |
| 202 | 202 | 'url' => $url->generate(), |
| 203 | 203 | 'page' => $n, |
| 204 | - 'current' => ( $n == $data['page'] ) |
|
| 204 | + 'current' => ($n == $data['page']) |
|
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | 207 | $links[] = $link; |
@@ -242,27 +242,27 @@ discard block |
||
| 242 | 242 | $numlinks = $this->generate_pagination_links($data, $URL, $firstpage, $lastpage); |
| 243 | 243 | |
| 244 | 244 | $pagelinks['nums'] = $numlinks; |
| 245 | - $pagelinks['first_result'] = $page == 1 ? 1 : ( ( $page - 1 ) * $results_per_page ) + 1; |
|
| 246 | - $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ( $results_per_page - 1 ); |
|
| 245 | + $pagelinks['first_result'] = $page == 1 ? 1 : (($page - 1) * $results_per_page) + 1; |
|
| 246 | + $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ($results_per_page - 1); |
|
| 247 | 247 | |
| 248 | - if ( $page != 1 ) { |
|
| 248 | + if ($page != 1) { |
|
| 249 | 249 | $prev_page = $page - 1; |
| 250 | - $URL->insert(array( 'p' => $prev_page ) ); |
|
| 250 | + $URL->insert(array('p' => $prev_page)); |
|
| 251 | 251 | $pagelinks['prev'] = array( |
| 252 | 252 | 'url' => $URL->generate() |
| 253 | 253 | ); |
| 254 | - $URL->insert(array( 'p' => 1 ) ); |
|
| 254 | + $URL->insert(array('p' => 1)); |
|
| 255 | 255 | $pagelinks['firstpage'] = array( |
| 256 | 256 | 'url' => $URL->generate() |
| 257 | 257 | ); |
| 258 | 258 | } |
| 259 | 259 | if ($page != $numpages) { |
| 260 | 260 | $next_page = $page + 1; |
| 261 | - $URL->insert(array( 'p' => $next_page ) ); |
|
| 261 | + $URL->insert(array('p' => $next_page)); |
|
| 262 | 262 | $pagelinks['next'] = array( |
| 263 | 263 | 'url' => $URL->generate() |
| 264 | 264 | ); |
| 265 | - $URL->insert(array( 'p' => $numpages ) ); |
|
| 265 | + $URL->insert(array('p' => $numpages)); |
|
| 266 | 266 | $pagelinks['lastpage'] = array( |
| 267 | 267 | 'url' => $URL->generate() |
| 268 | 268 | ); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $links['rss'] = $DATA->page_metadata($this_page, 'rss'); |
| 280 | 280 | |
| 281 | 281 | if ($SEARCHENGINE) { |
| 282 | - $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch='.urlencode($this->searchstring) : ''); |
|
| 282 | + $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch=' . urlencode($this->searchstring) : ''); |
|
| 283 | 283 | $links['email_desc'] = $SEARCHENGINE->query_description_long(); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $search_engine = new \SEARCHENGINE($filter_ss); |
| 294 | 294 | $links['email_section'] = $links['email']; |
| 295 | 295 | $links['email_desc_section'] = $links['email_desc']; |
| 296 | - $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch='.urlencode($filter_ss) : ''); |
|
| 296 | + $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch=' . urlencode($filter_ss) : ''); |
|
| 297 | 297 | $links['email_desc'] = $search_engine->query_description_long(); |
| 298 | 298 | } |
| 299 | 299 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | protected function getSearchSections() { |
| 26 | 26 | return array( |
| 27 | - array( 'section' => 'sp' ) |
|
| 27 | + array('section' => 'sp') |
|
| 28 | 28 | ); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | protected function display_front() { |
| 14 | 14 | global $DATA, $this_page; |
| 15 | - if ( get_http_var('type') == 'wrans') { |
|
| 15 | + if (get_http_var('type') == 'wrans') { |
|
| 16 | 16 | return parent::display_front(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | $data = array(); |
| 20 | 20 | |
| 21 | - $args = array( 'months' => 1 ); |
|
| 21 | + $args = array('months' => 1); |
|
| 22 | 22 | $WRANSLIST = new \WRANSLIST; |
| 23 | 23 | |
| 24 | 24 | $wrans = array(); |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function getSearchSections() { |
| 52 | 52 | $sections = array( |
| 53 | - array( 'section' => 'wrans', 'title' => 'Written Answers' ), |
|
| 53 | + array('section' => 'wrans', 'title' => 'Written Answers'), |
|
| 54 | 54 | ); |
| 55 | - if ( get_http_var('type') == '') { |
|
| 56 | - $sections[] = array( 'section' => 'wms', 'title' => 'Written Ministerial Statements' ); |
|
| 55 | + if (get_http_var('type') == '') { |
|
| 56 | + $sections[] = array('section' => 'wms', 'title' => 'Written Ministerial Statements'); |
|
| 57 | 57 | } |
| 58 | 58 | return $sections; |
| 59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | # speech bar the first (assuming that's the question) |
| 63 | 63 | private $votelinks_so_far = 0; |
| 64 | 64 | |
| 65 | - protected function generate_votes ($votes, $id, $gid) { |
|
| 65 | + protected function generate_votes($votes, $id, $gid) { |
|
| 66 | 66 | /* |
| 67 | 67 | Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar. |
| 68 | 68 | $votes = => array ( |
@@ -19,7 +19,9 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function fromTimestamp($videodb, $date, $time) { |
| 22 | - if (!$videodb) return null; |
|
| 22 | + if (!$videodb) { |
|
| 23 | + return null; |
|
| 24 | + } |
|
| 23 | 25 | date_default_timezone_set('Europe/London'); |
| 24 | 26 | $epoch = strtotime("$date $time"); |
| 25 | 27 | $timestamp = gmdate('c', $epoch); |
@@ -38,9 +40,13 @@ discard block |
||
| 38 | 40 | |
| 39 | 41 | public static function object($video_id, $start, $gid, $stamping = '', $pid = 0) { |
| 40 | 42 | $flashvars = "gid=$gid&file=$video_id&start=$start"; |
| 41 | - if ($stamping) $flashvars .= '&stamping=1'; |
|
| 42 | - if ($pid) $flashvars .= '&pid=' . $pid; |
|
| 43 | -/* |
|
| 43 | + if ($stamping) { |
|
| 44 | + $flashvars .= '&stamping=1'; |
|
| 45 | + } |
|
| 46 | + if ($pid) { |
|
| 47 | + $flashvars .= '&pid=' . $pid; |
|
| 48 | + } |
|
| 49 | + /* |
|
| 44 | 50 | <object width='360' height='300' |
| 45 | 51 | classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' |
| 46 | 52 | codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'> |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 14 | public static function dbConnect() { |
| 15 | - $connstr = 'host='.OPTION_BBC_DB_HOST.' port='.OPTION_BBC_DB_PORT.' dbname='.OPTION_BBC_DB_NAME.' user='.OPTION_BBC_DB_USER.' password='.OPTION_BBC_DB_PASS; |
|
| 15 | + $connstr = 'host=' . OPTION_BBC_DB_HOST . ' port=' . OPTION_BBC_DB_PORT . ' dbname=' . OPTION_BBC_DB_NAME . ' user=' . OPTION_BBC_DB_USER . ' password=' . OPTION_BBC_DB_PASS; |
|
| 16 | 16 | $videodb = pg_connect($connstr); |
| 17 | 17 | |
| 18 | 18 | return $videodb; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | public function getSetDescriptions() { |
| 312 | - return $this->set_descs; |
|
| 312 | + return $this->set_descs; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -397,18 +397,18 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | public function limitToArray($policies) { |
| 400 | - $out = array(); |
|
| 401 | - // Reassemble the new policies list based on the set. |
|
| 402 | - foreach ($policies as $policy) { |
|
| 403 | - if (isset($this->policies[$policy])) { |
|
| 404 | - $out[$policy] = $this->policies[$policy]; |
|
| 405 | - } |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - $new_policies = new self(); |
|
| 409 | - $new_policies->policies = $out; |
|
| 410 | - |
|
| 411 | - return $new_policies; |
|
| 400 | + $out = array(); |
|
| 401 | + // Reassemble the new policies list based on the set. |
|
| 402 | + foreach ($policies as $policy) { |
|
| 403 | + if (isset($this->policies[$policy])) { |
|
| 404 | + $out[$policy] = $this->policies[$policy]; |
|
| 405 | + } |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + $new_policies = new self(); |
|
| 409 | + $new_policies->policies = $out; |
|
| 410 | + |
|
| 411 | + return $new_policies; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | public function getPolicyDetails($policyID) { |
@@ -293,7 +293,7 @@ |
||
| 293 | 293 | |
| 294 | 294 | private $policy_id; |
| 295 | 295 | |
| 296 | - public function __construct($policy_id = NULL) { |
|
| 296 | + public function __construct($policy_id = null) { |
|
| 297 | 297 | $this->db = new \ParlDB; |
| 298 | 298 | |
| 299 | 299 | if ( $policy_id ) { |
@@ -366,14 +366,12 @@ |
||
| 366 | 366 | public function limitToSet($set) { |
| 367 | 367 | |
| 368 | 368 | // Sanity check the set exists |
| 369 | - if (isset($this->sets[$set])) |
|
| 370 | - { |
|
| 369 | + if (isset($this->sets[$set])) { |
|
| 371 | 370 | $out = array(); |
| 372 | 371 | // Reassemble the new policies list based on the set. |
| 373 | 372 | foreach ($this->sets[$set] as $set_policy) |
| 374 | 373 | { |
| 375 | - if (isset($this->policies[$set_policy])) |
|
| 376 | - { |
|
| 374 | + if (isset($this->policies[$set_policy])) { |
|
| 377 | 375 | $out[$set_policy] = $this->policies[$set_policy]; |
| 378 | 376 | } else { |
| 379 | 377 | // if we've limited the policies to a single one then we only |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | public function __construct($policy_id = NULL) { |
| 303 | 303 | $this->db = new \ParlDB; |
| 304 | 304 | |
| 305 | - if ( $policy_id ) { |
|
| 305 | + if ($policy_id) { |
|
| 306 | 306 | $this->policy_id = $policy_id; |
| 307 | 307 | $this->policies = array( |
| 308 | 308 | $policy_id => $this->policies[$policy_id] |
@@ -386,8 +386,8 @@ discard block |
||
| 386 | 386 | // want to complain here if we're looking for that policy and |
| 387 | 387 | // it does not exist. Otherwise, if the single policy isn't in |
| 388 | 388 | // the set we want to return an empty set |
| 389 | - if ( !isset($this->policy_id) || $set_policy == $this->policy_id ) { |
|
| 390 | - throw new \Exception ('Policy ' . $set_policy . ' in set "' . $set . '" does not exist.'); |
|
| 389 | + if (!isset($this->policy_id) || $set_policy == $this->policy_id) { |
|
| 390 | + throw new \Exception('Policy ' . $set_policy . ' in set "' . $set . '" does not exist.'); |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | return $new_policies; |
| 399 | 399 | |
| 400 | 400 | } else { |
| 401 | - throw new \Exception ('Policy set "' . $set . '" does not exist.'); |
|
| 401 | + throw new \Exception('Policy set "' . $set . '" does not exist.'); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | $image = $q['image']; |
| 441 | 441 | |
| 442 | - if ( $image && file_exists(BASEDIR . '/' . $image)) { |
|
| 442 | + if ($image && file_exists(BASEDIR . '/' . $image)) { |
|
| 443 | 443 | $props['image'] = $image; |
| 444 | 444 | $props['image_license'] = $q['image_license']; |
| 445 | 445 | $props['image_attribution'] = $q['image_attrib']; |