@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | if ($last_postcode == $postcode) { |
41 | 41 | $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value; |
42 | - twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value )); |
|
42 | + twfy_debug ("TIME", "postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value )); |
|
43 | 43 | return $return_value; |
44 | 44 | } |
45 | 45 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | if ($last_postcode == $postcode) { |
41 | 41 | $return_value = $mp_only ? $last_postcode_value['WMC'] : $last_postcode_value; |
42 | - twfy_debug ("TIME", "Postcode $postcode looked up last time, is " . ( is_array($return_value) ? implode(', ', $return_value) : $return_value )); |
|
42 | + twfy_debug("TIME", "Postcode $postcode looked up last time, is " . (is_array($return_value) ? implode(', ', $return_value) : $return_value)); |
|
43 | 43 | return $return_value; |
44 | 44 | } |
45 | 45 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $name = $q['name']; |
76 | 76 | if (self::postcodeIsScottish($postcode)) { |
77 | 77 | $name = explode('|', $name); |
78 | - if (count($name)==3) |
|
78 | + if (count($name) == 3) |
|
79 | 79 | return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]); |
80 | 80 | } elseif (self::postcodeIsNi($postcode)) { |
81 | 81 | $name = explode('|', $name); |
82 | - if (count($name)==2) |
|
82 | + if (count($name) == 2) |
|
83 | 83 | return array('WMC' => $name[0], 'NIE' => $name[1]); |
84 | 84 | } else { |
85 | 85 | return array('WMC' => $name); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $r = json_decode($file, true); |
115 | 115 | if (!$r) { |
116 | - trigger_error("Postcode database is not working. Content:\n".$file.", request: ". $filename, E_USER_WARNING); |
|
116 | + trigger_error("Postcode database is not working. Content:\n" . $file . ", request: " . $filename, E_USER_WARNING); |
|
117 | 117 | return ''; |
118 | 118 | } |
119 | 119 | if (isset($r['error']) || !isset($r['areas'])) { |
@@ -179,29 +179,29 @@ discard block |
||
179 | 179 | if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) |
180 | 180 | return true; |
181 | 181 | |
182 | - if ($m[1]=='DG') { |
|
183 | - if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England |
|
182 | + if ($m[1] == 'DG') { |
|
183 | + if ($m[2] == 16 && $m[3] == 5 && in_array($m[4], array('HT', 'HU', 'HZ', 'JA', 'JB'))) return false; # A few postcodes in England |
|
184 | 184 | return true; |
185 | 185 | } |
186 | 186 | |
187 | 187 | # Damn postcodes crossing country boundaries |
188 | - if ($m[1]=='TD') { |
|
189 | - if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland |
|
190 | - if ($m[2]==9) { |
|
191 | - if ($m[3]!=0) return true; # TD9 1-9 all in Scotland |
|
192 | - if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland |
|
188 | + if ($m[1] == 'TD') { |
|
189 | + if ($m[2] != 15 && $m[2] != 12 && $m[2] != 9) return true; # TD1-8, 10-11, 13-14 all in Scotland |
|
190 | + if ($m[2] == 9) { |
|
191 | + if ($m[3] != 0) return true; # TD9 1-9 all in Scotland |
|
192 | + if (!in_array($m[4], array('TJ', 'TP', 'TR', 'TS', 'TT', 'TU', 'TW'))) return true; # Nearly all of TD9 0 in Scotland |
|
193 | 193 | } |
194 | 194 | $m[5] = substr($m[4], 0, 1); |
195 | - if ($m[2]==12) { # $m[3] will be 4 currently. |
|
196 | - if ($m[4]=='XE') return true; |
|
197 | - if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
195 | + if ($m[2] == 12) { # $m[3] will be 4 currently. |
|
196 | + if ($m[4] == 'XE') return true; |
|
197 | + if (in_array($m[5], array('A', 'B', 'D', 'E', 'H', 'J', 'L', 'N', 'W', 'Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
198 | 198 | } |
199 | 199 | # TD15 is mostly England |
200 | - if ($m[2]==15) { |
|
201 | - if ($m[3]!=1) return false; # TD15 2 and 9 are in England |
|
202 | - if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true; |
|
203 | - if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland |
|
204 | - if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
200 | + if ($m[2] == 15) { |
|
201 | + if ($m[3] != 1) return false; # TD15 2 and 9 are in England |
|
202 | + if (in_array($m[4], array('BT', 'SU', 'SZ', 'UF', 'UG', 'UH', 'UJ', 'UL', 'US', 'UZ', 'WY', 'WZ'))) return true; |
|
203 | + if ($m[5] == 'T' && $m[4] != 'TA' && $m[4] != 'TB') return true; # Most of TD15 1T* in Scotland |
|
204 | + if ($m[5] == 'X' && $m[4] != 'XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | $ret = self::postcodeFetchFromMapit($postcode); |
53 | 53 | } |
54 | 54 | |
55 | - if (is_string($ret)) return $ret; |
|
55 | + if (is_string($ret)) { |
|
56 | + return $ret; |
|
57 | + } |
|
56 | 58 | |
57 | 59 | $last_postcode = $postcode; |
58 | 60 | $last_postcode_value = $ret; |
@@ -75,12 +77,14 @@ discard block |
||
75 | 77 | $name = $q['name']; |
76 | 78 | if (self::postcodeIsScottish($postcode)) { |
77 | 79 | $name = explode('|', $name); |
78 | - if (count($name)==3) |
|
79 | - return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]); |
|
80 | + if (count($name)==3) { |
|
81 | + return array('WMC' => $name[0], 'SPC' => $name[1], 'SPE' => $name[2]); |
|
82 | + } |
|
80 | 83 | } elseif (self::postcodeIsNi($postcode)) { |
81 | 84 | $name = explode('|', $name); |
82 | - if (count($name)==2) |
|
83 | - return array('WMC' => $name[0], 'NIE' => $name[1]); |
|
85 | + if (count($name)==2) { |
|
86 | + return array('WMC' => $name[0], 'NIE' => $name[1]); |
|
87 | + } |
|
84 | 88 | } else { |
85 | 89 | return array('WMC' => $name); |
86 | 90 | } |
@@ -121,8 +125,9 @@ discard block |
||
121 | 125 | } |
122 | 126 | $areas = array(); |
123 | 127 | foreach ($r['areas'] as $row) { |
124 | - if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE'))) |
|
125 | - $areas[$row['type']] = $row['name']; |
|
128 | + if (in_array($row['type'], array('WMC', 'SPC', 'SPE', 'NIE'))) { |
|
129 | + $areas[$row['type']] = $row['name']; |
|
130 | + } |
|
126 | 131 | } |
127 | 132 | |
128 | 133 | if (!isset($areas['WMC'])) { |
@@ -172,36 +177,67 @@ discard block |
||
172 | 177 | */ |
173 | 178 | |
174 | 179 | public static function postcodeIsScottish($pc) { |
175 | - if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m)) |
|
176 | - return false; |
|
180 | + if (!preg_match('#^([A-Z]{1,2})(\d+) (\d)([A-Z]{2})#', self::canonicalisePostcode($pc), $m)) { |
|
181 | + return false; |
|
182 | + } |
|
177 | 183 | |
178 | 184 | # Check for Scottish postal areas |
179 | - if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) |
|
180 | - return true; |
|
185 | + if (in_array($m[1], array('AB', 'DD', 'EH', 'FK', 'G', 'HS', 'IV', 'KA', 'KW', 'KY', 'ML', 'PA', 'PH', 'ZE'))) { |
|
186 | + return true; |
|
187 | + } |
|
181 | 188 | |
182 | 189 | if ($m[1]=='DG') { |
183 | - if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) return false; # A few postcodes in England |
|
190 | + if ($m[2]==16 && $m[3]==5 && in_array($m[4], array('HT','HU','HZ','JA','JB'))) { |
|
191 | + return false; |
|
192 | + } |
|
193 | + # A few postcodes in England |
|
184 | 194 | return true; |
185 | 195 | } |
186 | 196 | |
187 | 197 | # Damn postcodes crossing country boundaries |
188 | 198 | if ($m[1]=='TD') { |
189 | - if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) return true; # TD1-8, 10-11, 13-14 all in Scotland |
|
199 | + if ($m[2]!=15 && $m[2]!=12 && $m[2]!=9) { |
|
200 | + return true; |
|
201 | + } |
|
202 | + # TD1-8, 10-11, 13-14 all in Scotland |
|
190 | 203 | if ($m[2]==9) { |
191 | - if ($m[3]!=0) return true; # TD9 1-9 all in Scotland |
|
192 | - if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) return true; # Nearly all of TD9 0 in Scotland |
|
204 | + if ($m[3]!=0) { |
|
205 | + return true; |
|
206 | + } |
|
207 | + # TD9 1-9 all in Scotland |
|
208 | + if (!in_array($m[4], array('TJ','TP','TR','TS','TT','TU','TW'))) { |
|
209 | + return true; |
|
210 | + } |
|
211 | + # Nearly all of TD9 0 in Scotland |
|
193 | 212 | } |
194 | 213 | $m[5] = substr($m[4], 0, 1); |
195 | - if ($m[2]==12) { # $m[3] will be 4 currently. |
|
196 | - if ($m[4]=='XE') return true; |
|
197 | - if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) return true; # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
214 | + if ($m[2]==12) { |
|
215 | +# $m[3] will be 4 currently. |
|
216 | + if ($m[4]=='XE') { |
|
217 | + return true; |
|
218 | + } |
|
219 | + if (in_array($m[5], array('A','B','D','E','H','J','L','N','W','Y'))) { |
|
220 | + return true; |
|
221 | + } |
|
222 | + # These bits of TD12 4 are in Scotland, others (Q, R, S, T, U, X) in England |
|
198 | 223 | } |
199 | 224 | # TD15 is mostly England |
200 | 225 | if ($m[2]==15) { |
201 | - if ($m[3]!=1) return false; # TD15 2 and 9 are in England |
|
202 | - if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) return true; |
|
203 | - if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') return true; # Most of TD15 1T* in Scotland |
|
204 | - if ($m[5]=='X' && $m[4]!='XX') return true; # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
226 | + if ($m[3]!=1) { |
|
227 | + return false; |
|
228 | + } |
|
229 | + # TD15 2 and 9 are in England |
|
230 | + if (in_array($m[4], array('BT','SU','SZ','UF','UG','UH','UJ','UL','US','UZ','WY','WZ'))) { |
|
231 | + return true; |
|
232 | + } |
|
233 | + if ($m[5]=='T' && $m[4]!='TA' && $m[4]!='TB') { |
|
234 | + return true; |
|
235 | + } |
|
236 | + # Most of TD15 1T* in Scotland |
|
237 | + if ($m[5]=='X' && $m[4]!='XX') { |
|
238 | + return true; |
|
239 | + } |
|
240 | + # TD15 1XX in England, rest of TD15 1X* in Scotland |
|
205 | 241 | } |
206 | 242 | } |
207 | 243 | |
@@ -215,8 +251,9 @@ discard block |
||
215 | 251 | |
216 | 252 | public static function postcodeIsNi($pc) { |
217 | 253 | $prefix = substr(self::canonicalisePostcode($pc), 0, 2); |
218 | - if ($prefix == 'BT') |
|
219 | - return true; |
|
254 | + if ($prefix == 'BT') { |
|
255 | + return true; |
|
256 | + } |
|
220 | 257 | return false; |
221 | 258 | } |
222 | 259 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | protected function getCalendarData() { |
41 | - return NULL; |
|
41 | + return null; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $both = 1; |
220 | 220 | $agree = 10; |
221 | 221 | |
222 | - if ( stripos($vote, '3') !== FALSE ) { |
|
222 | + if ( stripos($vote, '3') !== false ) { |
|
223 | 223 | $agree = 50; |
224 | 224 | $absent = 25; |
225 | 225 | $both = 25; |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | 'both' => $both |
231 | 231 | ); |
232 | 232 | |
233 | - if ( stripos($vote, 'aye') !== FALSE ) { |
|
233 | + if ( stripos($vote, 'aye') !== false ) { |
|
234 | 234 | $scores['aye'] = $agree; |
235 | 235 | $scores['no'] = 0; |
236 | - } else if ( stripos($vote, 'no') !== FALSE ) { |
|
236 | + } else if ( stripos($vote, 'no') !== false ) { |
|
237 | 237 | $scores['no'] = $agree; |
238 | 238 | $scores['aye'] = 0; |
239 | 239 | } else { |
@@ -144,9 +144,15 @@ |
||
144 | 144 | $num_votes = 0; |
145 | 145 | foreach ($votes as $vote) { |
146 | 146 | $vote_dir = $vote['vote']; |
147 | - if ( $vote_dir == '' ) continue; |
|
148 | - if ( $vote_dir == 'tellno' ) $vote_dir = 'no'; |
|
149 | - if ( $vote_dir == 'tellaye' ) $vote_dir = 'aye'; |
|
147 | + if ( $vote_dir == '' ) { |
|
148 | + continue; |
|
149 | + } |
|
150 | + if ( $vote_dir == 'tellno' ) { |
|
151 | + $vote_dir = 'no'; |
|
152 | + } |
|
153 | + if ( $vote_dir == 'tellaye' ) { |
|
154 | + $vote_dir = 'aye'; |
|
155 | + } |
|
150 | 156 | |
151 | 157 | $num_votes += $vote['num_votes']; |
152 | 158 | $score += ($vote['num_votes'] * $weights[$vote_dir]); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function __construct($name) { |
21 | 21 | // treat Labour and Labour/Co-operative the same as that's how |
22 | 22 | // people view them and it'll confuse the results otherwise |
23 | - if ( $name == 'Labour/Co-operative' ) { |
|
23 | + if ($name == 'Labour/Co-operative') { |
|
24 | 24 | $name = 'Labour'; |
25 | 25 | } |
26 | 26 | $this->name = $name; |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | $score = $position['score']; |
75 | 75 | $score_desc = score_to_strongly($score); |
76 | 76 | |
77 | - if ( $want_score ) { |
|
78 | - return array( $score_desc, $score); |
|
77 | + if ($want_score) { |
|
78 | + return array($score_desc, $score); |
|
79 | 79 | } else { |
80 | 80 | return $score_desc; |
81 | 81 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ':party' => $this->name |
115 | 115 | ); |
116 | 116 | |
117 | - if ( $this->name == 'Labour' ) { |
|
117 | + if ($this->name == 'Labour') { |
|
118 | 118 | $party_where = '( party = :party OR party = :party2 )'; |
119 | 119 | $params = array( |
120 | 120 | ':party' => $this->name, |
@@ -144,40 +144,40 @@ discard block |
||
144 | 144 | $num_votes = 0; |
145 | 145 | foreach ($votes as $vote) { |
146 | 146 | $vote_dir = $vote['vote']; |
147 | - if ( $vote_dir == '' ) continue; |
|
148 | - if ( $vote_dir == 'tellno' ) $vote_dir = 'no'; |
|
149 | - if ( $vote_dir == 'tellaye' ) $vote_dir = 'aye'; |
|
147 | + if ($vote_dir == '') continue; |
|
148 | + if ($vote_dir == 'tellno') $vote_dir = 'no'; |
|
149 | + if ($vote_dir == 'tellaye') $vote_dir = 'aye'; |
|
150 | 150 | |
151 | 151 | $num_votes += $vote['num_votes']; |
152 | 152 | $score += ($vote['num_votes'] * $weights[$vote_dir]); |
153 | 153 | } |
154 | 154 | |
155 | 155 | $total_votes += $num_votes; |
156 | - $max_score += $num_votes * max( array_values( $weights ) ); |
|
156 | + $max_score += $num_votes * max(array_values($weights)); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( $total_votes == 0 ) { |
|
159 | + if ($total_votes == 0) { |
|
160 | 160 | return null; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // this implies that all the divisions in the policy have a policy |
164 | 164 | // position of absent so we set weight to -1 to indicate we can't |
165 | 165 | // really say what the parties position is. |
166 | - if ( $max_score == 0 ) { |
|
166 | + if ($max_score == 0) { |
|
167 | 167 | $weight = -1; |
168 | 168 | } else { |
169 | - $weight = 1 - ( $score/$max_score ); |
|
169 | + $weight = 1 - ($score / $max_score); |
|
170 | 170 | } |
171 | 171 | $score_desc = score_to_strongly($weight); |
172 | 172 | |
173 | - if ( $want_score ) { |
|
174 | - return array( $score_desc, $weight); |
|
173 | + if ($want_score) { |
|
174 | + return array($score_desc, $weight); |
|
175 | 175 | } else { |
176 | 176 | return $score_desc; |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - public function cache_position( $position ) { |
|
180 | + public function cache_position($position) { |
|
181 | 181 | $this->db->query( |
182 | 182 | "REPLACE INTO partypolicy |
183 | 183 | (party, house, policy_id, score) |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | return $positions; |
198 | 198 | } |
199 | 199 | |
200 | - foreach ( $policies->getPolicies() as $policy_id => $policy_text ) { |
|
201 | - list( $position, $score ) = $this->$method($policy_id, true); |
|
202 | - if ( $position === null ) { |
|
200 | + foreach ($policies->getPolicies() as $policy_id => $policy_text) { |
|
201 | + list($position, $score) = $this->$method($policy_id, true); |
|
202 | + if ($position === null) { |
|
203 | 203 | continue; |
204 | 204 | } |
205 | 205 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $both = 1; |
220 | 220 | $agree = 10; |
221 | 221 | |
222 | - if ( stripos($vote, '3') !== FALSE ) { |
|
222 | + if (stripos($vote, '3') !== FALSE) { |
|
223 | 223 | $agree = 50; |
224 | 224 | $absent = 25; |
225 | 225 | $both = 25; |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | 'both' => $both |
231 | 231 | ); |
232 | 232 | |
233 | - if ( stripos($vote, 'aye') !== FALSE ) { |
|
233 | + if (stripos($vote, 'aye') !== FALSE) { |
|
234 | 234 | $scores['aye'] = $agree; |
235 | 235 | $scores['no'] = 0; |
236 | - } else if ( stripos($vote, 'no') !== FALSE ) { |
|
236 | + } else if (stripos($vote, 'no') !== FALSE) { |
|
237 | 237 | $scores['no'] = $agree; |
238 | 238 | $scores['aye'] = 0; |
239 | 239 | } else { |
@@ -11,7 +11,7 @@ |
||
11 | 11 | protected $db; |
12 | 12 | protected $alert; |
13 | 13 | |
14 | - public function __construct($THEUSER = NULL) { |
|
14 | + public function __construct($THEUSER = null) { |
|
15 | 15 | $this->user = $THEUSER; |
16 | 16 | $this->db = new \ParlDB; |
17 | 17 | $this->alert = new \ALERT; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | */ |
30 | 30 | |
31 | - public function __construct($data = NULL) |
|
31 | + public function __construct($data = null) |
|
32 | 32 | { |
33 | 33 | $this->db = new \ParlDB; |
34 | 34 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function sctitle() { |
55 | 55 | $title = $this->title; |
56 | - if (strpos($title, 'The ') === 0 ) { |
|
56 | + if (strpos($title, 'The ') === 0) { |
|
57 | 57 | $title = lcfirst($title); |
58 | 58 | } |
59 | 59 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ); |
243 | 243 | } else { |
244 | 244 | foreach ($sets as $set) { |
245 | - if ($set == '' ) { |
|
245 | + if ($set == '') { |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | $q = $this->db->query( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ); |
286 | 286 | } else { |
287 | 287 | foreach ($policies as $policy) { |
288 | - if ($policy == '' ) { |
|
288 | + if ($policy == '') { |
|
289 | 289 | continue; |
290 | 290 | } |
291 | 291 | $q = $this->db->query( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->db = new \ParlDB; |
34 | 34 | |
35 | 35 | if (is_null($data)) { |
36 | - return; |
|
36 | + return; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $this->id = $data['id']; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | private function _getContentIDs() { |
126 | 126 | $q = $this->db->query( |
127 | - "SELECT body, gid, ep.epobject_id FROM epobject ep |
|
127 | + "SELECT body, gid, ep.epobject_id FROM epobject ep |
|
128 | 128 | JOIN hansard h on ep.epobject_id = h.epobject_id |
129 | 129 | JOIN topic_epobjects te on te.epobject_id = ep.epobject_id |
130 | 130 | WHERE topic_key = :topic_key", |
@@ -178,24 +178,24 @@ discard block |
||
178 | 178 | |
179 | 179 | public function addContent($gid) { |
180 | 180 | $q = $this->db->query( |
181 | - "SELECT epobject_id FROM hansard WHERE gid = :gid", |
|
182 | - array( |
|
181 | + "SELECT epobject_id FROM hansard WHERE gid = :gid", |
|
182 | + array( |
|
183 | 183 | ":gid" => $gid |
184 | - ) |
|
184 | + ) |
|
185 | 185 | )->first(); |
186 | 186 | |
187 | 187 | if (!$q) { |
188 | - return false; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $epobject_id = $q['epobject_id']; |
192 | 192 | |
193 | 193 | $q = $this->db->query( |
194 | - "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)", |
|
195 | - array( |
|
194 | + "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)", |
|
195 | + array( |
|
196 | 196 | ":topic" => $this->id, |
197 | 197 | ":ep_id" => $epobject_id |
198 | - ) |
|
198 | + ) |
|
199 | 199 | ); |
200 | 200 | |
201 | 201 | return $q->success(); |
@@ -203,23 +203,23 @@ discard block |
||
203 | 203 | |
204 | 204 | public function deleteContent($id) { |
205 | 205 | $q = $this->db->query( |
206 | - "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id", |
|
207 | - array( |
|
206 | + "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id", |
|
207 | + array( |
|
208 | 208 | ":topic" => $this->id, |
209 | 209 | ":ep_id" => $id |
210 | - ) |
|
210 | + ) |
|
211 | 211 | ); |
212 | 212 | |
213 | 213 | return $q->success(); |
214 | 214 | } |
215 | 215 | |
216 | 216 | public function getPolicySets() { |
217 | - $q = $this->db->query( |
|
217 | + $q = $this->db->query( |
|
218 | 218 | "SELECT policyset FROM topic_policysets WHERE topic_key = :key", |
219 | 219 | array( |
220 | - ':key' => $this->id |
|
220 | + ':key' => $this->id |
|
221 | 221 | ) |
222 | - ); |
|
222 | + ); |
|
223 | 223 | |
224 | 224 | $sets = array(); |
225 | 225 | foreach ($q as $row) { |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | public function getPolicies() { |
259 | - $q = $this->db->query( |
|
259 | + $q = $this->db->query( |
|
260 | 260 | 'SELECT policy_id FROM topic_policies WHERE topic_key = :key', |
261 | 261 | array( |
262 | - ':key' => $this->id |
|
262 | + ':key' => $this->id |
|
263 | 263 | ) |
264 | - ); |
|
264 | + ); |
|
265 | 265 | |
266 | 266 | $policies = array(); |
267 | 267 | foreach ($q as $row) { |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | public function save() { |
314 | 314 | $q = $this->db->query( |
315 | - "REPLACE INTO topics |
|
315 | + "REPLACE INTO topics |
|
316 | 316 | (id, title, slug, description, search_string, front_page, image) |
317 | 317 | VALUES |
318 | 318 | (:id, :title, :slug, :description, :search_string, :front_page, :image)", |
@@ -65,7 +65,7 @@ |
||
65 | 65 | } elseif ($this->session) { |
66 | 66 | # Display the bills for a particular session |
67 | 67 | $this_page = 'pbc_session'; |
68 | - $DATA->set_page_metadata($this_page, 'title', "Session $this->session"); |
|
68 | + $DATA->set_page_metadata($this_page, 'title', "session $this->session"); |
|
69 | 69 | $args = array ( |
70 | 70 | 'session' => $this->session, |
71 | 71 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } elseif ($bill_id) { |
48 | 48 | # Display the page for a particular bill |
49 | 49 | $this_page = 'pbc_bill'; |
50 | - $args = array ( |
|
50 | + $args = array( |
|
51 | 51 | 'id' => $bill_id, |
52 | 52 | 'title' => $this->bill, |
53 | 53 | 'session' => $this->session, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | # Display the bills for a particular session |
67 | 67 | $this_page = 'pbc_session'; |
68 | 68 | $DATA->set_page_metadata($this_page, 'title', "Session $this->session"); |
69 | - $args = array ( |
|
69 | + $args = array( |
|
70 | 70 | 'session' => $this->session, |
71 | 71 | ); |
72 | 72 | $data = array(); |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | |
89 | 89 | protected function getSearchSections() { |
90 | 90 | return array( |
91 | - array( 'section' => 'pbc' ) |
|
91 | + array('section' => 'pbc') |
|
92 | 92 | ); |
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function front_content() { |
96 | - return $this->list->display( 'recent_pbc_debates', array( 'num' => 50 ), 'none' ); |
|
96 | + return $this->list->display('recent_pbc_debates', array('num' => 50), 'none'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | protected function display_front() { |
@@ -512,7 +512,7 @@ |
||
512 | 512 | if ($row['totalcomments'] > 1) { |
513 | 513 | $morecount = $row['totalcomments'] - 1; |
514 | 514 | $plural = $morecount == 1 ? 'annotation' : 'annotations'; |
515 | - $linktext = "Read $morecount more $plural"; |
|
515 | + $linktext = "read $morecount more $plural"; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | } else { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $data = $this->addCommonData($data); |
33 | 33 | } elseif ($date = get_http_var('d')) { |
34 | 34 | $data = $this->display_day($date); |
35 | - if ( !isset($data['template']) ) { |
|
35 | + if (!isset($data['template'])) { |
|
36 | 36 | $data['template'] = 'section/day'; |
37 | 37 | } |
38 | 38 | $data = $this->addCommonData($data); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $data = $this->display_section_or_speech(); |
41 | 41 | } else { |
42 | 42 | $data = $this->display_front(); |
43 | - if ( !isset($data['template']) ) { |
|
43 | + if (!isset($data['template'])) { |
|
44 | 44 | $data['template'] = 'section/recent'; |
45 | 45 | } |
46 | 46 | $data['search_sections'] = $this->getSearchSections(); |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | $data['recess_major'] = $this->getRecessMajor(); |
60 | 60 | |
61 | 61 | $nextprev = $DATA->page_metadata($this_page, 'nextprev'); |
62 | - if ( isset($nextprev['next']['url']) ) { |
|
62 | + if (isset($nextprev['next']['url'])) { |
|
63 | 63 | $data['next'] = $nextprev['next']; |
64 | 64 | } |
65 | - if ( isset($nextprev['prev']['url']) ) { |
|
65 | + if (isset($nextprev['prev']['url'])) { |
|
66 | 66 | $data['prev'] = $nextprev['prev']; |
67 | 67 | } |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (!isset($data['title']) && $parent_page != '') { |
72 | 72 | $data['title'] = $DATA->page_metadata($parent_page, 'title'); |
73 | 73 | } |
74 | - if ( $parent_page ) { |
|
74 | + if ($parent_page) { |
|
75 | 75 | $data['parent_title'] = $DATA->page_metadata($parent_page, 'title'); |
76 | 76 | } |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $urls = array_merge($urls, $this->getViewUrls()); |
89 | 89 | |
90 | - if ( isset($data['info']['page']) ) { |
|
90 | + if (isset($data['info']['page'])) { |
|
91 | 91 | $day = new \MySociety\TheyWorkForYou\Url($data['info']['page']); |
92 | 92 | $urls['day'] = $day; |
93 | 93 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $DATA->set_page_metadata($this_page, 'title', $year); |
134 | 134 | } |
135 | 135 | |
136 | - $args = array ( 'year' => $year ); |
|
136 | + $args = array('year' => $year); |
|
137 | 137 | $data = $this->list->display('calendar', $args, 'none'); |
138 | 138 | return $data; |
139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function display_column($date, $column) { |
142 | 142 | global $this_page; |
143 | 143 | $this_page = $this->page_base; |
144 | - $args = array( 'date' => $date, 'column' => $column ); |
|
144 | + $args = array('date' => $date, 'column' => $column); |
|
145 | 145 | $content = $this->list->display('column', $args, 'none'); |
146 | 146 | |
147 | 147 | $data = array(); |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | protected function display_day($date) { |
167 | 167 | global $this_page; |
168 | 168 | $this_page = $this->page_base . 'day'; |
169 | - $args = array ( 'date' => get_http_var('d') ); |
|
169 | + $args = array('date' => get_http_var('d')); |
|
170 | 170 | $data = $this->list->display('date', $args, 'none'); |
171 | 171 | list($year, $month, $day) = explode('-', $date); |
172 | - $args = array( 'year' => $year, 'month' => $month, 'day' => $day); |
|
172 | + $args = array('year' => $year, 'month' => $month, 'day' => $day); |
|
173 | 173 | $calendar = $this->list->display('calendar', $args, 'none'); |
174 | - if ( isset($calendar['years']) ) { |
|
174 | + if (isset($calendar['years'])) { |
|
175 | 175 | $data['calendar'] = $calendar['years']; |
176 | 176 | } |
177 | 177 | return $data; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | global $DATA, $this_page, $THEUSER; |
182 | 182 | |
183 | 183 | # += as we *don't* want to override any already supplied argument |
184 | - $args += array ( |
|
184 | + $args += array( |
|
185 | 185 | 'gid' => get_http_var('id'), |
186 | 186 | 's' => get_http_var('s'), // Search terms to be highlighted. |
187 | 187 | 'member_id' => get_http_var('m'), // Member's speeches to be highlighted. |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | if ($this->major == 6) { |
199 | 199 | # Magically (as in I can't remember quite why), pbc_clause will |
200 | 200 | # contain the new URL without any change... |
201 | - $URL->remove( array('id') ); |
|
201 | + $URL->remove(array('id')); |
|
202 | 202 | } else { |
203 | - $URL->insert( array('id'=>$e->getMessage()) ); |
|
203 | + $URL->insert(array('id'=>$e->getMessage())); |
|
204 | 204 | } |
205 | 205 | # put the search term back in so highlighting works. |
206 | 206 | # NB: as we don't see the # part of the URL we lose this :( |
207 | - if ( $args['s'] !== '' ) { |
|
208 | - $URL->insert( array('s'=>$args['s']) ); |
|
207 | + if ($args['s'] !== '') { |
|
208 | + $URL->insert(array('s'=>$args['s'])); |
|
209 | 209 | } |
210 | 210 | redirect($URL->generate('none')); |
211 | 211 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if (array_key_exists('text_heading', $data['info'])) { |
280 | 280 | // avoid having Clause 1 etc as the alert text search string on PBC pages as it's |
281 | 281 | // almost certainly not what the person wants |
282 | - if ( $this->major == 6 ) { |
|
282 | + if ($this->major == 6) { |
|
283 | 283 | $data['email_alert_text'] = $data['section_title']; |
284 | 284 | } else { |
285 | 285 | $data['email_alert_text'] = $data['info']['text_heading']; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $body = preg_replace('#<phrase class="honfriend" id="uk.org.publicwhip/member/(\d+)" name="([^"]*?)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?m=$1" title="Our page on $2 - \'$3\'">$4</a>', $body); |
327 | 327 | $body = preg_replace('#<phrase class="honfriend" name="([^"]*?)" person_id="uk.org.publicwhip/person/(\d+)">(.*?\s*\((.*?)\))</phrase>#', '<a href="/mp/?p=$2" title="Our page on $1 - \'$3\'">$4</a>', $body); |
328 | 328 | $body = preg_replace_callback('#<phrase class="offrep" id="(.*?)/(\d+)-(\d+)-(\d+)\.(.*?)">(.*?)</phrase>#', function($matches) { |
329 | - return '<a href="/search/?pop=1&s=date:' . $matches[2] . $matches[3] . $matches[4] . '+column:' . $matches[5] . '+section:' . $matches[1] .'">' . str_replace("Official Report", "Hansard", $matches[6]) . '</a>'; |
|
329 | + return '<a href="/search/?pop=1&s=date:' . $matches[2] . $matches[3] . $matches[4] . '+column:' . $matches[5] . '+section:' . $matches[1] . '">' . str_replace("Official Report", "Hansard", $matches[6]) . '</a>'; |
|
330 | 330 | }, $body); |
331 | 331 | #$body = preg_replace('#<phrase class="offrep" id="((.*?)/(\d+)-(\d+)-(\d+)\.(.*?))">(.*?)</phrase>#e', "\"<a href='/search/?pop=1&s=date:$3$4$5+column:$6+section:$2&match=$1'>\" . str_replace('Official Report', 'Hansard', '$7') . '</a>'", $body); |
332 | 332 | $bodies[] = $body; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $data['section_title'] = ''; |
360 | 360 | $subsection_title = ''; |
361 | 361 | $rows = count($data['rows']); |
362 | - for ($i=0; $i<$rows; $i++) { |
|
362 | + for ($i = 0; $i < $rows; $i++) { |
|
363 | 363 | $row = $data['rows'][$i]; |
364 | 364 | $htype = $row['htype']; |
365 | 365 | // HPOS should be defined below if it's needed; otherwise default to 0 |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | # Voting links |
383 | 383 | $data['rows'][$i]['voting_data'] = ''; |
384 | 384 | if (isset($row['votes'])) { |
385 | - $data['rows'][$i]['voting_data'] = $this->generate_votes( $row['votes'], $row['epobject_id'], $row['gid'] ); |
|
385 | + $data['rows'][$i]['voting_data'] = $this->generate_votes($row['votes'], $row['epobject_id'], $row['gid']); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | # Annotation link |
@@ -423,52 +423,52 @@ discard block |
||
423 | 423 | |
424 | 424 | private function getCountryDetails() { |
425 | 425 | $details = array( |
426 | - 1 => array ( |
|
426 | + 1 => array( |
|
427 | 427 | 'country' => 'UK', |
428 | 428 | 'assembly' => 'uk-commons', |
429 | 429 | 'location' => '– in the House of Commons' |
430 | 430 | ), |
431 | - 2 => array ( |
|
431 | + 2 => array( |
|
432 | 432 | 'country' => 'UK', |
433 | 433 | 'assembly' => 'uk-commons', |
434 | 434 | 'location' => '– in Westminster Hall' |
435 | 435 | ), |
436 | - 3 => array ( |
|
436 | + 3 => array( |
|
437 | 437 | 'country' => 'UK', |
438 | 438 | 'assembly' => 'uk-commons', |
439 | 439 | 'location' => 'written question – answered' |
440 | 440 | ), |
441 | - 4 => array ( |
|
441 | + 4 => array( |
|
442 | 442 | 'country' => 'UK', |
443 | 443 | 'assembly' => 'uk-commons', |
444 | 444 | 'location' => 'written statement – made' |
445 | 445 | ), |
446 | - 5 => array ( |
|
446 | + 5 => array( |
|
447 | 447 | 'country' => 'NORTHERN IRELAND', |
448 | 448 | 'assembly' => 'ni', |
449 | 449 | 'location' => '– in the Northern Ireland Assembly' |
450 | 450 | ), |
451 | - 6 => array ( |
|
451 | + 6 => array( |
|
452 | 452 | 'country' => 'UK', |
453 | 453 | 'assembly' => 'uk-commons', |
454 | 454 | 'location' => '– in a Public Bill Committee' |
455 | 455 | ), |
456 | - 7 => array ( |
|
456 | + 7 => array( |
|
457 | 457 | 'country' => 'SCOTLAND', |
458 | 458 | 'assembly' => 'scotland', |
459 | 459 | 'location' => '– in the Scottish Parliament' |
460 | 460 | ), |
461 | - 8 => array ( |
|
461 | + 8 => array( |
|
462 | 462 | 'country' => 'SCOTLAND', |
463 | 463 | 'assembly' => 'scotland', |
464 | 464 | 'location' => '– Scottish Parliament written question – answered' |
465 | 465 | ), |
466 | - 9 => array ( |
|
466 | + 9 => array( |
|
467 | 467 | 'country' => 'LONDON', |
468 | 468 | 'assembly' => 'london-assembly', |
469 | 469 | 'location' => 'Questions to the Mayor of London – answered' |
470 | 470 | ), |
471 | - 101 => array ( |
|
471 | + 101 => array( |
|
472 | 472 | 'country' => 'UK', |
473 | 473 | 'assembly' => 'uk-lords', |
474 | 474 | 'location' => '– in the House of Lords' |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | global $DATA, $this_page; |
516 | 516 | $this_page = $this->page_base . 'front'; |
517 | 517 | $data = array(); |
518 | - if ( $this->index_template ) { |
|
518 | + if ($this->index_template) { |
|
519 | 519 | $data['template'] = $this->index_template; |
520 | 520 | } |
521 | 521 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | |
526 | 526 | $content['calendar'] = $class->display('calendar', array('months' => 1), 'none'); |
527 | 527 | |
528 | - if ( $rssurl = $DATA->page_metadata($this_page, 'rss') ) { |
|
528 | + if ($rssurl = $DATA->page_metadata($this_page, 'rss')) { |
|
529 | 529 | $content['rssurl'] = $rssurl; |
530 | 530 | } |
531 | 531 | |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | } |
541 | 541 | |
542 | 542 | //$totalcomments, $comment, $commenturl |
543 | - function generate_commentteaser ($row) { |
|
543 | + function generate_commentteaser($row) { |
|
544 | 544 | // Returns HTML for the one fragment of comment and link for the sidebar. |
545 | 545 | // $totalcomments is the number of comments this item has on it. |
546 | 546 | // $comment is an array like: |
@@ -53,7 +53,7 @@ |
||
53 | 53 | <text font-size="24" font-weight="normal" fill="#000000"> |
54 | 54 | <?php foreach ($lines as $j=>$line) { ?> |
55 | 55 | <tspan x="40" y="<?= $stance_y + $stance_padding_top + $stance_baseline_offset + ($stance_lineheight * $j) ?>"><?php |
56 | - if (strpos($line, '*') !== False) { |
|
56 | + if (strpos($line, '*') !== false) { |
|
57 | 57 | echo preg_replace( |
58 | 58 | '#(?:^|[*])([^\r\n *][^*\n]*[^\r\n *])(?:$|[*])#i', |
59 | 59 | $tspan_bold_open . '$1' . $tspan_bold_close, |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | echo '<?xml version="1.0" encoding="utf-8"?>'; |
31 | 31 | |
32 | - ?> |
|
32 | + ?> |
|
33 | 33 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> |
34 | 34 | <svg width="1000" height="500" viewBox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" font-family="Droid Sans, Trebuchet"> |
35 | 35 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $stances = array(); |
4 | 4 | |
5 | 5 | foreach ($segment['votes']->positions as $key_vote) { |
6 | - if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) { |
|
6 | + if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') { |
|
7 | 7 | $stance = strip_tags($key_vote['desc'], '<b>'); |
8 | 8 | $stance = ucfirst($stance); |
9 | 9 | $stance = preg_replace('#</?b[^>]*>#i', '*', $stance); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | </div> |
34 | 34 | <?php endif; ?> |
35 | 35 | |
36 | - <?php $displayed_votes = FALSE; ?> |
|
36 | + <?php $displayed_votes = false; ?> |
|
37 | 37 | <?php if ( isset($policydivisions) && $policydivisions ) { ?> |
38 | 38 | |
39 | 39 | <?php if ($has_voting_record) { ?> |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | |
87 | 87 | <ul class="vote-descriptions policy-votes"> |
88 | 88 | <?php |
89 | - $show_all = FALSE; |
|
89 | + $show_all = false; |
|
90 | 90 | if ( $policy['weak_count'] == 0 || $policy['weak_count'] == count($policy['divisions']) ) { |
91 | - $show_all = TRUE; |
|
91 | + $show_all = true; |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | <?php foreach ($policy['divisions'] as $division) { |
95 | 95 | include('_division_description.php'); |
96 | - $displayed_votes = TRUE; |
|
96 | + $displayed_votes = true; |
|
97 | 97 | } ?> |
98 | 98 | </ul> |
99 | 99 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | </div> |
16 | 16 | <div class="person-panels"> |
17 | 17 | <div class="sidebar__unit in-page-nav"> |
18 | - <?php if ( isset($policydivisions) && $policydivisions && count($policydivisions) == 1 ) { ?> |
|
18 | + <?php if (isset($policydivisions) && $policydivisions && count($policydivisions) == 1) { ?> |
|
19 | 19 | <p class="policy-votes-intro"> |
20 | 20 | How <?= $full_name ?> voted on <?= $policydivisions[array_keys($policydivisions)[0]]['desc'] ?>. |
21 | 21 | </p> |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | <?php endif; ?> |
35 | 35 | |
36 | 36 | <?php $displayed_votes = FALSE; ?> |
37 | - <?php if ( isset($policydivisions) && $policydivisions ) { ?> |
|
37 | + <?php if (isset($policydivisions) && $policydivisions) { ?> |
|
38 | 38 | |
39 | 39 | <?php if ($has_voting_record) { ?> |
40 | 40 | |
41 | 41 | <?php foreach ($policydivisions as $policy) { ?> |
42 | 42 | |
43 | - <?php if ( isset($policy['header']) ) { ?> |
|
43 | + <?php if (isset($policy['header'])) { ?> |
|
44 | 44 | <div class="panel policy-votes-hero" style="background-image: url('<?php echo $policy['header']['image']; ?>');"> |
45 | 45 | <h2><?php echo $policy['header']['title']; ?></h2> |
46 | 46 | <p><?php echo $policy['header']['description']; ?>.</p> |
47 | - <?php if ( $policy['header']['image_source'] ) { ?> |
|
47 | + <?php if ($policy['header']['image_source']) { ?> |
|
48 | 48 | <span class="policy-votes-hero__image-attribution"> |
49 | 49 | Photo: |
50 | 50 | <a href="<?php echo $policy['header']['image_source']; ?>"> |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | <?php } ?> |
60 | 60 | |
61 | 61 | |
62 | - <?php if ( isset($policy['position']) ) { ?> |
|
62 | + <?php if (isset($policy['position'])) { ?> |
|
63 | 63 | <div class="panel"> |
64 | - <?php if ( $policy['position']['has_strong'] ) { ?> |
|
64 | + <?php if ($policy['position']['has_strong']) { ?> |
|
65 | 65 | <h3 class="policy-vote-overall-stance"> |
66 | 66 | <?= $full_name . ' ' . $policy['position']['desc'] ?> |
67 | 67 | </h3> |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | <ul class="vote-descriptions policy-votes"> |
88 | 88 | <?php |
89 | 89 | $show_all = FALSE; |
90 | - if ( $policy['weak_count'] == 0 || $policy['weak_count'] == count($policy['divisions']) ) { |
|
90 | + if ($policy['weak_count'] == 0 || $policy['weak_count'] == count($policy['divisions'])) { |
|
91 | 91 | $show_all = TRUE; |
92 | 92 | } |
93 | 93 | ?> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | </ul> |
99 | 99 | |
100 | 100 | <div class="policy-votes-list-footer"> |
101 | - <?php if ( !$show_all && $policy['weak_count'] > 0 ) { ?> |
|
101 | + <?php if (!$show_all && $policy['weak_count'] > 0) { ?> |
|
102 | 102 | <p><button class="button secondary-button small js-show-all-votes">Show all votes, including <?= $policy['weak_count'] ?> less important <?= $policy['weak_count'] == 1 ? 'vote' : 'votes' ?></button></p> |
103 | 103 | <?php } ?> |
104 | 104 | <p class="voting-information-provenance"> |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | <script type="text/javascript"> |
112 | 112 | $(function(){ |
113 | - <?php if ( !$show_all ) { ?> |
|
113 | + <?php if (!$show_all) { ?> |
|
114 | 114 | $('#policy-votes-type').text('Key'); |
115 | 115 | <?php } ?> |
116 | 116 | $('.js-show-all-votes').on('click', function(){ |