@@ -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,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; ?> |
@@ -135,12 +135,16 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $recess_major = 1; # For all of UK Parliament |
| 138 | - if ($hansardmajors[$data['info']['major']]['location'] == 'NI') |
|
| 139 | - $recess_major = 5; |
|
| 140 | - elseif ($hansardmajors[$data['info']['major']]['location'] == 'Scotland') |
|
| 141 | - $recess_major = 4; # For all of Scotland |
|
| 142 | - elseif ($data['info']['major'] == 101) |
|
| 143 | - $recess_major = 101; # Lords slightly different |
|
| 138 | + if ($hansardmajors[$data['info']['major']]['location'] == 'NI') { |
|
| 139 | + $recess_major = 5; |
|
| 140 | + } elseif ($hansardmajors[$data['info']['major']]['location'] == 'Scotland') { |
|
| 141 | + $recess_major = 4; |
|
| 142 | + } |
|
| 143 | + # For all of Scotland |
|
| 144 | + elseif ($data['info']['major'] == 101) { |
|
| 145 | + $recess_major = 101; |
|
| 146 | + } |
|
| 147 | + # Lords slightly different |
|
| 144 | 148 | $recess = recess_prettify($currentDay, $month, $year, $recess_major); |
| 145 | 149 | |
| 146 | 150 | // Is this day actually Today in the real world? |
@@ -149,11 +153,15 @@ discard block |
||
| 149 | 153 | // sittings - e.g. WH is only Tuesday-Thursday |
| 150 | 154 | if ($currentDay == $toDay) { |
| 151 | 155 | print '<td class="on"'; |
| 152 | - if ($recess[0] && $recess[0]!=1) print ' title="'.$recess[0].'"'; |
|
| 156 | + if ($recess[0] && $recess[0]!=1) { |
|
| 157 | + print ' title="'.$recess[0].'"'; |
|
| 158 | + } |
|
| 153 | 159 | print '>'; |
| 154 | 160 | } elseif ($recess[0]) { |
| 155 | 161 | print '<td class="no"'; |
| 156 | - if ($recess[0]!=1) print ' title="'.$recess[0].'"'; |
|
| 162 | + if ($recess[0]!=1) { |
|
| 163 | + print ' title="'.$recess[0].'"'; |
|
| 164 | + } |
|
| 157 | 165 | print '>'; |
| 158 | 166 | } else { |
| 159 | 167 | print '<td>'; |
@@ -58,10 +58,12 @@ |
||
| 58 | 58 | to <a href="<?= $member_url ?>/votes">see all their votes</a>. |
| 59 | 59 | </p> |
| 60 | 60 | |
| 61 | - <?php else: ?> |
|
| 61 | + <?php else { |
|
| 62 | + : ?> |
|
| 62 | 63 | <ul class="vote-descriptions"> |
| 63 | 64 | <?php |
| 64 | 65 | $policy_ids = array(); |
| 66 | +} |
|
| 65 | 67 | |
| 66 | 68 | foreach ($positions as $position) { |
| 67 | 69 | if (!in_array($position['policy_id'], $policy_ids)) { |
@@ -14,7 +14,9 @@ discard block |
||
| 14 | 14 | if (isset ($data['rows'])) { |
| 15 | 15 | for ($i=0; $i<count($data['rows']); $i++) { |
| 16 | 16 | $row = $data['rows'][$i]; |
| 17 | - if (count($row) == 0) continue; |
|
| 17 | + if (count($row) == 0) { |
|
| 18 | + continue; |
|
| 19 | + } |
|
| 18 | 20 | if ($row['htype'] == '12') { |
| 19 | 21 | if (isset($row['speaker']) && count($row['speaker']) > 0) { |
| 20 | 22 | $speaker = $row['speaker']; |
@@ -36,7 +38,9 @@ discard block |
||
| 36 | 38 | $desc .= $speaker['constituency'] . ', '; |
| 37 | 39 | } |
| 38 | 40 | $desc .= _htmlentities($speaker['party']); |
| 39 | - if ($desc) $row['speaker']['desc'] = $desc; |
|
| 41 | + if ($desc) { |
|
| 42 | + $row['speaker']['desc'] = $desc; |
|
| 43 | + } |
|
| 40 | 44 | } |
| 41 | 45 | } |
| 42 | 46 | $out[] = $row; |
@@ -52,8 +56,9 @@ discard block |
||
| 52 | 56 | $has_content = false; |
| 53 | 57 | } |
| 54 | 58 | $entry = $row; |
| 55 | - if (isset($row['excerpt'])) |
|
| 56 | - $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
| 59 | + if (isset($row['excerpt'])) { |
|
| 60 | + $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
| 61 | + } |
|
| 57 | 62 | if ($has_content) { |
| 58 | 63 | } else { |
| 59 | 64 | unset($entry['listurl']); |
@@ -27,8 +27,9 @@ |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $entry = $row; |
| 30 | - if (isset($row['excerpt'])) |
|
| 31 | - $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
| 30 | + if (isset($row['excerpt'])) { |
|
| 31 | + $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
| 32 | + } |
|
| 32 | 33 | if ($has_content) { |
| 33 | 34 | } else { |
| 34 | 35 | unset($entry['listurl']); |
@@ -5,7 +5,9 @@ |
||
| 5 | 5 | echo '<optgroup label="', $key, '">'; |
| 6 | 6 | foreach ($values as $k => $v) { |
| 7 | 7 | echo '<option'; |
| 8 | - if ($current == $k) echo ' selected'; |
|
| 8 | + if ($current == $k) { |
|
| 9 | + echo ' selected'; |
|
| 10 | + } |
|
| 9 | 11 | echo ' value="', $k, '">', $v; |
| 10 | 12 | } |
| 11 | 13 | echo "</optgroup>\n"; |