Completed
Pull Request — master (#965)
by Nick
05:26
created
www/includes/easyparliament/glossary.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 
28 28
 class GLOSSARY {
29 29
 
30
-    public $num_terms;			// how many glossary entries do we have
30
+    public $num_terms; // how many glossary entries do we have
31 31
                             // (changes depending on how GLOSSARY is called
32
-    public $hansard_count;		// how many times does the phrase appear in hansard?
33
-    public $query;				// search term
34
-    public $glossary_id;		// if this is set then we only have 1 glossary term
35
-    public $current_term;		// will only be set if we have a valid epobject_id
32
+    public $hansard_count; // how many times does the phrase appear in hansard?
33
+    public $query; // search term
34
+    public $glossary_id; // if this is set then we only have 1 glossary term
35
+    public $current_term; // will only be set if we have a valid epobject_id
36 36
     public $current_letter;
37 37
 
38 38
     // constructor...
39
-    public function __construct($args=array()) {
39
+    public function __construct($args = array()) {
40 40
     // We can optionally start the glossary with one of several arguments
41 41
     //		1. glossary_id - treat the glossary as a single term
42 42
     //		2. glossary_term - search within glossary for a term
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
 
76 76
             // These stop stupid submissions.
77 77
             // everything should be lowercase.
78
-            $this->stopwords = array( "the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate" );
78
+            $this->stopwords = array("the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate");
79 79
 
80 80
     }
81 81
 
82
-    public function get_glossary_item($args=array()) {
82
+    public function get_glossary_item($args = array()) {
83 83
         // Search for and fetch glossary item with title or glossary_id
84 84
         // We could also search glossary text that contains the title text, for cross references
85 85
 
86 86
         $this->alphabet = array();
87
-        foreach (range ("A", "Z") as $letter) {
87
+        foreach (range("A", "Z") as $letter) {
88 88
             $this->alphabet[$letter] = array();
89 89
         }
90 90
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
             WHERE g.glossary_id=eq.glossary_id AND u.user_id=eq.user_id AND g.visible=1 AND eq.approved=1
94 94
             ORDER by g.title");
95 95
         if ($q->success() && $q->rows()) {
96
-            for ($i=0; $i < $q->rows(); $i++) {
97
-                $this->terms[ $q->field($i,"glossary_id") ] = $q->row($i);
96
+            for ($i = 0; $i < $q->rows(); $i++) {
97
+                $this->terms[$q->field($i, "glossary_id")] = $q->row($i);
98 98
                 // Now add the epobject to the alphabet navigation.
99
-                $first_letter = strtoupper(substr($q->field($i,"title"),0,1));
100
-                $this->alphabet[$first_letter][] = $q->field($i,"glossary_id");
99
+                $first_letter = strtoupper(substr($q->field($i, "title"), 0, 1));
100
+                $this->alphabet[$first_letter][] = $q->field($i, "glossary_id");
101 101
             }
102 102
 
103 103
             $this->num_terms = $q->rows();
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         }
141 141
     }
142 142
 
143
-    public function search_glossary($args=array()) {
143
+    public function search_glossary($args = array()) {
144 144
         // Search for and fetch glossary item with a title
145 145
         // Useful for the search page, and nowhere else (so far)
146 146
 
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
         $query = "SELECT g.glossary_id, g.title, g.body, u.user_id, u.firstname, u.lastname
152 152
             FROM editqueue AS eq, glossary AS g, users AS u
153 153
             WHERE g.glossary_id=eq.glossary_id AND u.user_id=eq.user_id AND g.visible=1
154
-                AND g.title LIKE '%" . $this->query . "%'
154
+                AND g.title LIKE '%" . $this->query."%'
155 155
             ORDER by g.title";
156 156
         $q = $this->db->query($query);
157 157
         if ($q->success() && $q->rows()) {
158
-            for ($i=0; $i < $q->rows(); $i++) {
159
-                $this->search_matches[ $q->field($i,"glossary_id") ] = $q->row($i);
158
+            for ($i = 0; $i < $q->rows(); $i++) {
159
+                $this->search_matches[$q->field($i, "glossary_id")] = $q->row($i);
160 160
             }
161 161
             $this->num_search_matches = $q->rows();
162 162
         }
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
         global $THEUSER;
193 193
 
194 194
         if ($data['title'] == '') {
195
-            error ("Sorry, you can't define a term without a title");
195
+            error("Sorry, you can't define a term without a title");
196 196
             return false;
197 197
         }
198 198
 
199 199
         if ($data['body'] == '') {
200
-            error ("You haven't entered a definition!");
200
+            error("You haven't entered a definition!");
201 201
             return false;
202 202
         }
203 203
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             $q = $this->db->query("SELECT glossary_id
211 211
                             FROM	editqueue
212
-                            WHERE	user_id = '" . $THEUSER->user_id() . "'
212
+                            WHERE	user_id = '" . $THEUSER->user_id()."'
213 213
                             AND		submitted + 0 > NOW() - $flood_time_limit");
214 214
 
215 215
             if ($q->rows() > 0) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         }
251 251
     }
252 252
 
253
-    public function glossarise($body, $tokenize=0, $urlize=0) {
253
+    public function glossarise($body, $tokenize = 0, $urlize = 0) {
254 254
     // Turn a body of text into a link-up wonderland of glossary joy
255 255
 
256 256
         global $this_page;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         // should be the complete and linked url.
265 265
         // NB. This should only match when $body is a definition beginning with "http:"
266 266
         if (is_string($body) && preg_match("/^(http:*[^\s])$/i", $body)) {
267
-            $body = "<a href=\"" . $body . "\" title=\"External link to " . $body . "\">" . $body . "</a>";
267
+            $body = "<a href=\"".$body."\" title=\"External link to ".$body."\">".$body."</a>";
268 268
             return ($body);
269 269
         }
270 270
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
             $URL->update(array("gl" => $glossary_id));
288 288
             # The regex here ensures that the phrase is only matched if it's not already within <a> tags, preventing double-linking. Kudos to http://stackoverflow.com/questions/7798829/php-regular-expression-to-match-keyword-outside-html-tag-a
289
-            $findwords[$glossary_id] = "/\b(" . $term_title . ")\b(?!(?>[^<]*(?:<(?!\/?a\b)[^<]*)*)<\/a>)/i";
289
+            $findwords[$glossary_id] = "/\b(".$term_title.")\b(?!(?>[^<]*(?:<(?!\/?a\b)[^<]*)*)<\/a>)/i";
290 290
             // catch glossary terms within their own definitions
291 291
             if ($glossary_id == $this->glossary_id) {
292 292
                 $replacewords[] = "<strong>\\1</strong>";
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         // Highlight all occurrences of another glossary term in the definition.
306 306
         $body = preg_replace($findwords, $replacewords, $body, 1);
307 307
         if (isset($this->glossary_id))
308
-            $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
308
+            $body = preg_replace("/(?<![>\.\'\/])\b(".$this->terms[$this->glossary_id]['title'].")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
309 309
 
310 310
         // Replace any phrases in wikipedia
311 311
         // TODO: Merge this code into above, so our gloss and wikipedia
Please login to merge, or discard this patch.
Braces   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
             if (isset($args['glossary_id']) && ($args['glossary_id'] != "")) {
108 108
                 $next = 0; $first_term = null;
109 109
                 foreach ($this->terms as $term) {
110
-                    if (!$first_term) $first_term = $term;
110
+                    if (!$first_term) {
111
+                        $first_term = $term;
112
+                    }
111 113
                     $last_term = $term;
112 114
                     if ($next == 1) {
113 115
                         $this->next_term = $term;
114 116
                         break;
115
-                    }
116
-                    elseif ($term['glossary_id'] == $args['glossary_id']) {
117
+                    } elseif ($term['glossary_id'] == $args['glossary_id']) {
117 118
                         $this->glossary_id = $args['glossary_id'];
118 119
                         $this->current_term = $term;
119 120
                         $next = 1;
120 121
 
121
-                    }
122
-                    else {
122
+                    } else {
123 123
                         $this->previous_term = $term;
124 124
                     }
125 125
                 }
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
             }
135 135
 
136 136
             return ($this->num_terms);
137
-        }
138
-        else {
137
+        } else {
139 138
             return false;
140 139
         }
141 140
     }
@@ -278,8 +277,9 @@  discard block
 block discarded – undo
278 277
 
279 278
         // check for any glossary terms to replace
280 279
         foreach ($this->replace_order as $glossary_id => $count) {
281
-            if ($glossary_id == $this->glossary_id)
282
-                continue;
280
+            if ($glossary_id == $this->glossary_id) {
281
+                            continue;
282
+            }
283 283
 
284 284
             $term_body = $this->terms[$glossary_id]['body'];
285 285
             $term_title = $this->terms[$glossary_id]['title'];
@@ -290,12 +290,10 @@  discard block
 block discarded – undo
290 290
             // catch glossary terms within their own definitions
291 291
             if ($glossary_id == $this->glossary_id) {
292 292
                 $replacewords[] = "<strong>\\1</strong>";
293
-            }
294
-            else {
293
+            } else {
295 294
                 if ($this_page == "admin_glossary") {
296 295
                     $link_url = "#gl".$glossary_id;
297
-                }
298
-                else {
296
+                } else {
299 297
                     $link_url = $URL->generate('url');
300 298
                 }
301 299
                 $title = _htmlentities(trim_characters($term_body, 0, 80));
@@ -304,8 +302,9 @@  discard block
 block discarded – undo
304 302
         }
305 303
         // Highlight all occurrences of another glossary term in the definition.
306 304
         $body = preg_replace($findwords, $replacewords, $body, 1);
307
-        if (isset($this->glossary_id))
308
-            $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
305
+        if (isset($this->glossary_id)) {
306
+                    $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
307
+        }
309 308
 
310 309
         // Replace any phrases in wikipedia
311 310
         // TODO: Merge this code into above, so our gloss and wikipedia
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/rss/hansard_search.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 twfy_debug("TEMPLATE", "rss/hansard_search.php");
22 22
 
23 23
 if (isset ($data['rows']) && count($data['rows']) > 0) {
24
-    for ($i=0; $i<count($data['rows']); $i++) {
24
+    for ($i = 0; $i < count($data['rows']); $i++) {
25 25
         $row = $data['rows'][$i];
26 26
 
27 27
         $hdate = format_date($row['hdate'], 'D, d M Y');
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
         if (isset($row['parent']) && count($row['parent']) > 0) {
38 38
             echo strip_tags($row['parent']['body']);
39 39
         }
40
-        echo (' (' . format_date($row['hdate'], SHORTDATEFORMAT) . ')');
40
+        echo (' ('.format_date($row['hdate'], SHORTDATEFORMAT).')');
41 41
 ?></title>
42 42
 <link>https://www.theyworkforyou.com<?=$row['listurl'] ?></link>
43 43
 <pubDate><?=$date ?></pubDate>
44 44
 <description><?php
45 45
         if (isset($row['speaker']) && count($row['speaker'])) {
46 46
             $name = ucfirst($row['speaker']['name']);
47
-            echo entities_to_numbers($name) . ': ';
47
+            echo entities_to_numbers($name).': ';
48 48
         }
49
-        echo _htmlspecialchars(str_replace(array('&#8212;', '<span class="hi">', '</span>'), array('-', '<b>', '</b>'), $row['extract'])) . "</description>\n</item>\n";
49
+        echo _htmlspecialchars(str_replace(array('&#8212;', '<span class="hi">', '</span>'), array('-', '<b>', '</b>'), $row['extract']))."</description>\n</item>\n";
50 50
     }
51 51
 }
52 52
 ?>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $row = $data['rows'][$i];
26 26
 
27 27
         $hdate = format_date($row['hdate'], 'D, d M Y');
28
-        if (isset($row['htime']) && $row['htime'] != NULL) {
28
+        if (isset($row['htime']) && $row['htime'] != null) {
29 29
             $htime = format_time($row['htime'], 'H:i:s');
30 30
         } else {
31 31
             $htime = '00:00:00';
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
             <p><?= $error ?></p>
8 8
 
9
-        <?php if ( $rep_search_url ) { ?>
9
+        <?php if ($rep_search_url) { ?>
10 10
         </div>
11 11
 
12 12
         <div class="full-page__unit">
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/votes.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                               <?php foreach ($segment['votes']->positions as $key_vote) {
61 61
 
62 62
                                 if (isset($policy_last_update[$key_vote['policy_id']]) && $policy_last_update[$key_vote['policy_id']] > $most_recent) {
63
-                                  $most_recent = $policy_last_update[$key_vote['policy_id']];
63
+                                    $most_recent = $policy_last_update[$key_vote['policy_id']];
64 64
                                 }
65 65
 
66 66
                                 if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
                                 include '_vote_description.php';
83 83
 
84
-                              } ?>
84
+                                } ?>
85 85
                             </ul>
86 86
 
87 87
                             <div class="share-vote-descriptions">
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-include_once INCLUDESPATH . "easyparliament/templates/html/mp/header.php";
2
+include_once INCLUDESPATH."easyparliament/templates/html/mp/header.php";
3 3
 ?>
4 4
 
5 5
 <div class="full-page">
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                                   $most_recent = $policy_last_update[$key_vote['policy_id']];
64 64
                                 }
65 65
 
66
-                                if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) {
66
+                                if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') {
67 67
                                     $description = ucfirst($key_vote['desc']);
68 68
                                 } else {
69 69
                                     $description = sprintf(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                             <div class="share-vote-descriptions">
88 88
                                 <p>Share a screenshot of these votes:</p>
89 89
 
90
-                                <a href="#" class="fb-share-button-tracked" data-title="<?= $single_policy_page ? '' : $segment['title'] . ' ' ?><?= $page_title ?>" data-href="<?= $abs_member_url ?>/votes?policy=<?= $segment['key'] ?>" data-image="<?= $abs_member_url ?>/policy_set_png?policy_set=<?= $segment['key'] ?>" "See how <?= $full_name ?> voted on <?= $segment["title"] ?>">Share</a>
90
+                                <a href="#" class="fb-share-button-tracked" data-title="<?= $single_policy_page ? '' : $segment['title'].' ' ?><?= $page_title ?>" data-href="<?= $abs_member_url ?>/votes?policy=<?= $segment['key'] ?>" data-image="<?= $abs_member_url ?>/policy_set_png?policy_set=<?= $segment['key'] ?>" "See how <?= $full_name ?> voted on <?= $segment["title"] ?>">Share</a>
91 91
 
92 92
                                 <a class="twitter-share-button" href="https://twitter.com/share" data-size="small" data-url="<?= $abs_member_url ?>/votes?policy=<?= $segment['key'] ?>">Tweet</a>
93 93
                                 </div>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,13 +110,16 @@
 block discarded – undo
110 110
 
111 111
                         <?php endif; ?>
112 112
 
113
-                    <?php else: ?>
113
+                    <?php else {
114
+    : ?>
114 115
 
115 116
                         <div class="panel">
116 117
                             <p>This person has not voted on any of the key issues which we keep track of.</p>
117 118
                         </div>
118 119
 
119
-                    <?php endif; ?>
120
+                    <?php endif;
121
+}
122
+?>
120 123
 
121 124
                 <?php endif; ?>
122 125
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
                 <?php if ($has_voting_record): ?>
44 44
 
45
-                    <?php $displayed_votes = FALSE; ?>
45
+                    <?php $displayed_votes = false; ?>
46 46
 
47 47
                     <?php foreach ($key_votes_segments as $segment): ?>
48 48
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                                 <small>Last updated: <?= format_date($most_recent, LONGDATEFORMAT) ?></small>
95 95
                             </div>
96 96
 
97
-                            <?php $displayed_votes = TRUE; ?>
97
+                            <?php $displayed_votes = true; ?>
98 98
 
99 99
                         <?php endif; ?>
100 100
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/recent.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
                 if ( isset($divisions) && $divisions ) {
39 39
                     if ($has_voting_record) {
40 40
                         foreach ($divisions as $division) {
41
-                          $displayed_votes = TRUE;
41
+                            $displayed_votes = TRUE;
42 42
 
43
-                          if ($current_date != $division['date']) {
43
+                            if ($current_date != $division['date']) {
44 44
                             if ($current_date != '' ) {
45
-                              print('</ul></div>');
45
+                                print('</ul></div>');
46 46
                             }
47 47
                             $current_date = $division['date'];
48 48
                             $sidebar_links[] = $division['date'];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                             <h2><?= strftime('%e %b %Y', strtotime($division['date'])) ?></h2>
52 52
                              <ul class="vote-descriptions policy-votes">
53 53
                           <?php }
54
-                          include('_division_description.php');
54
+                            include('_division_description.php');
55 55
                         }
56 56
                         echo('</div>');
57 57
                     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-include_once INCLUDESPATH . "easyparliament/templates/html/mp/header.php";
2
+include_once INCLUDESPATH."easyparliament/templates/html/mp/header.php";
3 3
 ?>
4 4
 
5 5
 <div class="full-page">
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
                 $current_date = '';
36 36
                 $sidebar_links = array();
37 37
 
38
-                if ( isset($divisions) && $divisions ) {
38
+                if (isset($divisions) && $divisions) {
39 39
                     if ($has_voting_record) {
40 40
                         foreach ($divisions as $division) {
41 41
                           $displayed_votes = TRUE;
42 42
 
43 43
                           if ($current_date != $division['date']) {
44
-                            if ($current_date != '' ) {
44
+                            if ($current_date != '') {
45 45
                               print('</ul></div>');
46 46
                             }
47 47
                             $current_date = $division['date'];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
             <div class="sidebar__unit in-page-nav">
69 69
                 <ul data-magellan-expedition="fixed">
70
-                  <?php foreach($sidebar_links as $date) { ?>
70
+                  <?php foreach ($sidebar_links as $date) { ?>
71 71
                     <li data-magellan-arrival="<?= strftime('%Y-%m-%d', strtotime($date)) ?>">
72 72
                         <a href="#<?= strftime('%Y-%m-%d', strtotime($date)) ?>">
73 73
                             <?= strftime('%e %b %Y', strtotime($date)) ?>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 
31 31
                 <?php
32 32
 
33
-                $displayed_votes = FALSE;
34
-                $show_all = TRUE;
33
+                $displayed_votes = false;
34
+                $show_all = true;
35 35
                 $current_date = '';
36 36
                 $sidebar_links = array();
37 37
 
38 38
                 if ( isset($divisions) && $divisions ) {
39 39
                     if ($has_voting_record) {
40 40
                         foreach ($divisions as $division) {
41
-                          $displayed_votes = TRUE;
41
+                          $displayed_votes = true;
42 42
 
43 43
                           if ($current_date != $division['date']) {
44 44
                             if ($current_date != '' ) {
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/divisions.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-include_once INCLUDESPATH . "easyparliament/templates/html/mp/header.php";
2
+include_once INCLUDESPATH."easyparliament/templates/html/mp/header.php";
3 3
 ?>
4 4
 
5 5
 <div class="full-page">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,14 +59,14 @@  discard block
 block discarded – undo
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
-                                            <?= $full_name . ' ' . $policy['position']['desc'] ?>
66
+                                            <?= $full_name.' '.$policy['position']['desc'] ?>
67 67
                                         </h3>
68 68
 
69
-                                        <?php $pw_url = 'http://www.publicwhip.org.uk/mp.php?mpid=' . $member_id . '&amp;dmp=' . $policy['policy_id']; ?>
69
+                                        <?php $pw_url = 'http://www.publicwhip.org.uk/mp.php?mpid='.$member_id.'&amp;dmp='.$policy['policy_id']; ?>
70 70
                                         <p>
71 71
                                             TheyWorkForYou has automatically calculated this MP&rsquo;s stance based on all
72 72
                                             of their votes on the topic. <a href="<?= $pw_url ?>">You can browse the source
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(){
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/profile.php 4 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
                             include '_vote_description.php';
81 81
 
82
-                          } ?>
82
+                            } ?>
83 83
                         </ul>
84 84
 
85 85
                         <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>&rsquo;s voting record  on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>&rsquo;s full vote analysis page</a> for more.</p>
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
                             include '_vote_description.php';
121 121
 
122
-                          } ?>
122
+                            } ?>
123 123
                         </ul>
124 124
 
125 125
                         <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>&rsquo;s voting record  on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>&rsquo;s full vote analysis page</a> for more.</p>
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
                             include '_vote_description.php';
150 150
 
151
-                          } ?>
151
+                            } ?>
152 152
                         </ul>
153 153
 
154 154
                         <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>&rsquo;s voting record  on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>&rsquo;s full vote analysis page</a> for more.</p>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-include_once INCLUDESPATH . "easyparliament/templates/html/mp/header.php";
2
+include_once INCLUDESPATH."easyparliament/templates/html/mp/header.php";
3 3
 
4 4
 // if this is set to a year for which we have WTT responsiveness stats then
5 5
 // it'll display a banner with the MPs stats, assuming we have them for the
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 </div>
59 59
               <?php endif; ?>
60 60
 
61
-                <?php if ( !$current_member[HOUSE_TYPE_COMMONS] ) { ?>
61
+                <?php if (!$current_member[HOUSE_TYPE_COMMONS]) { ?>
62 62
                     <?php if (count($policyPositions->positions) > 0) { ?>
63 63
                     <div class="panel">
64 64
                         <a name="votes"></a>
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                                 $party,
115 115
                                 $party_positions[$policy_id]['position']
116 116
                             );
117
-                            $link = $member_url . '/divisions?policy=' . $policy_id;
117
+                            $link = $member_url.'/divisions?policy='.$policy_id;
118 118
                             $show_link = true;
119 119
 
120 120
                             include '_vote_description.php';
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
                         <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>&rsquo;s voting record  on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>&rsquo;s full vote analysis page</a> for more.</p>
126 126
 
127
-                    <?php elseif (count($policyPositions->positions) > 0 ): ?>
127
+                    <?php elseif (count($policyPositions->positions) > 0): ?>
128 128
                         <?php if (count($party_positions) && $party_member_count > 1) { ?>
129 129
                         <p>
130 130
                         <?= $full_name ?> is a <?= $party ?> MP, and on the <b>vast majority</b> of issues votes the <b>same way</b> as other <?= $party ?> MPs.
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                         </ul>
153 153
 
154 154
                         <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>&rsquo;s voting record  on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>&rsquo;s full vote analysis page</a> for more.</p>
155
-                    <?php elseif (count($policyPositions->positions) == 0 ): ?>
155
+                    <?php elseif (count($policyPositions->positions) == 0): ?>
156 156
 
157 157
                         <p>No votes to display.</p>
158 158
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -190,11 +190,14 @@
 block discarded – undo
190 190
                         <?= $recent_appearances['additional_links'] ?>
191 191
                         <?php endif; ?>
192 192
 
193
-                    <?php else: ?>
193
+                    <?php else {
194
+    : ?>
194 195
 
195 196
                         <p>No recent appearances to display.</p>
196 197
 
197
-                    <?php endif; ?>
198
+                    <?php endif;
199
+}
200
+?>
198 201
 
199 202
                 </div>
200 203
                 <?php endif; ?>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
                         <ul class="vote-descriptions">
106 106
                           <?php foreach ($sorted_diffs as $policy_id => $score) {
107 107
 
108
-                            $key_vote = NULL;
108
+                            $key_vote = null;
109 109
                             $description = sprintf(
110 110
                                 '%s <b>%s</b> %s, while most %s MPs <b>%s</b>.',
111 111
                                 $full_name,
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/header.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
     <div class="regional-header regional-header--<?= $current_assembly ?>">
2 2
         <div class="regional-header__overlay"></div>
3
-        <div class="person-header <?= $this_page ?> <?= (isset($data['photo_attribution_text'])?'has-data-attribution':'') ?>">
3
+        <div class="person-header <?= $this_page ?> <?= (isset($data['photo_attribution_text']) ? 'has-data-attribution' : '') ?>">
4 4
             <div class="full-page__row">
5 5
                 <div class="full-page__unit">
6 6
                     <div class="person-header__content">
7 7
                         <div class="person-name">
8
-                          <?php if ( $image ) { ?>
8
+                          <?php if ($image) { ?>
9 9
                             <div class="mp-image">
10 10
                                 <img src="<?= $image['url'] ?>" height="48">
11 11
                             </div>
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
                               <?php } ?>
18 18
                             </div>
19 19
                         </div>
20
-                        <?php if($image && $image['exists']): ?>
21
-                            <?php if(isset($data['photo_attribution_text'])) { ?>
20
+                        <?php if ($image && $image['exists']): ?>
21
+                            <?php if (isset($data['photo_attribution_text'])) { ?>
22 22
                                 <div class="person-data-attribution">
23
-                                  <?php if(isset($data['photo_attribution_link'])) { ?>
23
+                                  <?php if (isset($data['photo_attribution_link'])) { ?>
24 24
                                     Profile photo: <a href="<?= $data['photo_attribution_link'] ?>"><?= $data['photo_attribution_text'] ?></a>
25 25
                                   <?php } else { ?>
26 26
                                     Profile photo: <?= $data['photo_attribution_text'] ?>
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
                             </div>
39 39
                         <?php endif; ?>
40 40
                         <div class="person-constituency">
41
-                          <?php if ( $constituency && $this_page != 'peer' && $this_page != 'royal' ) { ?>
41
+                          <?php if ($constituency && $this_page != 'peer' && $this_page != 'royal') { ?>
42 42
                             <span class="constituency"><?= $constituency ?></span>
43 43
                           <?php } ?>
44
-                          <?php if ( $party ) { ?>
44
+                          <?php if ($party) { ?>
45 45
                             <span class="party <?= $party_short ?>"><?= $party ?></span>
46 46
                           <?php } ?>
47 47
                         </div>
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                                     echo "?person=uk.org.publicwhip/person/$person_id";
59 59
                                 }
60 60
                                 if ($the_users_mp) {
61
-                                    echo "?a=WMC&amp;pc=" . _htmlentities(urlencode($user_postcode));
61
+                                    echo "?a=WMC&amp;pc="._htmlentities(urlencode($user_postcode));
62 62
                                 }
63 63
                             ?>" class="button wtt" onclick="trackLinkClick(this, 'Links', 'WriteToThem', 'Person'); return false;"><img src="/style/img/envelope.png">Send a message</a>
64 64
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
                                   <?php } ?>
28 28
                                 </div>
29 29
                             <?php } ?>
30
-                        <?php else: ?>
30
+                        <?php else {
31
+    : ?>
31 32
                             <div class="person-data-attribution">
32 33
                                 We&rsquo;re missing a photo of <?= $full_name ?>. If you have a
33 34
                                 photo <em>that you can release under a Creative Commons Attribution-ShareAlike
@@ -36,7 +37,9 @@  discard block
 block discarded – undo
36 37
                                 Please do not email us about copyrighted photos elsewhere on the internet; we can&rsquo;t
37 38
                                 use them.
38 39
                             </div>
39
-                        <?php endif; ?>
40
+                        <?php endif;
41
+}
42
+?>
40 43
                         <div class="person-constituency">
41 44
                           <?php if ( $constituency && $this_page != 'peer' && $this_page != 'royal' ) { ?>
42 45
                             <span class="constituency"><?= $constituency ?></span>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/_vote_description.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <li>
2 2
     <?= $description ?>
3
-    <?php if ( $show_link ) { ?>
3
+    <?php if ($show_link) { ?>
4 4
         <a class="vote-description__source" href="<?= $link ?>">Show votes</a>
5 5
         <?php if (isset($key_vote)) { ?>
6 6
         <a class="vote-description__evidence" href="<?= $link ?>"><?= $key_vote['summary'] ?></a>
Please login to merge, or discard this patch.