@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | </h2> |
| 27 | 27 | |
| 28 | 28 | <?php if (isset($data['mp_data'])) { |
| 29 | - include('_your_mp.php'); |
|
| 30 | - } ?> |
|
| 29 | + include('_your_mp.php'); |
|
| 30 | + } ?> |
|
| 31 | 31 | |
| 32 | 32 | <div class="debate-speech__division__details"> |
| 33 | 33 | <p> |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | <?php } else { ?> |
| 39 | 39 | <?php if ($mp_vote['with_majority']) { ?> |
| 40 | 40 | <?php $vote_prefix = 'A majority of ' . $division['members']['plural'] . ' <b>agreed</b> and'; |
| 41 | - include('_vote_description.php'); ?> |
|
| 41 | + include('_vote_description.php'); ?> |
|
| 42 | 42 | <?php } else { ?> |
| 43 | 43 | <?php $vote_prefix = 'A majority of ' . $division['members']['plural'] . ' <b>disagreed</b> and'; |
| 44 | - include('_vote_description.php'); ?> |
|
| 44 | + include('_vote_description.php'); ?> |
|
| 45 | 45 | <?php } ?> |
| 46 | 46 | <?php } ?> |
| 47 | 47 | </p> |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | <?php if (count($tellers) > 0) { ?> |
| 30 | 30 | <h4><?= gettext('Tellers') ?></h4> |
| 31 | 31 | <ul class="division-names"> |
| 32 | - <?php foreach($tellers as $teller) { |
|
| 32 | + <?php foreach ($tellers as $teller) { |
|
| 33 | 33 | print_voter($teller); |
| 34 | 34 | } ?> |
| 35 | 35 | </p> |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <p> |
| 2 | 2 | <a href="#for"><?= sprintf(gettext('%s for'), $division['for']) ?></a>, |
| 3 | 3 | <a href="#against"><?= sprintf(gettext('%s against'), $division['against']) ?></a><?php |
| 4 | - if ($division['both'] > 0) { ?>, |
|
| 4 | + if ($division['both'] > 0) { ?>, |
|
| 5 | 5 | <a href="#both"><?= sprintf(gettext('%s abstained'), $division['both']) ?></a><?php |
| 6 | - } |
|
| 6 | + } |
|
| 7 | 7 | if ($division['absent'] > 0) { ?>, |
| 8 | 8 | <a href="#absent"><?= sprintf(gettext('%s absent'), $division['absent']) ?></a><?php |
| 9 | 9 | } ?>. |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | ], |
| 20 | 20 | ]; |
| 21 | 21 | |
| 22 | -$sections_with_votes = array_filter(array_keys($vote_sets), function ($s) use ($division) { |
|
| 22 | +$sections_with_votes = array_filter(array_keys($vote_sets), function($s) use ($division) { |
|
| 23 | 23 | return count($division[$s]); |
| 24 | 24 | }); |
| 25 | 25 | $sections_with_votes = array_values($sections_with_votes); |
@@ -11,29 +11,29 @@ |
||
| 11 | 11 | <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content"> |
| 12 | 12 | <?php if (isset($mp_vote)) { ?> |
| 13 | 13 | <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php |
| 14 | - switch ($mp_vote['vote']) { |
|
| 15 | - case 'aye': |
|
| 14 | + switch ($mp_vote['vote']) { |
|
| 15 | + case 'aye': |
|
| 16 | 16 | echo 'Aye'; |
| 17 | - break; |
|
| 18 | - case 'no': |
|
| 17 | + break; |
|
| 18 | + case 'no': |
|
| 19 | 19 | echo 'No'; |
| 20 | - break; |
|
| 21 | - case 'absent': |
|
| 20 | + break; |
|
| 21 | + case 'absent': |
|
| 22 | 22 | echo 'Absent'; |
| 23 | - break; |
|
| 24 | - case 'both': |
|
| 23 | + break; |
|
| 24 | + case 'both': |
|
| 25 | 25 | echo 'Abstain'; |
| 26 | - break; |
|
| 27 | - case 'tellaye': |
|
| 26 | + break; |
|
| 27 | + case 'tellaye': |
|
| 28 | 28 | echo 'Aye (Teller)'; |
| 29 | - break; |
|
| 30 | - case 'tellno': |
|
| 29 | + break; |
|
| 30 | + case 'tellno': |
|
| 31 | 31 | echo 'No (Teller)'; |
| 32 | - break; |
|
| 33 | - default: |
|
| 32 | + break; |
|
| 33 | + default: |
|
| 34 | 34 | echo 'N/A'; |
| 35 | - } |
|
| 36 | - ?></span> |
|
| 35 | + } |
|
| 36 | + ?></span> |
|
| 37 | 37 | <?php } elseif (isset($before_mp) || isset($after_mp)) { ?> |
| 38 | 38 | <span class="your-mp__vote">N/A</span> |
| 39 | 39 | <?php } ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <div class="debate-speech__division__your-mp"> |
| 2 | - <?php if (!isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 2 | + <?php if (!isset($main_vote_mp) || !$main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 3 | 3 | <div class="your-mp__header"> |
| 4 | 4 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
| 5 | 5 | <p> |
@@ -1,5 +1,6 @@ |
||
| 1 | 1 | <div class="debate-speech__division__your-mp"> |
| 2 | - <?php if (!isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 2 | + <?php if (!isset($main_vote_mp) || ! $main_vote_mp) { |
|
| 3 | +/* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 3 | 4 | <div class="your-mp__header"> |
| 4 | 5 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
| 5 | 6 | <p> |
@@ -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 = []; |
| 66 | +} |
|
| 65 | 67 | |
| 66 | 68 | foreach ($positions as $position) { |
| 67 | 69 | if (!in_array($position['policy_id'], $policy_ids)) { |
@@ -61,23 +61,23 @@ |
||
| 61 | 61 | <?php else: ?> |
| 62 | 62 | <ul class="vote-descriptions"> |
| 63 | 63 | <?php |
| 64 | - $policy_ids = []; |
|
| 65 | - |
|
| 66 | - foreach ($positions as $position) { |
|
| 67 | - if (!in_array($position['policy_id'], $policy_ids)) { |
|
| 68 | - $description = ucfirst($position['desc']); |
|
| 69 | - $link = sprintf( |
|
| 70 | - '%s/divisions?policy=%s', |
|
| 71 | - $member_url, |
|
| 72 | - $position['policy_id'] |
|
| 73 | - ); |
|
| 74 | - $link_text = $position['position'] != 'has never voted on' ? 'Show votes' : 'Details'; |
|
| 75 | - $key_vote = $position; |
|
| 76 | - include(dirname(__DIR__) . '/mp/_vote_description.php'); |
|
| 77 | - |
|
| 78 | - $policy_ids[] = $position['policy_id']; |
|
| 79 | - } |
|
| 80 | - } ?> |
|
| 64 | + $policy_ids = []; |
|
| 65 | + |
|
| 66 | + foreach ($positions as $position) { |
|
| 67 | + if (!in_array($position['policy_id'], $policy_ids)) { |
|
| 68 | + $description = ucfirst($position['desc']); |
|
| 69 | + $link = sprintf( |
|
| 70 | + '%s/divisions?policy=%s', |
|
| 71 | + $member_url, |
|
| 72 | + $position['policy_id'] |
|
| 73 | + ); |
|
| 74 | + $link_text = $position['position'] != 'has never voted on' ? 'Show votes' : 'Details'; |
|
| 75 | + $key_vote = $position; |
|
| 76 | + include(dirname(__DIR__) . '/mp/_vote_description.php'); |
|
| 77 | + |
|
| 78 | + $policy_ids[] = $position['policy_id']; |
|
| 79 | + } |
|
| 80 | + } ?> |
|
| 81 | 81 | </ul> |
| 82 | 82 | |
| 83 | 83 | <?php endif; ?> |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | // COMMENT REPORTING LINK. |
| 83 | 83 | |
| 84 | 84 | if (($this_page != 'commentreport' && |
| 85 | - $this_page != 'addcomment' && |
|
| 85 | + $this_page != 'addcomment' && |
|
| 86 | 86 | $this_page != 'admin_commentreport') |
| 87 | 87 | && $THEUSER->is_able_to('reportcomment') |
| 88 | 88 | && $THEUSER->user_id() != $comment['user_id'] |
@@ -319,7 +319,8 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | if (preg_match("/^(\d\d\d\d)-(\d\d?)-(\d\d?)$/", $date, $matches)) { |
| 321 | 321 | [$string, $year, $month, $day] = $matches; |
| 322 | - if ($year < 1902) { # gmdate fns only go back to Dec. 1901 |
|
| 322 | + if ($year < 1902) { |
|
| 323 | +# gmdate fns only go back to Dec. 1901 |
|
| 323 | 324 | if ($format == SHORTDATEFORMAT) { |
| 324 | 325 | return ($day + 0) . ' ' . $format_date_months_short[$month + 0] . " $year"; |
| 325 | 326 | } else { |
@@ -1046,7 +1047,8 @@ discard block |
||
| 1046 | 1047 | 'Lords in Waiting (HM Household)' => 'Government Whip', |
| 1047 | 1048 | 'Baronesses in Waiting, HM Household' => 'Government Whip', |
| 1048 | 1049 | ]; |
| 1049 | - if ($pos) { # Government post, or Chairman of Select Committee |
|
| 1050 | + if ($pos) { |
|
| 1051 | +# Government post, or Chairman of Select Committee |
|
| 1050 | 1052 | $pretty = $pos; |
| 1051 | 1053 | if ($dept && $dept != 'No Department') { |
| 1052 | 1054 | $pretty .= ", $dept"; |
@@ -1054,7 +1056,8 @@ discard block |
||
| 1054 | 1056 | if (array_key_exists($pretty, $lookup)) { |
| 1055 | 1057 | $pretty = $lookup[$pretty]; |
| 1056 | 1058 | } |
| 1057 | - } else { # Member of Select Committee |
|
| 1059 | + } else { |
|
| 1060 | +# Member of Select Committee |
|
| 1058 | 1061 | $pretty = "Member, $dept"; |
| 1059 | 1062 | } |
| 1060 | 1063 | return $pretty; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if ($debug_level != '') { |
| 30 | 30 | |
| 31 | 31 | // Set which level shows which types of debug info. |
| 32 | - $levels = [ |
|
| 32 | + $levels = [ |
|
| 33 | 33 | 1 => ['THEUSER', 'TIME', 'SQLERROR', 'PAGE', 'TEMPLATE', 'SEARCH', 'ALERTS', 'MP'], |
| 34 | 34 | 2 => ['SQL', 'EMAIL', 'WIKIPEDIA', 'hansardlist', 'debatelist', 'wranslist', 'whalllist'], |
| 35 | 35 | 3 => ['SQLRESULT'], |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | // consider are E_WARNING, E_NOTICE, E_USER_ERROR, |
| 79 | 79 | // E_USER_WARNING and E_USER_NOTICE |
| 80 | 80 | # Commented out are ones that a user function cannot handle. |
| 81 | - $errortype = [ |
|
| 81 | + $errortype = [ |
|
| 82 | 82 | #E_ERROR => "Error", |
| 83 | 83 | E_WARNING => "Warning", |
| 84 | 84 | #E_PARSE => "Parsing Error", |
@@ -355,14 +355,14 @@ discard block |
||
| 355 | 355 | $in_seconds = strtotime($datetime); |
| 356 | 356 | $now = time(); |
| 357 | 357 | |
| 358 | - $diff = $now - $in_seconds; |
|
| 359 | - $months = floor($diff / 2419200); |
|
| 358 | + $diff = $now - $in_seconds; |
|
| 359 | + $months = floor($diff / 2419200); |
|
| 360 | 360 | $diff -= $months * 2419200; |
| 361 | - $weeks = floor($diff / 604800); |
|
| 361 | + $weeks = floor($diff / 604800); |
|
| 362 | 362 | $diff -= $weeks * 604800; |
| 363 | - $days = floor($diff / 86400); |
|
| 363 | + $days = floor($diff / 86400); |
|
| 364 | 364 | $diff -= $days * 86400; |
| 365 | - $hours = floor($diff / 3600); |
|
| 365 | + $hours = floor($diff / 3600); |
|
| 366 | 366 | $diff -= $hours * 3600; |
| 367 | 367 | $minutes = floor($diff / 60); |
| 368 | 368 | $diff -= $minutes * 60; |
@@ -497,11 +497,11 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | if ($filter_type == 'strict') { |
| 499 | 499 | // No tags allowed at all! |
| 500 | - $filter->allowed = []; |
|
| 500 | + $filter->allowed = []; |
|
| 501 | 501 | } else { |
| 502 | 502 | // Comment. |
| 503 | 503 | // Only allowing <a href>, <b>, <strong>, <i> and <em> |
| 504 | - $filter->allowed = [ |
|
| 504 | + $filter->allowed = [ |
|
| 505 | 505 | 'a' => ['href'], |
| 506 | 506 | 'strong' => [], |
| 507 | 507 | 'em' => [], |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $link_length = 60; |
| 531 | 531 | $text = preg_replace_callback( |
| 532 | 532 | "/(?<!\"|\/)((http(s?):\/\/)|(www\.))([a-zA-Z\d_.+,;:?%~\-\/#='*$!()&[\]]+)([a-zA-Z\d_?%~\-\/#='*$!&])/", |
| 533 | - function ($matches) use ($link_length) { |
|
| 533 | + function($matches) use ($link_length) { |
|
| 534 | 534 | if (strlen($matches[0]) > $link_length) { |
| 535 | 535 | return '<a href="' . $matches[0] . '" rel="nofollow">' . substr($matches[0], 0, $link_length) . "...</a>"; |
| 536 | 536 | } else { |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | function entities_to_numbers($string) { |
| 899 | 899 | $string = str_replace( |
| 900 | 900 | ['Ö', 'â', 'ú', 'á', 'í', 'ô', 'é'], |
| 901 | - ['Ö', 'â', 'ú', 'á', 'í', 'ô', 'é' ], |
|
| 901 | + ['Ö', 'â', 'ú', 'á', 'í', 'ô', 'é'], |
|
| 902 | 902 | $string |
| 903 | 903 | ); |
| 904 | 904 | return $string; |
@@ -915,9 +915,9 @@ discard block |
||
| 915 | 915 | } |
| 916 | 916 | } |
| 917 | 917 | |
| 918 | - $s = [' ', '&', 'ô', 'Ö', 'ö', 'â', 'í', 'á', 'ú', 'é', 'ó', 'Ó']; |
|
| 919 | - $s2 = [" ", "&", "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93"]; |
|
| 920 | - $r = ['_', 'and', 'o', 'o', 'o', 'a', 'i', 'a', 'u', 'e', 'o', 'o']; |
|
| 918 | + $s = [' ', '&', 'ô', 'Ö', 'ö', 'â', 'í', 'á', 'ú', 'é', 'ó', 'Ó']; |
|
| 919 | + $s2 = [" ", "&", "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93"]; |
|
| 920 | + $r = ['_', 'and', 'o', 'o', 'o', 'a', 'i', 'a', 'u', 'e', 'o', 'o']; |
|
| 921 | 921 | $name = preg_replace('#^the #', '', strtolower($name)); |
| 922 | 922 | |
| 923 | 923 | $out = ''; |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | } |
| 1097 | 1097 | $out .= '<li>' . $body . '<ul>'; |
| 1098 | 1098 | } else { |
| 1099 | - $LISTURL->insert([ 'id' => $gid ]); |
|
| 1099 | + $LISTURL->insert(['id' => $gid]); |
|
| 1100 | 1100 | $out .= '<li><a href="' . $LISTURL->generate() . '">'; |
| 1101 | 1101 | $out .= $body . '</a>'; |
| 1102 | 1102 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | global $hansardmajors; |
| 31 | 31 | global $db; |
| 32 | 32 | |
| 33 | - $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [ ':gid' => $gid ])->first(); |
|
| 33 | + $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", [':gid' => $gid])->first(); |
|
| 34 | 34 | $url_gid = fix_gid_from_db($gid); |
| 35 | 35 | $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']); |
| 36 | 36 | $url->insert(['id' => $url_gid]); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | print "<h2>Preview Content</h2>"; |
| 119 | 119 | if ($gid !== null) { |
| 120 | 120 | $h = new MySociety\TheyWorkForYou\Homepage(); |
| 121 | - $featured = $h->getFeaturedDebate($gid, $title, $context, [ $related_gid1, $related_gid2, $related_gid3 ]); |
|
| 121 | + $featured = $h->getFeaturedDebate($gid, $title, $context, [$related_gid1, $related_gid2, $related_gid3]); |
|
| 122 | 122 | |
| 123 | 123 | include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php'; |
| 124 | 124 | } else { |