Passed
Push — master ( c3b9b9...2d5ec3 )
by Stiofan
12:21 queued 06:01
created
includes/class-wpinv-ajax.php 1 patch
Spacing   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -7,28 +7,28 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 class WPInv_Ajax {
15 15
     public static function init() {
16
-        add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 );
17
-        add_action( 'template_redirect', array( __CLASS__, 'do_wpinv_ajax' ), 0 );
16
+        add_action('init', array(__CLASS__, 'define_ajax'), 0);
17
+        add_action('template_redirect', array(__CLASS__, 'do_wpinv_ajax'), 0);
18 18
         self::add_ajax_events();
19 19
     }
20 20
 
21 21
     public static function define_ajax() {
22
-        if ( !empty( $_GET['wpinv-ajax'] ) ) {
23
-            if ( ! defined( 'DOING_AJAX' ) ) {
24
-                define( 'DOING_AJAX', true );
22
+        if (!empty($_GET['wpinv-ajax'])) {
23
+            if (!defined('DOING_AJAX')) {
24
+                define('DOING_AJAX', true);
25 25
             }
26
-            if ( ! defined( 'WC_DOING_AJAX' ) ) {
27
-                define( 'WC_DOING_AJAX', true );
26
+            if (!defined('WC_DOING_AJAX')) {
27
+                define('WC_DOING_AJAX', true);
28 28
             }
29 29
             // Turn off display_errors during AJAX events to prevent malformed JSON
30
-            if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) {
31
-                @ini_set( 'display_errors', 0 );
30
+            if (!WP_DEBUG || (WP_DEBUG && !WP_DEBUG_DISPLAY)) {
31
+                @ini_set('display_errors', 0);
32 32
             }
33 33
             $GLOBALS['wpdb']->hide_errors();
34 34
         }
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
     public static function do_wpinv_ajax() {
38 38
         global $wp_query;
39 39
 
40
-        if ( !empty( $_GET['wpinv-ajax'] ) ) {
41
-            $wp_query->set( 'wpinv-ajax', sanitize_text_field( $_GET['wpinv-ajax'] ) );
40
+        if (!empty($_GET['wpinv-ajax'])) {
41
+            $wp_query->set('wpinv-ajax', sanitize_text_field($_GET['wpinv-ajax']));
42 42
         }
43 43
 
44
-        if ( $action = $wp_query->get( 'wpinv-ajax' ) ) {
44
+        if ($action = $wp_query->get('wpinv-ajax')) {
45 45
             self::wpinv_ajax_headers();
46
-            do_action( 'wpinv_ajax_' . sanitize_text_field( $action ) );
46
+            do_action('wpinv_ajax_' . sanitize_text_field($action));
47 47
             die();
48 48
         }
49 49
     }
50 50
     
51 51
     private static function wpinv_ajax_headers() {
52 52
         send_origin_headers();
53
-        @header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
54
-        @header( 'X-Robots-Tag: noindex' );
53
+        @header('Content-Type: text/html; charset=' . get_option('blog_charset'));
54
+        @header('X-Robots-Tag: noindex');
55 55
         send_nosniff_header();
56 56
         nocache_headers();
57
-        status_header( 200 );
57
+        status_header(200);
58 58
     }
59 59
     
60 60
     public static function add_ajax_events() {
@@ -76,39 +76,39 @@  discard block
 block discarded – undo
76 76
             'remove_discount' => false,
77 77
         );
78 78
 
79
-        foreach ( $ajax_events as $ajax_event => $nopriv ) {
80
-            add_action( 'wp_ajax_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
79
+        foreach ($ajax_events as $ajax_event => $nopriv) {
80
+            add_action('wp_ajax_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
81 81
             
82
-            if ( !defined( 'WPI_AJAX_' . strtoupper( $nopriv ) ) ) {
83
-                define( 'WPI_AJAX_' . strtoupper( $nopriv ), 1 );
82
+            if (!defined('WPI_AJAX_' . strtoupper($nopriv))) {
83
+                define('WPI_AJAX_' . strtoupper($nopriv), 1);
84 84
             }
85 85
 
86
-            if ( $nopriv ) {
87
-                add_action( 'wp_ajax_nopriv_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
86
+            if ($nopriv) {
87
+                add_action('wp_ajax_nopriv_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
88 88
 
89
-                add_action( 'wpinv_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) );
89
+                add_action('wpinv_ajax_' . $ajax_event, array(__CLASS__, $ajax_event));
90 90
             }
91 91
         }
92 92
     }
93 93
     
94 94
     public static function add_note() {
95
-        check_ajax_referer( 'add-invoice-note', '_nonce' );
95
+        check_ajax_referer('add-invoice-note', '_nonce');
96 96
 
97
-        if ( !current_user_can( 'manage_options' ) ) {
97
+        if (!current_user_can('manage_options')) {
98 98
             die(-1);
99 99
         }
100 100
 
101
-        $post_id   = absint( $_POST['post_id'] );
102
-        $note      = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) );
103
-        $note_type = sanitize_text_field( $_POST['note_type'] );
101
+        $post_id   = absint($_POST['post_id']);
102
+        $note      = wp_kses_post(trim(stripslashes($_POST['note'])));
103
+        $note_type = sanitize_text_field($_POST['note_type']);
104 104
 
105 105
         $is_customer_note = $note_type == 'customer' ? 1 : 0;
106 106
 
107
-        if ( $post_id > 0 ) {
108
-            $note_id = wpinv_insert_payment_note( $post_id, $note, $is_customer_note );
107
+        if ($post_id > 0) {
108
+            $note_id = wpinv_insert_payment_note($post_id, $note, $is_customer_note);
109 109
 
110
-            if ( $note_id > 0 && !is_wp_error( $note_id ) ) {
111
-                wpinv_get_invoice_note_line_item( $note_id );
110
+            if ($note_id > 0 && !is_wp_error($note_id)) {
111
+                wpinv_get_invoice_note_line_item($note_id);
112 112
             }
113 113
         }
114 114
 
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
     }
117 117
 
118 118
     public static function delete_note() {
119
-        check_ajax_referer( 'delete-invoice-note', '_nonce' );
119
+        check_ajax_referer('delete-invoice-note', '_nonce');
120 120
 
121
-        if ( !current_user_can( 'manage_options' ) ) {
121
+        if (!current_user_can('manage_options')) {
122 122
             die(-1);
123 123
         }
124 124
 
125 125
         $note_id = (int)$_POST['note_id'];
126 126
 
127
-        if ( $note_id > 0 ) {
128
-            wp_delete_comment( $note_id, true );
127
+        if ($note_id > 0) {
128
+            wp_delete_comment($note_id, true);
129 129
         }
130 130
 
131 131
         die();
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
     }
139 139
     
140 140
     public static function checkout() {
141
-        if ( ! defined( 'WPINV_CHECKOUT' ) ) {
142
-            define( 'WPINV_CHECKOUT', true );
141
+        if (!defined('WPINV_CHECKOUT')) {
142
+            define('WPINV_CHECKOUT', true);
143 143
         }
144 144
 
145 145
         wpinv_process_checkout();
@@ -148,53 +148,53 @@  discard block
 block discarded – undo
148 148
     
149 149
     public static function add_invoice_item() {
150 150
         global $wpi_userID, $wpinv_ip_address_country;
151
-        check_ajax_referer( 'invoice-item', '_nonce' );
152
-        if ( !current_user_can( 'manage_options' ) ) {
151
+        check_ajax_referer('invoice-item', '_nonce');
152
+        if (!current_user_can('manage_options')) {
153 153
             die(-1);
154 154
         }
155 155
         
156
-        $item_id    = sanitize_text_field( $_POST['item_id'] );
157
-        $invoice_id = absint( $_POST['invoice_id'] );
156
+        $item_id    = sanitize_text_field($_POST['item_id']);
157
+        $invoice_id = absint($_POST['invoice_id']);
158 158
         
159
-        if ( !is_numeric( $invoice_id ) || !is_numeric( $item_id ) ) {
159
+        if (!is_numeric($invoice_id) || !is_numeric($item_id)) {
160 160
             die();
161 161
         }
162 162
         
163
-        $invoice    = wpinv_get_invoice( $invoice_id );
164
-        if ( empty( $invoice ) ) {
163
+        $invoice = wpinv_get_invoice($invoice_id);
164
+        if (empty($invoice)) {
165 165
             die();
166 166
         }
167 167
         
168
-        if ( $invoice->is_paid() ) {
168
+        if ($invoice->is_paid()) {
169 169
             die(); // Don't allow modify items for paid invoice.
170 170
         }
171 171
         
172
-        if ( !empty( $_POST['user_id'] ) ) {
173
-            $wpi_userID = absint( $_POST['user_id'] ); 
172
+        if (!empty($_POST['user_id'])) {
173
+            $wpi_userID = absint($_POST['user_id']); 
174 174
         }
175 175
 
176
-        $item = new WPInv_Item( $item_id );
177
-        if ( !( !empty( $item ) && $item->post_type == 'wpi_item' ) ) {
176
+        $item = new WPInv_Item($item_id);
177
+        if (!(!empty($item) && $item->post_type == 'wpi_item')) {
178 178
             die();
179 179
         }
180 180
         
181 181
         // Validate item before adding to invoice because recurring item must be paid individually.
182
-        if ( !empty( $invoice->cart_details ) ) {
182
+        if (!empty($invoice->cart_details)) {
183 183
             $valid = true;
184 184
             
185
-            if ( $recurring_item = $invoice->get_recurring() ) {
186
-                if ( $recurring_item != $item_id ) {
185
+            if ($recurring_item = $invoice->get_recurring()) {
186
+                if ($recurring_item != $item_id) {
187 187
                     $valid = false;
188 188
                 }
189
-            } else if ( wpinv_is_recurring_item( $item_id ) ) {
189
+            } else if (wpinv_is_recurring_item($item_id)) {
190 190
                 $valid = false;
191 191
             }
192 192
             
193
-            if ( !$valid ) {
193
+            if (!$valid) {
194 194
                 $response               = array();
195 195
                 $response['success']    = false;
196
-                $response['msg']        = __( 'You can not add item to invoice because recurring item must be paid individually!', 'invoicing' );
197
-                wp_send_json( $response );
196
+                $response['msg']        = __('You can not add item to invoice because recurring item must be paid individually!', 'invoicing');
197
+                wp_send_json($response);
198 198
             }
199 199
         }
200 200
         
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
         
203 203
         $data                   = array();
204 204
         $data['invoice_id']     = $invoice_id;
205
-        $data['cart_discounts'] = $invoice->get_discounts( true );
205
+        $data['cart_discounts'] = $invoice->get_discounts(true);
206 206
         
207
-        wpinv_set_checkout_session( $data );
207
+        wpinv_set_checkout_session($data);
208 208
         
209 209
         $quantity = wpinv_item_quantities_enabled() && !empty($_POST['qty']) && (int)$_POST['qty'] > 0 ? (int)$_POST['qty'] : 1;
210 210
 
@@ -218,21 +218,21 @@  discard block
 block discarded – undo
218 218
             'fees'       => array()
219 219
         );
220 220
 
221
-        $invoice->add_item( $item_id, $args );
221
+        $invoice->add_item($item_id, $args);
222 222
         $invoice->save();
223 223
         
224
-        if ( empty( $_POST['country'] ) ) {
224
+        if (empty($_POST['country'])) {
225 225
             $_POST['country'] = !empty($invoice->country) ? $invoice->country : wpinv_get_default_country();
226 226
         }
227
-        if ( empty( $_POST['state'] ) ) {
227
+        if (empty($_POST['state'])) {
228 228
             $_POST['state'] = $invoice->state;
229 229
         }
230 230
          
231
-        $invoice->country   = sanitize_text_field( $_POST['country'] );
232
-        $invoice->state     = sanitize_text_field( $_POST['state'] );
231
+        $invoice->country   = sanitize_text_field($_POST['country']);
232
+        $invoice->state     = sanitize_text_field($_POST['state']);
233 233
         
234
-        $invoice->set( 'country', sanitize_text_field( $_POST['country'] ) );
235
-        $invoice->set( 'state', sanitize_text_field( $_POST['state'] ) );
234
+        $invoice->set('country', sanitize_text_field($_POST['country']));
235
+        $invoice->set('state', sanitize_text_field($_POST['state']));
236 236
         
237 237
         $wpinv_ip_address_country = $invoice->country;
238 238
 
@@ -240,52 +240,52 @@  discard block
 block discarded – undo
240 240
         
241 241
         $response                       = array();
242 242
         $response['success']            = true;
243
-        $response['data']['items']      = wpinv_admin_get_line_items( $invoice );
243
+        $response['data']['items']      = wpinv_admin_get_line_items($invoice);
244 244
         $response['data']['subtotal']   = $invoice->get_subtotal();
245 245
         $response['data']['subtotalf']  = $invoice->get_subtotal(true);
246 246
         $response['data']['tax']        = $invoice->get_tax();
247 247
         $response['data']['taxf']       = $invoice->get_tax(true);
248 248
         $response['data']['discount']   = $invoice->discount;
249
-        $response['data']['discountf']  = wpinv_price( $invoice->discount, $invoice->get_currency() );
249
+        $response['data']['discountf']  = wpinv_price($invoice->discount, $invoice->get_currency());
250 250
         $response['data']['total']      = $invoice->get_total();
251 251
         $response['data']['totalf']     = $invoice->get_total(true);
252 252
         
253 253
         wpinv_set_checkout_session($checkout_session);
254 254
         
255
-        wp_send_json( $response );
255
+        wp_send_json($response);
256 256
     }
257 257
     
258 258
     public static function remove_invoice_item() {
259 259
         global $wpi_userID, $wpinv_ip_address_country;
260 260
         
261
-        check_ajax_referer( 'invoice-item', '_nonce' );
262
-        if ( !current_user_can( 'manage_options' ) ) {
261
+        check_ajax_referer('invoice-item', '_nonce');
262
+        if (!current_user_can('manage_options')) {
263 263
             die(-1);
264 264
         }
265 265
         
266
-        $item_id    = sanitize_text_field( $_POST['item_id'] );
267
-        $invoice_id = absint( $_POST['invoice_id'] );
268
-        $cart_index = isset( $_POST['index'] ) && $_POST['index'] >= 0 ? $_POST['index'] : false;
266
+        $item_id    = sanitize_text_field($_POST['item_id']);
267
+        $invoice_id = absint($_POST['invoice_id']);
268
+        $cart_index = isset($_POST['index']) && $_POST['index'] >= 0 ? $_POST['index'] : false;
269 269
         
270
-        if ( !is_numeric( $invoice_id ) || !is_numeric( $item_id ) ) {
270
+        if (!is_numeric($invoice_id) || !is_numeric($item_id)) {
271 271
             die();
272 272
         }
273 273
 
274
-        $invoice    = wpinv_get_invoice( $invoice_id );
275
-        if ( empty( $invoice ) ) {
274
+        $invoice = wpinv_get_invoice($invoice_id);
275
+        if (empty($invoice)) {
276 276
             die();
277 277
         }
278 278
         
279
-        if ( $invoice->is_paid() ) {
279
+        if ($invoice->is_paid()) {
280 280
             die(); // Don't allow modify items for paid invoice.
281 281
         }
282 282
         
283
-        if ( !empty( $_POST['user_id'] ) ) {
284
-            $wpi_userID = absint( $_POST['user_id'] ); 
283
+        if (!empty($_POST['user_id'])) {
284
+            $wpi_userID = absint($_POST['user_id']); 
285 285
         }
286 286
 
287
-        $item       = new WPInv_Item( $item_id );
288
-        if ( !( !empty( $item ) && $item->post_type == 'wpi_item' ) ) {
287
+        $item = new WPInv_Item($item_id);
288
+        if (!(!empty($item) && $item->post_type == 'wpi_item')) {
289 289
             die();
290 290
         }
291 291
         
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
         
294 294
         $data                   = array();
295 295
         $data['invoice_id']     = $invoice_id;
296
-        $data['cart_discounts'] = $invoice->get_discounts( true );
296
+        $data['cart_discounts'] = $invoice->get_discounts(true);
297 297
         
298
-        wpinv_set_checkout_session( $data );
298
+        wpinv_set_checkout_session($data);
299 299
 
300 300
         $args = array(
301 301
             'id'         => $item_id,
@@ -303,21 +303,21 @@  discard block
 block discarded – undo
303 303
             'cart_index' => $cart_index
304 304
         );
305 305
 
306
-        $invoice->remove_item( $item_id, $args );
306
+        $invoice->remove_item($item_id, $args);
307 307
         $invoice->save();
308 308
         
309
-        if ( empty( $_POST['country'] ) ) {
309
+        if (empty($_POST['country'])) {
310 310
             $_POST['country'] = !empty($invoice->country) ? $invoice->country : wpinv_get_default_country();
311 311
         }
312
-        if ( empty( $_POST['state'] ) ) {
312
+        if (empty($_POST['state'])) {
313 313
             $_POST['state'] = $invoice->state;
314 314
         }
315 315
          
316
-        $invoice->country   = sanitize_text_field( $_POST['country'] );
317
-        $invoice->state     = sanitize_text_field( $_POST['state'] );
316
+        $invoice->country   = sanitize_text_field($_POST['country']);
317
+        $invoice->state     = sanitize_text_field($_POST['state']);
318 318
         
319
-        $invoice->set( 'country', sanitize_text_field( $_POST['country'] ) );
320
-        $invoice->set( 'state', sanitize_text_field( $_POST['state'] ) );
319
+        $invoice->set('country', sanitize_text_field($_POST['country']));
320
+        $invoice->set('state', sanitize_text_field($_POST['state']));
321 321
         
322 322
         $wpinv_ip_address_country = $invoice->country;
323 323
         
@@ -325,52 +325,52 @@  discard block
 block discarded – undo
325 325
         
326 326
         $response                       = array();
327 327
         $response['success']            = true;
328
-        $response['data']['items']      = wpinv_admin_get_line_items( $invoice );
328
+        $response['data']['items']      = wpinv_admin_get_line_items($invoice);
329 329
         $response['data']['subtotal']   = $invoice->get_subtotal();
330 330
         $response['data']['subtotalf']  = $invoice->get_subtotal(true);
331 331
         $response['data']['tax']        = $invoice->get_tax();
332 332
         $response['data']['taxf']       = $invoice->get_tax(true);
333 333
         $response['data']['discount']   = $invoice->discount;
334
-        $response['data']['discountf']  = wpinv_price( $invoice->discount, $invoice->get_currency() );
334
+        $response['data']['discountf']  = wpinv_price($invoice->discount, $invoice->get_currency());
335 335
         $response['data']['total']      = $invoice->get_total();
336 336
         $response['data']['totalf']     = $invoice->get_total(true);
337 337
         
338 338
         wpinv_set_checkout_session($checkout_session);
339 339
         
340
-        wp_send_json( $response );
340
+        wp_send_json($response);
341 341
     }
342 342
     
343 343
     public static function create_invoice_item() {
344
-        check_ajax_referer( 'invoice-item', '_nonce' );
345
-        if ( !current_user_can( 'manage_options' ) ) {
344
+        check_ajax_referer('invoice-item', '_nonce');
345
+        if (!current_user_can('manage_options')) {
346 346
             die(-1);
347 347
         }
348 348
         
349
-        $invoice_id = absint( $_POST['invoice_id'] );
349
+        $invoice_id = absint($_POST['invoice_id']);
350 350
 
351 351
         // Find the item
352
-        if ( !is_numeric( $invoice_id ) ) {
352
+        if (!is_numeric($invoice_id)) {
353 353
             die();
354 354
         }        
355 355
         
356
-        $invoice     = wpinv_get_invoice( $invoice_id );
357
-        if ( empty( $invoice ) ) {
356
+        $invoice = wpinv_get_invoice($invoice_id);
357
+        if (empty($invoice)) {
358 358
             die();
359 359
         }
360 360
         
361 361
         // Validate item before adding to invoice because recurring item must be paid individually.
362
-        if ( !empty( $invoice->cart_details ) && $invoice->get_recurring() ) {
362
+        if (!empty($invoice->cart_details) && $invoice->get_recurring()) {
363 363
             $response               = array();
364 364
             $response['success']    = false;
365
-            $response['msg']        = __( 'You can not add item to invoice because recurring item must be paid individually!', 'invoicing' );
366
-            wp_send_json( $response );
365
+            $response['msg']        = __('You can not add item to invoice because recurring item must be paid individually!', 'invoicing');
366
+            wp_send_json($response);
367 367
         }        
368 368
         
369 369
         $save_item = $_POST['_wpinv_quick'];
370 370
         
371 371
         $meta               = array();
372 372
         $meta['type']       = !empty($save_item['type']) ? sanitize_text_field($save_item['type']) : 'custom';
373
-        $meta['price']      = !empty($save_item['price']) ? wpinv_format_amount($save_item['price'], NULL, true ) : 0;
373
+        $meta['price']      = !empty($save_item['price']) ? wpinv_format_amount($save_item['price'], NULL, true) : 0;
374 374
         $meta['vat_rule']   = !empty($save_item['vat_rule']) ? sanitize_text_field($save_item['vat_rule']) : 'digital';
375 375
         $meta['vat_class']  = !empty($save_item['vat_class']) ? sanitize_text_field($save_item['vat_class']) : '_standard';
376 376
         
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
         $data['meta']           = $meta;
381 381
         
382 382
         $item = new WPInv_Item();
383
-        $item->create( $data );
383
+        $item->create($data);
384 384
         
385
-        if ( !empty( $item ) ) {
385
+        if (!empty($item)) {
386 386
             $_POST['item_id']   = $item->ID;
387 387
             $_POST['qty']       = !empty($save_item['qty']) && $save_item['qty'] > 0 ? (int)$save_item['qty'] : 1;
388 388
             
@@ -392,15 +392,15 @@  discard block
 block discarded – undo
392 392
     }
393 393
     
394 394
     public static function get_billing_details() {
395
-        check_ajax_referer( 'get-billing-details', '_nonce' );
395
+        check_ajax_referer('get-billing-details', '_nonce');
396 396
         
397
-        if ( !current_user_can( 'manage_options' ) ) {
397
+        if (!current_user_can('manage_options')) {
398 398
             die(-1);
399 399
         }
400 400
 
401 401
         $user_id            = (int)$_POST['user_id'];
402 402
         $billing_details    = wpinv_get_user_address($user_id);
403
-        $billing_details    = apply_filters( 'wpinv_fill_billing_details', $billing_details, $user_id );
403
+        $billing_details    = apply_filters('wpinv_fill_billing_details', $billing_details, $user_id);
404 404
         
405 405
         if (isset($billing_details['user_id'])) {
406 406
             unset($billing_details['user_id']);
@@ -414,20 +414,20 @@  discard block
 block discarded – undo
414 414
         $response['success']                    = true;
415 415
         $response['data']['billing_details']    = $billing_details;
416 416
         
417
-        wp_send_json( $response );
417
+        wp_send_json($response);
418 418
     }
419 419
     
420 420
     public static function admin_recalculate_totals() {
421 421
         global $wpi_userID, $wpinv_ip_address_country;
422 422
         
423
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
424
-        if ( !current_user_can( 'manage_options' ) ) {
423
+        check_ajax_referer('wpinv-nonce', '_nonce');
424
+        if (!current_user_can('manage_options')) {
425 425
             die(-1);
426 426
         }
427 427
         
428
-        $invoice_id = absint( $_POST['invoice_id'] );        
429
-        $invoice    = wpinv_get_invoice( $invoice_id );
430
-        if ( empty( $invoice ) ) {
428
+        $invoice_id = absint($_POST['invoice_id']);        
429
+        $invoice    = wpinv_get_invoice($invoice_id);
430
+        if (empty($invoice)) {
431 431
             die();
432 432
         }
433 433
         
@@ -435,23 +435,23 @@  discard block
 block discarded – undo
435 435
         
436 436
         $data                   = array();
437 437
         $data['invoice_id']     = $invoice_id;
438
-        $data['cart_discounts'] = $invoice->get_discounts( true );
438
+        $data['cart_discounts'] = $invoice->get_discounts(true);
439 439
         
440
-        wpinv_set_checkout_session( $data );
440
+        wpinv_set_checkout_session($data);
441 441
         
442
-        if ( !empty( $_POST['user_id'] ) ) {
443
-            $wpi_userID = absint( $_POST['user_id'] ); 
442
+        if (!empty($_POST['user_id'])) {
443
+            $wpi_userID = absint($_POST['user_id']); 
444 444
         }
445 445
         
446
-        if ( empty( $_POST['country'] ) ) {
446
+        if (empty($_POST['country'])) {
447 447
             $_POST['country'] = !empty($invoice->country) ? $invoice->country : wpinv_get_default_country();
448 448
         }
449 449
             
450
-        $invoice->country = sanitize_text_field( $_POST['country'] );
451
-        $invoice->set( 'country', sanitize_text_field( $_POST['country'] ) );
452
-        if ( isset( $_POST['state'] ) ) {
453
-            $invoice->state = sanitize_text_field( $_POST['state'] );
454
-            $invoice->set( 'state', sanitize_text_field( $_POST['state'] ) );
450
+        $invoice->country = sanitize_text_field($_POST['country']);
451
+        $invoice->set('country', sanitize_text_field($_POST['country']));
452
+        if (isset($_POST['state'])) {
453
+            $invoice->state = sanitize_text_field($_POST['state']);
454
+            $invoice->set('state', sanitize_text_field($_POST['state']));
455 455
         }
456 456
         
457 457
         $wpinv_ip_address_country = $invoice->country;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         
461 461
         $response                       = array();
462 462
         $response['success']            = true;
463
-        $response['data']['items']      = wpinv_admin_get_line_items( $invoice );
463
+        $response['data']['items']      = wpinv_admin_get_line_items($invoice);
464 464
         $response['data']['subtotal']   = $invoice->get_subtotal();
465 465
         $response['data']['subtotalf']  = $invoice->get_subtotal(true);
466 466
         $response['data']['tax']        = $invoice->get_tax();
@@ -472,25 +472,25 @@  discard block
 block discarded – undo
472 472
         
473 473
         wpinv_set_checkout_session($checkout_session);
474 474
         
475
-        wp_send_json( $response );
475
+        wp_send_json($response);
476 476
     }
477 477
     
478 478
     public static function admin_apply_discount() {
479 479
         global $wpi_userID;
480 480
         
481
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
482
-        if ( !current_user_can( 'manage_options' ) ) {
481
+        check_ajax_referer('wpinv-nonce', '_nonce');
482
+        if (!current_user_can('manage_options')) {
483 483
             die(-1);
484 484
         }
485 485
         
486
-        $invoice_id = absint( $_POST['invoice_id'] );
487
-        $discount_code = sanitize_text_field( $_POST['code'] );
488
-        if ( empty( $invoice_id ) || empty( $discount_code ) ) {
486
+        $invoice_id = absint($_POST['invoice_id']);
487
+        $discount_code = sanitize_text_field($_POST['code']);
488
+        if (empty($invoice_id) || empty($discount_code)) {
489 489
             die();
490 490
         }
491 491
         
492
-        $invoice = wpinv_get_invoice( $invoice_id );
493
-        if ( empty( $invoice ) || ( !empty( $invoice ) && $invoice->is_paid() ) ) {
492
+        $invoice = wpinv_get_invoice($invoice_id);
493
+        if (empty($invoice) || (!empty($invoice) && $invoice->is_paid())) {
494 494
             die();
495 495
         }
496 496
         
@@ -498,49 +498,49 @@  discard block
 block discarded – undo
498 498
         
499 499
         $data                   = array();
500 500
         $data['invoice_id']     = $invoice_id;
501
-        $data['cart_discounts'] = $invoice->get_discounts( true );
501
+        $data['cart_discounts'] = $invoice->get_discounts(true);
502 502
         
503
-        wpinv_set_checkout_session( $data );
503
+        wpinv_set_checkout_session($data);
504 504
         
505 505
         $response               = array();
506 506
         $response['success']    = false;
507
-        $response['msg']        = __( 'This discount is invalid.', 'invoicing' );
507
+        $response['msg']        = __('This discount is invalid.', 'invoicing');
508 508
         $response['data']['code'] = $discount_code;
509 509
         
510
-        if ( wpinv_is_discount_valid( $discount_code, $invoice->get_user_id() ) ) {
511
-            $discounts = wpinv_set_cart_discount( $discount_code );
510
+        if (wpinv_is_discount_valid($discount_code, $invoice->get_user_id())) {
511
+            $discounts = wpinv_set_cart_discount($discount_code);
512 512
             
513 513
             $response['success'] = true;
514
-            $response['msg'] = __( 'Discount has been applied successfully.', 'invoicing' );
515
-        }  else {
514
+            $response['msg'] = __('Discount has been applied successfully.', 'invoicing');
515
+        } else {
516 516
             $errors = wpinv_get_errors();
517
-            if ( !empty( $errors['wpinv-discount-error'] ) ) {
517
+            if (!empty($errors['wpinv-discount-error'])) {
518 518
                 $response['msg'] = $errors['wpinv-discount-error'];
519 519
             }
520
-            wpinv_unset_error( 'wpinv-discount-error' );
520
+            wpinv_unset_error('wpinv-discount-error');
521 521
         }
522 522
         
523 523
         wpinv_set_checkout_session($checkout_session);
524 524
         
525
-        wp_send_json( $response );
525
+        wp_send_json($response);
526 526
     }
527 527
     
528 528
     public static function admin_remove_discount() {
529 529
         global $wpi_userID;
530 530
         
531
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
532
-        if ( !current_user_can( 'manage_options' ) ) {
531
+        check_ajax_referer('wpinv-nonce', '_nonce');
532
+        if (!current_user_can('manage_options')) {
533 533
             die(-1);
534 534
         }
535 535
         
536
-        $invoice_id = absint( $_POST['invoice_id'] );
537
-        $discount_code = sanitize_text_field( $_POST['code'] );
538
-        if ( empty( $invoice_id ) || empty( $discount_code ) ) {
536
+        $invoice_id = absint($_POST['invoice_id']);
537
+        $discount_code = sanitize_text_field($_POST['code']);
538
+        if (empty($invoice_id) || empty($discount_code)) {
539 539
             die();
540 540
         }
541 541
         
542
-        $invoice = wpinv_get_invoice( $invoice_id );
543
-        if ( empty( $invoice ) || ( !empty( $invoice ) && $invoice->is_paid() ) ) {
542
+        $invoice = wpinv_get_invoice($invoice_id);
543
+        if (empty($invoice) || (!empty($invoice) && $invoice->is_paid())) {
544 544
             die();
545 545
         }
546 546
         
@@ -548,38 +548,38 @@  discard block
 block discarded – undo
548 548
         
549 549
         $data                   = array();
550 550
         $data['invoice_id']     = $invoice_id;
551
-        $data['cart_discounts'] = $invoice->get_discounts( true );
551
+        $data['cart_discounts'] = $invoice->get_discounts(true);
552 552
         
553
-        wpinv_set_checkout_session( $data );
553
+        wpinv_set_checkout_session($data);
554 554
         
555 555
         $response               = array();
556 556
         $response['success']    = false;
557 557
         $response['msg']        = NULL;
558 558
         
559
-        $discounts  = wpinv_unset_cart_discount( $discount_code );
559
+        $discounts = wpinv_unset_cart_discount($discount_code);
560 560
         $response['success'] = true;
561
-        $response['msg'] = __( 'Discount has been removed successfully.', 'invoicing' );
561
+        $response['msg'] = __('Discount has been removed successfully.', 'invoicing');
562 562
         
563 563
         wpinv_set_checkout_session($checkout_session);
564 564
         
565
-        wp_send_json( $response );
565
+        wp_send_json($response);
566 566
     }
567 567
     
568 568
     public static function check_email() {
569
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
570
-        if ( !current_user_can( 'manage_options' ) ) {
569
+        check_ajax_referer('wpinv-nonce', '_nonce');
570
+        if (!current_user_can('manage_options')) {
571 571
             die(-1);
572 572
         }
573 573
         
574
-        $email = sanitize_text_field( $_POST['email'] );
574
+        $email = sanitize_text_field($_POST['email']);
575 575
         
576 576
         $response = array();
577
-        if ( is_email( $email ) && email_exists( $email ) && $user_data = get_user_by( 'email', $email ) ) {
577
+        if (is_email($email) && email_exists($email) && $user_data = get_user_by('email', $email)) {
578 578
             $user_id            = $user_data->ID;
579 579
             $user_login         = $user_data->user_login;
580 580
             $display_name       = $user_data->display_name ? $user_data->display_name : $user_login;
581 581
             $billing_details    = wpinv_get_user_address($user_id);
582
-            $billing_details    = apply_filters( 'wpinv_fill_billing_details', $billing_details, $user_id );
582
+            $billing_details    = apply_filters('wpinv_fill_billing_details', $billing_details, $user_id);
583 583
             
584 584
             if (isset($billing_details['user_id'])) {
585 585
                 unset($billing_details['user_id']);
@@ -595,31 +595,31 @@  discard block
 block discarded – undo
595 595
             $response['data']['billing_details']    = $billing_details;
596 596
         }
597 597
         
598
-        wp_send_json( $response );
598
+        wp_send_json($response);
599 599
     }
600 600
     
601 601
     public static function run_tool() {
602
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
603
-        if ( !current_user_can( 'manage_options' ) ) {
602
+        check_ajax_referer('wpinv-nonce', '_nonce');
603
+        if (!current_user_can('manage_options')) {
604 604
             die(-1);
605 605
         }
606 606
         
607
-        $tool = sanitize_text_field( $_POST['tool'] );
607
+        $tool = sanitize_text_field($_POST['tool']);
608 608
         
609
-        do_action( 'wpinv_run_tool' );
609
+        do_action('wpinv_run_tool');
610 610
         
611
-        if ( !empty( $tool ) ) {
612
-            do_action( 'wpinv_tool_' . $tool );
611
+        if (!empty($tool)) {
612
+            do_action('wpinv_tool_' . $tool);
613 613
         }
614 614
     }
615 615
     
616 616
     public static function apply_discount() {
617
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
617
+        check_ajax_referer('wpinv-nonce', '_nonce');
618 618
         
619 619
         $response = array();
620 620
         
621
-        if ( isset( $_POST['code'] ) ) {
622
-            $discount_code = sanitize_text_field( $_POST['code'] );
621
+        if (isset($_POST['code'])) {
622
+            $discount_code = sanitize_text_field($_POST['code']);
623 623
 
624 624
             $response['success']        = false;
625 625
             $response['msg']            = '';
@@ -627,14 +627,14 @@  discard block
 block discarded – undo
627 627
             
628 628
             $user = is_user_logged_in() ? get_current_user_id() : '';
629 629
 
630
-            if ( wpinv_is_discount_valid( $discount_code, $user ) ) {
631
-                $discount       = wpinv_get_discount_by_code( $discount_code );
632
-                $discounts      = wpinv_set_cart_discount( $discount_code );
633
-                $amount         = wpinv_format_discount_rate( wpinv_get_discount_type( $discount->ID ), wpinv_get_discount_amount( $discount->ID ) );
634
-                $total          = wpinv_get_cart_total( null, $discounts );
635
-                $cart_totals    = wpinv_recalculate_tax( true );
630
+            if (wpinv_is_discount_valid($discount_code, $user)) {
631
+                $discount       = wpinv_get_discount_by_code($discount_code);
632
+                $discounts      = wpinv_set_cart_discount($discount_code);
633
+                $amount         = wpinv_format_discount_rate(wpinv_get_discount_type($discount->ID), wpinv_get_discount_amount($discount->ID));
634
+                $total          = wpinv_get_cart_total(null, $discounts);
635
+                $cart_totals    = wpinv_recalculate_tax(true);
636 636
             
637
-                if ( !empty( $cart_totals ) ) {
637
+                if (!empty($cart_totals)) {
638 638
                     $response['success']        = true;
639 639
                     $response['data']           = $cart_totals;
640 640
                     $response['data']['code']   = $discount_code;
@@ -643,29 +643,29 @@  discard block
 block discarded – undo
643 643
                 }
644 644
             } else {
645 645
                 $errors = wpinv_get_errors();
646
-                $response['msg']  = $errors['wpinv-discount-error'];
647
-                wpinv_unset_error( 'wpinv-discount-error' );
646
+                $response['msg'] = $errors['wpinv-discount-error'];
647
+                wpinv_unset_error('wpinv-discount-error');
648 648
             }
649 649
 
650 650
             // Allow for custom discount code handling
651
-            $response = apply_filters( 'wpinv_ajax_discount_response', $response );
651
+            $response = apply_filters('wpinv_ajax_discount_response', $response);
652 652
         }
653 653
         
654
-        wp_send_json( $response );
654
+        wp_send_json($response);
655 655
     }
656 656
     
657 657
     public static function remove_discount() {
658
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
658
+        check_ajax_referer('wpinv-nonce', '_nonce');
659 659
         
660 660
         $response = array();
661 661
         
662
-        if ( isset( $_POST['code'] ) ) {
663
-            $discount_code  = sanitize_text_field( $_POST['code'] );
664
-            $discounts      = wpinv_unset_cart_discount( $discount_code );
665
-            $total          = wpinv_get_cart_total( null, $discounts );
666
-            $cart_totals    = wpinv_recalculate_tax( true );
662
+        if (isset($_POST['code'])) {
663
+            $discount_code  = sanitize_text_field($_POST['code']);
664
+            $discounts      = wpinv_unset_cart_discount($discount_code);
665
+            $total          = wpinv_get_cart_total(null, $discounts);
666
+            $cart_totals    = wpinv_recalculate_tax(true);
667 667
             
668
-            if ( !empty( $cart_totals ) ) {
668
+            if (!empty($cart_totals)) {
669 669
                 $response['success']        = true;
670 670
                 $response['data']           = $cart_totals;
671 671
                 $response['data']['code']   = $discount_code;
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
             }
675 675
             
676 676
             // Allow for custom discount code handling
677
-            $response = apply_filters( 'wpinv_ajax_discount_response', $response );
677
+            $response = apply_filters('wpinv_ajax_discount_response', $response);
678 678
         }
679 679
         
680
-        wp_send_json( $response );
680
+        wp_send_json($response);
681 681
     }
682 682
 }
683 683
 
Please login to merge, or discard this patch.
includes/class-wpinv-notes.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit; // Exit if accessed directly
4 4
 }
5 5
 
@@ -14,65 +14,65 @@  discard block
 block discarded – undo
14 14
     }
15 15
     
16 16
     public function init() {
17
-        do_action( 'wpinv_class_notes_init', $this );
17
+        do_action('wpinv_class_notes_init', $this);
18 18
     }
19 19
     
20 20
     public function includes() {
21
-        do_action( 'wpinv_class_notes_includes', $this );
21
+        do_action('wpinv_class_notes_includes', $this);
22 22
     }
23 23
     
24 24
     public function actions() {
25 25
         // Secure inovice notes
26
-        add_action( 'pre_get_comments', array( $this, 'set_invoice_note_type' ), 11, 1 );
26
+        add_action('pre_get_comments', array($this, 'set_invoice_note_type'), 11, 1);
27 27
         
28
-        do_action( 'wpinv_class_notes_actions', $this );
28
+        do_action('wpinv_class_notes_actions', $this);
29 29
     }
30 30
         
31
-    public function set_invoice_note_type( $query ) {
32
-        $post_ID        = !empty( $query->query_vars['post_ID'] ) ? $query->query_vars['post_ID'] : $query->query_vars['post_id'];
31
+    public function set_invoice_note_type($query) {
32
+        $post_ID = !empty($query->query_vars['post_ID']) ? $query->query_vars['post_ID'] : $query->query_vars['post_id'];
33 33
         
34
-        if ( $post_ID && get_post_type( $post_ID ) == $this->invoice_post_type ) {
34
+        if ($post_ID && get_post_type($post_ID) == $this->invoice_post_type) {
35 35
             $query->query_vars['type__in']      = $this->comment_type;
36 36
             $query->query_vars['type__not_in']  = '';
37 37
         } else {        
38
-            if ( isset( $query->query_vars['type__in'] ) && $type_in = $query->query_vars['type__in'] ) {
39
-                if ( is_array( $type_in ) && in_array( $this->comment_type, $type_in ) ) {
40
-                    $key = array_search( $this->comment_type, $type_in );
41
-                    unset( $query->query_vars['type__in'][$key] );
42
-                } else if ( !is_array( $type_in ) && $type_in == $this->comment_type ) {
38
+            if (isset($query->query_vars['type__in']) && $type_in = $query->query_vars['type__in']) {
39
+                if (is_array($type_in) && in_array($this->comment_type, $type_in)) {
40
+                    $key = array_search($this->comment_type, $type_in);
41
+                    unset($query->query_vars['type__in'][$key]);
42
+                } else if (!is_array($type_in) && $type_in == $this->comment_type) {
43 43
                     $query->query_vars['type__in'] = '';
44 44
                 }
45 45
             }
46 46
             
47
-            if ( isset( $query->query_vars['type__not_in'] ) && $type_not_in = $query->query_vars['type__not_in'] ) {
48
-                if ( is_array( $type_not_in ) && !in_array( $this->comment_type, $type_not_in ) ) {
47
+            if (isset($query->query_vars['type__not_in']) && $type_not_in = $query->query_vars['type__not_in']) {
48
+                if (is_array($type_not_in) && !in_array($this->comment_type, $type_not_in)) {
49 49
                     $query->query_vars['type__not_in'][] = $this->comment_type;
50
-                } else if ( !is_array( $type_not_in ) && $type_not_in != $this->comment_type ) {
50
+                } else if (!is_array($type_not_in) && $type_not_in != $this->comment_type) {
51 51
                     $query->query_vars['type__not_in'] = (array)$query->query_vars['type__not_in'];
52 52
                     $query->query_vars['type__not_in'][] = $this->comment_type;
53 53
                 }
54 54
             } else {
55
-                $query->query_vars['type__not_in']  = $this->comment_type;
55
+                $query->query_vars['type__not_in'] = $this->comment_type;
56 56
             }
57 57
         }
58 58
         
59 59
         return $query;
60 60
     }
61 61
     
62
-    public function get_invoice_notes( $invoice_id = 0, $type = '' ) {
62
+    public function get_invoice_notes($invoice_id = 0, $type = '') {
63 63
         $args = array( 
64 64
             'post_id'   => $invoice_id,
65 65
             'order'     => 'comment_date_gmt',
66 66
             'order'     => 'DESC',
67 67
         );
68 68
         
69
-        if ( $type == 'customer' ) {
69
+        if ($type == 'customer') {
70 70
             $args['meta_key']   = '_wpi_customer_note';
71 71
             $args['meta_value'] = 1;
72 72
         }
73 73
         
74
-        $args   = apply_filters( 'wpinv_invoice_notes_args', $args, $this, $invoice_id, $type );
74
+        $args = apply_filters('wpinv_invoice_notes_args', $args, $this, $invoice_id, $type);
75 75
         
76
-        return get_comments( $args );
76
+        return get_comments($args);
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
includes/libraries/GeoIp2/Model/City.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,6 @@
 block discarded – undo
130 130
     private function mostSpecificSubdivision()
131 131
     {
132 132
         return empty($this->subdivisions) ?
133
-            new \GeoIp2\Record\Subdivision(array(), $this->locales) :
134
-            end($this->subdivisions);
133
+            new \GeoIp2\Record\Subdivision(array(), $this->locales) : end($this->subdivisions);
135 134
     }
136 135
 }
Please login to merge, or discard this patch.
includes/libraries/GeoIp2/WebService/Client.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
         // This is for backwards compatibility. Do not remove except for a
77 77
         // major version bump.
78 78
         if (is_string($options)) {
79
-            $options = array( 'host' => $options );
79
+            $options = array('host' => $options);
80 80
         }
81 81
 
82 82
         if (!isset($options['host'])) {
Please login to merge, or discard this patch.
includes/libraries/class-emogrifier.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		if ($nodesWithStyleAttributes !== false) {
239 239
 			/** @var $nodeWithStyleAttribute DOMNode */
240 240
 			foreach ($nodesWithStyleAttributes as $node) {
241
-				$normalizedOriginalStyle = preg_replace_callback( '/[A-z\\-]+(?=\\:)/S', array( $this, 'strtolower' ), $node->getAttribute('style') );
241
+				$normalizedOriginalStyle = preg_replace_callback('/[A-z\\-]+(?=\\:)/S', array($this, 'strtolower'), $node->getAttribute('style'));
242 242
 
243 243
 				// in order to not overwrite existing style attributes in the HTML, we have to save the original HTML styles
244 244
 				$nodePath = $node->getNodePath();
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			}
290 290
 
291 291
 			// now sort the selectors by precedence
292
-			usort($allSelectors, array($this,'sortBySelectorPrecedence'));
292
+			usort($allSelectors, array($this, 'sortBySelectorPrecedence'));
293 293
 
294 294
 			$this->caches[self::CACHE_KEY_CSS][$cssKey] = $allSelectors;
295 295
 		}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		if ($nodesWithStyleDisplayNone->length > 0) {
330 330
 			/** @var $node \DOMNode */
331 331
 			foreach ($nodesWithStyleDisplayNone as $node) {
332
-				if ($node->parentNode && is_callable(array($node->parentNode,'removeChild'))) {
332
+				if ($node->parentNode && is_callable(array($node->parentNode, 'removeChild'))) {
333 333
 					$node->parentNode->removeChild($node);
334 334
 				}
335 335
 			}
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 		$this->copyCssWithMediaToStyleNode($cssParts, $xmlDocument);
339 339
 
340 340
 		if ($this->preserveEncoding) {
341
-			if ( function_exists( 'mb_convert_encoding' ) ) {
342
-				return mb_convert_encoding( $xmlDocument->saveHTML(), self::ENCODING, 'HTML-ENTITIES' );
341
+			if (function_exists('mb_convert_encoding')) {
342
+				return mb_convert_encoding($xmlDocument->saveHTML(), self::ENCODING, 'HTML-ENTITIES');
343 343
 			} else {
344
-				return htmlspecialchars_decode( utf8_encode( html_entity_decode( $xmlDocument->saveHTML(), ENT_COMPAT, self::ENCODING ) ) );
344
+				return htmlspecialchars_decode(utf8_encode(html_entity_decode($xmlDocument->saveHTML(), ENT_COMPAT, self::ENCODING)));
345 345
 			}
346 346
 		} else {
347 347
 			return $xmlDocument->saveHTML();
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	 * @return array
463 463
 	 */
464 464
 	private function splitCssAndMediaQuery($css) {
465
-		$css = preg_replace_callback( '#@media\\s+(?:only\\s)?(?:[\\s{\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', array( $this, '_media_concat' ), $css );
465
+		$css = preg_replace_callback('#@media\\s+(?:only\\s)?(?:[\\s{\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', array($this, '_media_concat'), $css);
466 466
 
467 467
 		// filter the CSS
468 468
 		$search = array(
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 		return array('css' => $css, 'media' => self::$_media);
487 487
 	}
488 488
 
489
-	private function _media_concat( $matches ) {
489
+	private function _media_concat($matches) {
490 490
 		self::$_media .= $matches[0];
491 491
 	}
492 492
 
@@ -524,10 +524,10 @@  discard block
 block discarded – undo
524 524
 			$bodyWithoutUnprocessableTags = $this->html;
525 525
 		}
526 526
 
527
-		if ( function_exists( 'mb_convert_encoding' ) ) {
528
-			return mb_convert_encoding( $bodyWithoutUnprocessableTags, 'HTML-ENTITIES', self::ENCODING );
527
+		if (function_exists('mb_convert_encoding')) {
528
+			return mb_convert_encoding($bodyWithoutUnprocessableTags, 'HTML-ENTITIES', self::ENCODING);
529 529
 		} else {
530
-			return htmlspecialchars_decode( utf8_decode( htmlentities( $bodyWithoutUnprocessableTags, ENT_COMPAT, self::ENCODING, false ) ) );
530
+			return htmlspecialchars_decode(utf8_decode(htmlentities($bodyWithoutUnprocessableTags, ENT_COMPAT, self::ENCODING, false)));
531 531
 		}
532 532
 	}
533 533
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 			$precedence = 0;
563 563
 			$value = 100;
564 564
 			// ids: worth 100, classes: worth 10, elements: worth 1
565
-			$search = array('\\#','\\.','');
565
+			$search = array('\\#', '\\.', '');
566 566
 
567 567
 			foreach ($search as $s) {
568 568
 				if (trim($selector == '')) {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	private function translateCssToXpath($paramCssSelector) {
592 592
 		$cssSelector = ' ' . $paramCssSelector . ' ';
593
-		$cssSelector = preg_replace_callback( '/\s+\w+\s+/', array( $this, 'strtolower' ), $cssSelector );
593
+		$cssSelector = preg_replace_callback('/\s+\w+\s+/', array($this, 'strtolower'), $cssSelector);
594 594
 		$cssSelector = trim($cssSelector);
595 595
 		$xpathKey = md5($cssSelector);
596 596
 		if (!isset($this->caches[self::CACHE_KEY_XPATH][$xpathKey])) {
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	 * @return array
714 714
 	 */
715 715
 	private function parseNth(array $match) {
716
-		if (in_array(strtolower($match[2]), array('even','odd'))) {
716
+		if (in_array(strtolower($match[2]), array('even', 'odd'))) {
717 717
 			$index = strtolower($match[2]) == 'even' ? 0 : 1;
718 718
 			return array(self::MULTIPLIER => 2, self::INDEX => $index);
719 719
 		} elseif (stripos($match[2], 'n') === false) {
Please login to merge, or discard this patch.
includes/libraries/wp-session/wp-cli.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 * @param array $args
22 22
 	 * @param array $assoc_args
23 23
 	 */
24
-	public function count( $args, $assoc_args ) {
24
+	public function count($args, $assoc_args) {
25 25
 		$sessions = WP_Session_Utils::count_sessions();
26 26
 
27
-		\WP_CLI::line( sprintf( '%d sessions currently exist.', absint( $sessions ) ) );
27
+		\WP_CLI::line(sprintf('%d sessions currently exist.', absint($sessions)));
28 28
 	}
29 29
 
30 30
 	/**
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 * @param array $args
54 54
 	 * @param array $assoc_args
55 55
 	 */
56
-	public function delete( $args, $assoc_args ) {
57
-		if ( isset( $assoc_args['limit'] ) ) {
58
-			$limit = absint( $assoc_args['limit'] );
56
+	public function delete($args, $assoc_args) {
57
+		if (isset($assoc_args['limit'])) {
58
+			$limit = absint($assoc_args['limit']);
59 59
 
60
-			$count = WP_Session_Utils::delete_old_sessions( $limit );
60
+			$count = WP_Session_Utils::delete_old_sessions($limit);
61 61
 
62
-			if ( $count > 0 ) {
63
-				\WP_CLI::line( sprintf( 'Deleted %d sessions.', $count ) );
62
+			if ($count > 0) {
63
+				\WP_CLI::line(sprintf('Deleted %d sessions.', $count));
64 64
 			}
65 65
 
66 66
 			// Clear memory
@@ -69,32 +69,32 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 
71 71
 		// Determine if we're deleting all sessions or just a subset.
72
-		$all = isset( $assoc_args['all'] );
72
+		$all = isset($assoc_args['all']);
73 73
 
74 74
 		/**
75 75
 		 * Determine the size of each batch for deletion.
76 76
 		 *
77 77
 		 * @param int
78 78
 		 */
79
-		$batch = isset( $assoc_args['batch'] ) ? absint( $assoc_args['batch'] ) : apply_filters( 'wp_session_delete_batch_size', 1000 );
79
+		$batch = isset($assoc_args['batch']) ? absint($assoc_args['batch']) : apply_filters('wp_session_delete_batch_size', 1000);
80 80
 
81
-		switch ( $all ) {
81
+		switch ($all) {
82 82
 			case true:
83 83
 				$count = WP_Session_Utils::delete_all_sessions();
84 84
 
85
-				\WP_CLI::line( sprintf( 'Deleted all %d sessions.', $count ) );
85
+				\WP_CLI::line(sprintf('Deleted all %d sessions.', $count));
86 86
 				break;
87 87
 			case false:
88 88
 				do {
89
-					$count = WP_Session_Utils::delete_old_sessions( $batch );
89
+					$count = WP_Session_Utils::delete_old_sessions($batch);
90 90
 
91
-					if ( $count > 0 ) {
92
-						\WP_CLI::line( sprintf( 'Deleted %d sessions.', $count ) );
91
+					if ($count > 0) {
92
+						\WP_CLI::line(sprintf('Deleted %d sessions.', $count));
93 93
 					}
94 94
 
95 95
 					// Clear memory
96 96
 					self::free_up_memory();
97
-				} while ( $count > 0 );
97
+				} while ($count > 0);
98 98
 				break;
99 99
 		}
100 100
 	}
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 	 * @param array $args
121 121
 	 * @param array $assoc_args
122 122
 	 */
123
-	public function generate( $args, $assoc_args ) {
124
-		$count = absint( $args[0] );
125
-		$date  = isset( $assoc_args['expires'] ) ? $assoc_args['expires'] : null;
123
+	public function generate($args, $assoc_args) {
124
+		$count = absint($args[0]);
125
+		$date  = isset($assoc_args['expires']) ? $assoc_args['expires'] : null;
126 126
 
127
-		$notify = \WP_CLI\Utils\make_progress_bar( 'Generating sessions', $count );
127
+		$notify = \WP_CLI\Utils\make_progress_bar('Generating sessions', $count);
128 128
 
129
-		for ( $i = 0; $i < $count; $i ++ ) {
130
-			WP_Session_Utils::create_dummy_session( $date );
129
+		for ($i = 0; $i < $count; $i++) {
130
+			WP_Session_Utils::create_dummy_session($date);
131 131
 			$notify->tick();
132 132
 		}
133 133
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		global $wp_object_cache, $wpdb;
145 145
 		$wpdb->queries = array();
146 146
 
147
-		if ( ! is_object( $wp_object_cache ) ) {
147
+		if (!is_object($wp_object_cache)) {
148 148
 			return;
149 149
 		}
150 150
 
@@ -155,4 +155,4 @@  discard block
 block discarded – undo
155 155
 	}
156 156
 }
157 157
 
158
-\WP_CLI::add_command( 'session', 'WP_Session_Command' );
159 158
\ No newline at end of file
159
+\WP_CLI::add_command('session', 'WP_Session_Command');
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
includes/libraries/wp-session/wp-session.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @param string $data
35 35
  */
36
-function wp_session_decode( $data ) {
36
+function wp_session_decode($data) {
37 37
 	$wp_session = WP_Session::get_instance();
38 38
 
39
-	return $wp_session->json_in( $data );
39
+	return $wp_session->json_in($data);
40 40
 }
41 41
 
42 42
 /**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return bool
59 59
  */
60
-function wp_session_regenerate_id( $delete_old_session = false ) {
60
+function wp_session_regenerate_id($delete_old_session = false) {
61 61
 	$wp_session = WP_Session::get_instance();
62 62
 
63
-	$wp_session->regenerate_id( $delete_old_session );
63
+	$wp_session->regenerate_id($delete_old_session);
64 64
 
65 65
 	return true;
66 66
 }
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
  */
75 75
 function wp_session_start() {
76 76
 	$wp_session = WP_Session::get_instance();
77
-	do_action( 'wp_session_start' );
77
+	do_action('wp_session_start');
78 78
 
79 79
 	return $wp_session->session_started();
80 80
 }
81
-if ( ! defined( 'WP_CLI' ) || false === WP_CLI ) {
82
-	add_action( 'plugins_loaded', 'wp_session_start' );
81
+if (!defined('WP_CLI') || false === WP_CLI) {
82
+	add_action('plugins_loaded', 'wp_session_start');
83 83
 }
84 84
 
85 85
 /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 function wp_session_status() {
91 91
 	$wp_session = WP_Session::get_instance();
92 92
 
93
-	if ( $wp_session->session_started() ) {
93
+	if ($wp_session->session_started()) {
94 94
 		return PHP_SESSION_ACTIVE;
95 95
 	}
96 96
 
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 	$wp_session = WP_Session::get_instance();
114 114
 
115 115
 	$wp_session->write_data();
116
-	do_action( 'wp_session_commit' );
116
+	do_action('wp_session_commit');
117 117
 }
118
-if ( ! defined( 'WP_CLI' ) || false === WP_CLI ) {
119
-	add_action( 'shutdown', 'wp_session_write_close' );
118
+if (!defined('WP_CLI') || false === WP_CLI) {
119
+	add_action('shutdown', 'wp_session_write_close');
120 120
 }
121 121
 
122 122
 /**
@@ -127,33 +127,33 @@  discard block
 block discarded – undo
127 127
  * of a scheduled task or cron job.
128 128
  */
129 129
 function wp_session_cleanup() {
130
-	if ( defined( 'WP_SETUP_CONFIG' ) ) {
130
+	if (defined('WP_SETUP_CONFIG')) {
131 131
 		return;
132 132
 	}
133 133
 
134
-	if ( ! defined( 'WP_INSTALLING' ) ) {
134
+	if (!defined('WP_INSTALLING')) {
135 135
 		/**
136 136
 		 * Determine the size of each batch for deletion.
137 137
 		 *
138 138
 		 * @param int
139 139
 		 */
140
-		$batch_size = apply_filters( 'wp_session_delete_batch_size', 1000 );
140
+		$batch_size = apply_filters('wp_session_delete_batch_size', 1000);
141 141
 
142 142
 		// Delete a batch of old sessions
143
-		WP_Session_Utils::delete_old_sessions( $batch_size );
143
+		WP_Session_Utils::delete_old_sessions($batch_size);
144 144
 	}
145 145
 
146 146
 	// Allow other plugins to hook in to the garbage collection process.
147
-	do_action( 'wp_session_cleanup' );
147
+	do_action('wp_session_cleanup');
148 148
 }
149
-add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
149
+add_action('wp_session_garbage_collection', 'wp_session_cleanup');
150 150
 
151 151
 /**
152 152
  * Register the garbage collector as a twice daily event.
153 153
  */
154 154
 function wp_session_register_garbage_collection() {
155
-	if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) {
156
-		wp_schedule_event( time(), 'hourly', 'wp_session_garbage_collection' );
155
+	if (!wp_next_scheduled('wp_session_garbage_collection')) {
156
+		wp_schedule_event(time(), 'hourly', 'wp_session_garbage_collection');
157 157
 	}
158 158
 }
159
-add_action( 'wp', 'wp_session_register_garbage_collection' );
159
+add_action('wp', 'wp_session_register_garbage_collection');
Please login to merge, or discard this patch.
includes/libraries/wp-session/class-wp-session.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return bool|WP_Session
54 54
 	 */
55 55
 	public static function get_instance() {
56
-		if ( ! self::$instance ) {
56
+		if (!self::$instance) {
57 57
 			self::$instance = new self();
58 58
 		}
59 59
 
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire.
70 70
 	 */
71 71
 	protected function __construct() {
72
-		if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) {
73
-			$cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
74
-			$cookie_crumbs = explode( '||', $cookie );
72
+		if (isset($_COOKIE[WP_SESSION_COOKIE])) {
73
+			$cookie = stripslashes($_COOKIE[WP_SESSION_COOKIE]);
74
+			$cookie_crumbs = explode('||', $cookie);
75 75
 
76
-            $this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0] );
77
-            $this->expires = absint( $cookie_crumbs[1] );
78
-            $this->exp_variant = absint( $cookie_crumbs[2] );
76
+            $this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0]);
77
+            $this->expires = absint($cookie_crumbs[1]);
78
+            $this->exp_variant = absint($cookie_crumbs[2]);
79 79
 
80 80
 			// Update the session expiration if we're past the variant time
81
-			if ( time() > $this->exp_variant ) {
81
+			if (time() > $this->exp_variant) {
82 82
 				$this->set_expiration();
83
-				delete_option( "_wp_session_expires_{$this->session_id}" );
84
-				add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
83
+				delete_option("_wp_session_expires_{$this->session_id}");
84
+				add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no');
85 85
 			}
86 86
 		} else {
87 87
 			$this->session_id = WP_Session_Utils::generate_id();
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions.
114 114
 	 */
115 115
 	protected function set_expiration() {
116
-		$this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
117
-		$this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
116
+		$this->exp_variant = time() + (int)apply_filters('wp_session_expiration_variant', 24 * 60);
117
+		$this->expires = time() + (int)apply_filters('wp_session_expiration', 30 * 60);
118 118
 	}
119 119
 
120 120
 	/**
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 	* @uses apply_filters Calls `wp_session_cookie_httponly` to set the $httponly parameter of setcookie()
124 124
 	*/
125 125
 	protected function set_cookie() {
126
-		if ( !defined( 'WPI_TESTING_MODE' ) ) {
126
+		if (!defined('WPI_TESTING_MODE')) {
127 127
 			try {
128 128
 				$secure = apply_filters('wp_session_cookie_secure', false);
129 129
 				$httponly = apply_filters('wp_session_cookie_httponly', false);
130
-				setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN, $secure, $httponly );
131
-			} catch(Exception $e) {
132
-				error_log( 'Set Cookie Error: ' . $e->getMessage() );
130
+				setcookie(WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant, $this->expires, COOKIEPATH, COOKIE_DOMAIN, $secure, $httponly);
131
+			} catch (Exception $e) {
132
+				error_log('Set Cookie Error: ' . $e->getMessage());
133 133
 			}
134 134
 		}
135 135
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return array
143 143
 	 */
144 144
 	protected function read_data() {
145
-		$this->container = get_option( "_wp_session_{$this->session_id}", array() );
145
+		$this->container = get_option("_wp_session_{$this->session_id}", array());
146 146
 
147 147
 		return $this->container;
148 148
 	}
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 	public function write_data() {
154 154
 		$option_key = "_wp_session_{$this->session_id}";
155 155
 		
156
-		if ( false === get_option( $option_key ) ) {
157
-			add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
158
-			add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
156
+		if (false === get_option($option_key)) {
157
+			add_option("_wp_session_{$this->session_id}", $this->container, '', 'no');
158
+			add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no');
159 159
 		} else {
160
-			delete_option( "_wp_session_{$this->session_id}" );
161
-			add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
160
+			delete_option("_wp_session_{$this->session_id}");
161
+			add_option("_wp_session_{$this->session_id}", $this->container, '', 'no');
162 162
 		}
163 163
 	}
164 164
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return string
169 169
 	 */
170 170
 	public function json_out() {
171
-		return json_encode( $this->container );
171
+		return json_encode($this->container);
172 172
 	}
173 173
 
174 174
 	/**
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return bool
180 180
 	 */
181
-	public function json_in( $data ) {
182
-		$array = json_decode( $data );
181
+	public function json_in($data) {
182
+		$array = json_decode($data);
183 183
 
184
-		if ( is_array( $array ) ) {
184
+		if (is_array($array)) {
185 185
 			$this->container = $array;
186 186
 			return true;
187 187
 		}
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @param bool $delete_old Flag whether or not to delete the old session data from the server.
196 196
 	 */
197
-	public function regenerate_id( $delete_old = false ) {
198
-		if ( $delete_old ) {
199
-			delete_option( "_wp_session_{$this->session_id}" );
197
+	public function regenerate_id($delete_old = false) {
198
+		if ($delete_old) {
199
+			delete_option("_wp_session_{$this->session_id}");
200 200
 		}
201 201
 
202 202
 		$this->session_id = WP_Session_Utils::generate_id();
Please login to merge, or discard this patch.
includes/libraries/wp-session/class-recursive-arrayaccess.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param array $data
38 38
 	 */
39
-	protected function __construct( $data = array() ) {
40
-		foreach ( $data as $key => $value ) {
41
-			$this[ $key ] = $value;
39
+	protected function __construct($data = array()) {
40
+		foreach ($data as $key => $value) {
41
+			$this[$key] = $value;
42 42
 		}
43 43
 	}
44 44
 
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 	 * Allow deep copies of objects
47 47
 	 */
48 48
 	public function __clone() {
49
-		foreach ( $this->container as $key => $value ) {
50
-			if ( $value instanceof self ) {
51
-				$this[ $key ] = clone $value;
49
+		foreach ($this->container as $key => $value) {
50
+			if ($value instanceof self) {
51
+				$this[$key] = clone $value;
52 52
 			}
53 53
 		}
54 54
 	}
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function toArray() {
62 62
 		$data = $this->container;
63
-		foreach ( $data as $key => $value ) {
64
-			if ( $value instanceof self ) {
65
-				$data[ $key ] = $value->toArray();
63
+		foreach ($data as $key => $value) {
64
+			if ($value instanceof self) {
65
+				$data[$key] = $value->toArray();
66 66
 			}
67 67
 		}
68 68
 		return $data;
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return boolean true on success or false on failure.
83 83
 	 */
84
-	public function offsetExists( $offset ) {
85
-		return isset( $this->container[ $offset ]) ;
84
+	public function offsetExists($offset) {
85
+		return isset($this->container[$offset]);
86 86
 	}
87 87
 
88 88
 	/**
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @return mixed Can return all value types.
96 96
 	 */
97
-	public function offsetGet( $offset ) {
98
-		return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
97
+	public function offsetGet($offset) {
98
+		return isset($this->container[$offset]) ? $this->container[$offset] : null;
99 99
 	}
100 100
 
101 101
 	/**
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return void
110 110
 	 */
111
-	public function offsetSet( $offset, $data ) {
112
-		if ( is_array( $data ) ) {
113
-			$data = new self( $data );
111
+	public function offsetSet($offset, $data) {
112
+		if (is_array($data)) {
113
+			$data = new self($data);
114 114
 		}
115
-		if ( $offset === null ) { // don't forget this!
115
+		if ($offset === null) { // don't forget this!
116 116
 			$this->container[] = $data;
117 117
 		} else {
118
-			$this->container[ $offset ] = $data;
118
+			$this->container[$offset] = $data;
119 119
 		}
120 120
 
121 121
 		$this->dirty = true;
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return void
132 132
 	 */
133
-	public function offsetUnset( $offset ) {
134
-		unset( $this->container[ $offset ] );
133
+	public function offsetUnset($offset) {
134
+		unset($this->container[$offset]);
135 135
 
136 136
 		$this->dirty = true;
137 137
 	}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return mixed
150 150
 	 */
151 151
 	public function current() {
152
-		return current( $this->container );
152
+		return current($this->container);
153 153
 	}
154 154
 
155 155
 	/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return mixed
161 161
 	 */
162 162
 	public function key() {
163
-		return key( $this->container );
163
+		return key($this->container);
164 164
 	}
165 165
 
166 166
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @return void
172 172
 	 */
173 173
 	public function next() {
174
-		next( $this->container );
174
+		next($this->container);
175 175
 	}
176 176
 
177 177
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @return void
183 183
 	 */
184 184
 	public function rewind() {
185
-		reset( $this->container );
185
+		reset($this->container);
186 186
 	}
187 187
 
188 188
 	/**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @return bool
194 194
 	 */
195 195
 	public function valid() {
196
-		return $this->offsetExists( $this->key() );
196
+		return $this->offsetExists($this->key());
197 197
 	}
198 198
 
199 199
 	/*****************************************************************/
@@ -208,6 +208,6 @@  discard block
 block discarded – undo
208 208
 	 * @return int
209 209
 	 */
210 210
 	public function count() {
211
-		return count( $this->container );
211
+		return count($this->container);
212 212
 	}
213 213
 }
Please login to merge, or discard this patch.