@@ -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 |
@@ -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; |
@@ -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() { |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | } |
82 | 82 | $result = ''; |
83 | 83 | $nrows = count($row_data); |
84 | - $last_date = NULL; |
|
85 | - $first_difference_output = TRUE; |
|
84 | + $last_date = null; |
|
85 | + $first_difference_output = true; |
|
86 | 86 | // Keep the references until after the history that's in a timeline: |
87 | 87 | $references = array(); |
88 | 88 | for( $i = 0; $i < $nrows; $i++ ) { |
89 | 89 | $row = $row_data[$i]; |
90 | 90 | if( ! $row["date"] ) { |
91 | 91 | // If this mention isn't associated with a date, the difference won't be interesting. |
92 | - $last_date = NULL; |
|
92 | + $last_date = null; |
|
93 | 93 | } |
94 | 94 | $description = ''; |
95 | 95 | if ($last_date && ($last_date != $row["date"])) { |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | $daysstring = ($daysdiff == 1) ? "day" : "days"; |
99 | 99 | $further = ""; |
100 | 100 | if( $first_difference_output ) { |
101 | - $first_difference_output = FALSE; |
|
101 | + $first_difference_output = false; |
|
102 | 102 | } else { |
103 | 103 | $further = " a further"; |
104 | 104 | } |
105 | 105 | $description = "\n<span class=\"question-mention-gap\">After$further $daysdiff $daysstring,</span> "; |
106 | 106 | } |
107 | - $reference = FALSE; |
|
107 | + $reference = false; |
|
108 | 108 | $inner = "BUG: Unknown mention type $row[type]"; |
109 | 109 | $date = format_date($row['date'], SHORTDATEFORMAT); |
110 | 110 | $url = $row['url']; |
111 | - if ( strpos($url, 'business/businessBulletin') !== FALSE ) { |
|
111 | + if ( strpos($url, 'business/businessBulletin') !== false ) { |
|
112 | 112 | $url = str_replace('www.scottish', 'archive.scottish', $url); |
113 | 113 | } |
114 | 114 | switch ($row["type"]) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $URL->insert( array('spid' => $referencing_spid) ); |
148 | 148 | $relative_url = $URL->generate("none"); |
149 | 149 | $inner = "Referenced in <a href=\"$relative_url\">question $referencing_spid</a>"; |
150 | - $reference = TRUE; |
|
150 | + $reference = true; |
|
151 | 151 | } |
152 | 152 | break; |
153 | 153 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this_page = 'spwransfront'; |
22 | 22 | $data = array(); |
23 | 23 | |
24 | - $args = array( 'months' => 1 ); |
|
24 | + $args = array('months' => 1); |
|
25 | 25 | $WRANSLIST = new \SPWRANSLIST; |
26 | 26 | |
27 | 27 | $wrans = array(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | protected function getSearchSections() { |
45 | 45 | return array( |
46 | - array( 'section' => 'spwrans' ) |
|
46 | + array('section' => 'spwrans') |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
@@ -54,29 +54,29 @@ discard block |
||
54 | 54 | $SPWRANSLIST = new \SPWRANSLIST; |
55 | 55 | $gid = $SPWRANSLIST->get_gid_from_spid($spid); |
56 | 56 | if ($gid) { |
57 | - if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) { |
|
57 | + if (preg_match('/uk\.org\.publicwhip\/spwa\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) { |
|
58 | 58 | $URL = new \MySociety\TheyWorkForYou\Url('spwrans'); |
59 | 59 | $URL->reset(); |
60 | - $URL->insert( array('id' => $m[1]) ); |
|
60 | + $URL->insert(array('id' => $m[1])); |
|
61 | 61 | $fragment_identifier = '#g' . $m[2]; |
62 | 62 | header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303); |
63 | 63 | exit; |
64 | - } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/',$gid,$m)) { |
|
64 | + } elseif (preg_match('/uk\.org\.publicwhip\/spor\/(\d{4}-\d\d-\d\d\.(.*))/', $gid, $m)) { |
|
65 | 65 | $URL = new \MySociety\TheyWorkForYou\Url('spdebates'); |
66 | 66 | $URL->reset(); |
67 | - $URL->insert( array('id' => $m[1]) ); |
|
67 | + $URL->insert(array('id' => $m[1])); |
|
68 | 68 | $fragment_identifier = '#g' . $m[2]; |
69 | 69 | header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303); |
70 | 70 | exit; |
71 | 71 | } else { |
72 | - $PAGE->error_message ("Strange GID ($gid) for that Scottish Parliament ID."); |
|
72 | + $PAGE->error_message("Strange GID ($gid) for that Scottish Parliament ID."); |
|
73 | 73 | } |
74 | 74 | } |
75 | - $PAGE->error_message ("Couldn't match that Scottish Parliament ID to a GID."); |
|
75 | + $PAGE->error_message("Couldn't match that Scottish Parliament ID to a GID."); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | protected function get_question_mentions_html($row_data) { |
79 | - if( count($row_data) == 0 ) { |
|
79 | + if (count($row_data) == 0) { |
|
80 | 80 | return ''; |
81 | 81 | } |
82 | 82 | $result = ''; |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | $first_difference_output = TRUE; |
86 | 86 | // Keep the references until after the history that's in a timeline: |
87 | 87 | $references = array(); |
88 | - for( $i = 0; $i < $nrows; $i++ ) { |
|
88 | + for ($i = 0; $i < $nrows; $i++) { |
|
89 | 89 | $row = $row_data[$i]; |
90 | - if( ! $row["date"] ) { |
|
90 | + if (!$row["date"]) { |
|
91 | 91 | // If this mention isn't associated with a date, the difference won't be interesting. |
92 | 92 | $last_date = NULL; |
93 | 93 | } |
94 | 94 | $description = ''; |
95 | 95 | if ($last_date && ($last_date != $row["date"])) { |
96 | 96 | // Calculate how long the gap was in days: |
97 | - $daysdiff = (integer)((strtotime($row["date"]) - strtotime($last_date)) / 86400); |
|
97 | + $daysdiff = (integer) ((strtotime($row["date"]) - strtotime($last_date)) / 86400); |
|
98 | 98 | $daysstring = ($daysdiff == 1) ? "day" : "days"; |
99 | 99 | $further = ""; |
100 | - if( $first_difference_output ) { |
|
100 | + if ($first_difference_output) { |
|
101 | 101 | $first_difference_output = FALSE; |
102 | 102 | } else { |
103 | 103 | $further = " a further"; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $inner = "BUG: Unknown mention type $row[type]"; |
109 | 109 | $date = format_date($row['date'], SHORTDATEFORMAT); |
110 | 110 | $url = $row['url']; |
111 | - if ( strpos($url, 'business/businessBulletin') !== FALSE ) { |
|
111 | + if (strpos($url, 'business/businessBulletin') !== FALSE) { |
|
112 | 112 | $url = str_replace('www.scottish', 'archive.scottish', $url); |
113 | 113 | } |
114 | 114 | switch ($row["type"]) { |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | $inner = "Mentioned in <a class=\"debate-speech__meta__link\" href=\"$url\">tabled written questions on $date</a>"; |
123 | 123 | break; |
124 | 124 | case 4: |
125 | - if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['gid'],$m) ) { |
|
125 | + if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['gid'], $m)) { |
|
126 | 126 | $URL = new \MySociety\TheyWorkForYou\Url("spwrans"); |
127 | - $URL->insert( array('spid' => $m[1]) ); |
|
127 | + $URL->insert(array('spid' => $m[1])); |
|
128 | 128 | $relative_url = $URL->generate("none"); |
129 | 129 | $inner = "Given a <a class=\"debate-speech__meta__link\" href=\"$relative_url\">written answer on $date</a>"; |
130 | 130 | } |
@@ -133,25 +133,25 @@ discard block |
||
133 | 133 | $inner = "Given a holding answer on $date"; |
134 | 134 | break; |
135 | 135 | case 6: |
136 | - if( preg_match('/^uk.org.publicwhip\/spor\/(.*)$/',$row['mentioned_gid'],$m) ) { |
|
136 | + if (preg_match('/^uk.org.publicwhip\/spor\/(.*)$/', $row['mentioned_gid'], $m)) { |
|
137 | 137 | $URL = new \MySociety\TheyWorkForYou\Url("spdebates"); |
138 | - $URL->insert( array('id' => $m[1]) ); |
|
138 | + $URL->insert(array('id' => $m[1])); |
|
139 | 139 | $relative_url = $URL->generate("none"); |
140 | 140 | $inner = "<a href=\"$relative_url\">Asked in parliament on $date</a>"; |
141 | 141 | } |
142 | 142 | break; |
143 | 143 | case 7: |
144 | - if( preg_match('/^uk.org.publicwhip\/spq\/(.*)$/',$row['mentioned_gid'],$m) ) { |
|
144 | + if (preg_match('/^uk.org.publicwhip\/spq\/(.*)$/', $row['mentioned_gid'], $m)) { |
|
145 | 145 | $referencing_spid = $m[1]; |
146 | 146 | $URL = new \MySociety\TheyWorkForYou\Url("spwrans"); |
147 | - $URL->insert( array('spid' => $referencing_spid) ); |
|
147 | + $URL->insert(array('spid' => $referencing_spid)); |
|
148 | 148 | $relative_url = $URL->generate("none"); |
149 | 149 | $inner = "Referenced in <a href=\"$relative_url\">question $referencing_spid</a>"; |
150 | 150 | $reference = TRUE; |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | } |
154 | - if( $reference ) { |
|
154 | + if ($reference) { |
|
155 | 155 | $references[] = "\n<li>$inner."; |
156 | 156 | } else { |
157 | 157 | $result .= "\n<li class=\"link-to-hansard\">$description$inner</span>"; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $data = array(); |
44 | 44 | $urls = array(); |
45 | 45 | |
46 | - $data['popular_searches'] = NULL; |
|
46 | + $data['popular_searches'] = null; |
|
47 | 47 | |
48 | 48 | |
49 | 49 | $data['urls'] = $this->getURLs($data); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $MOREURL->insert( array( 'more' => 1 ) ); |
56 | 56 | |
57 | 57 | // this makes sure that we don't repeat this debate in the list below |
58 | - $random_debate = NULL; |
|
58 | + $random_debate = null; |
|
59 | 59 | if ( isset($debates['data']) && count($debates['data']) ) { |
60 | 60 | $random_debate = $debates['data'][0]; |
61 | 61 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | protected function getSearchSections() { |
34 | 34 | return array( |
35 | - array( 'section' => 'ni' ) |
|
35 | + array('section' => 'ni') |
|
36 | 36 | ); |
37 | 37 | } |
38 | 38 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none'); |
54 | 54 | $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront'); |
55 | - $MOREURL->insert( array( 'more' => 1 ) ); |
|
55 | + $MOREURL->insert(array('more' => 1)); |
|
56 | 56 | |
57 | 57 | // this makes sure that we don't repeat this debate in the list below |
58 | 58 | $random_debate = NULL; |
59 | - if ( isset($debates['data']) && count($debates['data']) ) { |
|
59 | + if (isset($debates['data']) && count($debates['data'])) { |
|
60 | 60 | $random_debate = $debates['data'][0]; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $recent = array(); |
64 | - if ( isset($debates['data']) && count($debates['data']) ) { |
|
64 | + if (isset($debates['data']) && count($debates['data'])) { |
|
65 | 65 | // at the start of a session there may be less than 6 |
66 | 66 | // debates |
67 | 67 | $max = 6; |
68 | - if ( count($debates['data']) < 6 ) { |
|
68 | + if (count($debates['data']) < 6) { |
|
69 | 69 | $max = count($debates['data']); |
70 | 70 | } |
71 | - for ( $i = 1; $i < $max; $i++ ) { |
|
71 | + for ($i = 1; $i < $max; $i++) { |
|
72 | 72 | $debate = $debates['data'][$i]; |
73 | 73 | $debate['desc'] = "Northern Ireland Assembly debates"; |
74 | 74 | $debate['more_url'] = $MOREURL->generate(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | $featured = array(); |
80 | - if ( $random_debate ) { |
|
80 | + if ($random_debate) { |
|
81 | 81 | $featured = $random_debate; |
82 | 82 | $featured['more_url'] = $MOREURL->generate(); |
83 | 83 | $featured['desc'] = 'Northern Ireland Assembly debate'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $data['featured'] = $featured; |
89 | - $data['debates'] = array( 'recent' => $recent); |
|
89 | + $data['debates'] = array('recent' => $recent); |
|
90 | 90 | |
91 | 91 | $data['regional'] = $this->getMLAList(); |
92 | 92 | $data['template'] = 'ni/index'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $data['postcode'] = $this->user->postcode_is_set() ? $this->user->postcode() : ''; |
33 | 33 | |
34 | 34 | if ( $this->isEmailSignedUpForPostCode( $data['email'], $data['postcode'] ) ) { |
35 | - $data['already_signed_up'] = True; |
|
35 | + $data['already_signed_up'] = true; |
|
36 | 36 | $mp = $this->getPersonFromPostcode($data['postcode']); |
37 | 37 | $data['mp_name'] = $mp->full_name(); |
38 | 38 | } |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | |
68 | 68 | private function createAlertForPostCode($email, $postcode) { |
69 | 69 | if ( !$this->validateDetails($email, $postcode) ) { |
70 | - return array('invalid-postcode-or-email' => True); |
|
70 | + return array('invalid-postcode-or-email' => true); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | try { |
74 | 74 | $person = $this->getPersonFromPostcode($postcode); |
75 | 75 | } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
76 | - return array('bad-constituency' => True); |
|
76 | + return array('bad-constituency' => true); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $details = array( |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | // no logged in user so send them an email to let them |
94 | 94 | // know someone tried to create an alert |
95 | 95 | $this->alert->send_already_signedup_email($details); |
96 | - $data['confirmation_sent'] = True; |
|
96 | + $data['confirmation_sent'] = true; |
|
97 | 97 | } else { |
98 | - $data['already_signed_up'] = True; |
|
98 | + $data['already_signed_up'] = true; |
|
99 | 99 | } |
100 | 100 | break; |
101 | 101 | case self::CREATE_FAILED: |
102 | - $data['error'] = True; |
|
102 | + $data['error'] = true; |
|
103 | 103 | break; |
104 | 104 | default: // alert created |
105 | 105 | if ( $not_logged_in ) { |
106 | - $data['confirmation_sent'] = True; |
|
106 | + $data['confirmation_sent'] = true; |
|
107 | 107 | } else { |
108 | - $data['signedup_no_confirm'] = True; |
|
108 | + $data['signedup_no_confirm'] = true; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | $this->alert->delete($q->field($i, 'alert_id') . '::' . $q->field($i ,'registrationtoken')); |
149 | - $this->alert->add($details, False); |
|
149 | + $this->alert->add($details, false); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return array( |
153 | - 'signedup_no_confirm' => True, |
|
153 | + 'signedup_no_confirm' => true, |
|
154 | 154 | 'new_mp' => $new_mp->full_name(), |
155 | 155 | ); |
156 | 156 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | if ( $this->alert->fetch_by_mp( $existing['email'], $new_mp->person_id) ) { |
185 | 185 | $data = array( |
186 | - 'already_signed_up' => True, |
|
186 | + 'already_signed_up' => true, |
|
187 | 187 | 'old_mp' => $old_mp->full_name(), |
188 | 188 | 'mp_name' => $new_mp->full_name(), |
189 | 189 | ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | ); |
195 | 195 | } |
196 | 196 | |
197 | - $data['update'] = True; |
|
197 | + $data['update'] = true; |
|
198 | 198 | $data['confirmation'] = $confirmation; |
199 | 199 | |
200 | 200 | return $data; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | public function display() { |
8 | 8 | $data = array(); |
9 | 9 | $data['recent_election'] = false; |
10 | - if ( $this->user->loggedin() ) { |
|
10 | + if ($this->user->loggedin()) { |
|
11 | 11 | $data['user_signed_in'] = true; |
12 | 12 | } |
13 | 13 | |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | $data['postcode'] = get_http_var('postcode'); |
18 | 18 | |
19 | 19 | $result = $this->createAlertForPostCode($data['email'], $data['postcode']); |
20 | - $data = array_merge( $data, $result ); |
|
20 | + $data = array_merge($data, $result); |
|
21 | 21 | } elseif (get_http_var('update')) { |
22 | 22 | $result = $this->getNewMP(get_http_var('update')); |
23 | - $data = array_merge( $data, $result ); |
|
23 | + $data = array_merge($data, $result); |
|
24 | 24 | } elseif (get_http_var('update-alert')) { |
25 | - $success = $this->replaceAlert( get_http_var('confirmation') ); |
|
25 | + $success = $this->replaceAlert(get_http_var('confirmation')); |
|
26 | 26 | $data['confirmation_received'] = $success; |
27 | 27 | } elseif (get_http_var('confirmed')) { |
28 | - $success = $this->confirmAlert( get_http_var('confirmed') ); |
|
28 | + $success = $this->confirmAlert(get_http_var('confirmed')); |
|
29 | 29 | $data['confirmation_received'] = $success; |
30 | 30 | } else { |
31 | 31 | $data['email'] = $this->user->email() ? $this->user->email() : ''; |
32 | 32 | $data['postcode'] = $this->user->postcode_is_set() ? $this->user->postcode() : ''; |
33 | 33 | |
34 | - if ( $this->isEmailSignedUpForPostCode( $data['email'], $data['postcode'] ) ) { |
|
34 | + if ($this->isEmailSignedUpForPostCode($data['email'], $data['postcode'])) { |
|
35 | 35 | $data['already_signed_up'] = True; |
36 | 36 | $mp = $this->getPersonFromPostcode($data['postcode']); |
37 | 37 | $data['mp_name'] = $mp->full_name(); |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | private function createAlertForPostCode($email, $postcode) { |
69 | - if ( !$this->validateDetails($email, $postcode) ) { |
|
69 | + if (!$this->validateDetails($email, $postcode)) { |
|
70 | 70 | return array('invalid-postcode-or-email' => True); |
71 | 71 | } |
72 | 72 | |
73 | 73 | try { |
74 | 74 | $person = $this->getPersonFromPostcode($postcode); |
75 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
75 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
76 | 76 | return array('bad-constituency' => True); |
77 | 77 | } |
78 | 78 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | switch ($result) { |
91 | 91 | case self::ALERT_EXISTS: |
92 | - if ( $not_logged_in ) { |
|
92 | + if ($not_logged_in) { |
|
93 | 93 | // no logged in user so send them an email to let them |
94 | 94 | // know someone tried to create an alert |
95 | 95 | $this->alert->send_already_signedup_email($details); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $data['error'] = True; |
103 | 103 | break; |
104 | 104 | default: // alert created |
105 | - if ( $not_logged_in ) { |
|
105 | + if ($not_logged_in) { |
|
106 | 106 | $data['confirmation_sent'] = True; |
107 | 107 | } else { |
108 | 108 | $data['signedup_no_confirm'] = True; |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | $existing = $this->alert->fetch_by_token($confirmation); |
117 | 117 | preg_match('/speaker:(\d+)/', $existing['criteria'], $matches); |
118 | 118 | $old_mp_id = $matches[1]; |
119 | - $old_mp = new \MySociety\TheyWorkForYou\Member(array( 'person_id' => $old_mp_id ) ); |
|
120 | - $new_mp = new \MySociety\TheyWorkForYou\Member(array( 'constituency' => $old_mp->constituency, 'house' => 1 )); |
|
119 | + $old_mp = new \MySociety\TheyWorkForYou\Member(array('person_id' => $old_mp_id)); |
|
120 | + $new_mp = new \MySociety\TheyWorkForYou\Member(array('constituency' => $old_mp->constituency, 'house' => 1)); |
|
121 | 121 | |
122 | 122 | $q = $this->db->query( |
123 | 123 | "SELECT alert_id, criteria, registrationtoken FROM alerts |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | ) |
132 | 132 | ); |
133 | 133 | |
134 | - for ( $i = 0; $i < $q->rows; $i++ ) { |
|
134 | + for ($i = 0; $i < $q->rows; $i++) { |
|
135 | 135 | // need to reset this otherwise delete does not work |
136 | 136 | $this->alert->token_checked = null; |
137 | 137 | $other_criteria = trim(preg_replace('/speaker:\d+/', '', $q->field($i, 'criteria'))); |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | 'pid' => $new_mp->person_id, |
142 | 142 | 'pc' => '', |
143 | 143 | ); |
144 | - if ( $other_criteria ) { |
|
144 | + if ($other_criteria) { |
|
145 | 145 | $details['keyword'] = $other_criteria; |
146 | 146 | } |
147 | 147 | |
148 | - $this->alert->delete($q->field($i, 'alert_id') . '::' . $q->field($i ,'registrationtoken')); |
|
148 | + $this->alert->delete($q->field($i, 'alert_id') . '::' . $q->field($i, 'registrationtoken')); |
|
149 | 149 | $this->alert->add($details, False); |
150 | 150 | } |
151 | 151 | |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | private function isEmailSignedUpForPostCode($email, $postcode) { |
159 | 159 | $is_signed_up = false; |
160 | 160 | |
161 | - if ( $email && $postcode ) { |
|
161 | + if ($email && $postcode) { |
|
162 | 162 | try { |
163 | 163 | $person = $this->getPersonFromPostcode($postcode); |
164 | 164 | $is_signed_up = $this->alert->fetch_by_mp($email, $person->person_id); |
165 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
165 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
166 | 166 | $is_signed_up = false; |
167 | 167 | } |
168 | 168 | } |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | preg_match('/speaker:(\d+)/', $existing['criteria'], $matches); |
179 | 179 | $criteria = $matches[1]; |
180 | 180 | |
181 | - $old_mp = new \MySociety\TheyWorkForYou\Member(array( 'person_id' => $criteria ) ); |
|
182 | - $new_mp = new \MySociety\TheyWorkForYou\Member(array( 'constituency' => $old_mp->constituency, 'house' => 1 )); |
|
181 | + $old_mp = new \MySociety\TheyWorkForYou\Member(array('person_id' => $criteria)); |
|
182 | + $new_mp = new \MySociety\TheyWorkForYou\Member(array('constituency' => $old_mp->constituency, 'house' => 1)); |
|
183 | 183 | |
184 | - if ( $this->alert->fetch_by_mp( $existing['email'], $new_mp->person_id) ) { |
|
184 | + if ($this->alert->fetch_by_mp($existing['email'], $new_mp->person_id)) { |
|
185 | 185 | $data = array( |
186 | 186 | 'already_signed_up' => True, |
187 | 187 | 'old_mp' => $old_mp->full_name(), |
@@ -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 | ?> |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | |
100 | 100 | <div class="policy-votes-list-footer"> |
101 | 101 | <p class="policy-votes__byline">Vote information from <a href="http://www.publicwhip.org.uk/mp.php?mpid=<?= $member_id ?>&dmp=<?= $policy['policy_id'] ?>">PublicWhip</a>. Last updated: <?= $policy_last_update[$policy['policy_id']] ?></p> |
102 | - <?php if ( !$show_all && $policy['weak_count'] > 0 ) { ?> |
|
102 | + <?php if (!$show_all && $policy['weak_count'] > 0) { ?> |
|
103 | 103 | <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> |
104 | 104 | <?php } ?> |
105 | 105 | </div> |
106 | 106 | |
107 | 107 | <script type="text/javascript"> |
108 | 108 | $(function(){ |
109 | - <?php if ( !$show_all ) { ?> |
|
109 | + <?php if (!$show_all) { ?> |
|
110 | 110 | $('#policy-votes-type').text('Key'); |
111 | 111 | <?php } ?> |
112 | 112 | $('.js-show-all-votes').on('click', function(){ |
@@ -24,7 +24,7 @@ |
||
24 | 24 | </form> |
25 | 25 | </div> |
26 | 26 | <!-- TheyWorkForYou box, end --> |
27 | -END; |
|
27 | +end; |
|
28 | 28 | print $link_to_us_form; |
29 | 29 | ?> |
30 | 30 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | <div class="row nested-row"> |
42 | 42 | <div class="homepage-in-the-news homepage-content-section"> |
43 | 43 | <?php if ( $featured ) { |
44 | - include dirname(__FILE__) . "/../homepage/featured.php"; |
|
44 | + include dirname(__FILE__) . "/../homepage/featured.php"; |
|
45 | 45 | } ?> |
46 | 46 | </div> |
47 | 47 | <div class="homepage-create-alert homepage-content-section"> |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | </div> |
12 | 12 | <div class="row"> |
13 | 13 | <div class="medium-9 columns"> |
14 | - <?php if ( count($data['regional']) > 0 ) { ?> |
|
14 | + <?php if (count($data['regional']) > 0) { ?> |
|
15 | 15 | <ul class="homepage-rep-list"> |
16 | 16 | <li>Your Regional MSPs:</li> |
17 | - <?php foreach ( $data['regional'] as $msp ) { ?> |
|
17 | + <?php foreach ($data['regional'] as $msp) { ?> |
|
18 | 18 | <li class="homepage-rep-list__rep"><a href="/msp/?p=<?= $msp['person_id'] ?>"><?= $msp['name'] ?></a></li> |
19 | 19 | <?php } ?> |
20 | 20 | </ul> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | <div class="panel panel--flushtop clearfix"> |
58 | 58 | <div class="row nested-row"> |
59 | 59 | <div class="homepage-in-the-news homepage-content-section"> |
60 | - <?php if ( $featured ) { |
|
60 | + <?php if ($featured) { |
|
61 | 61 | include dirname(__FILE__) . "/../homepage/featured.php"; |
62 | 62 | } ?> |
63 | 63 | </div> |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | <div class="homepage-recently homepage-content-section"> |
103 | 103 | <h2>Recently in Parliament</h2> |
104 | 104 | <ul class="recently__list"><?php |
105 | - foreach ( $debates['recent'] as $recent ) { |
|
105 | + foreach ($debates['recent'] as $recent) { |
|
106 | 106 | include dirname(__FILE__) . '/../homepage/recent-debates.php'; |
107 | 107 | } |
108 | 108 | ?></ul> |