@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | include_once '../../includes/easyparliament/init.php'; |
| 4 | -include_once (INCLUDESPATH."easyparliament/commentreportlist.php"); |
|
| 4 | +include_once (INCLUDESPATH . "easyparliament/commentreportlist.php"); |
|
| 5 | 5 | |
| 6 | 6 | $this_page = "admin_home"; |
| 7 | 7 | |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE confirmed = '0'"); |
| 23 | 23 | $unconfirmedusers = $q->field(0, 'count'); |
| 24 | 24 | |
| 25 | -$olddate = gmdate("Y-m-d H:i:s", time()-86400); |
|
| 25 | +$olddate = gmdate("Y-m-d H:i:s", time() - 86400); |
|
| 26 | 26 | $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'"); |
| 27 | 27 | $dayusers = $q->field(0, 'count'); |
| 28 | 28 | |
| 29 | -$olddate = gmdate("Y-m-d H:i:s", time()-86400*7); |
|
| 29 | +$olddate = gmdate("Y-m-d H:i:s", time() - 86400 * 7); |
|
| 30 | 30 | $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'"); |
| 31 | 31 | $weekusers = $q->field(0, 'count'); |
| 32 | 32 | ?> |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $rows = array(); |
| 62 | 62 | $USERURL = new \MySociety\TheyWorkForYou\Url('userview'); |
| 63 | 63 | |
| 64 | -for ($row=0; $row<$q->rows(); $row++) { |
|
| 64 | +for ($row = 0; $row < $q->rows(); $row++) { |
|
| 65 | 65 | |
| 66 | 66 | $user_id = $q->field($row, 'user_id'); |
| 67 | 67 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $name = _htmlspecialchars($q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname')); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $rows[] = array ( |
|
| 79 | + $rows[] = array( |
|
| 80 | 80 | $name, |
| 81 | 81 | '<a href="mailto:' . $q->field($row, 'email') . '">' . $q->field($row, 'email') . '</a>', |
| 82 | 82 | $confirmed, |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | ); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | -$tabledata = array ( |
|
| 88 | - 'header' => array ( |
|
| 87 | +$tabledata = array( |
|
| 88 | + 'header' => array( |
|
| 89 | 89 | 'Name', |
| 90 | 90 | 'Email', |
| 91 | 91 | 'Confirmed?', |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $out = ''; |
| 13 | 13 | if (get_http_var('preview')) { |
| 14 | 14 | preview_featured(); |
| 15 | -} else if ( get_http_var('confirm') ) { |
|
| 15 | +} else if (get_http_var('confirm')) { |
|
| 16 | 16 | $out = update_featured(); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | print '</div>'; |
| 24 | 24 | |
| 25 | 25 | function gid_to_url($gid) { |
| 26 | - if ( !$gid ) { |
|
| 26 | + if (!$gid) { |
|
| 27 | 27 | return ''; |
| 28 | 28 | } |
| 29 | 29 | global $hansardmajors; |
| 30 | 30 | global $db; |
| 31 | 31 | |
| 32 | - $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid )); |
|
| 32 | + $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid)); |
|
| 33 | 33 | $url_gid = fix_gid_from_db($gid); |
| 34 | 34 | $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q->field(0, 'major')]['page']); |
| 35 | 35 | $url->insert(array('id' => $url_gid)); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $related = $featured->get_related(); |
| 44 | 44 | $context = $featured->get_context(); |
| 45 | 45 | |
| 46 | - if ( get_http_var('url') ) { |
|
| 46 | + if (get_http_var('url')) { |
|
| 47 | 47 | $url = get_http_var('url'); |
| 48 | 48 | $title = get_http_var('title'); |
| 49 | 49 | $context = get_http_var('context'); |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | $related_gid3 = $related3 ? get_gid_from_url($related3) : NULL; |
| 114 | 114 | |
| 115 | 115 | print "<h2>Preview Content</h2>"; |
| 116 | - if ( $gid !== NULL ) { |
|
| 116 | + if ($gid !== NULL) { |
|
| 117 | 117 | $h = new MySociety\TheyWorkForYou\Homepage; |
| 118 | - $featured = $h->getFeaturedDebate($gid, $title, $context, array( $related_gid1, $related_gid2, $related_gid3 )); |
|
| 118 | + $featured = $h->getFeaturedDebate($gid, $title, $context, array($related_gid1, $related_gid2, $related_gid3)); |
|
| 119 | 119 | |
| 120 | 120 | include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php'; |
| 121 | 121 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $parts = parse_url($url); |
| 158 | 158 | parse_str($parts['query'], $query); |
| 159 | 159 | |
| 160 | - if ( $query['id'] ) { |
|
| 160 | + if ($query['id']) { |
|
| 161 | 161 | if (strpos($parts['path'], 'lords') !== false) { |
| 162 | 162 | $gid = 'uk.org.publicwhip/lords/'; |
| 163 | 163 | } elseif (strpos($parts['path'], 'whall') !== false) { |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $anchor = '#addcomment'; |
| 21 | 21 | |
| 22 | 22 | $URL = new \MySociety\TheyWorkForYou\Url('userjoin'); |
| 23 | -$URL->insert(array('ret'=>$returl.$anchor)); |
|
| 23 | +$URL->insert(array('ret'=>$returl . $anchor)); |
|
| 24 | 24 | $joinurl = $URL->generate(); |
| 25 | 25 | |
| 26 | 26 | |
@@ -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 | ) |
@@ -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 | |
@@ -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>"; |