Failed Conditions
Pull Request — master (#1325)
by Nick
26:10 queued 21:10
created
classes/MiniSurvey.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace MySociety\TheyWorkForYou;
4 4
 
5
-require_once INCLUDESPATH . "../../commonlib/phplib/random.php";
6
-require_once INCLUDESPATH . "../../commonlib/phplib/auth.php";
5
+require_once INCLUDESPATH."../../commonlib/phplib/random.php";
6
+require_once INCLUDESPATH."../../commonlib/phplib/auth.php";
7 7
 
8 8
 class MiniSurvey {
9 9
 
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
         if ($hide_question) {
26 26
             $always_ask = 0;
27 27
             $show_survey_qn = $current_question;
28
-            setcookie('survey', $current_question, time()+60*60*24*365, '/');
28
+            setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
29 29
         } elseif ($has_answered_question == $current_question && !$always_ask) {
30 30
             $show_survey_qn = $current_question;
31
-            setcookie('survey', $current_question, time()+60*60*24*365, '/');
31
+            setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
32 32
         } elseif (isset($_COOKIE['survey'])) {
33 33
             $show_survey_qn = $_COOKIE['survey'];
34 34
         }
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 
39 39
             $page_url = '';
40 40
             $hide_url = '';
41
-            if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) {
41
+            if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) {
42 42
                 global $MEMBER;
43
-                if ( $MEMBER ) {
44
-                    $page_url = $MEMBER->url(true) . "?answered_survey=$current_question";
45
-                    $hide_url = $MEMBER->url() . "?hide_survey=$current_question";
43
+                if ($MEMBER) {
44
+                    $page_url = $MEMBER->url(true)."?answered_survey=$current_question";
45
+                    $hide_url = $MEMBER->url()."?hide_survey=$current_question";
46 46
                 }
47 47
             } else {
48 48
                 $URL = new \URL($this_page);
49
-                $URL->insert(array('answered_survey' => $current_question ));
50
-                $page_url = 'https://' . DOMAIN . $URL->generate();
49
+                $URL->insert(array('answered_survey' => $current_question));
50
+                $page_url = 'https://'.DOMAIN.$URL->generate();
51 51
                 $URL = new \URL($this_page);
52
-                $URL->insert(array('hide_survey' => $current_question ));
52
+                $URL->insert(array('hide_survey' => $current_question));
53 53
                 $hide_url = $URL->generate();
54 54
             }
55 55
 
Please login to merge, or discard this patch.
classes/Search/ParseArgs.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
         $searchstring = '';
14 14
 
15 15
         if ($advphrase = get_http_var('phrase')) {
16
-            $searchstring .= ' "' . $advphrase . '"';
16
+            $searchstring .= ' "'.$advphrase.'"';
17 17
         }
18 18
 
19 19
         if ($advexclude = get_http_var('exclude')) {
20
-            $searchstring .= ' -' . join(' -', preg_split('/\s+/', $advexclude));
20
+            $searchstring .= ' -'.join(' -', preg_split('/\s+/', $advexclude));
21 21
         }
22 22
 
23 23
         return $searchstring;
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
             $q = \MySociety\TheyWorkForYou\Utility\Search::searchMemberDbLookup($searchspeaker);
82 82
             $pids = array();
83 83
             $row_count = $q->rows();
84
-            for ($i=0; $i<$row_count; $i++) {
84
+            for ($i = 0; $i < $row_count; $i++) {
85 85
                 $pids[$q->field($i, 'person_id')] = true;
86 86
             }
87 87
             $pids = array_keys($pids);
88 88
             if (count($pids) > 0) {
89
-                $searchstring .= ' speaker:' . join(' speaker:', $pids);
89
+                $searchstring .= ' speaker:'.join(' speaker:', $pids);
90 90
             }
91 91
         }
92 92
 
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
         $searchstring = '';
98 98
 
99 99
         if ($advdept = get_http_var('department')) {
100
-            $searchstring .= ' department:' . preg_replace('#[^a-z]#i', '', $advdept);
100
+            $searchstring .= ' department:'.preg_replace('#[^a-z]#i', '', $advdept);
101 101
         }
102 102
 
103 103
         if ($advparty = get_http_var('party')) {
104
-            $searchstring .= ' party:' . join(' party:', explode(',', $advparty));
104
+            $searchstring .= ' party:'.join(' party:', explode(',', $advparty));
105 105
         }
106 106
 
107 107
         $advsection = get_http_var('section');
108 108
         if (!$advsection)
109 109
             $advsection = get_http_var('maj'); # Old URLs had this
110 110
         if (is_array($advsection)) {
111
-            $searchstring .= ' section:' . join(' section:', $advsection);
111
+            $searchstring .= ' section:'.join(' section:', $advsection);
112 112
         } elseif ($advsection) {
113 113
             $searchstring .= " section:$advsection";
114 114
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,11 +28,17 @@  discard block
 block discarded – undo
28 28
 
29 29
         if (get_http_var('from') || get_http_var('to')) {
30 30
             $from = parse_date(get_http_var('from'));
31
-            if ($from) $from = $from['iso'];
32
-            else $from = '1935-10-01';
31
+            if ($from) {
32
+                $from = $from['iso'];
33
+            } else {
34
+                $from = '1935-10-01';
35
+            }
33 36
             $to = parse_date(get_http_var('to'));
34
-            if ($to) $to = $to['iso'];
35
-            else $to = date('Y-m-d');
37
+            if ($to) {
38
+                $to = $to['iso'];
39
+            } else {
40
+                $to = date('Y-m-d');
41
+            }
36 42
             $searchstring .= " $from..$to";
37 43
         }
38 44
 
@@ -105,8 +111,10 @@  discard block
 block discarded – undo
105 111
         }
106 112
 
107 113
         $advsection = get_http_var('section');
108
-        if (!$advsection)
109
-            $advsection = get_http_var('maj'); # Old URLs had this
114
+        if (!$advsection) {
115
+                    $advsection = get_http_var('maj');
116
+        }
117
+        # Old URLs had this
110 118
         if (is_array($advsection)) {
111 119
             $searchstring .= ' section:' . join(' section:', $advsection);
112 120
         } elseif ($advsection) {
Please login to merge, or discard this patch.
classes/Topic.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->db = new \ParlDB;
34 34
 
35 35
         if (is_null($data)) {
36
-          return;
36
+            return;
37 37
         }
38 38
 
39 39
         $this->id = $data['id'];
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
     private function _getContentIDs() {
126 126
         $q = $this->db->query(
127
-          "SELECT body, gid, ep.epobject_id FROM epobject ep
127
+            "SELECT body, gid, ep.epobject_id FROM epobject ep
128 128
            JOIN hansard h on ep.epobject_id = h.epobject_id
129 129
            JOIN topic_epobjects te on te.epobject_id = ep.epobject_id
130 130
            WHERE topic_key = :topic_key",
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 
181 181
     function addContent($gid) {
182 182
         $q = $this->db->query(
183
-          "SELECT epobject_id FROM hansard WHERE gid = :gid",
184
-          array(
183
+            "SELECT epobject_id FROM hansard WHERE gid = :gid",
184
+            array(
185 185
             ":gid" => $gid
186
-          )
186
+            )
187 187
         );
188 188
 
189 189
         if (!$q->success() || $q->rows == 0) {
190
-          return false;
190
+            return false;
191 191
         }
192 192
 
193 193
         $epobject_id = $q->field(0, 'epobject_id');
194 194
 
195 195
         $q = $this->db->query(
196
-          "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)",
197
-          array(
196
+            "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)",
197
+            array(
198 198
             ":topic" => $this->id,
199 199
             ":ep_id" => $epobject_id
200
-          )
200
+            )
201 201
         );
202 202
 
203 203
         return $q->success();
@@ -205,31 +205,31 @@  discard block
 block discarded – undo
205 205
 
206 206
     function deleteContent($id) {
207 207
         $q = $this->db->query(
208
-          "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id",
209
-          array(
208
+            "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id",
209
+            array(
210 210
             ":topic" => $this->id,
211 211
             ":ep_id" => $id
212
-          )
212
+            )
213 213
         );
214 214
 
215 215
         return $q->success();
216 216
     }
217 217
 
218 218
     function getPolicySets() {
219
-      $q = $this->db->query(
219
+        $q = $this->db->query(
220 220
         "SELECT policyset FROM topic_policysets WHERE topic_key = :key",
221 221
         array(
222
-          ':key' => $this->id
222
+            ':key' => $this->id
223 223
         )
224
-      );
224
+        );
225 225
 
226
-      $sets = array();
227
-      $count = $q->rows;
228
-      for ($i = 0; $i < $count; $i++) {
226
+        $sets = array();
227
+        $count = $q->rows;
228
+        for ($i = 0; $i < $count; $i++) {
229 229
         $sets[] = $q->field($i, 'policyset');
230
-      }
230
+        }
231 231
 
232
-      return $sets;
232
+        return $sets;
233 233
     }
234 234
 
235 235
     function addPolicySets($sets) {
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
     }
260 260
 
261 261
     function getPolicies() {
262
-      $q = $this->db->query(
262
+        $q = $this->db->query(
263 263
         'SELECT policy_id FROM topic_policies WHERE topic_key = :key',
264 264
         array(
265
-          ':key' => $this->id
265
+            ':key' => $this->id
266 266
         )
267
-      );
267
+        );
268 268
 
269
-      $policies = array();
270
-      $count = $q->rows;
271
-      for ($i = 0; $i < $count; $i++) {
269
+        $policies = array();
270
+        $count = $q->rows;
271
+        for ($i = 0; $i < $count; $i++) {
272 272
         $policies[] = $q->field($i, 'policy_id');
273
-      }
273
+        }
274 274
 
275
-      return $policies;
275
+        return $policies;
276 276
     }
277 277
 
278 278
     function addPolicies($policies) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
     function save() {
318 318
         $q = $this->db->query(
319
-          "REPLACE INTO topics
319
+            "REPLACE INTO topics
320 320
           (id, title, slug, description, search_string, front_page, image)
321 321
           VALUES
322 322
           (:id, :title, :slug, :description, :search_string, :front_page, :image)",
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     function sctitle() {
55 55
         $title = $this->title;
56
-        if (strpos($title, 'The ') === 0 ) {
56
+        if (strpos($title, 'The ') === 0) {
57 57
             $title = lcfirst($title);
58 58
         }
59 59
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     function url() {
76 76
         $url = new \URL('topic');
77
-        return $url->generate() . $this->slug;
77
+        return $url->generate().$this->slug;
78 78
     }
79 79
 
80 80
     function image() {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     function image_url() {
85
-        return "/topic/image.php?id=" . $this->slug();
85
+        return "/topic/image.php?id=".$this->slug();
86 86
     }
87 87
 
88 88
     function image_path() {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             );
243 243
         } else {
244 244
             foreach ($sets as $set) {
245
-                if ($set == '' ) {
245
+                if ($set == '') {
246 246
                     continue;
247 247
                 }
248 248
                 $q = $this->db->query(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             );
286 286
         } else {
287 287
             foreach ($policies as $policy) {
288
-                if ($policy == '' ) {
288
+                if ($policy == '') {
289 289
                     continue;
290 290
                 }
291 291
                 $q = $this->db->query(
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      *
29 29
      */
30 30
 
31
-    public function __construct($data = NULL)
31
+    public function __construct($data = null)
32 32
     {
33 33
         $this->db = new \ParlDB;
34 34
 
Please login to merge, or discard this patch.
classes/SectionView/SpwransView.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 \URL('spwrans');
59 59
                 $URL->reset();
60
-                $URL->insert( array('id' => $m[1]) );
61
-                $fragment_identifier = '#g' . $m[2];
62
-                header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303);
60
+                $URL->insert(array('id' => $m[1]));
61
+                $fragment_identifier = '#g'.$m[2];
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 \URL('spdebates');
66 66
                 $URL->reset();
67
-                $URL->insert( array('id' => $m[1]) );
68
-                $fragment_identifier = '#g' . $m[2];
69
-                header('Location: ' . $URL->generate('none') . $fragment_identifier, true, 303);
67
+                $URL->insert(array('id' => $m[1]));
68
+                $fragment_identifier = '#g'.$m[2];
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 \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
 block discarded – undo
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 \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 \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>";
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
classes/SectionView/SpView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
     protected function getSearchSections() {
26 26
         return array(
27
-            array( 'section' => 'sp' )
27
+            array('section' => 'sp')
28 28
         );
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
classes/SectionView/WransView.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 
13 13
     protected function display_front() {
14 14
         global $DATA, $this_page;
15
-        if ( get_http_var('type') == 'wrans') {
15
+        if (get_http_var('type') == 'wrans') {
16 16
             return parent::display_front();
17 17
         }
18 18
 
19 19
         $data = array();
20 20
 
21
-        $args = array( 'months' => 1 );
21
+        $args = array('months' => 1);
22 22
         $WRANSLIST = new \WRANSLIST;
23 23
 
24 24
         $wrans = array();
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 
51 51
     protected function getSearchSections() {
52 52
         $sections = array(
53
-            array( 'section' => 'wrans', 'title' => 'Written Answers' ),
53
+            array('section' => 'wrans', 'title' => 'Written Answers'),
54 54
         );
55
-        if ( get_http_var('type') == '') {
56
-            $sections[] = array( 'section' => 'wms', 'title' => 'Written Ministerial Statements' );
55
+        if (get_http_var('type') == '') {
56
+            $sections[] = array('section' => 'wms', 'title' => 'Written Ministerial Statements');
57 57
         }
58 58
         return $sections;
59 59
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     # speech bar the first (assuming that's the question)
63 63
     private $votelinks_so_far = 0;
64 64
 
65
-    protected function generate_votes ($votes, $id, $gid) {
65
+    protected function generate_votes($votes, $id, $gid) {
66 66
         /*
67 67
         Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar.
68 68
         $votes = => array (
Please login to merge, or discard this patch.
classes/SectionView/PbcView.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
         if ($bill_id && $id) {
44 44
             return $this->display_section_or_speech(array(
45
-                'gid' => $standingprefix . $id,
45
+                'gid' => $standingprefix.$id,
46 46
             ));
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,
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
         } elseif ($this->session && $this->bill) {
61 61
             # Illegal bill title, redirect to session page
62 62
             $URL = new \URL('pbc_session');
63
-            header('Location: ' . $URL->generate() . urlencode($this->session));
63
+            header('Location: '.$URL->generate().urlencode($this->session));
64 64
             exit;
65 65
         } elseif ($this->session) {
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
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
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
             );
Please login to merge, or discard this patch.
classes/SectionView/DebatesView.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $DEBATELIST = new \DEBATELIST;
17 17
         $debates = array();
18 18
         $debates['data'] = $DEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
19
-        $args = array( 'months' => 1 );
19
+        $args = array('months' => 1);
20 20
         $debates['calendar'] = $DEBATELIST->display('calendar', $args, 'none');
21 21
         $debates['rssurl'] = $DATA->page_metadata($this_page, 'rss');
22 22
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         $WHALLLIST = new \WHALLLIST;
28 28
         $whall['data'] = $WHALLLIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
29
-        $args = array( 'months' => 1 );
29
+        $args = array('months' => 1);
30 30
         $whall['calendar'] = $WHALLLIST->display('calendar', $args, 'none');
31 31
         $whall['rssurl'] = $DATA->page_metadata($this_page, 'rss');
32 32
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         $LORDSDEBATELIST = new \LORDSDEBATELIST;
38 38
         $lords['data'] = $LORDSDEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none');
39
-        $args = array( 'months' => 1 );
39
+        $args = array('months' => 1);
40 40
         $lords['calendar'] = $LORDSDEBATELIST->display('calendar', $args, 'none');
41 41
 
42 42
         $lords['rssurl'] = $DATA->page_metadata($this_page, 'rss');
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 
56 56
     protected function getSearchSections() {
57 57
         return array(
58
-            array( 'section' => 'debates', 'title' => 'House of Commons' ),
59
-            array( 'section' => 'lords', 'title' => 'House of Lords' ),
60
-            array( 'section' => 'whall', 'title' => 'Westminster Hall' )
58
+            array('section' => 'debates', 'title' => 'House of Commons'),
59
+            array('section' => 'lords', 'title' => 'House of Lords'),
60
+            array('section' => 'whall', 'title' => 'Westminster Hall')
61 61
         );
62 62
     }
63 63
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
         if (!$this->first_gid) $this->first_gid = $row['gid'];
70 70
 
71 71
         $video_content = '';
72
-        if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) {
72
+        if (!$this->first_video_displayed && $row['video_status'] & 4 && !($row['video_status'] & 8)) {
73 73
             $video_content = $this->video_sidebar($row, $heading_hpos, $speeches);
74 74
             $this->first_video_displayed = true;
75 75
         }
76
-        if (!$video_content && !$this->first_speech_displayed && $row['video_status']&1 && !($row['video_status']&12)) {
76
+        if (!$video_content && !$this->first_speech_displayed && $row['video_status'] & 1 && !($row['video_status'] & 12)) {
77 77
             $video_content = $this->video_advert($row);
78 78
             $this->first_speech_displayed = true;
79 79
         }
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
         if ($count > 1) {
105 105
             $out .= '<div class="debate__video" id="video_wrap"><div>';
106 106
             if ($row['gid'] != $this->first_gid) {
107
-                $out .= '<p class="video-instructions">This video starts around ' . ($row['hpos']-$heading_hpos) . ' speeches in (<a href="#g' . gid_to_anchor($row['gid']) . '">move there in text</a>)</p>';
107
+                $out .= '<p class="video-instructions">This video starts around '.($row['hpos'] - $heading_hpos).' speeches in (<a href="#g'.gid_to_anchor($row['gid']).'">move there in text</a>)</p>';
108 108
             }
109 109
         }
110 110
         $out .= \MySociety\TheyWorkForYou\Utility\Video::object($video['id'], $start, "$gid_type/$row[gid]");
111
-        $flashvars = 'gid=' . "$gid_type/$row[gid]" . '&amp;file=' . $video['id'] . '&amp;start=' . $start;
111
+        $flashvars = 'gid='."$gid_type/$row[gid]".'&amp;file='.$video['id'].'&amp;start='.$start;
112 112
         $out .= "<strong>Embed this video</strong><p class='video-instructions'>Copy and paste this code on your website</p><input readonly onclick='this.focus();this.select();' type='text' name='embed' size='40' value=\"<embed src='https://www.theyworkforyou.com/video/parlvid.swf' width='320' height='230' allowfullscreen='true' allowscriptaccess='always' flashvars='$flashvars'></embed>\">";
113 113
         if ($count > 1) {
114 114
             $out .= '<p class="hide-video"><a href="" onclick="return showVideo();">Hide</a></p>';
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     <div style="border:solid 1px #9999ff; background-color: #ccccff; padding: 4px; text-align: center;
126 126
     background-image: url(\'/images/video-x-generic.png\'); background-repeat: no-repeat; padding-left: 40px;
127 127
     background-position: 0 2px; margin-bottom: 1em;">
128
-    Help us <a href="/video/?from=debate&amp;gid=' . $gid_type . '/' . $row['gid'] . '">match the video for this speech</a>
128
+    Help us <a href="/video/?from=debate&amp;gid=' . $gid_type.'/'.$row['gid'].'">match the video for this speech</a>
129 129
     to get the right video playing here
130 130
     </div>
131 131
     ';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
     private $first_gid = '';
67 67
 
68 68
     protected function get_video_html($row, $heading_hpos, $speeches) {
69
-        if (!$this->first_gid) $this->first_gid = $row['gid'];
69
+        if (!$this->first_gid) {
70
+            $this->first_gid = $row['gid'];
71
+        }
70 72
 
71 73
         $video_content = '';
72 74
         if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) {
@@ -97,7 +99,9 @@  discard block
 block discarded – undo
97 99
         $adate = $vq->field(0, 'adate');
98 100
         $time = $vq->field(0, 'atime');
99 101
         $videodb = \MySociety\TheyWorkForYou\Utility\Video::dbConnect();
100
-        if (!$videodb) return '';
102
+        if (!$videodb) {
103
+            return '';
104
+        }
101 105
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $adate, $time);
102 106
         $start = $video['offset'];
103 107
         $out = '';
Please login to merge, or discard this patch.
classes/SectionView/NiView.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
52 52
 
53 53
         $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none');
54 54
         $MOREURL = new \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
 block discarded – undo
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
 block discarded – undo
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';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.