@@ -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 URL($hansardmajors[$major[$i]]['page_all']); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | print "<h2 class='calendar'>$chamber"; |
26 | 26 | if (in_array($major[$i], $data['majors'])) { |
27 | 27 | $URL = new URL($hansardmajors[$major[$i]]['page_all']); |
28 | - $URL->insert( array( 'd' => $date ) ); |
|
28 | + $URL->insert(array('d' => $date)); |
|
29 | 29 | print ' <a href="' . $URL->generate() . '">See this day →</a>'; |
30 | 30 | } |
31 | 31 | print "</h2>\n"; |
@@ -113,7 +113,7 @@ |
||
113 | 113 | </div> |
114 | 114 | |
115 | 115 | <ul class="debate-speech__meta debate-speech__links"> |
116 | - <?php if ( $division['debate_url'] ) { ?> |
|
116 | + <?php if ($division['debate_url']) { ?> |
|
117 | 117 | <li class="link-to-speech"> |
118 | 118 | <a class="link debate-speech__meta__link" href="<?= $division['debate_url'] ?>">Show full debate</a> |
119 | 119 | </li> |
@@ -49,11 +49,13 @@ discard block |
||
49 | 49 | <a href="/mp/?p=<?= $member->person_id() ?>"><?= $member->full_name() ?></a> <?= preg_replace('/(voted\s+(?:for|against|not to|to|in favour))/', '<b>\1</b>', $mp_vote['text']) ?> |
50 | 50 | </span><br> |
51 | 51 | </p> |
52 | - <?php } else if (isset($before_mp)) { ?> |
|
52 | + <?php } |
|
53 | +else if (isset($before_mp)) { ?> |
|
53 | 54 | <p> |
54 | 55 | This vote happened before <a href="/mp/?p=<?= $member->person_id() ?>"><?= $member->full_name() ?></a> was elected. |
55 | 56 | </p> |
56 | - <?php } else if (isset($after_mp)) { ?> |
|
57 | + <?php } |
|
58 | +else if (isset($after_mp)) { ?> |
|
57 | 59 | <p> |
58 | 60 | This vote happened after <a href="/mp/?p=<?= $member->person_id() ?>"><?= $member->full_name() ?></a> left the House of Commons. |
59 | 61 | </p> |
@@ -63,17 +65,20 @@ discard block |
||
63 | 65 | <span class="policy-vote__text"> |
64 | 66 | <?php include('_vote_description.php'); ?> |
65 | 67 | </span><br> |
66 | - <?php } else { ?> |
|
68 | + <?php } |
|
69 | +else { ?> |
|
67 | 70 | <?php if ($mp_vote['with_majority']) { ?> |
68 | 71 | A majority of MPs voted the same. |
69 | - <?php } else { ?> |
|
72 | + <?php } |
|
73 | +else { ?> |
|
70 | 74 | <?php $vote_prefix = 'A majority of MPs <b>disagreed</b> and'; include('_vote_description.php'); ?> |
71 | 75 | <?php } ?> |
72 | 76 | <?php } ?> |
73 | 77 | </p> |
74 | 78 | |
75 | 79 | <?php include('_vote_summary.php'); ?> |
76 | - <?php } else { ?> |
|
80 | + <?php } |
|
81 | +else { ?> |
|
77 | 82 | <p> |
78 | 83 | <span class="policy-vote__text"> |
79 | 84 | <?php include('_vote_description.php'); ?> |
@@ -87,23 +92,30 @@ discard block |
||
87 | 92 | Your MP, <a href="/mp/?p=<?= $member->person_id() ?>"><?= $member->full_name() ?></a>, |
88 | 93 | <?php if ($mp_vote['vote'] == 'aye') { ?> |
89 | 94 | voted for. |
90 | - <?php } else if ($mp_vote['vote'] == 'no') { ?> |
|
95 | + <?php } |
|
96 | +else if ($mp_vote['vote'] == 'no') { ?> |
|
91 | 97 | voted against. |
92 | - <?php } else if ($mp_vote['vote'] == 'absent') { ?> |
|
98 | + <?php } |
|
99 | +else if ($mp_vote['vote'] == 'absent') { ?> |
|
93 | 100 | was absent. |
94 | - <?php } else if ($mp_vote['vote'] == 'both') { ?> |
|
101 | + <?php } |
|
102 | +else if ($mp_vote['vote'] == 'both') { ?> |
|
95 | 103 | abstained. |
96 | - <?php } else if ($mp_vote['vote'] == 'tellaye') { ?> |
|
104 | + <?php } |
|
105 | +else if ($mp_vote['vote'] == 'tellaye') { ?> |
|
97 | 106 | was a teller for the Ayes. |
98 | - <?php } else if ($mp_vote['vote'] == 'tellno') { ?> |
|
107 | + <?php } |
|
108 | +else if ($mp_vote['vote'] == 'tellno') { ?> |
|
99 | 109 | was a teller for the Nos. |
100 | 110 | <?php } ?> |
101 | 111 | </p> |
102 | - <?php } else if (isset($before_mp)) { ?> |
|
112 | + <?php } |
|
113 | +else if (isset($before_mp)) { ?> |
|
103 | 114 | <p> |
104 | 115 | This vote happened before your MP, <a href="/mp/?p=<?= $member->person_id() ?>"><?= $member->full_name() ?></a>, was elected. |
105 | 116 | </p> |
106 | - <?php } else if (isset($after_mp)) { ?> |
|
117 | + <?php } |
|
118 | +else if (isset($after_mp)) { ?> |
|
107 | 119 | <p> |
108 | 120 | This vote happened after your MP, <a href="/mp/?p=<?= $member->person_id() ?>"><?= $member->full_name() ?></a>, left the House of Commons. |
109 | 121 | </p> |
@@ -9,10 +9,10 @@ |
||
9 | 9 | ?> |
10 | 10 | <ul class="division-list"> |
11 | 11 | <?php foreach ($votes as $vote) { |
12 | - $voter = sprintf('<a href="/mp/?p=%d">%s</a>', $vote['person_id'], $vote['name']); |
|
13 | - if ($vote['teller']) { |
|
14 | - $tellers[] = $voter; |
|
15 | - } else { ?> |
|
12 | + $voter = sprintf('<a href="/mp/?p=%d">%s</a>', $vote['person_id'], $vote['name']); |
|
13 | + if ($vote['teller']) { |
|
14 | + $tellers[] = $voter; |
|
15 | + } else { ?> |
|
16 | 16 | <li><?= $voter ?></li> |
17 | 17 | <?php |
18 | 18 | } |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | $voter = sprintf('<a href="/mp/?p=%d">%s</a>', $vote['person_id'], $vote['name']); |
13 | 13 | if ($vote['teller']) { |
14 | 14 | $tellers[] = $voter; |
15 | - } else { ?> |
|
15 | + } |
|
16 | + else { ?> |
|
16 | 17 | <li><?= $voter ?></li> |
17 | 18 | <?php |
18 | 19 | } |
@@ -23,7 +24,8 @@ discard block |
||
23 | 24 | Tellers: <?= implode(', ', $tellers) ?> |
24 | 25 | </p> |
25 | 26 | <?php } |
26 | - } else { ?> |
|
27 | + } |
|
28 | + else { ?> |
|
27 | 29 | <p> |
28 | 30 | None |
29 | 31 | </p> |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | </div> |
8 | 8 | <div class="business-section__primary"> |
9 | 9 | <?php |
10 | - if ( isset($divisions) && $divisions ) { |
|
11 | - $current_date = ''; |
|
12 | - ?> |
|
10 | + if ( isset($divisions) && $divisions ) { |
|
11 | + $current_date = ''; |
|
12 | + ?> |
|
13 | 13 | <ul class="business-list"> |
14 | 14 | <?php foreach ($divisions as $division) { ?> |
15 | 15 | <li id="<?= $division['division_id'] ?>"> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | <h3><?= format_date($division['date'], LONGERDATEFORMAT) ?></h3> |
19 | 19 | </span> |
20 | 20 | <?php |
21 | - $current_date = $division['date']; |
|
21 | + $current_date = $division['date']; |
|
22 | 22 | } ?> |
23 | 23 | <a href="/divisions/<?= $division['division_id'] ?>" class="business-list__title"> |
24 | 24 | <h3><?= $division['division_title'] ?></h3> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | </div> |
8 | 8 | <div class="business-section__primary"> |
9 | 9 | <?php |
10 | - if ( isset($divisions) && $divisions ) { |
|
10 | + if (isset($divisions) && $divisions) { |
|
11 | 11 | $current_date = ''; |
12 | 12 | ?> |
13 | 13 | <ul class="business-list"> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <br> |
30 | 30 | <span class="business-list__meta"> |
31 | 31 | <?= $division['summary'] ?> |
32 | - <?= $division['mp_vote'] !== '' ? '. <b>Your MP, ' . $mp_name . ', ' . $division['mp_vote'] . '.</b>': '' ?> |
|
32 | + <?= $division['mp_vote'] !== '' ? '. <b>Your MP, ' . $mp_name . ', ' . $division['mp_vote'] . '.</b>' : '' ?> |
|
33 | 33 | </span> |
34 | 34 | </p> |
35 | 35 | </li> |
@@ -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 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 | ?> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $date = format_date($date, SHORTDATEFORMAT); |
34 | 34 | $time = format_time($time, TIMEFORMAT); |
35 | 35 | |
36 | - $count = $n+1; |
|
36 | + $count = $n + 1; |
|
37 | 37 | |
38 | 38 | $USERURL->insert(array('u'=>$comment['user_id'])); |
39 | 39 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($this_page == 'home') { |
48 | 48 | $MOREURL = new URL('comments_recent'); |
49 | 49 | ?> |
50 | - <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p> |
|
50 | + <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments']) + 1; ?>">See more annotations posted recently</a></p> |
|
51 | 51 | <?php |
52 | 52 | } |
53 | 53 | if ($this_page != 'home') $PAGE->page_links($data); |
@@ -84,13 +84,13 @@ |
||
84 | 84 | $db->display_total_duration(); |
85 | 85 | |
86 | 86 | $duration = getmicrotime() - STARTTIME; |
87 | - twfy_debug ("TIME", "Total time for page: $duration seconds."); |
|
87 | + twfy_debug("TIME", "Total time for page: $duration seconds."); |
|
88 | 88 | if (!isset($_SERVER['WINDIR'])) { |
89 | 89 | $rusage = getrusage(); |
90 | - $duration = $rusage['ru_utime.tv_sec']*1000000 + $rusage['ru_utime.tv_usec'] - STARTTIMEU; |
|
91 | - twfy_debug ('TIME', "Total user time: $duration microseconds."); |
|
92 | - $duration = $rusage['ru_stime.tv_sec']*1000000 + $rusage['ru_stime.tv_usec'] - STARTTIMES; |
|
93 | - twfy_debug ('TIME', "Total system time: $duration microseconds."); |
|
90 | + $duration = $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec'] - STARTTIMEU; |
|
91 | + twfy_debug('TIME', "Total user time: $duration microseconds."); |
|
92 | + $duration = $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec'] - STARTTIMES; |
|
93 | + twfy_debug('TIME', "Total system time: $duration microseconds."); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | ?> |
@@ -31,7 +31,7 @@ |
||
31 | 31 | </li> |
32 | 32 | |
33 | 33 | <?php |
34 | -$user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; |
|
34 | +$user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; |
|
35 | 35 | if (stristr($user_agent, 'Firefox/')) { |
36 | 36 | ?> |
37 | 37 | <li>You can also add TheyWorkForYou to <a href="http://mycroft.mozdev.org/download.html?name=theyworkforyou">Firefox's search box</a>.</li> |
@@ -67,4 +67,4 @@ |
||
67 | 67 | api_output($out); |
68 | 68 | } else { |
69 | 69 | api_error('Nothing'); |
70 | - } |
|
70 | + } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | $out = array(); |
14 | 14 | if (isset ($data['rows'])) { |
15 | - for ($i=0; $i<count($data['rows']); $i++) { |
|
15 | + for ($i = 0; $i < count($data['rows']); $i++) { |
|
16 | 16 | $row = $data['rows'][$i]; |
17 | 17 | if (count($row) == 0) continue; |
18 | 18 | if ($row['htype'] == '12') { |
@@ -14,13 +14,16 @@ 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']; |
21 | 23 | if (is_file(BASEDIR . IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpeg')) { |
22 | 24 | $row['speaker']['image'] = IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpeg'; |
23 | - } elseif (is_file(BASEDIR . IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpg')) { |
|
25 | + } |
|
26 | + elseif (is_file(BASEDIR . IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpg')) { |
|
24 | 27 | $row['speaker']['image'] = IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpg'; |
25 | 28 | } |
26 | 29 | $desc = ''; |
@@ -36,7 +39,9 @@ discard block |
||
36 | 39 | $desc .= $speaker['constituency'] . ', '; |
37 | 40 | } |
38 | 41 | $desc .= _htmlentities($speaker['party']); |
39 | - if ($desc) $row['speaker']['desc'] = $desc; |
|
42 | + if ($desc) { |
|
43 | + $row['speaker']['desc'] = $desc; |
|
44 | + } |
|
40 | 45 | } |
41 | 46 | } |
42 | 47 | $out[] = $row; |
@@ -46,16 +51,20 @@ discard block |
||
46 | 51 | foreach ($data['subrows'] as $row) { |
47 | 52 | if (isset($row['contentcount']) && $row['contentcount'] > 0) { |
48 | 53 | $has_content = true; |
49 | - } elseif ($row['htype'] == '11' && $hansardmajors[$row['major']]['type'] == 'other') { |
|
54 | + } |
|
55 | + elseif ($row['htype'] == '11' && $hansardmajors[$row['major']]['type'] == 'other') { |
|
50 | 56 | $has_content = true; |
51 | - } else { |
|
57 | + } |
|
58 | + else { |
|
52 | 59 | $has_content = false; |
53 | 60 | } |
54 | 61 | $entry = $row; |
55 | - if (isset($row['excerpt'])) |
|
56 | - $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
62 | + if (isset($row['excerpt'])) { |
|
63 | + $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
64 | + } |
|
57 | 65 | if ($has_content) { |
58 | - } else { |
|
66 | + } |
|
67 | + else { |
|
59 | 68 | unset($entry['listurl']); |
60 | 69 | unset($entry['commentsurl']); |
61 | 70 | unset($entry['comment']); |
@@ -65,6 +74,7 @@ discard block |
||
65 | 74 | } |
66 | 75 | } |
67 | 76 | api_output($out); |
68 | -} else { |
|
77 | +} |
|
78 | +else { |
|
69 | 79 | api_error('Nothing'); |
70 | 80 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (isset ($data['rows'])) { |
13 | 13 | $out = array(); |
14 | - for ($i=0; $i<count($data['rows']); $i++) { |
|
14 | + for ($i = 0; $i < count($data['rows']); $i++) { |
|
15 | 15 | $row = $data['rows'][$i]; |
16 | 16 | |
17 | 17 | if ($row['htype'] == '10' && isset($row['excerpt']) && strstr($row['excerpt'], "was asked—")) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if ($row['htype'] == '10') { |
41 | 41 | $out[] = array('entry' => $entry, 'subs' => array()); |
42 | 42 | } else { |
43 | - $out[sizeof($out)-1]['subs'][] = $entry; |
|
43 | + $out[sizeof($out) - 1]['subs'][] = $entry; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
@@ -18,19 +18,24 @@ discard block |
||
18 | 18 | // We fake it here. We hope this section only has a single line like |
19 | 19 | // "The Secretary of State was asked-" and we don't want to make it a link. |
20 | 20 | $has_content = false; |
21 | - } elseif (isset($row['contentcount']) && $row['contentcount'] > 0) { |
|
21 | + } |
|
22 | + elseif (isset($row['contentcount']) && $row['contentcount'] > 0) { |
|
22 | 23 | $has_content = true; |
23 | - } elseif ($row['htype'] == '11' && $hansardmajors[$row['major']]['type'] == 'other') { |
|
24 | + } |
|
25 | + elseif ($row['htype'] == '11' && $hansardmajors[$row['major']]['type'] == 'other') { |
|
24 | 26 | $has_content = true; |
25 | - } else { |
|
27 | + } |
|
28 | + else { |
|
26 | 29 | $has_content = false; |
27 | 30 | } |
28 | 31 | |
29 | 32 | $entry = $row; |
30 | - if (isset($row['excerpt'])) |
|
31 | - $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
33 | + if (isset($row['excerpt'])) { |
|
34 | + $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
35 | + } |
|
32 | 36 | if ($has_content) { |
33 | - } else { |
|
37 | + } |
|
38 | + else { |
|
34 | 39 | unset($entry['listurl']); |
35 | 40 | unset($entry['commentsurl']); |
36 | 41 | unset($entry['comment']); |
@@ -39,12 +44,14 @@ discard block |
||
39 | 44 | |
40 | 45 | if ($row['htype'] == '10') { |
41 | 46 | $out[] = array('entry' => $entry, 'subs' => array()); |
42 | - } else { |
|
47 | + } |
|
48 | + else { |
|
43 | 49 | $out[sizeof($out)-1]['subs'][] = $entry; |
44 | 50 | } |
45 | 51 | |
46 | 52 | } |
47 | 53 | api_output($out); |
48 | -} else { |
|
54 | +} |
|
55 | +else { |
|
49 | 56 | api_error('No data to display'); |
50 | 57 | } |