Passed
Pull Request — master (#13)
by
unknown
02:21
created
templates/product_simulator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@
 block discarded – undo
3 3
 
4 4
     function loadSimulator()
5 5
     {
6
-        var positionSelector = '<? echo $positionSelector;?>';
6
+        var positionSelector = '<? echo $positionSelector; ?>';
7 7
         if (positionSelector === 'default') {
8 8
             positionSelector = '.PagantisSimulator';
9 9
         }
10 10
 
11
-        var priceSelector = '<? echo $priceSelector;?>';
11
+        var priceSelector = '<? echo $priceSelector; ?>';
12 12
         if (priceSelector === 'default') {
13 13
             priceSelector = 'div.summary.entry-summary span.woocommerce-Price-amount.amount';
14 14
         }
15 15
 
16
-        var quantitySelector = '<? echo $quantitySelector;?>';
16
+        var quantitySelector = '<? echo $quantitySelector; ?>';
17 17
         if (quantitySelector === 'default') {
18 18
             quantitySelector = 'div.quantity>input';
19 19
         }
Please login to merge, or discard this patch.
WC_Pagantis.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function loadPagantisTranslation($mofile, $domain)
72 72
     {
73
-        if ('pagantis' === $domain) {
74
-            $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo';
73
+        if ('pagantis'===$domain) {
74
+            $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo';
75 75
         }
76 76
         return $mofile;
77 77
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $tableName = $wpdb->prefix.self::CONFIG_TABLE;
86 86
 
87 87
         //Check if table exists
88
-        $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName;
88
+        $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName;
89 89
         if ($tableExists) {
90 90
             $charset_collate = $wpdb->get_charset_collate();
91 91
             $sql = "CREATE TABLE IF NOT EXISTS $tableName (
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         }
114 114
 
115 115
         foreach (array_merge($this->defaultConfigs, $simpleDbConfigs) as $key => $value) {
116
-            putenv($key . '=' . $value);
116
+            putenv($key.'='.$value);
117 117
         }
118 118
 
119 119
         //Current plugin config: pagantis_public_key => New field --- public_key => Old field
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
         global $product;
141 141
 
142 142
         $cfg = get_option('woocommerce_pagantis_settings');
143
-        if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' ||
144
-            $cfg['simulator'] !== 'yes') {
143
+        if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']=='' || $cfg['pagantis_private_key']=='' ||
144
+            $cfg['simulator']!=='yes') {
145 145
             return;
146 146
         }
147 147
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function addPagantisGateway($methods)
168 168
     {
169
-        if (! class_exists('WC_Payment_Gateway')) {
169
+        if (!class_exists('WC_Payment_Gateway')) {
170 170
             return $methods;
171 171
         }
172 172
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function pagantisRowMeta($links, $file)
221 221
     {
222
-        if ($file == plugin_basename(__FILE__)) {
222
+        if ($file==plugin_basename(__FILE__)) {
223 223
             $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>';
224 224
             $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'.
225 225
             __('API documentation', 'pagantis').'</a>';
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         $tableName = $wpdb->prefix.self::LOGS_TABLE;
248 248
         $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc";
249 249
         $results = $wpdb->get_results($query);
250
-        if (isset($results) && $privateKey == $secretKey) {
250
+        if (isset($results) && $privateKey==$secretKey) {
251 251
             foreach ($results as $key => $result) {
252 252
                 $response[$key]['timestamp'] = $result->createdAt;
253 253
                 $response[$key]['log']       = json_decode($result->log);
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 
275 275
         $filters   = ($data->get_params());
276 276
         $secretKey = $filters['secret'];
277
-        $cfg  = get_option('woocommerce_pagantis_settings');
277
+        $cfg = get_option('woocommerce_pagantis_settings');
278 278
         $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null;
279
-        if ($privateKey != $secretKey) {
279
+        if ($privateKey!=$secretKey) {
280 280
             $response['status'] = 401;
281 281
             $response['result'] = 'Unauthorized';
282
-        } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
282
+        } elseif ($_SERVER['REQUEST_METHOD']=='POST') {
283 283
             if (count($_POST)) {
284 284
                 foreach ($_POST as $config => $value) {
285 285
                     if (isset($this->defaultConfigs[$config]) && $response['status']==null) {
Please login to merge, or discard this patch.
controllers/notifyController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             $this->insertLog($exception);
87 87
         }
88 88
 
89
-        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
89
+        if ($_SERVER['REQUEST_METHOD']=='POST') {
90 90
             $jsonResponse->printResponse();
91 91
         } else {
92 92
             return $jsonResponse;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     private function checkConcurrency()
104 104
     {
105 105
         $this->woocommerceOrderId = $_GET['order-received'];
106
-        if ($this->woocommerceOrderId == '') {
106
+        if ($this->woocommerceOrderId=='') {
107 107
             throw new QuoteNotFoundException();
108 108
         }
109 109
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $queryResult = $wpdb->get_row("select order_id from $tableName where id='".$this->woocommerceOrderId."'");
132 132
         $this->pagantisOrderId = $queryResult->order_id;
133 133
 
134
-        if ($this->pagantisOrderId == '') {
134
+        if ($this->pagantisOrderId=='') {
135 135
             throw new NoIdentificationException();
136 136
         }
137 137
     }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     {
197 197
         $pagantisAmount = $this->pagantisOrder->getShoppingCart()->getTotalAmount();
198 198
         $wcAmount = intval(strval(100 * $this->woocommerceOrder->get_total()));
199
-        if ($pagantisAmount != $wcAmount) {
199
+        if ($pagantisAmount!=$wcAmount) {
200 200
             throw new AmountMismatchException($pagantisAmount, $wcAmount);
201 201
         }
202 202
     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         global $wpdb;
238 238
         $tableName = $wpdb->prefix.self::ORDERS_TABLE;
239 239
 
240
-        if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) {
240
+        if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) {
241 241
             $charset_collate = $wpdb->get_charset_collate();
242 242
             $sql             = "CREATE TABLE $tableName (id int, order_id varchar(50), wc_order_id varchar(50), 
243 243
                   UNIQUE KEY id (id)) $charset_collate";
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         global $wpdb;
256 256
         $tableName = $wpdb->prefix.self::LOGS_TABLE;
257 257
 
258
-        if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) {
258
+        if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) {
259 259
             $charset_collate = $wpdb->get_charset_collate();
260 260
             $sql = "CREATE TABLE $tableName ( id int NOT NULL AUTO_INCREMENT, log text NOT NULL, 
261 261
                     createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (id)) $charset_collate";
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 
355 355
         if ($exception instanceof \Exception) {
356 356
             $this->checkDbLogTable();
357
-            $logEntry= new LogEntry();
357
+            $logEntry = new LogEntry();
358 358
             $logEntryJson = $logEntry->error($exception)->toJson();
359 359
 
360 360
             $tableName = $wpdb->prefix.self::LOGS_TABLE;
Please login to merge, or discard this patch.
controllers/paymentController.php 1 patch
Spacing   +48 added lines, -49 removed lines patch added patch discarded remove patch
@@ -33,27 +33,27 @@  discard block
 block discarded – undo
33 33
         $this->has_fields = true;
34 34
 
35 35
         //Useful vars
36
-        $this->template_path = plugin_dir_path(__FILE__) . '../templates/';
36
+        $this->template_path = plugin_dir_path(__FILE__).'../templates/';
37 37
         $this->allowed_currencies = array("EUR");
38
-        $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php';
38
+        $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)).'/WC_Pagantis.php';
39 39
         $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false);
40 40
 
41 41
         //Panel form fields
42
-        $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php');//Panel options
42
+        $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php'); //Panel options
43 43
         $this->init_settings();
44 44
 
45
-        $this->settings['ok_url'] = (getenv('PAGANTIS_URL_OK')!='')?getenv('PAGANTIS_URL_OK'):$this->generateOkUrl();
46
-        $this->settings['ko_url'] = (getenv('PAGANTIS_URL_KO')!='')?getenv('PAGANTIS_URL_KO'):$this->generateKoUrl();
45
+        $this->settings['ok_url'] = (getenv('PAGANTIS_URL_OK')!='') ?getenv('PAGANTIS_URL_OK') : $this->generateOkUrl();
46
+        $this->settings['ko_url'] = (getenv('PAGANTIS_URL_KO')!='') ?getenv('PAGANTIS_URL_KO') : $this->generateKoUrl();
47 47
         foreach ($this->settings as $setting_key => $setting_value) {
48 48
             $this->$setting_key = $setting_value;
49 49
         }
50 50
 
51 51
         //Hooks
52
-        add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this,'process_admin_options')); //Save plugin options
53
-        add_action('admin_notices', array($this, 'pagantisCheckFields'));                          //Check config fields
54
-        add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage'));          //Pagantis form
55
-        add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification'));      //Json Notification
56
-        add_filter('woocommerce_payment_complete_order_status', array($this,'pagantisCompleteStatus'), 10, 3);
52
+        add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this, 'process_admin_options')); //Save plugin options
53
+        add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields
54
+        add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form
55
+        add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification
56
+        add_filter('woocommerce_payment_complete_order_status', array($this, 'pagantisCompleteStatus'), 10, 3);
57 57
         add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2);
58 58
     }
59 59
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function loadPagantisTranslation($mofile, $domain)
66 66
     {
67
-        if ('pagantis' === $domain) {
68
-            $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo';
67
+        if ('pagantis'===$domain) {
68
+            $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo';
69 69
         }
70 70
         return $mofile;
71 71
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $template_fields = array(
85 85
             'panel_header' => $this->title,
86 86
             'panel_description' => $this->method_description,
87
-            'button1_label' => __('Login to panel of ', 'pagantis') . ucfirst(WcPagantisGateway::METHOD_ID),
87
+            'button1_label' => __('Login to panel of ', 'pagantis').ucfirst(WcPagantisGateway::METHOD_ID),
88 88
             'button2_label' => __('Documentation', 'pagantis'),
89 89
             'logo' => $this->icon,
90 90
             'settings' => $this->generate_settings_html($this->form_fields, false)
@@ -98,24 +98,24 @@  discard block
 block discarded – undo
98 98
     public function pagantisCheckFields()
99 99
     {
100 100
         $error_string = '';
101
-        if ($this->settings['enabled'] !== 'yes') {
101
+        if ($this->settings['enabled']!=='yes') {
102 102
             return;
103 103
         } elseif (!version_compare(phpversion(), '5.3.0', '>=')) {
104
-            $error_string =  __(' is not compatible with your php and/or curl version', 'pagantis');
104
+            $error_string = __(' is not compatible with your php and/or curl version', 'pagantis');
105 105
             $this->settings['enabled'] = 'no';
106 106
         } elseif ($this->settings['pagantis_public_key']=="" || $this->settings['pagantis_private_key']=="") {
107 107
             $error_string = __(' is not configured correctly, the fields Public Key and Secret Key are mandatory for use this plugin', 'pagantis');
108 108
             $this->settings['enabled'] = 'no';
109 109
         } elseif (!in_array(get_woocommerce_currency(), $this->allowed_currencies)) {
110
-            $error_string =  __(' only can be used in Euros', 'pagantis');
110
+            $error_string = __(' only can be used in Euros', 'pagantis');
111 111
             $this->settings['enabled'] = 'no';
112
-        } elseif (getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS')<'2'
113
-                  || getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS')>'12') {
112
+        } elseif (getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS') < '2'
113
+                  || getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS') > '12') {
114 114
             $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
115
-        } elseif (getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS')<'2'
116
-                  || getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS')>'12') {
115
+        } elseif (getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS') < '2'
116
+                  || getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS') > '12') {
117 117
             $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
118
-        } elseif (getenv('PAGANTIS_DISPLAY_MIN_AMOUNT')<0) {
118
+        } elseif (getenv('PAGANTIS_DISPLAY_MIN_AMOUNT') < 0) {
119 119
             $error_string = __(' can not have a minimum amount less than 0', 'pagantis');
120 120
         }
121 121
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
             $shippingAddress = $order->get_address('shipping');
149 149
             $billingAddress = $order->get_address('billing');
150
-            if ($shippingAddress['address_1'] == '') {
150
+            if ($shippingAddress['address_1']=='') {
151 151
                 $shippingAddress = $billingAddress;
152 152
             }
153 153
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 ->setFixPhone($shippingAddress['phone'])
170 170
                 ->setMobilePhone($shippingAddress['phone'])
171 171
             ;
172
-            $orderBillingAddress =  new Address();
172
+            $orderBillingAddress = new Address();
173 173
             $orderBillingAddress
174 174
                 ->setZipCode($billingAddress['postcode'])
175 175
                 ->setFullName($billingAddress['fist_name']." ".$billingAddress['last_name'])
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                 wc_get_template('iframe.php', $template_fields, '', $this->template_path);
289 289
             }
290 290
         } catch (\Exception $exception) {
291
-            wc_add_notice(__('Payment error ', 'pagantis') . $exception->getMessage(), 'error');
291
+            wc_add_notice(__('Payment error ', 'pagantis').$exception->getMessage(), 'error');
292 292
             $checkout_url = get_permalink(wc_get_page_id('checkout'));
293 293
             wp_redirect($checkout_url);
294 294
             exit;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     public function pagantisNotification()
302 302
     {
303 303
         try {
304
-            $origin = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'Notify' : 'Order';
304
+            $origin = ($_SERVER['REQUEST_METHOD']=='POST') ? 'Notify' : 'Order';
305 305
 
306 306
             include_once('notifyController.php');
307 307
             $notify = new WcPagantisNotify();
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
      */
341 341
     public function pagantisCompleteStatus($status, $order_id, $order)
342 342
     {
343
-        if ($order->get_payment_method() == WcPagantisGateway::METHOD_ID) {
344
-            if ($order->get_status() == 'failed') {
343
+        if ($order->get_payment_method()==WcPagantisGateway::METHOD_ID) {
344
+            if ($order->get_status()=='failed') {
345 345
                 $status = 'processing';
346
-            } elseif ($order->get_status() == 'pending' && $status=='completed') {
346
+            } elseif ($order->get_status()=='pending' && $status=='completed') {
347 347
                 $status = 'processing';
348 348
             }
349 349
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     public function is_available()
365 365
     {
366 366
         if ($this->enabled==='yes' && $this->pagantis_public_key!='' && $this->pagantis_private_key!='' &&
367
-            $this->get_order_total()>getenv('PAGANTIS_DISPLAY_MIN_AMOUNT')) {
367
+            $this->get_order_total() > getenv('PAGANTIS_DISPLAY_MIN_AMOUNT')) {
368 368
             return true;
369 369
         }
370 370
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
             $redirectUrl = $order->get_checkout_payment_url(true); //pagantisReceiptPage function
394 394
             if (strpos($redirectUrl, 'order-pay=')===false) {
395
-                $redirectUrl.= "&order-pay=".$order_id;
395
+                $redirectUrl .= "&order-pay=".$order_id;
396 396
             }
397 397
 
398 398
             return array(
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             );
402 402
 
403 403
         } catch (Exception $e) {
404
-            wc_add_notice(__('Payment error ', 'pagantis') . $e->getMessage(), 'error');
404
+            wc_add_notice(__('Payment error ', 'pagantis').$e->getMessage(), 'error');
405 405
             return array();
406 406
         }
407 407
     }
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
     private function generateUrl($url)
454 454
     {
455 455
         $parsed_url = parse_url($url);
456
-        if ($parsed_url !== false) {
456
+        if ($parsed_url!==false) {
457 457
             $parsed_url['query'] = !isset($parsed_url['query']) ? '' : $parsed_url['query'];
458 458
             parse_str($parsed_url['query'], $arrayParams);
459 459
             foreach ($arrayParams as $keyParam => $valueParam) {
@@ -501,11 +501,10 @@  discard block
 block discarded – undo
501 501
     private function getKeysUrl($order, $url)
502 502
     {
503 503
         $defaultFields = (get_class($order)=='WC_Order') ?
504
-            array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) :
505
-            array();
504
+            array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : array();
506 505
 
507 506
         $parsedUrl = parse_url($url);
508
-        if ($parsedUrl !== false) {
507
+        if ($parsedUrl!==false) {
509 508
             //Replace parameters from url
510 509
             $parsedUrl['query'] = $this->getKeysParametersUrl($parsedUrl['query'], $defaultFields);
511 510
 
@@ -550,7 +549,7 @@  discard block
 block discarded – undo
550 549
         foreach ($arrayParams as $keyParam => $valueParam) {
551 550
             preg_match('#\{{.*?}\}#', $valueParam, $match);
552 551
             if (count($match)) {
553
-                $key = str_replace(array('{{','}}'), array('',''), $match[0]);
552
+                $key = str_replace(array('{{', '}}'), array('', ''), $match[0]);
554 553
                 $arrayParams[$keyParam] = $defaultFields[$key];
555 554
             }
556 555
         }
@@ -565,13 +564,13 @@  discard block
 block discarded – undo
565 564
      */
566 565
     private function unparseUrl($parsed_url)
567 566
     {
568
-        $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
567
+        $scheme   = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : '';
569 568
         $host     = isset($parsed_url['host']) ? $parsed_url['host'] : '';
570
-        $port     = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
571
-        $query    = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
572
-        $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
569
+        $port     = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : '';
570
+        $query    = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : '';
571
+        $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : '';
573 572
         $path     = $parsed_url['path'];
574
-        return $scheme . $host . $port . $path . $query . $fragment;
573
+        return $scheme.$host.$port.$path.$query.$fragment;
575 574
     }
576 575
 
577 576
     /**
@@ -593,20 +592,20 @@  discard block
 block discarded – undo
593 592
             $is_guest = "false";
594 593
             $sign_up = substr($current_user->user_registered, 0, 10);
595 594
             $customer_orders = get_posts(array(
596
-                'numberposts' => - 1,
595
+                'numberposts' => -1,
597 596
                 'meta_key'    => '_customer_user',
598 597
                 'meta_value'  => $current_user->ID,
599
-                'post_type'   => array( 'shop_order' ),
600
-                'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded' ),
598
+                'post_type'   => array('shop_order'),
599
+                'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
601 600
             ));
602 601
         } else {
603 602
             $is_guest = "true";
604 603
             $customer_orders = get_posts(array(
605
-                'numberposts' => - 1,
604
+                'numberposts' => -1,
606 605
                 'meta_key'    => '_billing_email',
607 606
                 'meta_value'  => $billingEmail,
608
-                'post_type'   => array( 'shop_order' ),
609
-                'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded'),
607
+                'post_type'   => array('shop_order'),
608
+                'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
610 609
             ));
611 610
             foreach ($customer_orders as $customer_order) {
612 611
                 if (trim($sign_up)=='' ||
@@ -635,7 +634,7 @@  discard block
 block discarded – undo
635 634
         //Check if id exists
636 635
         $resultsSelect = $wpdb->get_results("select * from $tableName where id='$orderId'");
637 636
         $countResults = count($resultsSelect);
638
-        if ($countResults == 0) {
637
+        if ($countResults==0) {
639 638
             $wpdb->insert(
640 639
                 $tableName,
641 640
                 array('id' => $orderId, 'order_id' => $pagantisOrderId),
@@ -660,7 +659,7 @@  discard block
 block discarded – undo
660 659
         global $wpdb;
661 660
         $tableName = $wpdb->prefix.self::ORDERS_TABLE;
662 661
 
663
-        if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) {
662
+        if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) {
664 663
             $charset_collate = $wpdb->get_charset_collate();
665 664
             $sql             = "CREATE TABLE $tableName ( id int, order_id varchar(50), wc_order_id varchar(50),  
666 665
                   UNIQUE KEY id (id)) $charset_collate";
Please login to merge, or discard this patch.