@@ -324,7 +324,9 @@ |
||
| 324 | 324 | while (1) { |
| 325 | 325 | $len = strlen($data); |
| 326 | 326 | $data = preg_replace("/<({$tags})(\s[^>]*)?(><\\/\\1>|\\/>)/", '', $data); |
| 327 | - if ($len == strlen($data)) break; |
|
| 327 | + if ($len == strlen($data)) { |
|
| 328 | + break; |
|
| 329 | + } |
|
| 328 | 330 | } |
| 329 | 331 | } |
| 330 | 332 | |
@@ -114,7 +114,10 @@ discard block |
||
| 114 | 114 | // 'foot' - For the bottom stripe on hansard debates/wrans listings. |
| 115 | 115 | // $id is the value of an id for this div (if blank, not used). |
| 116 | 116 | ?> |
| 117 | - <div class="stripe-<?php echo $type; ?><?php if ($extra_class != '') echo ' ' . $extra_class; ?>"<?php |
|
| 117 | + <div class="stripe-<?php echo $type; ?><?php if ($extra_class != '') { |
|
| 118 | + echo ' ' . $extra_class; |
|
| 119 | +} |
|
| 120 | +?>"<?php |
|
| 118 | 121 | if ($id != '') { |
| 119 | 122 | print ' id="' . $id . '"'; |
| 120 | 123 | } |
@@ -479,7 +482,9 @@ discard block |
||
| 479 | 482 | |
| 480 | 483 | global $DATA, $this_page; |
| 481 | 484 | |
| 482 | - if ($this->page_started()) return; |
|
| 485 | + if ($this->page_started()) { |
|
| 486 | + return; |
|
| 487 | + } |
|
| 483 | 488 | // The page's HTML hasn't been started yet, so we'd better do it. |
| 484 | 489 | |
| 485 | 490 | // Set the page title (in the <title></title>). |
@@ -629,7 +634,9 @@ discard block |
||
| 629 | 634 | $URL->insert(array('adv' => 1)); |
| 630 | 635 | echo ' <a href="' . $URL->generate() . '">More options</a>'; |
| 631 | 636 | echo '<br>'; |
| 632 | - if ($wtt) print '<input type="hidden" name="wtt" value="1">'; |
|
| 637 | + if ($wtt) { |
|
| 638 | + print '<input type="hidden" name="wtt" value="1">'; |
|
| 639 | + } |
|
| 633 | 640 | } else { ?> |
| 634 | 641 | <form action="http://www.writetothem.com/lords" method="get"> |
| 635 | 642 | <input type="hidden" name="pid" value="<?=_htmlentities(get_http_var('pid')) ?>"> |
@@ -743,8 +750,7 @@ discard block |
||
| 743 | 750 | // The return url for after the user has logged in. |
| 744 | 751 | if (get_http_var("ret") != "") { |
| 745 | 752 | $returl = get_http_var("ret"); |
| 746 | - } |
|
| 747 | - else { |
|
| 753 | + } else { |
|
| 748 | 754 | $returl = $glossary_returl; |
| 749 | 755 | } |
| 750 | 756 | ?> |
@@ -808,15 +814,13 @@ discard block |
||
| 808 | 814 | else { |
| 809 | 815 | $letters[] = "<li class=\"on\">" . $letter . "</li>"; |
| 810 | 816 | } |
| 811 | - } |
|
| 812 | - elseif (!empty($GLOSSARY->alphabet[$letter])) { |
|
| 817 | + } elseif (!empty($GLOSSARY->alphabet[$letter])) { |
|
| 813 | 818 | $URL = new \MySociety\TheyWorkForYou\Url('glossary'); |
| 814 | 819 | $URL->insert(array('az' => $letter)); |
| 815 | 820 | $letter_link = $URL->generate('url'); |
| 816 | 821 | |
| 817 | 822 | $letters[] = "<li><a href=\"" . $letter_link . "\">" . $letter . "</a></li>"; |
| 818 | - } |
|
| 819 | - else { |
|
| 823 | + } else { |
|
| 820 | 824 | $letters[] = '<li>' . $letter . '</li>'; |
| 821 | 825 | } |
| 822 | 826 | } |
@@ -856,8 +860,7 @@ discard block |
||
| 856 | 860 | $URL->insert(array("delete_confirm" => $term['glossary_id'])); |
| 857 | 861 | $delete_url = $URL->generate(); |
| 858 | 862 | $admin_links = "<br><small><a href=\"".$delete_url."\">delete</a></small>"; |
| 859 | - } |
|
| 860 | - else { |
|
| 863 | + } else { |
|
| 861 | 864 | $admin_links = ""; |
| 862 | 865 | } |
| 863 | 866 | |
@@ -867,8 +870,7 @@ discard block |
||
| 867 | 870 | $user_link = $URL->generate('url'); |
| 868 | 871 | |
| 869 | 872 | $user_details = "\t\t\t\t<p><small>contributed by user <a href=\"" . $user_link . "\">" . $term['firstname'] . " " . $term['lastname'] . "</a></small>" . $admin_links . "</p>\n"; |
| 870 | - } |
|
| 871 | - else { |
|
| 873 | + } else { |
|
| 872 | 874 | $user_details = ""; |
| 873 | 875 | } |
| 874 | 876 | |
@@ -138,8 +138,9 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | global $PAGE; |
| 140 | 140 | |
| 141 | - if ($view == 'search' && (!defined('FRONT_END_SEARCH') || !FRONT_END_SEARCH)) |
|
| 142 | - return false; |
|
| 141 | + if ($view == 'search' && (!defined('FRONT_END_SEARCH') || !FRONT_END_SEARCH)) { |
|
| 142 | + return false; |
|
| 143 | + } |
|
| 143 | 144 | |
| 144 | 145 | $validviews = array ('calendar', 'date', 'gid', 'person', 'search', 'search_min', 'search_video', 'recent', 'recent_mostvotes', 'biggest_debates', 'recent_wrans', 'recent_wms', 'column', 'mp', 'bill', 'session', 'recent_debates', 'recent_pbc_debates', 'featured_gid'); |
| 145 | 146 | if (in_array($view, $validviews)) { |
@@ -326,10 +327,11 @@ discard block |
||
| 326 | 327 | ); |
| 327 | 328 | |
| 328 | 329 | $subsectiondata = $this->_get_hansard_data($input); |
| 329 | - if (count($subsectiondata) == 0) |
|
| 330 | - $subsectiondata = null; |
|
| 331 | - else |
|
| 332 | - $subsectiondata = $subsectiondata[0]; |
|
| 330 | + if (count($subsectiondata) == 0) { |
|
| 331 | + $subsectiondata = null; |
|
| 332 | + } else { |
|
| 333 | + $subsectiondata = $subsectiondata[0]; |
|
| 334 | + } |
|
| 333 | 335 | |
| 334 | 336 | } elseif ($itemdata['htype'] == '11') { |
| 335 | 337 | // It's a subsection, so use the item itself. |
@@ -1018,12 +1020,12 @@ discard block |
||
| 1018 | 1020 | // Mainly for glossary term adding |
| 1019 | 1021 | if (isset($args['num']) && $args['num']) { |
| 1020 | 1022 | $results_per_page = $args['num']+0; |
| 1021 | - } |
|
| 1022 | - else { |
|
| 1023 | + } else { |
|
| 1023 | 1024 | $results_per_page = 20; |
| 1024 | 1025 | } |
| 1025 | - if ($results_per_page > 1000) |
|
| 1026 | - $results_per_page = 1000; |
|
| 1026 | + if ($results_per_page > 1000) { |
|
| 1027 | + $results_per_page = 1000; |
|
| 1028 | + } |
|
| 1027 | 1029 | |
| 1028 | 1030 | $data['info']['results_per_page'] = $results_per_page; |
| 1029 | 1031 | |
@@ -1051,10 +1053,16 @@ discard block |
||
| 1051 | 1053 | // Get the gids from Xapian |
| 1052 | 1054 | $sort_order = 'date'; |
| 1053 | 1055 | if (isset($args['o'])) { |
| 1054 | - if ($args['o']=='d') $sort_order = 'newest'; |
|
| 1055 | - if ($args['o']=='o') $sort_order = 'oldest'; |
|
| 1056 | - elseif ($args['o']=='c') $sort_order = 'created'; |
|
| 1057 | - elseif ($args['o']=='r') $sort_order = 'relevance'; |
|
| 1056 | + if ($args['o']=='d') { |
|
| 1057 | + $sort_order = 'newest'; |
|
| 1058 | + } |
|
| 1059 | + if ($args['o']=='o') { |
|
| 1060 | + $sort_order = 'oldest'; |
|
| 1061 | + } elseif ($args['o']=='c') { |
|
| 1062 | + $sort_order = 'created'; |
|
| 1063 | + } elseif ($args['o']=='r') { |
|
| 1064 | + $sort_order = 'relevance'; |
|
| 1065 | + } |
|
| 1058 | 1066 | } |
| 1059 | 1067 | |
| 1060 | 1068 | $data['searchdescription'] = $SEARCHENGINE->query_description_long(); |
@@ -1114,7 +1122,9 @@ discard block |
||
| 1114 | 1122 | FROM future |
| 1115 | 1123 | LEFT JOIN future_people ON id=calendar_id AND witness=0 |
| 1116 | 1124 | WHERE id = $id AND deleted=0"); |
| 1117 | - if ($q->rows() == 0) continue; |
|
| 1125 | + if ($q->rows() == 0) { |
|
| 1126 | + continue; |
|
| 1127 | + } |
|
| 1118 | 1128 | |
| 1119 | 1129 | $itemdata = $q->row(0); |
| 1120 | 1130 | |
@@ -1123,8 +1133,9 @@ discard block |
||
| 1123 | 1133 | in_array($itemdata['chamber'], array( |
| 1124 | 1134 | 'Commons: Main Chamber', 'Lords: Main Chamber', |
| 1125 | 1135 | 'Commons: Westminster Hall', |
| 1126 | - ))) |
|
| 1127 | - continue; |
|
| 1136 | + ))) { |
|
| 1137 | + continue; |
|
| 1138 | + } |
|
| 1128 | 1139 | |
| 1129 | 1140 | list($cal_item, $cal_meta) = \MySociety\TheyWorkForYou\Utility\Calendar::meta($itemdata); |
| 1130 | 1141 | $body = $this->prepare_search_result_for_display($cal_item) . '.'; |
@@ -1237,10 +1248,17 @@ discard block |
||
| 1237 | 1248 | $section = $this->_get_section($itemdata); |
| 1238 | 1249 | $subsection = $this->_get_subsection($itemdata); |
| 1239 | 1250 | $body = $hansardmajors[$itemdata['major']]['title'] . ' — '; |
| 1240 | - if (isset($section['body'])) $body .= $section['body']; |
|
| 1241 | - if (isset($subsection['body'])) $body .= ': ' . $subsection['body']; |
|
| 1242 | - if (isset($subsection['listurl'])) $listurl = $subsection['listurl']; |
|
| 1243 | - else $listurl = ''; |
|
| 1251 | + if (isset($section['body'])) { |
|
| 1252 | + $body .= $section['body']; |
|
| 1253 | + } |
|
| 1254 | + if (isset($subsection['body'])) { |
|
| 1255 | + $body .= ': ' . $subsection['body']; |
|
| 1256 | + } |
|
| 1257 | + if (isset($subsection['listurl'])) { |
|
| 1258 | + $listurl = $subsection['listurl']; |
|
| 1259 | + } else { |
|
| 1260 | + $listurl = ''; |
|
| 1261 | + } |
|
| 1244 | 1262 | $itemdata['parent'] = array ( |
| 1245 | 1263 | 'body' => $body, |
| 1246 | 1264 | 'listurl' => $listurl |
@@ -1980,10 +1998,11 @@ discard block |
||
| 1980 | 1998 | // ); |
| 1981 | 1999 | |
| 1982 | 2000 | // $url_args is an array of other key/value pairs to be appended in the GET string. |
| 1983 | - if ($id_data['major']) |
|
| 1984 | - $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']); |
|
| 1985 | - else |
|
| 1986 | - $LISTURL = new \MySociety\TheyWorkForYou\Url('wrans'); |
|
| 2001 | + if ($id_data['major']) { |
|
| 2002 | + $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']); |
|
| 2003 | + } else { |
|
| 2004 | + $LISTURL = new \MySociety\TheyWorkForYou\Url('wrans'); |
|
| 2005 | + } |
|
| 1987 | 2006 | |
| 1988 | 2007 | $fragment = ''; |
| 1989 | 2008 | |
@@ -2633,7 +2652,9 @@ discard block |
||
| 2633 | 2652 | array(':gid_from_spid' => 'uk.org.publicwhip/spq/' . $fixed_spid) |
| 2634 | 2653 | ); |
| 2635 | 2654 | $gid = $q->field(0, 'mentioned_gid'); |
| 2636 | - if ($gid) return $gid; |
|
| 2655 | + if ($gid) { |
|
| 2656 | + return $gid; |
|
| 2657 | + } |
|
| 2637 | 2658 | return null; |
| 2638 | 2659 | } |
| 2639 | 2660 | public function old_get_gid_from_spid($spid) { |
@@ -2642,7 +2663,9 @@ discard block |
||
| 2642 | 2663 | array(':gid_like' => 'uk.org.publicwhip/spwa/%.' . $spid . '.h') |
| 2643 | 2664 | ); |
| 2644 | 2665 | $gid = $q->field(0, 'gid'); |
| 2645 | - if ($gid) return str_replace('uk.org.publicwhip/spwa/', '', $gid); |
|
| 2666 | + if ($gid) { |
|
| 2667 | + return str_replace('uk.org.publicwhip/spwa/', '', $gid); |
|
| 2668 | + } |
|
| 2646 | 2669 | return null; |
| 2647 | 2670 | } |
| 2648 | 2671 | } |
@@ -2928,7 +2951,9 @@ discard block |
||
| 2928 | 2951 | |
| 2929 | 2952 | // Get the most recent day on which we have a debate. |
| 2930 | 2953 | $recentday = $this->most_recent_day(); |
| 2931 | - if (!count($recentday)) return $data; |
|
| 2954 | + if (!count($recentday)) { |
|
| 2955 | + return $data; |
|
| 2956 | + } |
|
| 2932 | 2957 | |
| 2933 | 2958 | if (!isset($args['days']) || !is_numeric($args['days'])) { |
| 2934 | 2959 | $args['days'] = 1; |
@@ -3055,8 +3080,9 @@ discard block |
||
| 3055 | 3080 | |
| 3056 | 3081 | // Get the most recent day on which we have a debate. |
| 3057 | 3082 | $recentday = $this->most_recent_day(); |
| 3058 | - if (!count($recentday)) |
|
| 3059 | - return array(); |
|
| 3083 | + if (!count($recentday)) { |
|
| 3084 | + return array(); |
|
| 3085 | + } |
|
| 3060 | 3086 | |
| 3061 | 3087 | if (!isset($args['days']) || !is_numeric($args['days'])) { |
| 3062 | 3088 | $args['days'] = 1; |
@@ -3189,8 +3215,9 @@ discard block |
||
| 3189 | 3215 | |
| 3190 | 3216 | // Get the most recent day on which we have wrans. |
| 3191 | 3217 | $recentday = $this->most_recent_day(); |
| 3192 | - if (!count($recentday)) |
|
| 3193 | - return $data; |
|
| 3218 | + if (!count($recentday)) { |
|
| 3219 | + return $data; |
|
| 3220 | + } |
|
| 3194 | 3221 | |
| 3195 | 3222 | if (!isset($args['days']) || !is_numeric($args['days'])) { |
| 3196 | 3223 | $args['days'] = 1; |
@@ -3470,7 +3497,9 @@ discard block |
||
| 3470 | 3497 | } |
| 3471 | 3498 | |
| 3472 | 3499 | public function _get_data_by_recent_pbc_debates($args) { |
| 3473 | - if (!isset($args['num'])) $args['num'] = 20; |
|
| 3500 | + if (!isset($args['num'])) { |
|
| 3501 | + $args['num'] = 20; |
|
| 3502 | + } |
|
| 3474 | 3503 | $q = $this->db->query('select gid, minor, hdate from hansard |
| 3475 | 3504 | where htype=10 and major=6 |
| 3476 | 3505 | order by hdate desc limit ' . $args['num']); |
@@ -3484,7 +3513,9 @@ discard block |
||
| 3484 | 3513 | $session = $qq->field(0, 'session'); |
| 3485 | 3514 | list($sitting, $part) = $this->_get_sitting($gid); |
| 3486 | 3515 | $sitting_txt = make_ranking($sitting) . ' sitting'; |
| 3487 | - if ($part>0) $sitting .= ", part $part"; |
|
| 3516 | + if ($part>0) { |
|
| 3517 | + $sitting .= ", part $part"; |
|
| 3518 | + } |
|
| 3488 | 3519 | $data[$hdate][] = array( |
| 3489 | 3520 | 'bill'=> $title, |
| 3490 | 3521 | 'sitting' => $sitting_txt, |
@@ -3496,8 +3527,9 @@ discard block |
||
| 3496 | 3527 | |
| 3497 | 3528 | # Given a GID, parse out the sitting number and optional part from it |
| 3498 | 3529 | public function _get_sitting($gid) { |
| 3499 | - if (preg_match('#_(\d\d)-(\d)_#', $gid, $m)) |
|
| 3500 | - return array($m[1]+0, $m[2]); |
|
| 3530 | + if (preg_match('#_(\d\d)-(\d)_#', $gid, $m)) { |
|
| 3531 | + return array($m[1]+0, $m[2]); |
|
| 3532 | + } |
|
| 3501 | 3533 | return array(0, 0); |
| 3502 | 3534 | } |
| 3503 | 3535 | } |
@@ -18,10 +18,13 @@ |
||
| 18 | 18 | # Content goes here |
| 19 | 19 | foreach ($data['dates'] as $date => $day_events) { |
| 20 | 20 | foreach ($order as $i => $chamber) { |
| 21 | - if (!array_key_exists($chamber, $day_events)) |
|
| 22 | - continue; |
|
| 21 | + if (!array_key_exists($chamber, $day_events)) { |
|
| 22 | + continue; |
|
| 23 | + } |
|
| 23 | 24 | $events = $day_events[$chamber]; |
| 24 | - if ($plural[$i]) $chamber .= 's'; |
|
| 25 | + if ($plural[$i]) { |
|
| 26 | + $chamber .= 's'; |
|
| 27 | + } |
|
| 25 | 28 | print "<h2 class='calendar'>$chamber"; |
| 26 | 29 | if (in_array($major[$i], $data['majors'])) { |
| 27 | 30 | $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$major[$i]]['page_all']); |
@@ -18,7 +18,9 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | $PAGE->block_start(array('id'=>'recentcomments', 'title'=>$title)); |
| 20 | 20 | |
| 21 | - if ($this_page != 'home') $PAGE->page_links($data); |
|
| 21 | + if ($this_page != 'home') { |
|
| 22 | + $PAGE->page_links($data); |
|
| 23 | + } |
|
| 22 | 24 | $USERURL = new \MySociety\TheyWorkForYou\Url('userview'); |
| 23 | 25 | ?> |
| 24 | 26 | <ul> |
@@ -50,7 +52,9 @@ discard block |
||
| 50 | 52 | <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p> |
| 51 | 53 | <?php |
| 52 | 54 | } |
| 53 | - if ($this_page != 'home') $PAGE->page_links($data); |
|
| 55 | + if ($this_page != 'home') { |
|
| 56 | + $PAGE->page_links($data); |
|
| 57 | + } |
|
| 54 | 58 | $PAGE->block_end(); |
| 55 | 59 | } |
| 56 | 60 | ?> |
@@ -28,8 +28,9 @@ discard block |
||
| 28 | 28 | $URL = new \MySociety\TheyWorkForYou\Url('mp'); |
| 29 | 29 | $row['url'] = $URL->generate('none') . make_member_url($row['full_name'], $row['constituency'], $row['house'], $row['person_id']); |
| 30 | 30 | } |
| 31 | - if ($has_party && isset($parties[$row['party']])) |
|
| 32 | - $row['party'] = $parties[$row['party']]; |
|
| 31 | + if ($has_party && isset($parties[$row['party']])) { |
|
| 32 | + $row['party'] = $parties[$row['party']]; |
|
| 33 | + } |
|
| 33 | 34 | list($image,$sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($row['person_id']); |
| 34 | 35 | if ($image) { |
| 35 | 36 | list($width, $height) = getimagesize(str_replace(IMAGEPATH, BASEDIR . '/images/', $image)); |
@@ -49,7 +50,9 @@ discard block |
||
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | foreach ($row as $k => $r) { |
| 52 | - if (is_string($r)) $row[$k] = html_entity_decode($r); |
|
| 53 | + if (is_string($r)) { |
|
| 54 | + $row[$k] = html_entity_decode($r); |
|
| 55 | + } |
|
| 53 | 56 | } |
| 54 | 57 | |
| 55 | 58 | return $row; |
@@ -85,8 +88,9 @@ discard block |
||
| 85 | 88 | $out = _api_getPerson_row($q->row($i), $house == HOUSE_TYPE_ROYAL ? false : true); |
| 86 | 89 | $output[] = $out; |
| 87 | 90 | $time = strtotime($q->field($i, 'lastupdate')); |
| 88 | - if ($time > $last_mod) |
|
| 89 | - $last_mod = $time; |
|
| 91 | + if ($time > $last_mod) { |
|
| 92 | + $last_mod = $time; |
|
| 93 | + } |
|
| 90 | 94 | } |
| 91 | 95 | # Only one MP, not an array |
| 92 | 96 | if ($flatten && count($output) == 1 && $house == HOUSE_TYPE_COMMONS) { |
@@ -134,13 +138,18 @@ discard block |
||
| 134 | 138 | |
| 135 | 139 | $cons = array(); |
| 136 | 140 | foreach ($constituencies as $constituency) { |
| 137 | - if ($constituency == '') continue; |
|
| 138 | - if ($constituency == 'Orkney ') |
|
| 139 | - $constituency = 'Orkney & Shetland'; |
|
| 141 | + if ($constituency == '') { |
|
| 142 | + continue; |
|
| 143 | + } |
|
| 144 | + if ($constituency == 'Orkney ') { |
|
| 145 | + $constituency = 'Orkney & Shetland'; |
|
| 146 | + } |
|
| 140 | 147 | |
| 141 | 148 | if ($house == HOUSE_TYPE_COMMONS) { |
| 142 | 149 | $normalised = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($constituency); |
| 143 | - if ($normalised) $constituency = $normalised; |
|
| 150 | + if ($normalised) { |
|
| 151 | + $constituency = $normalised; |
|
| 152 | + } |
|
| 144 | 153 | } |
| 145 | 154 | |
| 146 | 155 | $cons[] = $constituency; |
@@ -62,16 +62,36 @@ discard block |
||
| 62 | 62 | $constituency = strtolower(str_replace('_', ' ', get_http_var('c'))); |
| 63 | 63 | |
| 64 | 64 | // Fix for names with non-ASCII characters |
| 65 | -if ($name == 'sion simon') $name = 'si\xf4n simon'; |
|
| 66 | -if ($name == 'sian james') $name = 'si\xe2n james'; |
|
| 67 | -if ($name == 'lembit opik') $name = 'lembit \xf6pik'; |
|
| 68 | -if ($name == 'bairbre de brun') $name = 'bairbre de br\xfan'; |
|
| 69 | -if ($name == 'daithi mckay') $name = 'daith\xed mckay'; |
|
| 70 | -if ($name == 'caral ni chuilin') $name = 'car\xe1l n\xed chuil\xedn'; |
|
| 71 | -if ($name == 'caledon du pre') $name = 'caledon du pr\xe9'; |
|
| 72 | -if ($name == 'sean etchingham') $name = 'se\xe1n etchingham'; |
|
| 73 | -if ($name == 'john tinne') $name = 'john tinn\xe9'; |
|
| 74 | -if ($name == 'renee short') $name = 'ren\xe9e short'; |
|
| 65 | +if ($name == 'sion simon') { |
|
| 66 | + $name = 'si\xf4n simon'; |
|
| 67 | +} |
|
| 68 | +if ($name == 'sian james') { |
|
| 69 | + $name = 'si\xe2n james'; |
|
| 70 | +} |
|
| 71 | +if ($name == 'lembit opik') { |
|
| 72 | + $name = 'lembit \xf6pik'; |
|
| 73 | +} |
|
| 74 | +if ($name == 'bairbre de brun') { |
|
| 75 | + $name = 'bairbre de br\xfan'; |
|
| 76 | +} |
|
| 77 | +if ($name == 'daithi mckay') { |
|
| 78 | + $name = 'daith\xed mckay'; |
|
| 79 | +} |
|
| 80 | +if ($name == 'caral ni chuilin') { |
|
| 81 | + $name = 'car\xe1l n\xed chuil\xedn'; |
|
| 82 | +} |
|
| 83 | +if ($name == 'caledon du pre') { |
|
| 84 | + $name = 'caledon du pr\xe9'; |
|
| 85 | +} |
|
| 86 | +if ($name == 'sean etchingham') { |
|
| 87 | + $name = 'se\xe1n etchingham'; |
|
| 88 | +} |
|
| 89 | +if ($name == 'john tinne') { |
|
| 90 | + $name = 'john tinn\xe9'; |
|
| 91 | +} |
|
| 92 | +if ($name == 'renee short') { |
|
| 93 | + $name = 'ren\xe9e short'; |
|
| 94 | +} |
|
| 75 | 95 | |
| 76 | 96 | // Fix for common misspellings, name changes etc |
| 77 | 97 | $name_fix = array( |
@@ -103,7 +123,9 @@ discard block |
||
| 103 | 123 | } |
| 104 | 124 | |
| 105 | 125 | // Fixes for Ynys Mon, and a Unicode URL |
| 106 | -if ($constituency == 'ynys mon') $constituency = "ynys m\xf4n"; |
|
| 126 | +if ($constituency == 'ynys mon') { |
|
| 127 | + $constituency = "ynys m\xf4n"; |
|
| 128 | +} |
|
| 107 | 129 | if (preg_match("#^ynys m\xc3\xb4n#i", $constituency)) { |
| 108 | 130 | $constituency = "ynys m\xf4n"; |
| 109 | 131 | } |
@@ -126,11 +148,17 @@ discard block |
||
| 126 | 148 | |
| 127 | 149 | ///////////////////////////////////////////////////////// |
| 128 | 150 | // DETERMINE TYPE OF REPRESENTITIVE |
| 129 | -if (get_http_var('peer')) $this_page = 'peer'; |
|
| 130 | -elseif (get_http_var('royal')) $this_page = 'royal'; |
|
| 131 | -elseif (get_http_var('mla')) $this_page = 'mla'; |
|
| 132 | -elseif (get_http_var('msp')) $this_page = 'msp'; |
|
| 133 | -else $this_page = 'mp'; |
|
| 151 | +if (get_http_var('peer')) { |
|
| 152 | + $this_page = 'peer'; |
|
| 153 | +} elseif (get_http_var('royal')) { |
|
| 154 | + $this_page = 'royal'; |
|
| 155 | +} elseif (get_http_var('mla')) { |
|
| 156 | + $this_page = 'mla'; |
|
| 157 | +} elseif (get_http_var('msp')) { |
|
| 158 | + $this_page = 'msp'; |
|
| 159 | +} else { |
|
| 160 | + $this_page = 'mp'; |
|
| 161 | +} |
|
| 134 | 162 | |
| 135 | 163 | try { |
| 136 | 164 | if (is_numeric($pid)) { |
@@ -179,8 +207,9 @@ discard block |
||
| 179 | 207 | $desc = "Read $member_name's contributions to Parliament, including speeches and questions"; |
| 180 | 208 | |
| 181 | 209 | // Enhance description if this is a current member |
| 182 | -if ($MEMBER->current_member_anywhere()) |
|
| 210 | +if ($MEMBER->current_member_anywhere()) { |
|
| 183 | 211 | $desc .= ', investigate their voting record, and get email alerts on their activity'; |
| 212 | +} |
|
| 184 | 213 | |
| 185 | 214 | // Enhance title if this is a member of the Commons |
| 186 | 215 | if ($MEMBER->house(HOUSE_TYPE_COMMONS)) { |
@@ -188,8 +217,10 @@ discard block |
||
| 188 | 217 | $title .= ', former'; |
| 189 | 218 | } |
| 190 | 219 | $title .= ' MP'; |
| 191 | - if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency(); |
|
| 192 | -} |
|
| 220 | + if ($MEMBER->constituency()) { |
|
| 221 | + $title .= ', ' . $MEMBER->constituency(); |
|
| 222 | + } |
|
| 223 | + } |
|
| 193 | 224 | |
| 194 | 225 | // Enhance title if this is a member of NIA |
| 195 | 226 | if ($MEMBER->house(HOUSE_TYPE_NI)) { |
@@ -202,8 +233,10 @@ discard block |
||
| 202 | 233 | $title .= ', former'; |
| 203 | 234 | } |
| 204 | 235 | $title .= ' MLA'; |
| 205 | - if ($MEMBER->constituency()) $title .= ', ' . $MEMBER->constituency(); |
|
| 206 | -} |
|
| 236 | + if ($MEMBER->constituency()) { |
|
| 237 | + $title .= ', ' . $MEMBER->constituency(); |
|
| 238 | + } |
|
| 239 | + } |
|
| 207 | 240 | |
| 208 | 241 | // Enhance title if this is a member of Scottish Parliament |
| 209 | 242 | if ($MEMBER->house(HOUSE_TYPE_SCOTLAND)) { |
@@ -224,14 +257,18 @@ discard block |
||
| 224 | 257 | // Position if this is a member of the Commons |
| 225 | 258 | if ($MEMBER->house(HOUSE_TYPE_COMMONS)) { |
| 226 | 259 | $position = $MEMBER->current_member(HOUSE_TYPE_COMMONS) ? 'MP' : 'Former MP'; |
| 227 | - if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency(); |
|
| 260 | + if ($MEMBER->constituency()) { |
|
| 261 | + $position .= ', ' . $MEMBER->constituency(); |
|
| 262 | + } |
|
| 228 | 263 | $positions[] = $position; |
| 229 | 264 | } |
| 230 | 265 | |
| 231 | 266 | // Position if this is a member of NIA |
| 232 | 267 | if ($MEMBER->house(HOUSE_TYPE_NI)) { |
| 233 | 268 | $position = $MEMBER->current_member(HOUSE_TYPE_NI) ? 'MLA' : 'Former MLA'; |
| 234 | - if ($MEMBER->constituency()) $position .= ', ' . $MEMBER->constituency(); |
|
| 269 | + if ($MEMBER->constituency()) { |
|
| 270 | + $position .= ', ' . $MEMBER->constituency(); |
|
| 271 | + } |
|
| 235 | 272 | $positions[] = $position; |
| 236 | 273 | } |
| 237 | 274 | |
@@ -265,8 +302,9 @@ discard block |
||
| 265 | 302 | |
| 266 | 303 | // Build the RSS link and add it to page data. |
| 267 | 304 | $feedurl = $DATA->page_metadata('mp_rss', 'url') . $MEMBER->person_id() . '.rdf'; |
| 268 | -if (file_exists(BASEDIR . '/' . $feedurl)) |
|
| 305 | +if (file_exists(BASEDIR . '/' . $feedurl)) { |
|
| 269 | 306 | $DATA->set_page_metadata($this_page, 'rss', $feedurl); |
| 307 | +} |
|
| 270 | 308 | |
| 271 | 309 | // Prepare data for the template |
| 272 | 310 | $data['full_name'] = $MEMBER->full_name(); |
@@ -692,11 +730,13 @@ discard block |
||
| 692 | 730 | $url = $MEMBER->url(); |
| 693 | 731 | $params = array(); |
| 694 | 732 | foreach ($_GET as $key => $value) { |
| 695 | - if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') |
|
| 696 | - $params[] = "$key=$value"; |
|
| 733 | + if (substr($key, 0, 4) == 'utm_' || $key == 'gclid') { |
|
| 734 | + $params[] = "$key=$value"; |
|
| 735 | + } |
|
| 736 | + } |
|
| 737 | + if (count($params)) { |
|
| 738 | + $url .= '?' . join('&', $params); |
|
| 697 | 739 | } |
| 698 | - if (count($params)) |
|
| 699 | - $url .= '?' . join('&', $params); |
|
| 700 | 740 | if ($pagetype) { |
| 701 | 741 | $pagetype = '/' . $pagetype; |
| 702 | 742 | } else { |
@@ -779,10 +819,14 @@ discard block |
||
| 779 | 819 | } |
| 780 | 820 | $desc = ''; |
| 781 | 821 | foreach ($MEMBER->houses() as $house) { |
| 782 | - if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) |
|
| 783 | - continue; # Same info is printed further down |
|
| 822 | + if ($house==HOUSE_TYPE_COMMONS && isset($entered_house[HOUSE_TYPE_LORDS])) { |
|
| 823 | + continue; |
|
| 824 | + } |
|
| 825 | + # Same info is printed further down |
|
| 784 | 826 | |
| 785 | - if (!$current_member[$house]) $desc .= 'Former '; |
|
| 827 | + if (!$current_member[$house]) { |
|
| 828 | + $desc .= 'Former '; |
|
| 829 | + } |
|
| 786 | 830 | |
| 787 | 831 | $party = $left_house[$house]['party']; |
| 788 | 832 | $party_br = ''; |
@@ -790,8 +834,9 @@ discard block |
||
| 790 | 834 | $party_br = $m[2]; |
| 791 | 835 | $party = $m[1]; |
| 792 | 836 | } |
| 793 | - if ($party != 'unknown') |
|
| 794 | - $desc .= _htmlentities($party); |
|
| 837 | + if ($party != 'unknown') { |
|
| 838 | + $desc .= _htmlentities($party); |
|
| 839 | + } |
|
| 795 | 840 | if ($party == 'Speaker' || $party == 'Deputy Speaker') { |
| 796 | 841 | $desc .= ', and '; |
| 797 | 842 | # XXX: Might go horribly wrong if something odd happens |
@@ -802,15 +847,23 @@ discard block |
||
| 802 | 847 | } |
| 803 | 848 | if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) { |
| 804 | 849 | $desc .= ' '; |
| 805 | - if ($house==HOUSE_TYPE_COMMONS) $desc .= '<abbr title="Member of Parliament">MP</abbr>'; |
|
| 806 | - if ($house==HOUSE_TYPE_NI) $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>'; |
|
| 807 | - if ($house==HOUSE_TYPE_SCOTLAND) $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>'; |
|
| 850 | + if ($house==HOUSE_TYPE_COMMONS) { |
|
| 851 | + $desc .= '<abbr title="Member of Parliament">MP</abbr>'; |
|
| 852 | + } |
|
| 853 | + if ($house==HOUSE_TYPE_NI) { |
|
| 854 | + $desc .= '<abbr title="Member of the Legislative Assembly">MLA</abbr>'; |
|
| 855 | + } |
|
| 856 | + if ($house==HOUSE_TYPE_SCOTLAND) { |
|
| 857 | + $desc .= '<abbr title="Member of the Scottish Parliament">MSP</abbr>'; |
|
| 858 | + } |
|
| 808 | 859 | if ($party_br) { |
| 809 | 860 | $desc .= " ($party_br)"; |
| 810 | 861 | } |
| 811 | 862 | $desc .= ' for ' . $left_house[$house]['constituency']; |
| 812 | 863 | } |
| 813 | - if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') $desc .= ' Peer'; |
|
| 864 | + if ($house==HOUSE_TYPE_LORDS && $party != 'Bishop') { |
|
| 865 | + $desc .= ' Peer'; |
|
| 866 | + } |
|
| 814 | 867 | $desc .= ', '; |
| 815 | 868 | } |
| 816 | 869 | $desc = preg_replace('#, $#', '', $desc); |
@@ -1073,10 +1126,13 @@ discard block |
||
| 1073 | 1126 | # Find latest entered house |
| 1074 | 1127 | $entered_house = null; |
| 1075 | 1128 | foreach ($member->entered_house() as $h => $eh) { |
| 1076 | - if (!$entered_house || $eh['date'] > $entered_house) $entered_house = $eh['date']; |
|
| 1129 | + if (!$entered_house || $eh['date'] > $entered_house) { |
|
| 1130 | + $entered_house = $eh['date']; |
|
| 1131 | + } |
|
| 1132 | + } |
|
| 1133 | + if ($entered_house > $year_ago) { |
|
| 1134 | + $since_text = 'since joining Parliament'; |
|
| 1077 | 1135 | } |
| 1078 | - if ($entered_house > $year_ago) |
|
| 1079 | - $since_text = 'since joining Parliament'; |
|
| 1080 | 1136 | |
| 1081 | 1137 | $MOREURL = new \MySociety\TheyWorkForYou\Url('search'); |
| 1082 | 1138 | $section = 'section:debates section:whall section:lords section:ni'; |
@@ -1089,10 +1145,12 @@ discard block |
||
| 1089 | 1145 | $MOREURL->insert(array('pid'=>$member->person_id(), 's'=>'section:wrans', 'pop'=>1)); |
| 1090 | 1146 | // We assume that if they've answered a question, they're a minister |
| 1091 | 1147 | $minister = 0; $Lminister = false; |
| 1092 | - if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) |
|
| 1093 | - $minister = 1; |
|
| 1094 | - if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) |
|
| 1095 | - $Lminister = true; |
|
| 1148 | + if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) { |
|
| 1149 | + $minister = 1; |
|
| 1150 | + } |
|
| 1151 | + if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) { |
|
| 1152 | + $Lminister = true; |
|
| 1153 | + } |
|
| 1096 | 1154 | if ($member->party() == 'SPK' || $member->party() == 'CWM' || $member->party() == 'DCWM') { |
| 1097 | 1155 | $minister = 2; |
| 1098 | 1156 | } |
@@ -1141,11 +1199,17 @@ discard block |
||
| 1141 | 1199 | |
| 1142 | 1200 | if (isset($extra_info['number_of_alerts']) && ($extra_info['number_of_alerts']>0 || $has_email_alerts)) { |
| 1143 | 1201 | $line = '<strong>' . _htmlentities($extra_info['number_of_alerts']) . '</strong> ' . ($extra_info['number_of_alerts']==1?'person is':'people are') . ' tracking '; |
| 1144 | - if ($member->house_disp == HOUSE_TYPE_COMMONS) $line .= 'this MP'; |
|
| 1145 | - elseif ($member->house_disp == HOUSE_TYPE_LORDS) $line .= 'this peer'; |
|
| 1146 | - elseif ($member->house_disp == HOUSE_TYPE_NI) $line .= 'this MLA'; |
|
| 1147 | - elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) $line .= 'this MSP'; |
|
| 1148 | - elseif ($member->house_disp == HOUSE_TYPE_ROYAL) $line .= $member->full_name(); |
|
| 1202 | + if ($member->house_disp == HOUSE_TYPE_COMMONS) { |
|
| 1203 | + $line .= 'this MP'; |
|
| 1204 | + } elseif ($member->house_disp == HOUSE_TYPE_LORDS) { |
|
| 1205 | + $line .= 'this peer'; |
|
| 1206 | + } elseif ($member->house_disp == HOUSE_TYPE_NI) { |
|
| 1207 | + $line .= 'this MLA'; |
|
| 1208 | + } elseif ($member->house_disp == HOUSE_TYPE_SCOTLAND) { |
|
| 1209 | + $line .= 'this MSP'; |
|
| 1210 | + } elseif ($member->house_disp == HOUSE_TYPE_ROYAL) { |
|
| 1211 | + $line .= $member->full_name(); |
|
| 1212 | + } |
|
| 1149 | 1213 | if ($has_email_alerts) { |
| 1150 | 1214 | $line .= ' — <a href="' . WEBPATH . 'alert/?pid='.$member->person_id().'">email me updates on '. $member->full_name(). '’s activity</a>'; |
| 1151 | 1215 | } |
@@ -1169,10 +1233,12 @@ discard block |
||
| 1169 | 1233 | |
| 1170 | 1234 | function display_stats_line($category, $blurb, $type, $inwhat, $afterstuff, $extra_info, $minister = false, $Lminister = false) { |
| 1171 | 1235 | $return = false; |
| 1172 | - if (isset($extra_info[$category])) |
|
| 1173 | - $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff); |
|
| 1174 | - if (isset($extra_info["L$category"])) |
|
| 1175 | - $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff); |
|
| 1236 | + if (isset($extra_info[$category])) { |
|
| 1237 | + $return = display_stats_line_house(HOUSE_TYPE_COMMONS, $category, $blurb, $type, $inwhat, $extra_info, $minister, $afterstuff); |
|
| 1238 | + } |
|
| 1239 | + if (isset($extra_info["L$category"])) { |
|
| 1240 | + $return = display_stats_line_house(HOUSE_TYPE_LORDS, "L$category", $blurb, $type, $inwhat, $extra_info, $Lminister, $afterstuff); |
|
| 1241 | + } |
|
| 1176 | 1242 | return $return; |
| 1177 | 1243 | } |
| 1178 | 1244 | |
@@ -1184,17 +1250,21 @@ discard block |
||
| 1184 | 1250 | $inwhat = preg_replace('#<\/a>#', '', $inwhat); |
| 1185 | 1251 | } |
| 1186 | 1252 | } |
| 1187 | - if ($house==HOUSE_TYPE_LORDS) $inwhat = str_replace('MP', 'Lord', $inwhat); |
|
| 1253 | + if ($house==HOUSE_TYPE_LORDS) { |
|
| 1254 | + $inwhat = str_replace('MP', 'Lord', $inwhat); |
|
| 1255 | + } |
|
| 1188 | 1256 | $line = $blurb; |
| 1189 | 1257 | $line .= '<strong>' . $extra_info[$category]; |
| 1190 | - if ($type) $line .= ' ' . make_plural($type, $extra_info[$category]); |
|
| 1258 | + if ($type) { |
|
| 1259 | + $line .= ' ' . make_plural($type, $extra_info[$category]); |
|
| 1260 | + } |
|
| 1191 | 1261 | $line .= '</strong>'; |
| 1192 | 1262 | $line .= $inwhat; |
| 1193 | 1263 | if ($minister===2) { |
| 1194 | 1264 | $line .= ' — Speakers/ deputy speakers do not ask written questions'; |
| 1195 | - } elseif ($minister) |
|
| 1196 | - $line .= ' — Ministers do not ask written questions'; |
|
| 1197 | - else { |
|
| 1265 | + } elseif ($minister) { |
|
| 1266 | + $line .= ' — Ministers do not ask written questions'; |
|
| 1267 | + } else { |
|
| 1198 | 1268 | $type = ($house==HOUSE_TYPE_COMMONS?'MP':($house==HOUSE_TYPE_LORDS?'Lord':'MLA')); |
| 1199 | 1269 | if (!get_http_var('rem') && isset($extra_info[$category . '_quintile'])) { |
| 1200 | 1270 | $line .= ' — '; |
@@ -1233,11 +1303,21 @@ discard block |
||
| 1233 | 1303 | $mean = $extra_info["writetothem_responsiveness_mean_$year"]; |
| 1234 | 1304 | |
| 1235 | 1305 | $a = $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"]; |
| 1236 | - if ($a == 'very low') $a = 'a very low'; |
|
| 1237 | - if ($a == 'low') $a = 'a low'; |
|
| 1238 | - if ($a == 'medium') $a = 'a medium'; |
|
| 1239 | - if ($a == 'high') $a = 'a high'; |
|
| 1240 | - if ($a == 'very high') $a = 'a very high'; |
|
| 1306 | + if ($a == 'very low') { |
|
| 1307 | + $a = 'a very low'; |
|
| 1308 | + } |
|
| 1309 | + if ($a == 'low') { |
|
| 1310 | + $a = 'a low'; |
|
| 1311 | + } |
|
| 1312 | + if ($a == 'medium') { |
|
| 1313 | + $a = 'a medium'; |
|
| 1314 | + } |
|
| 1315 | + if ($a == 'high') { |
|
| 1316 | + $a = 'a high'; |
|
| 1317 | + } |
|
| 1318 | + if ($a == 'very high') { |
|
| 1319 | + $a = 'a very high'; |
|
| 1320 | + } |
|
| 1241 | 1321 | $extra_info["writetothem_responsiveness_fuzzy_response_description_$year"] = $a; |
| 1242 | 1322 | |
| 1243 | 1323 | return display_stats_line("writetothem_responsiveness_fuzzy_response_description_$year", 'Replied within 2 or 3 weeks to <a href="https://www.writetothem.com/stats/'.$year.'/mps" title="From WriteToThem.com">', "", "</a> <!-- Mean: " . $mean . " --> number of messages sent via WriteToThem.com during ".$year.", according to constituents", "", $extra_info); |