@@ -3,7 +3,7 @@ |
||
3 | 3 | $stances = array(); |
4 | 4 | |
5 | 5 | foreach ($segment['votes']->positions as $key_vote) { |
6 | - if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) { |
|
6 | + if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') { |
|
7 | 7 | $stance = strip_tags($key_vote['desc'], '<b>'); |
8 | 8 | $stance = ucfirst($stance); |
9 | 9 | $stance = preg_replace('#</?b[^>]*>#i', '*', $stance); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | echo '<?xml version="1.0" encoding="utf-8"?>'; |
28 | 28 | |
29 | - ?> |
|
29 | + ?> |
|
30 | 30 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> |
31 | 31 | <svg width="1000" height="500" viewBox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" font-family="Source Sans Pro"> |
32 | 32 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | <text font-size="24" font-weight="normal" fill="#000000"> |
45 | 45 | <?php foreach ($lines as $j=>$line) { ?> |
46 | 46 | <tspan x="40" y="<?= $stance_y + $stance_padding_top + $stance_baseline_offset + ($stance_lineheight * $j) ?>"><?php |
47 | - if (strpos($line, '*') !== False) { |
|
47 | + if (strpos($line, '*') !== false) { |
|
48 | 48 | echo preg_replace( |
49 | 49 | '#(?:^|[*])([^\r\n *][^*\n]*[^\r\n *])(?:$|[*])#i', |
50 | 50 | '$1', |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected function getSearchSections() { |
22 | 22 | return array( |
23 | - array( 'section' => 'lmqs', 'title' => 'Mayoral Questions' ) |
|
23 | + array('section' => 'lmqs', 'title' => 'Mayoral Questions') |
|
24 | 24 | ); |
25 | 25 | } |
26 | 26 | } |
@@ -155,7 +155,8 @@ |
||
155 | 155 | # The subscription has been created, but it is possible that the |
156 | 156 | # payment failed (card error), or we need to do 3DS or similar |
157 | 157 | $pi = $invoice->payment_intent; |
158 | - if (!$pi) { # Free plan |
|
158 | + if (!$pi) { |
|
159 | +# Free plan |
|
159 | 160 | return; |
160 | 161 | } |
161 | 162 | if ($pi->status == 'requires_payment_method' || $pi->status == 'requires_source') { |
@@ -40,9 +40,9 @@ |
||
40 | 40 | |
41 | 41 | try { |
42 | 42 | $invoice = $sub->latest_invoice; |
43 | - $invoice->pay([ 'expand' => [ 'payment_intent' ] ]); |
|
43 | + $invoice->pay(['expand' => ['payment_intent']]); |
|
44 | 44 | } catch (\Stripe\Error\Card $e) { |
45 | - $invoice = \Stripe\Invoice::retrieve($sub->latest_invoice, ['expand' => [ 'payment_intent'] ]); |
|
45 | + $invoice = \Stripe\Invoice::retrieve($sub->latest_invoice, ['expand' => ['payment_intent']]); |
|
46 | 46 | } |
47 | 47 | } else { |
48 | 48 | $invoice = $sub->latest_invoice; |
@@ -53,10 +53,10 @@ |
||
53 | 53 | # Update the invoice's PaymentIntent and Charge to say it came from TWFY (for CSV export) |
54 | 54 | # Both are shown in the Stripe admin, annoyingly |
55 | 55 | if ($obj->payment_intent) { |
56 | - \Stripe\PaymentIntent::update($obj->payment_intent, [ 'description' => 'TheyWorkForYou' ]); |
|
56 | + \Stripe\PaymentIntent::update($obj->payment_intent, ['description' => 'TheyWorkForYou']); |
|
57 | 57 | } |
58 | 58 | if ($obj->charge) { |
59 | - \Stripe\Charge::update($obj->charge, [ 'description' => 'TheyWorkForYou' ]); |
|
59 | + \Stripe\Charge::update($obj->charge, ['description' => 'TheyWorkForYou']); |
|
60 | 60 | } |
61 | 61 | } catch (\Stripe\Error\Base $e) { |
62 | 62 | } |
@@ -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; |
@@ -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; |
@@ -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; |