@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $user = new Renderer\User(); |
44 | 44 | $data = array_merge($user->data, $data); |
45 | 45 | |
46 | - if ( isset($page_errors) ) { |
|
46 | + if (isset($page_errors)) { |
|
47 | 47 | $data['page_errors'] = $page_errors; |
48 | 48 | } |
49 | 49 | |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | |
96 | 96 | private static function addCommonURLs($data) { |
97 | 97 | $urls = array(); |
98 | - if ( isset($data['urls']) ) { |
|
98 | + if (isset($data['urls'])) { |
|
99 | 99 | $urls = $data['urls']; |
100 | 100 | } |
101 | 101 | |
102 | 102 | $common_urls = array('search', 'alert'); |
103 | 103 | |
104 | - foreach ( $common_urls as $path ) { |
|
105 | - if (!isset($urls[$path]) ) { |
|
104 | + foreach ($common_urls as $path) { |
|
105 | + if (!isset($urls[$path])) { |
|
106 | 106 | $url = new Url($path); |
107 | 107 | $urls[$path] = $url->generate(); |
108 | 108 | } |
@@ -84,13 +84,13 @@ |
||
84 | 84 | // Require the templates and output |
85 | 85 | |
86 | 86 | if ($template_only) { |
87 | - require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php'; |
|
87 | + require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php'; |
|
88 | 88 | } else { |
89 | - header('Content-Type: text/html; charset=utf-8'); |
|
90 | - require_once INCLUDESPATH . 'easyparliament/templates/html/header.php'; |
|
91 | - require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php'; |
|
92 | - require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php'; |
|
93 | - exit; |
|
89 | + header('Content-Type: text/html; charset=utf-8'); |
|
90 | + require_once INCLUDESPATH . 'easyparliament/templates/html/header.php'; |
|
91 | + require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php'; |
|
92 | + require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php'; |
|
93 | + exit; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | if ($pc) { |
22 | 22 | # current will have WMC key. If Scottish, has SPC and SPE too. If NI, has NIE. |
23 | 23 | $mapit = mapit_call('postcode', $pc); |
24 | - if (is_object($mapit)) { # RABX error returns an object |
|
24 | + if (is_object($mapit)) { |
|
25 | +# RABX error returns an object |
|
25 | 26 | print '<p class="error">Afraid we couldn’t find that postcode.</p>'; |
26 | 27 | $pc = ''; |
27 | 28 | } |
@@ -134,8 +135,11 @@ discard block |
||
134 | 135 | <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php |
135 | 136 | foreach ($mreg as $k => $n) { |
136 | 137 | print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>"; |
137 | - if ($k < count($mreg)-2) print ', '; |
|
138 | - elseif ($k == count($mreg)-2) print ' and '; |
|
138 | + if ($k < count($mreg)-2) { |
|
139 | + print ', '; |
|
140 | + } elseif ($k == count($mreg)-2) { |
|
141 | + print ' and '; |
|
142 | + } |
|
139 | 143 | } |
140 | 144 | echo '.</li>'; |
141 | 145 | } elseif ($country == 'N') { |
@@ -134,8 +134,8 @@ |
||
134 | 134 | <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php |
135 | 135 | foreach ($mreg as $k => $n) { |
136 | 136 | print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>"; |
137 | - if ($k < count($mreg)-2) print ', '; |
|
138 | - elseif ($k == count($mreg)-2) print ' and '; |
|
137 | + if ($k < count($mreg) - 2) print ', '; |
|
138 | + elseif ($k == count($mreg) - 2) print ' and '; |
|
139 | 139 | } |
140 | 140 | echo '.</li>'; |
141 | 141 | } elseif ($country == 'N') { |
@@ -148,10 +148,10 @@ |
||
148 | 148 | <p class="meta"><?php |
149 | 149 | $meta_items = array(); |
150 | 150 | $meta_items[] = $events[$i]['debate_type']; |
151 | - if( isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00' ){ |
|
151 | + if( isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00' ) { |
|
152 | 152 | $times = format_time($events[$i]['time_start'], 'g:i a'); |
153 | 153 | |
154 | - if( isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00' ){ |
|
154 | + if( isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00' ) { |
|
155 | 155 | $times = $times . ' - ' . format_time($events[$i]['time_end'], 'g:i a'); |
156 | 156 | } |
157 | 157 | $meta_items[] = $times; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | <div class="panel panel--flushtop clearfix"> |
46 | 46 | <div class="row nested-row"> |
47 | 47 | <div class="homepage-in-the-news homepage-content-section"> |
48 | - <?php if ( count($featured) > 0 ) { |
|
48 | + <?php if (count($featured) > 0) { |
|
49 | 49 | include 'homepage/featured.php'; |
50 | 50 | } else { ?> |
51 | 51 | No debates found. |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | |
111 | 111 | <h2>Recently in Parliament</h2> |
112 | 112 | <ul class="recently__list"><?php |
113 | - foreach ( $debates['recent'] as $recent ) { |
|
113 | + foreach ($debates['recent'] as $recent) { |
|
114 | 114 | include 'homepage/recent-debates.php'; |
115 | 115 | } |
116 | 116 | ?></ul> |
117 | 117 | </div> |
118 | 118 | <div class="homepage-upcoming homepage-content-section"> |
119 | 119 | <h2>Upcoming</h2> |
120 | - <?php if ( count($calendar) ) { ?> |
|
120 | + <?php if (count($calendar)) { ?> |
|
121 | 121 | <div class="upcoming__controls"> |
122 | 122 | <!-- |
123 | 123 | These controls should make the upcoming section slide to the next day. |
@@ -136,24 +136,24 @@ discard block |
||
136 | 136 | </div> |
137 | 137 | </div> |
138 | 138 | <?php $first = true; $count = 0; |
139 | - foreach ( $calendar as $date => $places ) { |
|
139 | + foreach ($calendar as $date => $places) { |
|
140 | 140 | $count++; ?> |
141 | 141 | <div class="cal-wrapper <?= $first ? 'visible' : 'hidden' ?>" id="day-<?= $count ?>" data-count="<?= $count ?>" data-date="<?= format_date($date, SHORTDATEFORMAT); ?>"> |
142 | 142 | <?php foreach ($places as $place => $events) { ?> |
143 | 143 | <?php $first = false; ?> |
144 | 144 | <h3><?= $place ?></h3> |
145 | 145 | <ul class="upcoming__list"> |
146 | - <?php for ( $i = 0; $i < 3; $i++ ) { |
|
147 | - if ( isset( $events[$i] ) ) { ?> |
|
146 | + <?php for ($i = 0; $i < 3; $i++) { |
|
147 | + if (isset($events[$i])) { ?> |
|
148 | 148 | <li> |
149 | 149 | <h4 class="upcoming__title"><a href="<?= $events[$i]['link_external'] ?>"><?= $events[$i]['title'] ?></a></h4> |
150 | 150 | <p class="meta"><?php |
151 | 151 | $meta_items = array(); |
152 | 152 | $meta_items[] = $events[$i]['debate_type']; |
153 | - if( isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00' ){ |
|
153 | + if (isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00') { |
|
154 | 154 | $times = format_time($events[$i]['time_start'], 'g:i a'); |
155 | 155 | |
156 | - if( isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00' ){ |
|
156 | + if (isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00') { |
|
157 | 157 | $times = $times . ' - ' . format_time($events[$i]['time_end'], 'g:i a'); |
158 | 158 | } |
159 | 159 | $meta_items[] = $times; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <?php } ?> |
166 | 166 | <?php } ?> |
167 | 167 | </ul> |
168 | - <?php if ( count($events) - 3 > 0 ) { ?> |
|
168 | + <?php if (count($events) - 3 > 0) { ?> |
|
169 | 169 | <a href="/calendar/?d=<?= format_date($date, 'Y-m-d') ?>" class="upcoming__more">And <?= count($events) - 3 ?> more</a><!-- (just links to relevant upcoming page) --> |
170 | 170 | <?php } ?> |
171 | 171 | <?php } ?> |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | <?php } ?> |
174 | 174 | <?php } else { |
175 | 175 | list($recess, $from, $to) = recess_prettify(date('j'), date('n'), date('Y'), 1); |
176 | - if ( $recess ) { ?> |
|
176 | + if ($recess) { ?> |
|
177 | 177 | <p> |
178 | 178 | Parliament is on holiday until <?= format_date($to, LONGERDATEFORMAT) ?>. |
179 | 179 | Follow us on <a href="https://twitter.com/theyworkforyou">Twitter</a> and you'll |
@@ -99,8 +99,9 @@ discard block |
||
99 | 99 | |
100 | 100 | # See if already matched a string this one is contained within |
101 | 101 | foreach ($matched as $got) { |
102 | - if (strstr($got, $phrase)) |
|
103 | - continue 2; |
|
102 | + if (strstr($got, $phrase)) { |
|
103 | + continue 2; |
|
104 | + } |
|
104 | 105 | } |
105 | 106 | |
106 | 107 | twfy_debug("WIKIPEDIA", "Matched '$phrase'"); |
@@ -119,8 +120,9 @@ discard block |
||
119 | 120 | array_push($matched, $phrase); |
120 | 121 | } |
121 | 122 | |
122 | - if (!$was_array) |
|
123 | - $source = join('|||', $source); |
|
123 | + if (!$was_array) { |
|
124 | + $source = join('|||', $source); |
|
125 | + } |
|
124 | 126 | |
125 | 127 | return $source; |
126 | 128 | |
@@ -148,28 +150,26 @@ discard block |
||
148 | 150 | { |
149 | 151 | $nextopen = strpos( $content, '<', $walker ); |
150 | 152 | $nextclose = strpos( $content, '>', $walker ); |
151 | - if( $nextclose === false ) |
|
152 | - { // ERROR! Open waka without close waka! |
|
153 | + if( $nextclose === false ) { |
|
154 | +// ERROR! Open waka without close waka! |
|
153 | 155 | // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
154 | 156 | return $content; |
155 | 157 | } |
156 | - if( $nextopen === false || $nextopen > $nextclose ) |
|
157 | - { // No more opens, but there was a close; or, a close happens before the next open. |
|
158 | + if( $nextopen === false || $nextopen > $nextclose ) { |
|
159 | +// No more opens, but there was a close; or, a close happens before the next open. |
|
158 | 160 | // walker goes to the close+1, and open decrements |
159 | 161 | $open --; |
160 | 162 | $walker = $nextclose + 1; |
161 | - } |
|
162 | - elseif( $nextopen < $nextclose ) |
|
163 | - { // an open before the next close |
|
163 | + } elseif( $nextopen < $nextclose ) { |
|
164 | +// an open before the next close |
|
164 | 165 | $open ++; |
165 | 166 | $walker = $nextopen + 1; |
166 | 167 | } |
167 | 168 | } |
168 | 169 | $tagend = $walker; |
169 | - if( $tagend > strlen( $content ) ) |
|
170 | - $tagend = strlen( $content ); |
|
171 | - else |
|
172 | - { |
|
170 | + if( $tagend > strlen( $content ) ) { |
|
171 | + $tagend = strlen( $content ); |
|
172 | + } else { |
|
173 | 173 | $tagend --; |
174 | 174 | $tagstart ++; |
175 | 175 | } |
@@ -136,61 +136,61 @@ |
||
136 | 136 | |
137 | 137 | public static function antiTagInTag($content = '', $format = 'htmlhead') |
138 | 138 | { |
139 | - $tagend = -1; |
|
140 | - for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
139 | + $tagend = -1; |
|
140 | + for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
141 | 141 | { |
142 | - // got the start of a tag. Now find the proper end! |
|
143 | - $walker = $tagstart + 1; |
|
144 | - $open = 1; |
|
145 | - while( $open != 0 && $walker < strlen( $content ) ) |
|
142 | + // got the start of a tag. Now find the proper end! |
|
143 | + $walker = $tagstart + 1; |
|
144 | + $open = 1; |
|
145 | + while( $open != 0 && $walker < strlen( $content ) ) |
|
146 | 146 | { |
147 | - $nextopen = strpos( $content, '<', $walker ); |
|
148 | - $nextclose = strpos( $content, '>', $walker ); |
|
149 | - if( $nextclose === false ) |
|
147 | + $nextopen = strpos( $content, '<', $walker ); |
|
148 | + $nextclose = strpos( $content, '>', $walker ); |
|
149 | + if( $nextclose === false ) |
|
150 | 150 | { // ERROR! Open waka without close waka! |
151 | - // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
|
152 | - return $content; |
|
151 | + // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
|
152 | + return $content; |
|
153 | 153 | } |
154 | - if( $nextopen === false || $nextopen > $nextclose ) |
|
154 | + if( $nextopen === false || $nextopen > $nextclose ) |
|
155 | 155 | { // No more opens, but there was a close; or, a close happens before the next open. |
156 | - // walker goes to the close+1, and open decrements |
|
157 | - $open --; |
|
158 | - $walker = $nextclose + 1; |
|
156 | + // walker goes to the close+1, and open decrements |
|
157 | + $open --; |
|
158 | + $walker = $nextclose + 1; |
|
159 | 159 | } |
160 | - elseif( $nextopen < $nextclose ) |
|
160 | + elseif( $nextopen < $nextclose ) |
|
161 | 161 | { // an open before the next close |
162 | - $open ++; |
|
163 | - $walker = $nextopen + 1; |
|
162 | + $open ++; |
|
163 | + $walker = $nextopen + 1; |
|
164 | 164 | } |
165 | 165 | } |
166 | - $tagend = $walker; |
|
167 | - if( $tagend > strlen( $content ) ) |
|
166 | + $tagend = $walker; |
|
167 | + if( $tagend > strlen( $content ) ) |
|
168 | 168 | $tagend = strlen( $content ); |
169 | - else |
|
169 | + else |
|
170 | 170 | { |
171 | - $tagend --; |
|
172 | - $tagstart ++; |
|
171 | + $tagend --; |
|
172 | + $tagstart ++; |
|
173 | 173 | } |
174 | - $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
175 | - $tags[] = '<' . $tag . '>'; |
|
174 | + $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
175 | + $tags[] = '<' . $tag . '>'; |
|
176 | 176 | |
177 | - if (function_exists('format_to_output')) { |
|
177 | + if (function_exists('format_to_output')) { |
|
178 | 178 | $newtag = format_to_output($tag, $format); |
179 | - } else { |
|
179 | + } else { |
|
180 | 180 | $newtag = strip_tags($tag); |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | - $newtags[] = '<' . $newtag . '>'; |
|
183 | + $newtags[] = '<' . $newtag . '>'; |
|
184 | 184 | |
185 | - if (function_exists('format_to_output')) { |
|
185 | + if (function_exists('format_to_output')) { |
|
186 | 186 | $newtag = format_to_output($tag, $format); |
187 | - } else { |
|
187 | + } else { |
|
188 | 188 | $newtag = strip_tags($tag); |
189 | - } |
|
189 | + } |
|
190 | + } |
|
191 | + if (isset($tags)&&isset($newtags)) { |
|
192 | + $content = str_replace($tags, $newtags, $content); |
|
190 | 193 | } |
191 | - if (isset($tags)&&isset($newtags)) { |
|
192 | - $content = str_replace($tags, $newtags, $content); |
|
193 | - } |
|
194 | 194 | |
195 | 195 | return $content; |
196 | 196 |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | twfy_debug("WIKIPEDIA", "Matched '$phrase'"); |
107 | 107 | # 1 means only replace one match for phrase per paragraph |
108 | - $source = preg_replace ('{ |
|
108 | + $source = preg_replace('{ |
|
109 | 109 | \b(' . $phrase_re . ')\b # Match the phrase itself |
110 | 110 | (?! # Match as long as the following does *not* apply: |
111 | 111 | (?: # Match, possessively, as many strings of: |
@@ -137,41 +137,41 @@ discard block |
||
137 | 137 | public static function antiTagInTag($content = '', $format = 'htmlhead') |
138 | 138 | { |
139 | 139 | $tagend = -1; |
140 | - for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
140 | + for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) |
|
141 | 141 | { |
142 | 142 | // got the start of a tag. Now find the proper end! |
143 | 143 | $walker = $tagstart + 1; |
144 | 144 | $open = 1; |
145 | - while( $open != 0 && $walker < strlen( $content ) ) |
|
145 | + while ($open != 0 && $walker < strlen($content)) |
|
146 | 146 | { |
147 | - $nextopen = strpos( $content, '<', $walker ); |
|
148 | - $nextclose = strpos( $content, '>', $walker ); |
|
149 | - if( $nextclose === false ) |
|
147 | + $nextopen = strpos($content, '<', $walker); |
|
148 | + $nextclose = strpos($content, '>', $walker); |
|
149 | + if ($nextclose === false) |
|
150 | 150 | { // ERROR! Open waka without close waka! |
151 | 151 | // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
152 | 152 | return $content; |
153 | 153 | } |
154 | - if( $nextopen === false || $nextopen > $nextclose ) |
|
154 | + if ($nextopen === false || $nextopen > $nextclose) |
|
155 | 155 | { // No more opens, but there was a close; or, a close happens before the next open. |
156 | 156 | // walker goes to the close+1, and open decrements |
157 | - $open --; |
|
157 | + $open--; |
|
158 | 158 | $walker = $nextclose + 1; |
159 | 159 | } |
160 | - elseif( $nextopen < $nextclose ) |
|
160 | + elseif ($nextopen < $nextclose) |
|
161 | 161 | { // an open before the next close |
162 | - $open ++; |
|
162 | + $open++; |
|
163 | 163 | $walker = $nextopen + 1; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | $tagend = $walker; |
167 | - if( $tagend > strlen( $content ) ) |
|
168 | - $tagend = strlen( $content ); |
|
167 | + if ($tagend > strlen($content)) |
|
168 | + $tagend = strlen($content); |
|
169 | 169 | else |
170 | 170 | { |
171 | - $tagend --; |
|
172 | - $tagstart ++; |
|
171 | + $tagend--; |
|
172 | + $tagstart++; |
|
173 | 173 | } |
174 | - $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
174 | + $tag = substr($content, $tagstart, $tagend - $tagstart); |
|
175 | 175 | $tags[] = '<' . $tag . '>'; |
176 | 176 | |
177 | 177 | if (function_exists('format_to_output')) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $newtag = strip_tags($tag); |
189 | 189 | } |
190 | 190 | } |
191 | - if (isset($tags)&&isset($newtags)) { |
|
191 | + if (isset($tags) && isset($newtags)) { |
|
192 | 192 | $content = str_replace($tags, $newtags, $content); |
193 | 193 | } |
194 | 194 |
@@ -130,7 +130,9 @@ discard block |
||
130 | 130 | $this->error($this->conn->errorCode() . ': ' . $this->conn->errorInfo()[2]); |
131 | 131 | } |
132 | 132 | |
133 | - if (!$this->success) return; |
|
133 | + if (!$this->success) { |
|
134 | + return; |
|
135 | + } |
|
134 | 136 | |
135 | 137 | if ((!$pdoStatement) or (empty($pdoStatement))) { |
136 | 138 | // A failed query. |
@@ -180,8 +182,9 @@ discard block |
||
180 | 182 | * @param string $column_name |
181 | 183 | */ |
182 | 184 | public function field($row_index, $column_name) { |
183 | - if ($this->rows > 0) |
|
184 | - return $this->data[$row_index][$column_name]; |
|
185 | + if ($this->rows > 0) { |
|
186 | + return $this->data[$row_index][$column_name]; |
|
187 | + } |
|
185 | 188 | return ""; |
186 | 189 | } |
187 | 190 | |
@@ -196,8 +199,9 @@ discard block |
||
196 | 199 | * @param integer $row_index |
197 | 200 | */ |
198 | 201 | public function row($row_index) { |
199 | - if ($this->success && $this->rows > 0) |
|
200 | - return $this->data[$row_index]; |
|
202 | + if ($this->success && $this->rows > 0) { |
|
203 | + return $this->data[$row_index]; |
|
204 | + } |
|
201 | 205 | return array(); |
202 | 206 | } |
203 | 207 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | }(document, 'script', 'facebook-jssdk')); |
158 | 158 | </script> |
159 | 159 | |
160 | - <?php if ( $banner_text ) { ?> |
|
160 | + <?php if ($banner_text) { ?> |
|
161 | 161 | <div class="banner"> |
162 | 162 | <div class="full-page__row"> |
163 | 163 | <div class="banner__content"> |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | <div class="site-nav__user"> |
236 | 236 | <ul> |
237 | - <?php foreach ($user_nav_links as $nav_link){ ?> |
|
237 | + <?php foreach ($user_nav_links as $nav_link) { ?> |
|
238 | 238 | <li><a href="<?= $nav_link['href']; ?>" title="<?= $nav_link['title']; ?>" class="<?= $nav_link['classes']; ?>"> |
239 | 239 | <?= $nav_link['text'] ?> |
240 | 240 | </a></li> |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | <div class="full-page legacy-page static-page"> |
269 | 269 | <div class="full-page__row"> |
270 | 270 | <div class="panel"> |
271 | - <?php foreach ( $page_errors as $error ) { ?> |
|
271 | + <?php foreach ($page_errors as $error) { ?> |
|
272 | 272 | <p><?= $error['text'] ?></p> |
273 | 273 | <?php } ?> |
274 | 274 | </div> |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $menudata = $this->pagedata->page_metadata('userviewself', 'menu'); |
48 | 48 | $edittitle = $menudata['title']; |
49 | 49 | $EDITURL = new \MySociety\TheyWorkForYou\Url('userviewself'); |
50 | - if ($this->page == 'userviewself' || $this->page == 'useredit' ) { |
|
50 | + if ($this->page == 'userviewself' || $this->page == 'useredit') { |
|
51 | 51 | $editclass = 'on'; |
52 | 52 | } else { |
53 | 53 | $editclass = ''; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // The 'Log out' link. |
57 | 57 | $menudata = $this->pagedata->page_metadata('userlogout', 'menu'); |
58 | 58 | $logouttext = $menudata['text']; |
59 | - $logouttitle= $menudata['title']; |
|
59 | + $logouttitle = $menudata['title']; |
|
60 | 60 | |
61 | 61 | $LOGOUTURL = new \MySociety\TheyWorkForYou\Url('userlogout'); |
62 | 62 | if ($this->page != 'userlogout') { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | public function getDataSet() |
10 | 10 | { |
11 | - return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/user.xml'); |
|
11 | + return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/user.xml'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | private function fetch_page($vars) |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | return $this->base_fetch_page($vars, 'user'); |
17 | 17 | } |
18 | 18 | |
19 | - private function fetch_user_page( $vars = array(), $page = 'user' ) |
|
19 | + private function fetch_user_page($vars = array(), $page = 'user') |
|
20 | 20 | { |
21 | - return $this->base_fetch_page_user( $vars, '1.fbb689a0c092f5534b929d302db2c8a9', $page ); |
|
21 | + return $this->base_fetch_page_user($vars, '1.fbb689a0c092f5534b929d302db2c8a9', $page); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function testLoginPageLoads() |
25 | 25 | { |
26 | - $page = $this->base_fetch_page( array(), 'user/login' ); |
|
26 | + $page = $this->base_fetch_page(array(), 'user/login'); |
|
27 | 27 | $this->assertContains('Sign in', $page); |
28 | 28 | } |
29 | 29 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'password' => 'password', |
35 | 35 | 'submitted' => 'true', |
36 | 36 | ); |
37 | - $page = $this->base_fetch_page( $vars, 'user/login' ); |
|
37 | + $page = $this->base_fetch_page($vars, 'user/login'); |
|
38 | 38 | # it's a redirect which means we should get nothing |
39 | 39 | # as we're using the cli version of php :( |
40 | 40 | $this->assertEquals('', $page); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function testEditUserInfo() |
51 | 51 | { |
52 | - $page = $this->fetch_user_page( array('pg' => 'edit' ) ); |
|
52 | + $page = $this->fetch_user_page(array('pg' => 'edit')); |
|
53 | 53 | $this->assertContains('Edit your details', $page); |
54 | 54 | $this->assertContains('name="pg" value="edit"', $page); |
55 | 55 | $this->assertContains('value="Test"', $page); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'email' => '[email protected]', |
63 | 63 | 'submitted' => 'true', |
64 | 64 | ); |
65 | - $page = $this->fetch_user_page( $vars ); |
|
65 | + $page = $this->fetch_user_page($vars); |
|
66 | 66 | $this->assertContains('Example User', $page); |
67 | 67 | } |
68 | 68 | } |
@@ -91,6 +91,6 @@ |
||
91 | 91 | <span class="formw"><input type="submit" name="submit" value="Update"></span> |
92 | 92 | </div> |
93 | 93 | </form> |
94 | -EOF; |
|
94 | +eof; |
|
95 | 95 | return $out; |
96 | 96 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | if ($row['constituency']) { |
48 | 48 | $desc .= ', ' . $row['constituency']; |
49 | 49 | } |
50 | - $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n"; |
|
50 | + $out .= '<option value="' . $p_id . '">' . $desc . '</option>' . "\n"; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $out .= ' </select></span> </div> '; |
@@ -43,7 +43,9 @@ |
||
43 | 43 | $house = $row['house']; |
44 | 44 | $desc = member_full_name($house, $row['title'], $row['given_name'], $row['family_name'], $row['lordofname']) . |
45 | 45 | " " . $houses[$house]; |
46 | - if ($row['party']) $desc .= ' (' . $row['party'] . ')'; |
|
46 | + if ($row['party']) { |
|
47 | + $desc .= ' (' . $row['party'] . ')'; |
|
48 | + } |
|
47 | 49 | if ($row['constituency']) { |
48 | 50 | $desc .= ', ' . $row['constituency']; |
49 | 51 | } |