@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | // These stores an associative array of key/value pairs that |
66 | 66 | // we'll want passed on to other pages. |
67 | - $this->session_vars = array (); |
|
67 | + $this->session_vars = array(); |
|
68 | 68 | |
69 | 69 | // Prevent things using $DATA running if it hasn't been set, ie in testing |
70 | 70 | if (isset($DATA)) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function reset() { |
104 | 104 | // Call this to remove all the session_vars. |
105 | - $this->session_vars = array (); |
|
105 | + $this->session_vars = array(); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | public function insert($arr) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - public function generate($encode = "html", $overrideVars=array()) { |
|
139 | + public function generate($encode = "html", $overrideVars = array()) { |
|
140 | 140 | // Returns a URL with the appropriate session_vars. |
141 | 141 | // If $encode is "html", the URL will be suitable to be put in HTML. |
142 | 142 | // If $encode is "none", the URL will be as is. |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // them. |
150 | 150 | global $DATA; |
151 | 151 | |
152 | - $url_args = array (); |
|
152 | + $url_args = array(); |
|
153 | 153 | |
154 | 154 | foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) { |
155 | 155 | if (is_array($var)) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // If you have a form that changes, say, $s, then you'll need to |
181 | 181 | // pass "s" in in the $remove_vars array, so it isn't created as a |
182 | 182 | // hidden variable. |
183 | - public function hidden_form_varsOLD ($remove_vars=array(), $insert_vars=array()) { |
|
183 | + public function hidden_form_varsOLD($remove_vars = array(), $insert_vars = array()) { |
|
184 | 184 | // This should really be tidied up lots. That $dont_keep array for a start is NASTY! |
185 | 185 | // You can also pass in an array of variables to remove() and insert(). |
186 | 186 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $html = ""; |
202 | 202 | |
203 | 203 | // Put keys of any variables you never want to hang on to in here: |
204 | - $dont_keep = array(); // VERY BAD! |
|
204 | + $dont_keep = array(); // VERY BAD! |
|
205 | 205 | $this->remove($dont_keep); |
206 | 206 | |
207 | 207 | foreach ($this->session_vars as $key => $val) { |
@@ -156,18 +156,22 @@ discard block |
||
156 | 156 | foreach ($var as $v) { |
157 | 157 | $url_args[] = "$key=" . urlencode(stripslashes($v)); |
158 | 158 | } |
159 | - } elseif ($var != null) |
|
160 | - $url_args[] = "$key=" . urlencode(stripslashes($var)); |
|
159 | + } |
|
160 | + elseif ($var != null) { |
|
161 | + $url_args[] = "$key=" . urlencode(stripslashes($var)); |
|
162 | + } |
|
161 | 163 | } |
162 | 164 | |
163 | 165 | $page_url = WEBPATH . $DATA->page_metadata($this->destinationpage, "url"); |
164 | 166 | |
165 | 167 | if (sizeof($url_args) == 0) { |
166 | 168 | return $page_url; |
167 | - } else { |
|
169 | + } |
|
170 | + else { |
|
168 | 171 | if ($encode == "html") { |
169 | 172 | return $page_url . "?" . implode("&", $url_args); |
170 | - } elseif ($encode == "none" || $encode == "url") { |
|
173 | + } |
|
174 | + elseif ($encode == "none" || $encode == "url") { |
|
171 | 175 | return $page_url . "?" . implode("&", $url_args); |
172 | 176 | } |
173 | 177 | } |
@@ -218,7 +222,8 @@ discard block |
||
218 | 222 | |
219 | 223 | if ($html != "") { |
220 | 224 | return $html . "\n"; |
221 | - } else { |
|
225 | + } |
|
226 | + else { |
|
222 | 227 | return $html; |
223 | 228 | } |
224 | 229 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function moderate_trackbacks() { return $this->moderate_trackbacks; } |
52 | 52 | |
53 | 53 | |
54 | - public function display ($view, $args=array(), $format='html') { |
|
54 | + public function display($view, $args = array(), $format = 'html') { |
|
55 | 55 | // $view is one of: |
56 | 56 | // 'epobject_id' - display the pings for one epobject. |
57 | 57 | // 'recent' - to get the most recent pings to anywhere. |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | if ($view == 'epobject_id' || $view == 'recent') { |
65 | 65 | |
66 | 66 | // What function do we call for this view? |
67 | - $function = '_get_trackbacks_by_'.$view; |
|
67 | + $function = '_get_trackbacks_by_' . $view; |
|
68 | 68 | // Get all the data that's to be rendered. |
69 | 69 | $trackbackdata = $this->$function($args); |
70 | 70 | |
71 | 71 | } else { |
72 | - $PAGE->error_message ("You haven't specified a valid view type."); |
|
72 | + $PAGE->error_message("You haven't specified a valid view type."); |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - $data = array ( |
|
76 | + $data = array( |
|
77 | 77 | 'data' => $trackbackdata, |
78 | - 'info' => array ( |
|
78 | + 'info' => array( |
|
79 | 79 | 'view' => $view |
80 | 80 | ) |
81 | 81 | ); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->render($view, $data, $format); |
87 | 87 | } |
88 | 88 | |
89 | - public function render($view, $data, $format='html') { |
|
89 | + public function render($view, $data, $format = 'html') { |
|
90 | 90 | |
91 | 91 | if ($format != 'html') { |
92 | 92 | $format = 'html'; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // We currently only have one kind of trackback template, so |
96 | 96 | // we're ignoring $view here I'm afraid... |
97 | 97 | |
98 | - include (INCLUDESPATH."easyparliament/templates/$format/trackbacks" . ".php"); |
|
98 | + include (INCLUDESPATH . "easyparliament/templates/$format/trackbacks" . ".php"); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | |
132 | 132 | |
133 | 133 | // Still here? Then we're trackbacking to a valid hansard item. |
134 | - $url = $trackbackdata['url']; |
|
135 | - $source_ip = $trackbackdata['source_ip']; |
|
134 | + $url = $trackbackdata['url']; |
|
135 | + $source_ip = $trackbackdata['source_ip']; |
|
136 | 136 | // These all strip_tags too. |
137 | - $title = trim_characters(html_entity_decode($trackbackdata['title']), 0, 255); |
|
138 | - $excerpt = trim_characters(html_entity_decode($trackbackdata['excerpt']), 0, 255); |
|
139 | - $blog_name = trim_characters(html_entity_decode($trackbackdata['blog_name']), 0, 255); |
|
137 | + $title = trim_characters(html_entity_decode($trackbackdata['title']), 0, 255); |
|
138 | + $excerpt = trim_characters(html_entity_decode($trackbackdata['excerpt']), 0, 255); |
|
139 | + $blog_name = trim_characters(html_entity_decode($trackbackdata['blog_name']), 0, 255); |
|
140 | 140 | |
141 | - $visible = $this->moderate_trackbacks ? 0 : 1; |
|
141 | + $visible = $this->moderate_trackbacks ? 0 : 1; |
|
142 | 142 | |
143 | 143 | $q = $this->db->query("INSERT INTO trackbacks |
144 | 144 | (epobject_id, blog_name, title, excerpt, url, source_ip, posted, visible) |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | "); |
199 | 199 | |
200 | 200 | if ($q->rows() > 0) { |
201 | - for ($row=0; $row<$q->rows(); $row++) { |
|
202 | - $trackbackdata[] = array ( |
|
201 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
202 | + $trackbackdata[] = array( |
|
203 | 203 | 'trackback_id' => $q->field($row, 'trackback_id'), |
204 | 204 | 'epobject_id' => $q->field($row, 'epobject_id'), |
205 | 205 | 'blog_name' => $q->field($row, 'blog_name'), |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | "); |
248 | 248 | |
249 | 249 | if ($q->rows() > 0) { |
250 | - for ($row=0; $row<$q->rows(); $row++) { |
|
251 | - $trackbackdata[] = array ( |
|
250 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
251 | + $trackbackdata[] = array( |
|
252 | 252 | 'trackback_id' => $q->field($row, 'trackback_id'), |
253 | 253 | 'epobject_id' => $q->field($row, 'epobject_id'), |
254 | 254 | 'blog_name' => $q->field($row, 'blog_name'), |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | // This page just does XML. |
278 | 278 | |
279 | 279 | if ($error) { |
280 | - echo '<?xml version="1.0" encoding="utf-8"?'.">\n"; |
|
280 | + echo '<?xml version="1.0" encoding="utf-8"?' . ">\n"; |
|
281 | 281 | echo "<response>\n"; |
282 | 282 | echo "<error>1</error>\n"; |
283 | 283 | echo "<message>$error_message</message>\n"; |
284 | 284 | echo "</response>"; |
285 | 285 | } else { |
286 | - echo '<?xml version="1.0" encoding="utf-8"?'.">\n"; |
|
286 | + echo '<?xml version="1.0" encoding="utf-8"?' . ">\n"; |
|
287 | 287 | echo "<response>\n"; |
288 | 288 | echo "<error>0</error>\n"; |
289 | 289 | echo "</response>"; |
@@ -42,7 +42,8 @@ discard block |
||
42 | 42 | // Set in init.php |
43 | 43 | if (ALLOWTRACKBACKS == true) { |
44 | 44 | $this->trackbacks_enabled = true; |
45 | - } else { |
|
45 | + } |
|
46 | + else { |
|
46 | 47 | $this->trackbacks_enabled = false; |
47 | 48 | } |
48 | 49 | } |
@@ -68,7 +69,8 @@ discard block |
||
68 | 69 | // Get all the data that's to be rendered. |
69 | 70 | $trackbackdata = $this->$function($args); |
70 | 71 | |
71 | - } else { |
|
72 | + } |
|
73 | + else { |
|
72 | 74 | $PAGE->error_message ("You haven't specified a valid view type."); |
73 | 75 | return false; |
74 | 76 | } |
@@ -157,7 +159,8 @@ discard block |
||
157 | 159 | // Return a success message. |
158 | 160 | $this->_trackback_response(0); |
159 | 161 | |
160 | - } else { |
|
162 | + } |
|
163 | + else { |
|
161 | 164 | die ("Sorry, we could not save the trackback to the database. Please <a href=\"mailto:" . CONTACTEMAIL . "\">email us</a> to let us know. Thanks."); |
162 | 165 | } |
163 | 166 | } |
@@ -282,7 +285,8 @@ discard block |
||
282 | 285 | echo "<error>1</error>\n"; |
283 | 286 | echo "<message>$error_message</message>\n"; |
284 | 287 | echo "</response>"; |
285 | - } else { |
|
288 | + } |
|
289 | + else { |
|
286 | 290 | echo '<?xml version="1.0" encoding="utf-8"?'.">\n"; |
287 | 291 | echo "<response>\n"; |
288 | 292 | echo "<error>0</error>\n"; |
@@ -290,12 +294,14 @@ discard block |
||
290 | 294 | } |
291 | 295 | die(); |
292 | 296 | |
293 | - } else { |
|
297 | + } |
|
298 | + else { |
|
294 | 299 | // We're adding a trackback from a page that's probably expecting HTML. |
295 | 300 | |
296 | 301 | if ($error) { |
297 | 302 | $PAGE->error_message($error_message); |
298 | - } else { |
|
303 | + } |
|
304 | + else { |
|
299 | 305 | print "<p>Trackback added successfully.</p>\n"; |
300 | 306 | } |
301 | 307 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | class GLOSSARYLIST { |
4 | 4 | |
5 | - public function render($data, $format='html', $template='glossary') { |
|
5 | + public function render($data, $format = 'html', $template = 'glossary') { |
|
6 | 6 | // Once we have the data that's to be rendered, |
7 | 7 | // include the template. |
8 | 8 | |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $format = 'html'; |
11 | 11 | } |
12 | 12 | |
13 | - include (INCLUDESPATH."easyparliament/templates/$format/$template.php"); |
|
13 | + include (INCLUDESPATH . "easyparliament/templates/$format/$template.php"); |
|
14 | 14 | |
15 | 15 | } |
16 | 16 |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | $desc = ucfirst(implode(' and ', $types)); |
21 | 21 | ?> |
22 | 22 | <h2><?= $desc ?> in constituencies matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
23 | - <?php } else { // count($cons) <= 1 ?> |
|
23 | + <?php } |
|
24 | +else { |
|
25 | +// count($cons) <= 1 ?> |
|
24 | 26 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
25 | 27 | <?php } ?> |
26 | 28 | <?php foreach ( $cons as $member ) { ?> |
@@ -50,15 +52,19 @@ discard block |
||
50 | 52 | |
51 | 53 | <?php if ( isset($error) ) { ?> |
52 | 54 | There was an error – <?= $error ?> – searching for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em>. |
53 | - <?php } else { ?> |
|
55 | + <?php } |
|
56 | +else { ?> |
|
54 | 57 | <h2> |
55 | 58 | <?php if ( $pagination_links ) { ?> |
56 | 59 | Results <?= $pagination_links['first_result'] ?>–<?= $pagination_links['last_result'] ?> of <?= $info['total_results'] ?> |
57 | - <?php } else if ( $info['total_results'] == 1 ) { ?> |
|
60 | + <?php } |
|
61 | +else if ( $info['total_results'] == 1 ) { ?> |
|
58 | 62 | The only result |
59 | - <?php } else if ( $info['total_results'] == 0 ) { ?> |
|
63 | + <?php } |
|
64 | +else if ( $info['total_results'] == 0 ) { ?> |
|
60 | 65 | There were no results |
61 | - <?php } else { ?> |
|
66 | + <?php } |
|
67 | +else { ?> |
|
62 | 68 | All <?= $info['total_results'] ?> results |
63 | 69 | <?php } ?> |
64 | 70 | for <em class="current-search-term"><?= _htmlentities($searchdescription) ?></em> |
@@ -73,10 +79,12 @@ discard block |
||
73 | 79 | <?php if ( $sort_order == 'relevance' ) { ?> |
74 | 80 | <li>Sorted by relevance</li> |
75 | 81 | <li>Sort by date: <a href="<?= $urls['newest'] ?>">newest</a> / <a href="<?= $urls['oldest'] ?>">oldest</a></li> |
76 | - <?php } else if ( $sort_order == 'oldest' ) { ?> |
|
82 | + <?php } |
|
83 | +else if ( $sort_order == 'oldest' ) { ?> |
|
77 | 84 | <li>Sort by <a href="<?= $urls['relevance'] ?>">relevance</a></li> |
78 | 85 | <li>Sorted by date: <a href="<?= $urls['newest'] ?>">newest</a> / oldest</li> |
79 | - <?php } else { ?> |
|
86 | + <?php } |
|
87 | +else { ?> |
|
80 | 88 | <li>Sort by <a href="<?= $urls['relevance'] ?>">relevance</a></li> |
81 | 89 | <li>Sorted by date: newest / <a href="<?= $urls['oldest'] ?>">oldest</a></li> |
82 | 90 | <?php } ?> |
@@ -9,8 +9,8 @@ |
||
9 | 9 | <div class="search-page__section search-page__section--results"> |
10 | 10 | <div class="search-page__section__primary"> |
11 | 11 | <?php |
12 | - # XXX Hack |
|
13 | - if (preg_match('#budget#', $searchstring)) { ?> |
|
12 | + # XXX Hack |
|
13 | + if (preg_match('#budget#', $searchstring)) { ?> |
|
14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
15 | 15 | <?php } ?> |
16 | 16 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <div class="full-page"> |
2 | - <div class="full-page__row search-page <?php if ( !$searchstring ) { ?>search-page--blank<?php } ?>"> |
|
2 | + <div class="full-page__row search-page <?php if (!$searchstring) { ?>search-page--blank<?php } ?>"> |
|
3 | 3 | |
4 | 4 | <form class="js-search-form-without-options"> |
5 | 5 | <?php include 'form_main.php'; ?> |
6 | 6 | </form> |
7 | 7 | |
8 | - <?php if ( $searchstring && !isset($warnings) ) { ?> |
|
8 | + <?php if ($searchstring && !isset($warnings)) { ?> |
|
9 | 9 | <div class="search-page__section search-page__section--results"> |
10 | 10 | <div class="search-page__section__primary"> |
11 | 11 | <?php |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
15 | 15 | <?php } ?> |
16 | 16 | |
17 | - <?php if ( $cons ) { ?> |
|
18 | - <?php if ( count($cons) > 1 ) { |
|
17 | + <?php if ($cons) { ?> |
|
18 | + <?php if (count($cons) > 1) { |
|
19 | 19 | $types = array(); |
20 | - if ( $mp_types['mp'] > 0 ) { |
|
20 | + if ($mp_types['mp'] > 0) { |
|
21 | 21 | $types[] = 'MPs'; |
22 | 22 | } |
23 | - if ( $mp_types['former'] > 0 ) { |
|
23 | + if ($mp_types['former'] > 0) { |
|
24 | 24 | $types[] = 'former MPs'; |
25 | 25 | } |
26 | 26 | $desc = ucfirst(implode(' and ', $types)); |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | <?php } else { // count($cons) <= 1 ?> |
30 | 30 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
31 | 31 | <?php } ?> |
32 | - <?php foreach ( $cons as $member ) { ?> |
|
32 | + <?php foreach ($cons as $member) { ?> |
|
33 | 33 | <?php include('person.php'); ?> |
34 | 34 | <?php } ?> |
35 | 35 | <?php } ?> |
36 | 36 | |
37 | - <?php if ( $members ) { ?> |
|
37 | + <?php if ($members) { ?> |
|
38 | 38 | <h2>People matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
39 | - <?php foreach ( $members as $member ) { ?> |
|
39 | + <?php foreach ($members as $member) { ?> |
|
40 | 40 | <?php include('person.php'); ?> |
41 | 41 | <?php } ?> |
42 | 42 | <hr> |
@@ -44,25 +44,25 @@ discard block |
||
44 | 44 | |
45 | 45 | <?php if ($glossary) { ?> |
46 | 46 | <h2>Glossary items matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
47 | - <?php foreach ( $glossary as $item ) { ?> |
|
47 | + <?php foreach ($glossary as $item) { ?> |
|
48 | 48 | <?php include('glossary.php'); ?> |
49 | 49 | <?php } ?> |
50 | 50 | <hr> |
51 | 51 | <?php } ?> |
52 | 52 | |
53 | - <?php if ( isset($pid) && $wtt == 2 ) { ?> |
|
53 | + <?php if (isset($pid) && $wtt == 2) { ?> |
|
54 | 54 | <p>I want to <a href="https://www.writetothem.com/lords/?pid=<?= $pid ?>">write to <?= $wtt_lord_name ?></a></p> |
55 | 55 | <?php } ?> |
56 | 56 | |
57 | - <?php if ( isset($error) ) { ?> |
|
57 | + <?php if (isset($error)) { ?> |
|
58 | 58 | There was an error – <?= $error ?> – searching for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em>. |
59 | 59 | <?php } else { ?> |
60 | 60 | <h2> |
61 | - <?php if ( $pagination_links ) { ?> |
|
61 | + <?php if ($pagination_links) { ?> |
|
62 | 62 | Results <?= $pagination_links['first_result'] ?>–<?= $pagination_links['last_result'] ?> of <?= $info['total_results'] ?> |
63 | - <?php } else if ( $info['total_results'] == 1 ) { ?> |
|
63 | + <?php } else if ($info['total_results'] == 1) { ?> |
|
64 | 64 | The only result |
65 | - <?php } else if ( $info['total_results'] == 0 ) { ?> |
|
65 | + <?php } else if ($info['total_results'] == 0) { ?> |
|
66 | 66 | There were no results |
67 | 67 | <?php } else { ?> |
68 | 68 | All <?= $info['total_results'] ?> results |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | for <em class="current-search-term"><?= _htmlentities($searchdescription) ?></em> |
71 | 71 | </h2> |
72 | 72 | |
73 | - <?php if ( $info['spelling_correction'] ) { ?> |
|
74 | - <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities( $info['spelling_correction_display'] ) ?></a>?</p> |
|
73 | + <?php if ($info['spelling_correction']) { ?> |
|
74 | + <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities($info['spelling_correction_display']) ?></a>?</p> |
|
75 | 75 | <?php } ?> |
76 | 76 | |
77 | - <?php if ( $info['total_results'] ) { ?> |
|
77 | + <?php if ($info['total_results']) { ?> |
|
78 | 78 | <ul class="search-result-display-options"> |
79 | - <?php if ( $sort_order == 'relevance' ) { ?> |
|
79 | + <?php if ($sort_order == 'relevance') { ?> |
|
80 | 80 | <li>Sorted by relevance</li> |
81 | 81 | <li>Sort by date: <a href="<?= $urls['newest'] ?>">newest</a> / <a href="<?= $urls['oldest'] ?>">oldest</a></li> |
82 | - <?php } else if ( $sort_order == 'oldest' ) { ?> |
|
82 | + <?php } else if ($sort_order == 'oldest') { ?> |
|
83 | 83 | <li>Sort by <a href="<?= $urls['relevance'] ?>">relevance</a></li> |
84 | 84 | <li>Sorted by date: <a href="<?= $urls['newest'] ?>">newest</a> / oldest</li> |
85 | 85 | <?php } else { ?> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | </ul> |
91 | 91 | <?php } ?> |
92 | 92 | |
93 | - <?php foreach ( $rows as $result ) { ?> |
|
93 | + <?php foreach ($rows as $result) { ?> |
|
94 | 94 | <div class="search-result search-result--generic"> |
95 | 95 | <h3 class="search-result__title"><a href="<?= $result['listurl'] ?>"><?= $result['parent']['body'] ?></a> (<?= format_date($result['hdate'], SHORTDATEFORMAT) ?>)</h3> |
96 | 96 | <p class="search-result__description"><?= isset($result['speaker']) ? $result['speaker']['name'] . ': ' : '' ?><?= $result['extract'] ?></p> |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | |
100 | 100 | <hr> |
101 | 101 | |
102 | - <?php if ( $pagination_links ) { ?> |
|
102 | + <?php if ($pagination_links) { ?> |
|
103 | 103 | <div class="search-result-pagination"> |
104 | - <?php if ( isset($pagination_links['prev']) ) { ?> |
|
104 | + <?php if (isset($pagination_links['prev'])) { ?> |
|
105 | 105 | <a href="<?= $pagination_links['firstpage']['url'] ?>" title="First page"><<</a> |
106 | 106 | <a href="<?= $pagination_links['prev']['url'] ?>" title="Previous page"><</a> |
107 | 107 | <?php } ?> |
108 | - <?php foreach ( $pagination_links['nums'] as $link ) { ?> |
|
108 | + <?php foreach ($pagination_links['nums'] as $link) { ?> |
|
109 | 109 | <a href="<?= $link['url'] ?>"<?= $link['current'] ? ' class="search-result-pagination__current-page"' : '' ?>><?= $link['page'] ?></a> |
110 | 110 | <?php } ?> |
111 | - <?php if ( isset($pagination_links['next']) ) { ?> |
|
111 | + <?php if (isset($pagination_links['next'])) { ?> |
|
112 | 112 | <a href="<?= $pagination_links['next']['url'] ?>" title="Next page">></a> |
113 | 113 | <a href="<?= $pagination_links['lastpage']['url'] ?>" title="Final page">>></a> |
114 | 114 | <?php } ?> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <input type="text" name="q" value="<?= _htmlentities($search_keyword) ?>" class="form-control"> |
5 | 5 | <input type="submit" class="button" value="Search"> |
6 | 6 | </p> |
7 | - <?php if (isset($warnings) ) { ?> |
|
7 | + <?php if (isset($warnings)) { ?> |
|
8 | 8 | <p class="error"> |
9 | 9 | <?= $warnings ?> |
10 | 10 | </p> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | <p> |
19 | 19 | <ul class="search-result-display-options"> |
20 | 20 | <li><a href="#options" class="search-options-toggle js-toggle-search-options">Advanced search</a></li> |
21 | - <?php if ( $is_adv ) { ?> |
|
21 | + <?php if ($is_adv) { ?> |
|
22 | 22 | <?= $search_phrase ? '<li>Exactly: ' . _htmlentities($search_phrase) . '</li>' : '' ?> |
23 | 23 | <?= $search_exclude ? '<li>Excluding: ' . _htmlentities($search_exclude) . '</li>' : '' ?> |
24 | 24 | <?= $search_from ? '<li>From: ' . _htmlentities($search_from) . '</li>' : '' ?> |
@@ -4,7 +4,7 @@ |
||
4 | 4 | <p class="search-result__description"> |
5 | 5 | <?php $details = $member->getMostRecentMembership(); ?> |
6 | 6 | <?= $details['left_house'] != '9999-12-31' ? 'Former ' : '' ?><?= $details['party'] ? $details['party'] . ' ' : '' ?><?= $details['rep_name'] ?><?= $details['cons'] ? ', ' . $details['cons'] : ''?> |
7 | - <?php if ( $details['entered_house'] || ( $details['left_house'] && $details['left_house'] != '9999-12-31' ) ) { ?> |
|
7 | + <?php if ($details['entered_house'] || ($details['left_house'] && $details['left_house'] != '9999-12-31')) { ?> |
|
8 | 8 | , <?= format_date($details['entered_house'], SHORTDATEFORMAT) ?> – <?= $details['left_house'] != '9999-12-31' ? format_date($details['left_house'], SHORTDATEFORMAT) : '' ?> |
9 | 9 | <?php } ?> |
10 | 10 | </p> |
@@ -9,17 +9,17 @@ discard block |
||
9 | 9 | <div class="search-page__section__primary"> |
10 | 10 | <h2>Who says <em class="current-search-term"><?= _htmlentities($searchstring) ?></em> the most?</h2> |
11 | 11 | |
12 | - <?php if ( isset($error) ) { ?> |
|
13 | - <?php if ( $error == 'No results' && isset( $house ) && $house != 0 ) { ?> |
|
12 | + <?php if (isset($error)) { ?> |
|
13 | + <?php if ($error == 'No results' && isset($house) && $house != 0) { ?> |
|
14 | 14 | <ul class="search-result-display-options"> |
15 | 15 | <li> |
16 | - <?php if ( $house == 1 ) { ?> |
|
16 | + <?php if ($house == 1) { ?> |
|
17 | 17 | No results for MPs only |
18 | - <?php } else if ( $house == 2 ) { ?> |
|
18 | + <?php } else if ($house == 2) { ?> |
|
19 | 19 | No results for Peers only |
20 | - <?php } else if ( $house == 4 ) { ?> |
|
20 | + <?php } else if ($house == 4) { ?> |
|
21 | 21 | No results for MSPs only |
22 | - <?php } else if ( $house == 3 ) { ?> |
|
22 | + <?php } else if ($house == 3) { ?> |
|
23 | 23 | No results for MLAs only |
24 | 24 | <?php } ?> |
25 | 25 | | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | <?php } ?> |
32 | 32 | <?php } ?> |
33 | 33 | |
34 | - <?php if ( $wtt ) { ?> |
|
34 | + <?php if ($wtt) { ?> |
|
35 | 35 | <p><strong>Now, try reading what a couple of these Lords are saying, |
36 | 36 | to help you find someone appropriate. When you've found someone, |
37 | 37 | hit the "I want to write to this Lord" button on their results page |
@@ -39,37 +39,37 @@ discard block |
||
39 | 39 | </strong></p> |
40 | 40 | <?php } ?> |
41 | 41 | |
42 | - <?php if ( isset($speakers) && count($speakers) ) { ?> |
|
42 | + <?php if (isset($speakers) && count($speakers)) { ?> |
|
43 | 43 | |
44 | - <?php if ( !$wtt ) { ?> |
|
44 | + <?php if (!$wtt) { ?> |
|
45 | 45 | <ul class="search-result-display-options"> |
46 | 46 | <li>Results grouped by person</li> |
47 | 47 | <li> |
48 | - <?php if ( $house == 0 ) { ?> |
|
48 | + <?php if ($house == 0) { ?> |
|
49 | 49 | Show All |
50 | 50 | <?php } else { ?> |
51 | 51 | <a href="<?= $this_url->generate('html') ?>">Show All</a> |
52 | 52 | <?php } ?> |
53 | 53 | | |
54 | - <?php if ( $house == 1 ) { ?> |
|
54 | + <?php if ($house == 1) { ?> |
|
55 | 55 | MPs only |
56 | 56 | <?php } else { ?> |
57 | 57 | <a href="<?= $this_url->generate('html', array('house'=>1)) ?>">MPs only</a> |
58 | 58 | <?php } ?> |
59 | 59 | | |
60 | - <?php if ( $house == 2 ) { ?> |
|
60 | + <?php if ($house == 2) { ?> |
|
61 | 61 | Peers only |
62 | 62 | <?php } else { ?> |
63 | 63 | <a href="<?= $this_url->generate('html', array('house'=>2)) ?>">Lords only</a> |
64 | 64 | <?php } ?> |
65 | 65 | | |
66 | - <?php if ( $house == 4 ) { ?> |
|
66 | + <?php if ($house == 4) { ?> |
|
67 | 67 | MSPs only |
68 | 68 | <?php } else { ?> |
69 | 69 | <a href="<?= $this_url->generate('html', array('house'=>4)) ?>">MSPs only</a> |
70 | 70 | <?php } ?> |
71 | 71 | | |
72 | - <?php if ( $house == 3 ) { ?> |
|
72 | + <?php if ($house == 3) { ?> |
|
73 | 73 | MLAs only |
74 | 74 | <?php } else { ?> |
75 | 75 | <a href="<?= $this_url->generate('html', array('house'=>3)) ?>">MLAs only</a> |
@@ -90,25 +90,25 @@ discard block |
||
90 | 90 | </tr> |
91 | 91 | </thead> |
92 | 92 | <tbody> |
93 | - <?php foreach ( $speakers as $pid => $speaker ) { ?> |
|
93 | + <?php foreach ($speakers as $pid => $speaker) { ?> |
|
94 | 94 | |
95 | - <?php if ( $wtt && $pid == 0 ) { continue; } // skip heading count for WTT lords list ?> |
|
95 | + <?php if ($wtt && $pid == 0) { continue; } // skip heading count for WTT lords list ?> |
|
96 | 96 | |
97 | 97 | <tr> |
98 | 98 | <td><?= $speaker['count'] ?></td> |
99 | 99 | <td> |
100 | - <?php if ( $pid ) { ?> |
|
101 | - <?php if ( !$wtt || $speaker['left'] == '9999-12-31' ) { ?> |
|
100 | + <?php if ($pid) { ?> |
|
101 | + <?php if (!$wtt || $speaker['left'] == '9999-12-31') { ?> |
|
102 | 102 | <a href="/search/?q=<?= _htmlentities($searchstring) ?>&pid=<?= $pid ?><?= isset($wtt) && $speaker['left'] == '9999-12-31' ? '&wtt=2' : '' ?>"> |
103 | 103 | <?php } ?> |
104 | 104 | <?= isset($speaker['name']) ? $speaker['name'] : 'N/A' ?> |
105 | - <?php if ( !$wtt || $speaker['left'] == '9999-12-31' ) { ?> |
|
105 | + <?php if (!$wtt || $speaker['left'] == '9999-12-31') { ?> |
|
106 | 106 | </a> |
107 | 107 | <?php } ?> |
108 | - <?php if ( isset($speaker['party']) ) { ?> |
|
108 | + <?php if (isset($speaker['party'])) { ?> |
|
109 | 109 | <span class="search-results-grouped__speaker-party">(<?= $speaker['party'] ?>)</span> |
110 | 110 | <?php } ?> |
111 | - <?php if ( $house != 2 ) { ?> |
|
111 | + <?php if ($house != 2) { ?> |
|
112 | 112 | <?= isset($speaker['office']) ? ' - ' . join('; ', $speaker['office']) : '' ?> |
113 | 113 | <?php } ?> |
114 | 114 | <?php } else { // no $pid ?> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <?php } ?> |
117 | 117 | </td> |
118 | 118 | <td> |
119 | - <?php if ( format_date($speaker['pmindate'], 'M Y') == format_date($speaker['pmaxdate'], 'M Y') ) { ?> |
|
119 | + <?php if (format_date($speaker['pmindate'], 'M Y') == format_date($speaker['pmaxdate'], 'M Y')) { ?> |
|
120 | 120 | <?= format_date($speaker['pmindate'], 'M Y') ?> |
121 | 121 | <?php } else { ?> |
122 | 122 | <?= format_date($speaker['pmindate'], 'M Y') ?> – <?= format_date($speaker['pmaxdate'], 'M Y') ?> |
@@ -15,18 +15,22 @@ discard block |
||
15 | 15 | <li> |
16 | 16 | <?php if ( $house == 1 ) { ?> |
17 | 17 | No results for MPs only |
18 | - <?php } else if ( $house == 2 ) { ?> |
|
18 | + <?php } |
|
19 | +else if ( $house == 2 ) { ?> |
|
19 | 20 | No results for Peers only |
20 | - <?php } else if ( $house == 4 ) { ?> |
|
21 | + <?php } |
|
22 | +else if ( $house == 4 ) { ?> |
|
21 | 23 | No results for MSPs only |
22 | - <?php } else if ( $house == 3 ) { ?> |
|
24 | + <?php } |
|
25 | +else if ( $house == 3 ) { ?> |
|
23 | 26 | No results for MLAs only |
24 | 27 | <?php } ?> |
25 | 28 | | |
26 | 29 | <a href="<?= $this_url->generate('html') ?>">Show results for all speakers</a> |
27 | 30 | </li> |
28 | 31 | </ul> |
29 | - <?php } else { ?> |
|
32 | + <?php } |
|
33 | +else { ?> |
|
30 | 34 | <p class="search-results-legend"><?= $error ?></p> |
31 | 35 | <?php } ?> |
32 | 36 | <?php } ?> |
@@ -47,31 +51,36 @@ discard block |
||
47 | 51 | <li> |
48 | 52 | <?php if ( $house == 0 ) { ?> |
49 | 53 | Show All |
50 | - <?php } else { ?> |
|
54 | + <?php } |
|
55 | +else { ?> |
|
51 | 56 | <a href="<?= $this_url->generate('html') ?>">Show All</a> |
52 | 57 | <?php } ?> |
53 | 58 | | |
54 | 59 | <?php if ( $house == 1 ) { ?> |
55 | 60 | MPs only |
56 | - <?php } else { ?> |
|
61 | + <?php } |
|
62 | +else { ?> |
|
57 | 63 | <a href="<?= $this_url->generate('html', array('house'=>1)) ?>">MPs only</a> |
58 | 64 | <?php } ?> |
59 | 65 | | |
60 | 66 | <?php if ( $house == 2 ) { ?> |
61 | 67 | Peers only |
62 | - <?php } else { ?> |
|
68 | + <?php } |
|
69 | +else { ?> |
|
63 | 70 | <a href="<?= $this_url->generate('html', array('house'=>2)) ?>">Lords only</a> |
64 | 71 | <?php } ?> |
65 | 72 | | |
66 | 73 | <?php if ( $house == 4 ) { ?> |
67 | 74 | MSPs only |
68 | - <?php } else { ?> |
|
75 | + <?php } |
|
76 | +else { ?> |
|
69 | 77 | <a href="<?= $this_url->generate('html', array('house'=>4)) ?>">MSPs only</a> |
70 | 78 | <?php } ?> |
71 | 79 | | |
72 | 80 | <?php if ( $house == 3 ) { ?> |
73 | 81 | MLAs only |
74 | - <?php } else { ?> |
|
82 | + <?php } |
|
83 | +else { ?> |
|
75 | 84 | <a href="<?= $this_url->generate('html', array('house'=>3)) ?>">MLAs only</a> |
76 | 85 | <?php } ?> |
77 | 86 | </li> |
@@ -111,14 +120,17 @@ discard block |
||
111 | 120 | <?php if ( $house != 2 ) { ?> |
112 | 121 | <?= isset($speaker['office']) ? ' - ' . join('; ', $speaker['office']) : '' ?> |
113 | 122 | <?php } ?> |
114 | - <?php } else { // no $pid ?> |
|
123 | + <?php } |
|
124 | +else { |
|
125 | +// no $pid ?> |
|
115 | 126 | <?= $speaker['name'] ?> |
116 | 127 | <?php } ?> |
117 | 128 | </td> |
118 | 129 | <td> |
119 | 130 | <?php if ( format_date($speaker['pmindate'], 'M Y') == format_date($speaker['pmaxdate'], 'M Y') ) { ?> |
120 | 131 | <?= format_date($speaker['pmindate'], 'M Y') ?> |
121 | - <?php } else { ?> |
|
132 | + <?php } |
|
133 | +else { ?> |
|
122 | 134 | <?= format_date($speaker['pmindate'], 'M Y') ?> – <?= format_date($speaker['pmaxdate'], 'M Y') ?> |
123 | 135 | <?php } ?> |
124 | 136 | </td> |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <div class="search-page__section__secondary search-page-sidebar"> |
2 | - <?php if ( isset( $search_sidebar['email'] ) ) { ?> |
|
2 | + <?php if (isset($search_sidebar['email'])) { ?> |
|
3 | 3 | <h2>Create an alert</h2> |
4 | 4 | <p class="sidebar-item-with-icon"> |
5 | 5 | <a href="<?= $search_sidebar['email'] ?>">Subscribe to an email alert</a> |
6 | 6 | for <em class="current-search-term"><?= $search_sidebar['email_desc'] ?></em> |
7 | - <?php if (isset( $search_sidebar['email_section'] ) ) { ?> |
|
7 | + <?php if (isset($search_sidebar['email_section'])) { ?> |
|
8 | 8 | <br><small>(or just <a href="<?= $search_sidebar['email_section'] ?>"><?= $search_sidebar['email_desc_section'] ?></a>)</small> |
9 | 9 | <?php } ?> |
10 | 10 | </p> |
@@ -16,5 +16,5 @@ discard block |
||
16 | 16 | <?php } ?> |
17 | 17 | |
18 | 18 | |
19 | - <?php include( dirname(__FILE__) . '/../sidebar/looking_for.php' ) ?> |
|
19 | + <?php include(dirname(__FILE__) . '/../sidebar/looking_for.php') ?> |
|
20 | 20 | </div> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | if (isset ($data['rows']) && count($data['rows']) > 0) { |
67 | 67 | |
68 | 68 | echo '<dl id="searchresults">'; |
69 | - for ($i=0; $i<count($data['rows']); $i++) { |
|
69 | + for ($i = 0; $i < count($data['rows']); $i++) { |
|
70 | 70 | |
71 | 71 | $row = $data['rows'][$i]; |
72 | 72 | echo '<dt><a href="', $row['listurl'], '">'; |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | } |
80 | 80 | if (isset($row['collapsed']) && $row['collapsed'] && $row['subsection_id']) { |
81 | 81 | $URL = new URL('search'); |
82 | - $URL->insert(array('s' => $info['s'] . " segment:$row[subsection_id]" )); |
|
82 | + $URL->insert(array('s' => $info['s'] . " segment:$row[subsection_id]")); |
|
83 | 83 | echo ' <a href="', $URL->generate(), '">See ', $row['collapsed'], |
84 | - ' other result', $row['collapsed']>1?'s':'', ' from this ', |
|
84 | + ' other result', $row['collapsed'] > 1 ? 's' : '', ' from this ', |
|
85 | 85 | $hansardmajors[$row['major']]['singular'], '</a>'; |
86 | 86 | } |
87 | 87 | echo '</small>'; |
88 | 88 | if ($match = get_http_var('match')) { |
89 | - echo ' – <a href="/search/record.php?result=', $row['gid'] , '&match=', _htmlspecialchars($match), '">This is the correct match</a>'; |
|
89 | + echo ' – <a href="/search/record.php?result=', $row['gid'], '&match=', _htmlspecialchars($match), '">This is the correct match</a>'; |
|
90 | 90 | } |
91 | 91 | echo '</dt> <dd><p>'; |
92 | 92 | if (isset($row['speaker']) && count($row['speaker'])) { |
@@ -46,7 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | print "\t\t\t\t<h3 style='font-weight:normal'>Results <strong>" . number_format($info['first_result']) . '-' . number_format($last_result) . '</strong> of ' . number_format($info['total_results']) . " for <strong>" . _htmlentities($searchdescription) . "</strong></h3>\n"; |
48 | 48 | |
49 | -} elseif ($info['total_results'] == 0) { |
|
49 | +} |
|
50 | +elseif ($info['total_results'] == 0) { |
|
50 | 51 | echo '<h3 style="font-weight:normal">Your search for <strong>', _htmlentities($searchdescription), '</strong> did not match anything.</h3>'; |
51 | 52 | } |
52 | 53 | |
@@ -91,7 +92,9 @@ discard block |
||
91 | 92 | echo '</dt> <dd><p>'; |
92 | 93 | if (isset($row['speaker']) && count($row['speaker'])) { |
93 | 94 | echo "<em>" . ucfirst($row['speaker']['name']) . "</em>"; |
94 | - if ($row['extract']) echo ": "; |
|
95 | + if ($row['extract']) { |
|
96 | + echo ": "; |
|
97 | + } |
|
95 | 98 | } |
96 | 99 | |
97 | 100 | echo $row['extract'] . "</p></dd>\n"; |