@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']); |
41 | 41 | $fragment = ''; |
42 | 42 | if ($id_data['htype'] == '11' || $id_data['htype'] == '10') { |
43 | - $LISTURL->insert( array( 'id' => $id_data['gid'] ) ); |
|
43 | + $LISTURL->insert(array('id' => $id_data['gid'])); |
|
44 | 44 | } else { |
45 | 45 | $parent_epobject_id = $id_data['subsection_id']; |
46 | 46 | $parent_gid = ''; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $parent_gid = fix_gid_from_db($r['gid']); |
54 | 54 | } |
55 | 55 | if ($parent_gid != '') { |
56 | - $LISTURL->insert( array( 'id' => $parent_gid ) ); |
|
56 | + $LISTURL->insert(array('id' => $parent_gid)); |
|
57 | 57 | $fragment = '#g' . gid_to_anchor($id_data['gid']); |
58 | 58 | } |
59 | 59 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | array_push($out['none'], '<li>' . $row['person_id'] . ' (' . $row['party'] . ')' . ', ' . $row['constituency']); |
23 | 23 | } |
24 | 24 | } |
25 | -print '<h3>Missing completely ('.count($out['none']).')</h3> <ul>'; |
|
25 | +print '<h3>Missing completely (' . count($out['none']) . ')</h3> <ul>'; |
|
26 | 26 | print join($out['none'], "\n"); |
27 | 27 | print '</ul>'; |
28 | 28 | print '<h3>Large and small</h3> <p>'; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!$dept) { |
13 | 13 | } else { |
14 | - $dept = strtolower(str_replace('_',' ',$dept)); |
|
14 | + $dept = strtolower(str_replace('_', ' ', $dept)); |
|
15 | 15 | $q = $db->query('select epobject.epobject_id from hansard,epobject |
16 | 16 | where hansard.epobject_id=epobject.epobject_id and major=3 and section_id=0 |
17 | 17 | and hdate>(select max(hdate) from hansard where major=3) - interval 7 day |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | order by body'); |
32 | 32 | print '<ul>'; |
33 | 33 | foreach ($q as $row) { |
34 | - print '<li><a href="/wrans/?id=' . fix_gid_from_db($row['gid']). '">' . $row['body']. '</a>'; |
|
34 | + print '<li><a href="/wrans/?id=' . fix_gid_from_db($row['gid']) . '">' . $row['body'] . '</a>'; |
|
35 | 35 | print '</li>'; |
36 | 36 | } |
37 | 37 | print '</ul>'; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!$dept) { |
13 | 13 | } else { |
14 | - $dept = strtolower(str_replace('_',' ',$dept)); |
|
14 | + $dept = strtolower(str_replace('_', ' ', $dept)); |
|
15 | 15 | $q = $db->query('select epobject.epobject_id from hansard,epobject |
16 | 16 | where hansard.epobject_id=epobject.epobject_id and major=4 and section_id=0 |
17 | 17 | and hdate>(select max(hdate) from hansard where major=4) - interval 7 day |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | order by body'); |
32 | 32 | print '<ul>'; |
33 | 33 | foreach ($q as $row) { |
34 | - print '<li><a href="/wms/?id=' . fix_gid_from_db($row['gid']). '">' . $row['body']. '</a>'; |
|
34 | + print '<li><a href="/wms/?id=' . fix_gid_from_db($row['gid']) . '">' . $row['body'] . '</a>'; |
|
35 | 35 | print '</li>'; |
36 | 36 | } |
37 | 37 | print '</ul>'; |
@@ -11,5 +11,5 @@ |
||
11 | 11 | $gid = fix_gid_from_db($gid); |
12 | 12 | |
13 | 13 | $URL = new \MySociety\TheyWorkForYou\Url('debates'); |
14 | -$URL->insert( array( 'id' => $gid ) ); |
|
14 | +$URL->insert(array('id' => $gid)); |
|
15 | 15 | header('Location: ' . $URL->generate()); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | $pc = preg_replace('#[^a-z0-9]#i', '', $pc); |
16 | 16 | if (!validate_postcode($pc)) { |
17 | - twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
17 | + twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
18 | 18 | postcode_error("Sorry, " . _htmlentities($pc) . " isn't a valid postcode"); |
19 | 19 | } |
20 | 20 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | exit; |
58 | 58 | } |
59 | 59 | |
60 | -function fetch_mp($pc, $constituencies, $house=null) { |
|
60 | +function fetch_mp($pc, $constituencies, $house = null) { |
|
61 | 61 | global $THEUSER; |
62 | 62 | $args = array('constituency' => $constituencies['WMC']); |
63 | 63 | if ($house) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | try { |
67 | 67 | $MEMBER = new MEMBER($args); |
68 | - } catch (MySociety\TheyWorkForYou\MemberException $e){ |
|
68 | + } catch (MySociety\TheyWorkForYou\MemberException $e) { |
|
69 | 69 | postcode_error($e->getMessage()); |
70 | 70 | } |
71 | 71 | if ($MEMBER->person_id()) { |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | foreach ($q as $row) { |
112 | 112 | $house = $row['house']; |
113 | 113 | $cons = $row['constituency']; |
114 | - if ($house==3) { |
|
114 | + if ($house == 3) { |
|
115 | 115 | $mreg[] = $row; |
116 | - } elseif ($house==4) { |
|
116 | + } elseif ($house == 4) { |
|
117 | 117 | if ($cons == $areas['SPC']) { |
118 | 118 | $mcon = $row; |
119 | 119 | } elseif ($cons == $areas['SPE']) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $out .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, ' . $mcon['constituency'] . '</li>'; |
139 | 139 | } |
140 | 140 | $out .= '<li>Your <strong>' . $areas[$area_type] . ' ' . $rep_type . 's</strong> '; |
141 | - if ($rep_type=='MLA') $out .= '(Members of the Legislative Assembly)'; |
|
141 | + if ($rep_type == 'MLA') $out .= '(Members of the Legislative Assembly)'; |
|
142 | 142 | $out .= ' ' . ($current ? 'are' : 'were') . ':'; |
143 | 143 | $out .= '<ul>'; |
144 | 144 | foreach ($mreg as $reg) { |
@@ -89,7 +89,9 @@ discard block |
||
89 | 89 | $mp = array(); |
90 | 90 | if ($q) { |
91 | 91 | $mp = $q; |
92 | - if ($mp['left_house'] != '9999-12-31') $mp['former'] = true; |
|
92 | + if ($mp['left_house'] != '9999-12-31') { |
|
93 | + $mp['former'] = true; |
|
94 | + } |
|
93 | 95 | } |
94 | 96 | |
95 | 97 | $a = array_values($areas); |
@@ -128,7 +130,9 @@ discard block |
||
128 | 130 | $out = ''; |
129 | 131 | $out .= '<p>That postcode has multiple results, please pick who you are interested in:</p>'; |
130 | 132 | $out .= '<ul><li>Your '; |
131 | - if (isset($mp['former'])) $out .= 'former '; |
|
133 | + if (isset($mp['former'])) { |
|
134 | + $out .= 'former '; |
|
135 | + } |
|
132 | 136 | $out .= '<strong>MP</strong> (Member of Parliament) is <a href="/mp/?p=' . $mp['person_id'] . '">'; |
133 | 137 | $out .= $mp['given_name'] . ' ' . $mp['family_name'] . '</a>, ' . $mp['constituency'] . '</li>'; |
134 | 138 | if ($mcon) { |
@@ -138,7 +142,9 @@ discard block |
||
138 | 142 | $out .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, ' . $mcon['constituency'] . '</li>'; |
139 | 143 | } |
140 | 144 | $out .= '<li>Your <strong>' . $areas[$area_type] . ' ' . $rep_type . 's</strong> '; |
141 | - if ($rep_type=='MLA') $out .= '(Members of the Legislative Assembly)'; |
|
145 | + if ($rep_type=='MLA') { |
|
146 | + $out .= '(Members of the Legislative Assembly)'; |
|
147 | + } |
|
142 | 148 | $out .= ' ' . ($current ? 'are' : 'were') . ':'; |
143 | 149 | $out .= '<ul>'; |
144 | 150 | foreach ($mreg as $reg) { |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | $gid = $row['gid']; |
24 | 24 | $atime = $row['atime']; |
25 | 25 | $body = strip_tags($row['body']); |
26 | - $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos+1) . ' group by video_timestamps.gid')->first(); |
|
26 | + $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos + 1) . ' group by video_timestamps.gid')->first(); |
|
27 | 27 | $next_atime = $qq['atime']; |
28 | 28 | if (!$next_atime) continue; |
29 | 29 | $duration = $next_atime - $atime; |
30 | - if ($duration<=0) continue; |
|
30 | + if ($duration <= 0) continue; |
|
31 | 31 | $words = preg_split('/\W+/', $body, -1, PREG_SPLIT_NO_EMPTY); |
32 | 32 | $num_words = count($words); |
33 | - $speed = $num_words / ($duration/60); |
|
33 | + $speed = $num_words / ($duration / 60); |
|
34 | 34 | $total_speed += $speed; |
35 | 35 | print "$gid, $num_words words, from $atime to $next_atime, duration $duration s, speed $speed wpm\n"; |
36 | 36 | $total += $duration; |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | $num++; |
39 | 39 | } |
40 | 40 | |
41 | - $total_min = $total/60; |
|
41 | + $total_min = $total / 60; |
|
42 | 42 | |
43 | 43 | print "Person ID $spid\n"; |
44 | - print "Average length = " . ($total/$num) . "s\n"; |
|
45 | - print "Average speed = " . ($total_words/$total_min) . "wpm\n"; |
|
46 | - print "Average of speeds = " . ($total_speed/$num) . "wpm\n"; |
|
44 | + print "Average length = " . ($total / $num) . "s\n"; |
|
45 | + print "Average speed = " . ($total_words / $total_min) . "wpm\n"; |
|
46 | + print "Average of speeds = " . ($total_speed / $num) . "wpm\n"; |
|
47 | 47 | print "\n"; |
48 | 48 | } |
49 | 49 |
@@ -25,9 +25,13 @@ |
||
25 | 25 | $body = strip_tags($row['body']); |
26 | 26 | $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos+1) . ' group by video_timestamps.gid')->first(); |
27 | 27 | $next_atime = $qq['atime']; |
28 | - if (!$next_atime) continue; |
|
28 | + if (!$next_atime) { |
|
29 | + continue; |
|
30 | + } |
|
29 | 31 | $duration = $next_atime - $atime; |
30 | - if ($duration<=0) continue; |
|
32 | + if ($duration<=0) { |
|
33 | + continue; |
|
34 | + } |
|
31 | 35 | $words = preg_split('/\W+/', $body, -1, PREG_SPLIT_NO_EMPTY); |
32 | 36 | $num_words = count($words); |
33 | 37 | $speed = $num_words / ($duration/60); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // available for editing, it's accurate. |
25 | 25 | $this->_update_locked(); |
26 | 26 | |
27 | - $data = $this->_get_data_by_recent (); |
|
27 | + $data = $this->_get_data_by_recent(); |
|
28 | 28 | |
29 | 29 | $this->render($data); |
30 | 30 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $data = array(); |
99 | 99 | foreach ($q as $row) { |
100 | - $data[] = array ( |
|
100 | + $data[] = array( |
|
101 | 101 | 'report_id' => $row['report_id'], |
102 | 102 | 'comment_id' => $row['comment_id'], |
103 | 103 | 'firstname' => $row['firstname'], |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ); |
109 | 109 | } |
110 | 110 | foreach ($r as $row) { |
111 | - $data[] = array ( |
|
111 | + $data[] = array( |
|
112 | 112 | 'report_id' => $row['report_id'], |
113 | 113 | 'comment_id' => $row['comment_id'], |
114 | 114 | 'firstname' => $row['firstname'], |
@@ -33,7 +33,7 @@ |
||
33 | 33 | list($firstyear, $firstmonth, $day) = explode('-', $min_future_date); |
34 | 34 | list($finalyear, $finalmonth, $day) = explode('-', $max_future_date); |
35 | 35 | |
36 | -$q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future |
|
36 | +$q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future |
|
37 | 37 | WHERE event_date >= :firstdate |
38 | 38 | AND event_date <= :finaldate |
39 | 39 | AND deleted = 0 |