@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | <meta property="og:site_name" content="TheyWorkForYou"> |
21 | 21 | <meta property="og:url" content="<?= _htmlentities($page_url) ?>"> |
22 | - <meta property="og:title" content="<?= strip_tags( $og_title ?: $page_title ) ?>"> |
|
22 | + <meta property="og:title" content="<?= strip_tags($og_title ?: $page_title) ?>"> |
|
23 | 23 | <meta property="og:type" content="website"> |
24 | 24 | |
25 | 25 | <meta name="twitter:card" content="summary_large_image"> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | <body> |
79 | 79 | |
80 | - <?php if ( $banner_text ) { ?> |
|
80 | + <?php if ($banner_text) { ?> |
|
81 | 81 | <div class="banner"> |
82 | 82 | <div class="full-page__row"> |
83 | 83 | <div class="banner__content"> |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | <div class="site-nav__user"> |
154 | 154 | <ul> |
155 | - <?php foreach ($user_nav_links as $nav_link){ ?> |
|
155 | + <?php foreach ($user_nav_links as $nav_link) { ?> |
|
156 | 156 | <li><a href="<?= $nav_link['href']; ?>" title="<?= $nav_link['title']; ?>" class="<?= $nav_link['classes']; ?>"> |
157 | 157 | <?= $nav_link['text'] ?> |
158 | 158 | </a></li> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | <div class="full-page legacy-page static-page"> |
187 | 187 | <div class="full-page__row"> |
188 | 188 | <div class="panel"> |
189 | - <?php foreach ( $page_errors as $error ) { ?> |
|
189 | + <?php foreach ($page_errors as $error) { ?> |
|
190 | 190 | <p><?= $error['text'] ?></p> |
191 | 191 | <?php } ?> |
192 | 192 | </div> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | foreach ($data['order'] as &$chamber) { |
79 | 79 | if (in_array($chamber['major'] ?? 0, $majors)) { |
80 | 80 | $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$chamber['major']]['page_all']); |
81 | - $URL->insert( array( 'd' => $date ) ); |
|
81 | + $URL->insert(array('d' => $date)); |
|
82 | 82 | $chamber['url'] = $URL->generate(); |
83 | 83 | } |
84 | 84 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | list($firstyear, $firstmonth, $day) = explode('-', $min_future_date); |
108 | 108 | list($finalyear, $finalmonth, $day) = explode('-', $max_future_date); |
109 | 109 | |
110 | - $q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future |
|
110 | + $q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future |
|
111 | 111 | WHERE event_date >= :firstdate |
112 | 112 | AND event_date <= :finaldate |
113 | 113 | AND deleted = 0 |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | public function update_email($email) { |
136 | - $this->update_customer([ 'email' => $email ]); |
|
136 | + $this->update_customer(['email' => $email]); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | public function update_payment_method($payment_method) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $error = 'Sorry, we could not process your payment, please try again. '; |
164 | 164 | $error .= 'Our payment processor returned: ' . $err['message']; |
165 | 165 | unset($_POST['stripeToken']); # So card form is shown again |
166 | - return [ $error ]; |
|
166 | + return [$error]; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | $customer = $obj->id; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | WHERE event_date >= :date |
26 | 26 | AND deleted = 0 |
27 | 27 | ORDER BY event_date, chamber, pos", |
28 | - array( ':date' => $date ) |
|
28 | + array(':date' => $date) |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | return self::tidyData($q); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $title = $e['title']; |
118 | 118 | if ($pids = $e['person_id']) { |
119 | 119 | foreach ($pids as $pid) { |
120 | - $MEMBER = new \MEMBER(array( 'person_id' => $pid )); |
|
120 | + $MEMBER = new \MEMBER(array('person_id' => $pid)); |
|
121 | 121 | $name = $MEMBER->full_name(); |
122 | 122 | $title .= " – <a href='/mp/?p=$pid'>$name</a>"; |
123 | 123 | } |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | $gid = $featured->get_gid(); |
60 | 60 | $gidCheck = new Gid($gid); |
61 | 61 | $gid = $gidCheck->checkForRedirect(); |
62 | - if ( $gid ) { |
|
62 | + if ($gid) { |
|
63 | 63 | $title = $featured->get_title(); |
64 | 64 | $context = $featured->get_context(); |
65 | 65 | $related = $featured->get_related(); |
66 | 66 | $item = $this->getFeaturedDebate($gid, $title, $context, $related); |
67 | 67 | } else { |
68 | 68 | $item = $debatelist->display('recent_debates', array('days' => 7, 'num' => 1), 'none'); |
69 | - if ( isset($item['data']) && count($item['data']) ) { |
|
69 | + if (isset($item['data']) && count($item['data'])) { |
|
70 | 70 | $item = $item['data'][0]; |
71 | 71 | $more_url = new Url('debates'); |
72 | 72 | $item['more_url'] = $more_url->generate(); |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | $item['featured'] = true; |
98 | 98 | |
99 | 99 | $related_debates = array(); |
100 | - foreach ( $related as $related_gid ) { |
|
101 | - if ( $related_gid ) { |
|
100 | + foreach ($related as $related_gid) { |
|
101 | + if ($related_gid) { |
|
102 | 102 | $related_item = $debatelist->display('featured_gid', array('gid' => $related_gid), 'none'); |
103 | 103 | $related_debates[] = $related_item['data']; |
104 | 104 | } |
@@ -128,21 +128,21 @@ discard block |
||
128 | 128 | |
129 | 129 | $recent_content = array(); |
130 | 130 | |
131 | - foreach ( $this->recent_types as $class => $recent ) { |
|
131 | + foreach ($this->recent_types as $class => $recent) { |
|
132 | 132 | $class = "\\$class"; |
133 | 133 | $instance = new $class(); |
134 | 134 | $more_url = new Url($recent[1]); |
135 | - if ( $recent[0] == 'recent_pbc_debates' ) { |
|
136 | - $content = array( 'data' => $instance->display($recent[0], array('num' => 5), 'none') ); |
|
135 | + if ($recent[0] == 'recent_pbc_debates') { |
|
136 | + $content = array('data' => $instance->display($recent[0], array('num' => 5), 'none')); |
|
137 | 137 | } else { |
138 | 138 | $content = $instance->display($recent[0], array('days' => 7, 'num' => 1), 'none'); |
139 | - if ( isset($content['data']) && count($content['data']) ) { |
|
139 | + if (isset($content['data']) && count($content['data'])) { |
|
140 | 140 | $content = $content['data'][0]; |
141 | 141 | } else { |
142 | 142 | $content = array(); |
143 | 143 | } |
144 | 144 | } |
145 | - if ( $content ) { |
|
145 | + if ($content) { |
|
146 | 146 | $content['more_url'] = $more_url->generate(); |
147 | 147 | $content['desc'] = $recent[2]; |
148 | 148 | $recent_content[] = $content; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | <div class="panel panel--flushtop clearfix"> |
49 | 49 | <div class="row nested-row"> |
50 | 50 | <div class="homepage-in-the-news homepage-content-section"> |
51 | - <?php if ( count($featured) > 0 ) { |
|
51 | + <?php if (count($featured) > 0) { |
|
52 | 52 | include 'homepage/featured.php'; |
53 | 53 | } else { ?> |
54 | 54 | No debates found. |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | |
114 | 114 | <h2>Recently in Parliament</h2> |
115 | 115 | <ul class="recently__list"><?php |
116 | - foreach ( $debates['recent'] as $recent ) { |
|
116 | + foreach ($debates['recent'] as $recent) { |
|
117 | 117 | include 'homepage/recent-debates.php'; |
118 | 118 | } |
119 | 119 | ?></ul> |
120 | 120 | </div> |
121 | 121 | <div class="homepage-upcoming homepage-content-section"> |
122 | 122 | <h2>Upcoming</h2> |
123 | - <?php if ( count($calendar) ) { ?> |
|
123 | + <?php if (count($calendar)) { ?> |
|
124 | 124 | <div class="upcoming__controls"> |
125 | 125 | <!-- |
126 | 126 | These controls should make the upcoming section slide to the next day. |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | </div> |
140 | 140 | </div> |
141 | 141 | <?php $first = true; $count = 0; |
142 | - foreach ( $calendar as $date => $places ) { |
|
142 | + foreach ($calendar as $date => $places) { |
|
143 | 143 | $count++; ?> |
144 | 144 | <div class="cal-wrapper <?= $first ? 'visible' : 'hidden' ?>" id="day-<?= $count ?>" data-count="<?= $count ?>" data-date="<?= format_date($date, SHORTDATEFORMAT); ?>"> |
145 | 145 | <?php foreach ($places as $place => $events) { ?> |
146 | 146 | <?php $first = false; ?> |
147 | 147 | <h3><?= $place ?></h3> |
148 | 148 | <ul class="upcoming__list"> |
149 | - <?php for ( $i = 0; $i < 3; $i++ ) { |
|
150 | - if ( isset( $events[$i] ) ) { |
|
149 | + <?php for ($i = 0; $i < 3; $i++) { |
|
150 | + if (isset($events[$i])) { |
|
151 | 151 | list($event_title, $meta_items) = MySociety\TheyWorkForYou\Utility\Calendar::meta($events[$i]); |
152 | 152 | ?> |
153 | 153 | <li> |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | <?php } ?> |
158 | 158 | <?php } ?> |
159 | 159 | </ul> |
160 | - <?php if ( count($events) - 3 > 0 ) { ?> |
|
160 | + <?php if (count($events) - 3 > 0) { ?> |
|
161 | 161 | <a href="/calendar/?d=<?= format_date($date, 'Y-m-d') ?>" class="upcoming__more">And <?= count($events) - 3 ?> more</a><!-- (just links to relevant upcoming page) --> |
162 | 162 | <?php } ?> |
163 | 163 | <?php } ?> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <?php } ?> |
166 | 166 | <?php } else { |
167 | 167 | list($recess, $from, $to) = recess_prettify(date('j'), date('n'), date('Y'), 1); |
168 | - if ( $recess ) { ?> |
|
168 | + if ($recess) { ?> |
|
169 | 169 | <p> |
170 | 170 | Parliament is on holiday until <?= format_date($to, LONGERDATEFORMAT) ?>. |
171 | 171 | Follow us on <a href="https://twitter.com/theyworkforyou">Twitter</a> and you'll |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | foreach ($data['parameters'] as $parameter) { |
48 | 48 | if ($q_param = trim(get_http_var($parameter))) { |
49 | 49 | $match++; |
50 | - include_once 'api_'. $method . '.php'; |
|
50 | + include_once 'api_' . $method . '.php'; |
|
51 | 51 | api_call_user_func_or_error('api_' . $method . '_' . $parameter, array($q_param), 'API call not yet functional', 'api'); |
52 | 52 | break; |
53 | 53 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | api_error('No parameter provided to function "' . |
58 | 58 | _htmlspecialchars($q_method) . |
59 | 59 | '". Possible choices are: ' . |
60 | - join(', ', $data['parameters']) ); |
|
60 | + join(', ', $data['parameters'])); |
|
61 | 61 | } else { |
62 | - include_once 'api_'. $method . '.php'; |
|
62 | + include_once 'api_' . $method . '.php'; |
|
63 | 63 | api_call_user_func_or_error('api_' . $method, array(), 'API call not yet functional', 'api'); |
64 | 64 | break; |
65 | 65 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $DATA->set_page_metadata($this_page, 'title', "$method function"); |
99 | 99 | $PAGE->page_start(); |
100 | 100 | $PAGE->stripe_start(); |
101 | - include_once 'api_'. $method . '.php'; |
|
101 | + include_once 'api_' . $method . '.php'; |
|
102 | 102 | print '<p align="center"><strong>https://www.theyworkforyou.com/api/' . $method . '</strong></p>'; |
103 | 103 | api_call_user_func_or_error('api_' . $method . '_front', array(), 'No documentation yet', 'html'); |
104 | 104 | if ($method != 'getQuota') { |
@@ -119,22 +119,22 @@ discard block |
||
119 | 119 | <form method="get" action="?#output"> |
120 | 120 | <p> |
121 | 121 | <?php foreach ($methods[$method]['parameters'] as $parameter) { |
122 | - print $parameter . ': <input type="text" name="'.$parameter.'" value="'; |
|
122 | + print $parameter . ': <input type="text" name="' . $parameter . '" value="'; |
|
123 | 123 | if ($val = get_http_var($parameter)) |
124 | 124 | print _htmlspecialchars($val); |
125 | 125 | print '" size="30"><br>'; |
126 | 126 | } |
127 | 127 | ?> |
128 | 128 | Output: |
129 | -<input id="output_json" type="radio" name="output" value="json"<?php if (get_http_var('output')=='json' || !get_http_var('output')) print ' checked'?>> |
|
129 | +<input id="output_json" type="radio" name="output" value="json"<?php if (get_http_var('output') == 'json' || !get_http_var('output')) print ' checked'?>> |
|
130 | 130 | <label for="output_json" class="inline">JSON</label> |
131 | -<input id="output_js" type="radio" name="output" value="js"<?php if (get_http_var('output')=='js') print ' checked'?>> |
|
131 | +<input id="output_js" type="radio" name="output" value="js"<?php if (get_http_var('output') == 'js') print ' checked'?>> |
|
132 | 132 | <label for="output_js" class="inline">JS</label> |
133 | -<input id="output_xml" type="radio" name="output" value="xml"<?php if (get_http_var('output')=='xml') print ' checked'?>> |
|
133 | +<input id="output_xml" type="radio" name="output" value="xml"<?php if (get_http_var('output') == 'xml') print ' checked'?>> |
|
134 | 134 | <label for="output_xml" class="inline">XML</label> |
135 | -<input id="output_php" type="radio" name="output" value="php"<?php if (get_http_var('output')=='php') print ' checked'?>> |
|
135 | +<input id="output_php" type="radio" name="output" value="php"<?php if (get_http_var('output') == 'php') print ' checked'?>> |
|
136 | 136 | <label for="output_php" class="inline">Serialised PHP</label> |
137 | -<input id="output_rabx" type="radio" name="output" value="rabx"<?php if (get_http_var('output')=='rabx') print ' checked'?>> |
|
137 | +<input id="output_rabx" type="radio" name="output" value="rabx"<?php if (get_http_var('output') == 'rabx') print ' checked'?>> |
|
138 | 138 | <label for="output_rabx" class="inline">RABX</label> |
139 | 139 | |
140 | 140 | <input type="submit" value="Go"> |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | print '<h4><a name="output"></a>Output</h4>'; |
151 | 151 | print '<p>URL for this: <strong>https://www.theyworkforyou.com/api/'; |
152 | - print $method . '?' . join('&', $qs) . '&output='._htmlspecialchars(get_http_var('output')).'</strong></p>'; |
|
152 | + print $method . '?' . join('&', $qs) . '&output=' . _htmlspecialchars(get_http_var('output')) . '</strong></p>'; |
|
153 | 153 | print '<pre>' . _htmlspecialchars($explorer) . '</pre>'; |
154 | 154 | } |
155 | 155 | } |
@@ -120,13 +120,15 @@ discard block |
||
120 | 120 | <p> |
121 | 121 | <?php foreach ($methods[$method]['parameters'] as $parameter) { |
122 | 122 | print $parameter . ': <input type="text" name="'.$parameter.'" value="'; |
123 | - if ($val = get_http_var($parameter)) |
|
124 | - print _htmlspecialchars($val); |
|
123 | + if ($val = get_http_var($parameter)) { |
|
124 | + print _htmlspecialchars($val); |
|
125 | + } |
|
125 | 126 | print '" size="30"><br>'; |
126 | 127 | } |
127 | 128 | ?> |
128 | 129 | Output: |
129 | -<input id="output_json" type="radio" name="output" value="json"<?php if (get_http_var('output')=='json' || !get_http_var('output')) print ' checked'?>> |
|
130 | +<input id="output_json" type="radio" name="output" value="json"<?php if (get_http_var('output')=='json' || !get_http_var('output')) { |
|
131 | + print ' checked'?>> |
|
130 | 132 | <label for="output_json" class="inline">JSON</label> |
131 | 133 | <input id="output_js" type="radio" name="output" value="js"<?php if (get_http_var('output')=='js') print ' checked'?>> |
132 | 134 | <label for="output_js" class="inline">JS</label> |
@@ -143,9 +145,11 @@ discard block |
||
143 | 145 | <?php |
144 | 146 | if ($explorer) { |
145 | 147 | $qs = array(); |
148 | +} |
|
146 | 149 | foreach ($methods[$method]['parameters'] as $parameter) { |
147 | - if (get_http_var($parameter)) |
|
148 | - $qs[] = _htmlspecialchars(rawurlencode($parameter) . '=' . urlencode(get_http_var($parameter))); |
|
150 | + if (get_http_var($parameter)) { |
|
151 | + $qs[] = _htmlspecialchars(rawurlencode($parameter) . '=' . urlencode(get_http_var($parameter))); |
|
152 | + } |
|
149 | 153 | } |
150 | 154 | print '<h4><a name="output"></a>Output</h4>'; |
151 | 155 | print '<p>URL for this: <strong>https://www.theyworkforyou.com/api/'; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $DATA->set_page_metadata($this_page, 'title', 'Parliament'); |
8 | 8 | $DATA->set_page_metadata($this_page, 'meta_description', |
9 | - 'What goes on in Parliament? Up-to-the-minute records on all MPs, debates, speeches and statements from the House of Commons, House of Lords, Scottish Parliament, and Northern Ireland Assembly.'); |
|
9 | + 'What goes on in Parliament? Up-to-the-minute records on all MPs, debates, speeches and statements from the House of Commons, House of Lords, Scottish Parliament, and Northern Ireland Assembly.'); |
|
10 | 10 | $DATA->set_page_metadata($this_page, 'meta_keywords', 'parliament, uk parliament, parliamentary, house of commons, house commons, house of lords, house lords, house of parliament, parliment, houses parliament, parliament uk, member of parliament, welsh parliament, senedd, scottish parliament, the parliament, house of parliment, houses of parliment, parliment uk, uk parliment, houses of parliament, parliament houses, parliament of uk, parliament in uk, the house of parliament, scottish parliment, members of parliament, parliament members, scotish parliament, parliament scottish, the house of commons, british parliament, what is parliament, the house of lords, the scottish parliament, london parliament, parliament london, the houses of parliament, english parliament, northern ireland parliament, the british parliament, northern ireland assembly, history of parliament, parliament history, parliament of england, england parliament'); |
11 | 11 | |
12 | 12 | $PAGE->supress_heading = true; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public function __construct($name) { |
21 | 21 | // treat Labour and Labour/Co-operative the same as that's how |
22 | 22 | // people view them and it'll confuse the results otherwise |
23 | - if ( $name == 'Labour/Co-operative' ) { |
|
23 | + if ($name == 'Labour/Co-operative') { |
|
24 | 24 | $name = 'Labour'; |
25 | 25 | } |
26 | 26 | $this->name = $name; |