@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | if ($string == 'minute' && $ago > 59) { $ago /= 60; $string = 'hour'; } |
15 | 15 | if ($string == 'hour' && $ago > 23) { $ago /= 24; $string = 'day'; } |
16 | 16 | if ($string == 'day' && $ago > 13) { $ago /= 7; $string = 'week'; } |
17 | - $ago = round($ago); if ($ago != 1) $string .= 's'; |
|
17 | + $ago = round($ago); if ($ago != 1) { |
|
18 | + $string .= 's'; |
|
19 | + } |
|
18 | 20 | $body .= '<li><a href="' . $item->xLink . '">' . $item->xTitle . '</a> ('.$ago.' '.$string.' ago)</li>'; |
19 | 21 | } |
20 | 22 | if ($body) { |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | #echo "cache miss!"; |
65 | 67 | |
66 | 68 | $a = file($techRati); |
67 | - if (!$a) return false; |
|
69 | + if (!$a) { |
|
70 | + return false; |
|
71 | + } |
|
68 | 72 | set_time_limit (10); |
69 | 73 | $contents = implode('', $a); |
70 | 74 | // $cachefp = fopen("cache/{$cacheFilename}.xml", "w"); |
@@ -121,12 +125,10 @@ discard block |
||
121 | 125 | $arItems[$itemCount] = new xItem(); |
122 | 126 | // set new item object's properties |
123 | 127 | $arItems[$itemCount]->xTitle = $data; |
124 | - } |
|
125 | - elseif ($curTag == $permalinkKey) { |
|
128 | + } elseif ($curTag == $permalinkKey) { |
|
126 | 129 | $arItems[$itemCount]->xPermalink = $data; |
127 | 130 | # $itemCount++; |
128 | - } |
|
129 | - elseif ($curTag == $linkKey) { |
|
131 | + } elseif ($curTag == $linkKey) { |
|
130 | 132 | $arItems[$itemCount]->xLink = $data; |
131 | 133 | #$itemCount++; |
132 | 134 | } elseif ($curTag == $createdKey) { |
@@ -41,7 +41,9 @@ |
||
41 | 41 | twfy_debug_timestamp("after including utility.php"); |
42 | 42 | |
43 | 43 | // Set the default timezone |
44 | -if(function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
44 | +if(function_exists('date_default_timezone_set')) { |
|
45 | + date_default_timezone_set(TIMEZONE); |
|
46 | +} |
|
45 | 47 | |
46 | 48 | // Only do clever things with errors if we're not testing, otherwise show as default |
47 | 49 |
@@ -107,15 +107,17 @@ discard block |
||
107 | 107 | $query .= 'LEFT OUTER JOIN personinfo ON member.person_id = personinfo.person_id AND data_key="' . $personinfo_key . '" '; |
108 | 108 | } |
109 | 109 | $query .= ' JOIN person_names p ON p.person_id = member.person_id AND p.type = "name" '; |
110 | - if (isset($args['date'])) |
|
111 | - $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
112 | - else |
|
113 | - $query .= 'AND end_date="9999-12-31" '; |
|
110 | + if (isset($args['date'])) { |
|
111 | + $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
112 | + } else { |
|
113 | + $query .= 'AND end_date="9999-12-31" '; |
|
114 | + } |
|
114 | 115 | $query .= 'WHERE house=' . $args['house'] . ' '; |
115 | - if (isset($args['date'])) |
|
116 | - $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
117 | - elseif (!isset($args['all']) || $args['house'] == 1) |
|
118 | - $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
116 | + if (isset($args['date'])) { |
|
117 | + $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
118 | + } elseif (!isset($args['all']) || $args['house'] == 1) { |
|
119 | + $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
120 | + } |
|
119 | 121 | |
120 | 122 | if (isset($args['order'])) { |
121 | 123 | $order = $args['order']; |
@@ -174,8 +176,9 @@ discard block |
||
174 | 176 | $data[$p_id] = $narray; |
175 | 177 | } |
176 | 178 | } |
177 | - if ($args['house'] == 2 && ($order == 'name' || $order == 'constituency')) |
|
178 | - uasort($data, array($this, 'by_peer_name')); |
|
179 | + if ($args['house'] == 2 && ($order == 'name' || $order == 'constituency')) { |
|
180 | + uasort($data, array($this, 'by_peer_name')); |
|
181 | + } |
|
179 | 182 | |
180 | 183 | $data = array ( |
181 | 184 | 'info' => array ( |
@@ -188,14 +191,18 @@ discard block |
||
188 | 191 | |
189 | 192 | } |
190 | 193 | public function by_peer_name($a, $b) { |
191 | - if (!$a['family_name'] && !$b['family_name']) |
|
192 | - return strcmp($a['lordofname'], $b['lordofname']); |
|
193 | - if (!$a['family_name']) |
|
194 | - return strcmp($a['lordofname'], $b['family_name']); |
|
195 | - if (!$b['family_name']) |
|
196 | - return strcmp($a['family_name'], $b['lordofname']); |
|
197 | - if (strcmp($a['family_name'], $b['family_name'])) |
|
198 | - return strcmp($a['family_name'], $b['family_name']); |
|
194 | + if (!$a['family_name'] && !$b['family_name']) { |
|
195 | + return strcmp($a['lordofname'], $b['lordofname']); |
|
196 | + } |
|
197 | + if (!$a['family_name']) { |
|
198 | + return strcmp($a['lordofname'], $b['family_name']); |
|
199 | + } |
|
200 | + if (!$b['family_name']) { |
|
201 | + return strcmp($a['family_name'], $b['lordofname']); |
|
202 | + } |
|
203 | + if (strcmp($a['family_name'], $b['family_name'])) { |
|
204 | + return strcmp($a['family_name'], $b['family_name']); |
|
205 | + } |
|
199 | 206 | return strcmp($a['lordofname'], $b['lordofname']); |
200 | 207 | } |
201 | 208 |
@@ -174,8 +174,7 @@ discard block |
||
174 | 174 | WHERE edit_id=" . $approval_id . ";"); |
175 | 175 | if (!$q->success()) { |
176 | 176 | break; |
177 | - } |
|
178 | - else { |
|
177 | + } else { |
|
179 | 178 | // Now send them an email telling them they've been approved |
180 | 179 | |
181 | 180 | |
@@ -216,8 +215,7 @@ discard block |
||
216 | 215 | WHERE edit_id=" . $decline_id . ";"); |
217 | 216 | if (!$q->success()) { |
218 | 217 | break; |
219 | - } |
|
220 | - else { |
|
218 | + } else { |
|
221 | 219 | // Scrub that one from the list of pending items |
222 | 220 | unset ($this->pending[$decline_id]); |
223 | 221 | } |
@@ -255,8 +253,7 @@ discard block |
||
255 | 253 | $this->update_pending_count(); |
256 | 254 | |
257 | 255 | return true; |
258 | - } |
|
259 | - else { |
|
256 | + } else { |
|
260 | 257 | return false; |
261 | 258 | } |
262 | 259 | } |
@@ -368,8 +365,7 @@ discard block |
||
368 | 365 | WHERE edit_id=" . $approval_id . ";"); |
369 | 366 | if (!$q->success()) { |
370 | 367 | break; |
371 | - } |
|
372 | - else { |
|
368 | + } else { |
|
373 | 369 | // Scrub that one from the list of pending items |
374 | 370 | unset ($this->pending[$approval_id]); |
375 | 371 | } |
@@ -107,19 +107,19 @@ discard block |
||
107 | 107 | if (isset($args['glossary_id']) && ($args['glossary_id'] != "")) { |
108 | 108 | $next = 0; $first_term = null; |
109 | 109 | foreach ($this->terms as $term) { |
110 | - if (!$first_term) $first_term = $term; |
|
110 | + if (!$first_term) { |
|
111 | + $first_term = $term; |
|
112 | + } |
|
111 | 113 | $last_term = $term; |
112 | 114 | if ($next == 1) { |
113 | 115 | $this->next_term = $term; |
114 | 116 | break; |
115 | - } |
|
116 | - elseif ($term['glossary_id'] == $args['glossary_id']) { |
|
117 | + } elseif ($term['glossary_id'] == $args['glossary_id']) { |
|
117 | 118 | $this->glossary_id = $args['glossary_id']; |
118 | 119 | $this->current_term = $term; |
119 | 120 | $next = 1; |
120 | 121 | |
121 | - } |
|
122 | - else { |
|
122 | + } else { |
|
123 | 123 | $this->previous_term = $term; |
124 | 124 | } |
125 | 125 | } |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | return ($this->num_terms); |
137 | - } |
|
138 | - else { |
|
137 | + } else { |
|
139 | 138 | return false; |
140 | 139 | } |
141 | 140 | } |
@@ -278,8 +277,9 @@ discard block |
||
278 | 277 | |
279 | 278 | // check for any glossary terms to replace |
280 | 279 | foreach ($this->replace_order as $glossary_id => $count) { |
281 | - if ($glossary_id == $this->glossary_id) |
|
282 | - continue; |
|
280 | + if ($glossary_id == $this->glossary_id) { |
|
281 | + continue; |
|
282 | + } |
|
283 | 283 | |
284 | 284 | $term_body = $this->terms[$glossary_id]['body']; |
285 | 285 | $term_title = $this->terms[$glossary_id]['title']; |
@@ -290,12 +290,10 @@ discard block |
||
290 | 290 | // catch glossary terms within their own definitions |
291 | 291 | if ($glossary_id == $this->glossary_id) { |
292 | 292 | $replacewords[] = "<strong>\\1</strong>"; |
293 | - } |
|
294 | - else { |
|
293 | + } else { |
|
295 | 294 | if ($this_page == "admin_glossary") { |
296 | 295 | $link_url = "#gl".$glossary_id; |
297 | - } |
|
298 | - else { |
|
296 | + } else { |
|
299 | 297 | $link_url = $URL->generate('url'); |
300 | 298 | } |
301 | 299 | $title = _htmlentities(trim_characters($term_body, 0, 80)); |
@@ -304,8 +302,9 @@ discard block |
||
304 | 302 | } |
305 | 303 | // Highlight all occurrences of another glossary term in the definition. |
306 | 304 | $body = preg_replace($findwords, $replacewords, $body, 1); |
307 | - if (isset($this->glossary_id)) |
|
308 | - $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1); |
|
305 | + if (isset($this->glossary_id)) { |
|
306 | + $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1); |
|
307 | + } |
|
309 | 308 | |
310 | 309 | // Replace any phrases in wikipedia |
311 | 310 | // TODO: Merge this code into above, so our gloss and wikipedia |
@@ -110,13 +110,16 @@ |
||
110 | 110 | |
111 | 111 | <?php endif; ?> |
112 | 112 | |
113 | - <?php else: ?> |
|
113 | + <?php else { |
|
114 | + : ?> |
|
114 | 115 | |
115 | 116 | <div class="panel"> |
116 | 117 | <p>This person has not voted on any of the key issues which we keep track of.</p> |
117 | 118 | </div> |
118 | 119 | |
119 | - <?php endif; ?> |
|
120 | + <?php endif; |
|
121 | +} |
|
122 | +?> |
|
120 | 123 | |
121 | 124 | <?php endif; ?> |
122 | 125 |
@@ -190,11 +190,14 @@ |
||
190 | 190 | <?= $recent_appearances['additional_links'] ?> |
191 | 191 | <?php endif; ?> |
192 | 192 | |
193 | - <?php else: ?> |
|
193 | + <?php else { |
|
194 | + : ?> |
|
194 | 195 | |
195 | 196 | <p>No recent appearances to display.</p> |
196 | 197 | |
197 | - <?php endif; ?> |
|
198 | + <?php endif; |
|
199 | +} |
|
200 | +?> |
|
198 | 201 | |
199 | 202 | </div> |
200 | 203 | <?php endif; ?> |
@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | <?php } ?> |
28 | 28 | </div> |
29 | 29 | <?php } ?> |
30 | - <?php else: ?> |
|
30 | + <?php else { |
|
31 | + : ?> |
|
31 | 32 | <div class="person-data-attribution"> |
32 | 33 | We’re missing a photo of <?= $full_name ?>. If you have a |
33 | 34 | photo <em>that you can release under a Creative Commons Attribution-ShareAlike |
@@ -36,7 +37,9 @@ discard block |
||
36 | 37 | Please do not email us about copyrighted photos elsewhere on the internet; we can’t |
37 | 38 | use them. |
38 | 39 | </div> |
39 | - <?php endif; ?> |
|
40 | + <?php endif; |
|
41 | +} |
|
42 | +?> |
|
40 | 43 | <div class="person-constituency"> |
41 | 44 | <?php if ( $constituency && $this_page != 'peer' && $this_page != 'royal' ) { ?> |
42 | 45 | <span class="constituency"><?= $constituency ?></span> |
@@ -91,7 +91,9 @@ |
||
91 | 91 | echo '</dt> <dd><p>'; |
92 | 92 | if (isset($row['speaker']) && count($row['speaker'])) { |
93 | 93 | echo "<em>" . ucfirst($row['speaker']['name']) . "</em>"; |
94 | - if ($row['extract']) echo ": "; |
|
94 | + if ($row['extract']) { |
|
95 | + echo ": "; |
|
96 | + } |
|
95 | 97 | } |
96 | 98 | |
97 | 99 | echo $row['extract'] . "</p></dd>\n"; |