@@ -3,17 +3,17 @@ |
||
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 | } |
@@ -70,8 +70,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -86,7 +86,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -35,27 +35,27 @@ discard block |
||
35 | 35 | $this->title = getenv('PAGANTIS_TITLE'); |
36 | 36 | |
37 | 37 | //Useful vars |
38 | - $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; |
|
38 | + $this->template_path = plugin_dir_path(__FILE__).'../templates/'; |
|
39 | 39 | $this->allowed_currencies = array("EUR"); |
40 | - $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; |
|
40 | + $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)).'/WC_Pagantis.php'; |
|
41 | 41 | $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false); |
42 | 42 | |
43 | 43 | //Panel form fields |
44 | - $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php');//Panel options |
|
44 | + $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php'); //Panel options |
|
45 | 45 | $this->init_settings(); |
46 | 46 | |
47 | - $this->settings['ok_url'] = (getenv('PAGANTIS_URL_OK')!='')?getenv('PAGANTIS_URL_OK'):$this->generateOkUrl(); |
|
48 | - $this->settings['ko_url'] = (getenv('PAGANTIS_URL_KO')!='')?getenv('PAGANTIS_URL_KO'):$this->generateKoUrl(); |
|
47 | + $this->settings['ok_url'] = (getenv('PAGANTIS_URL_OK')!='') ?getenv('PAGANTIS_URL_OK') : $this->generateOkUrl(); |
|
48 | + $this->settings['ko_url'] = (getenv('PAGANTIS_URL_KO')!='') ?getenv('PAGANTIS_URL_KO') : $this->generateKoUrl(); |
|
49 | 49 | foreach ($this->settings as $setting_key => $setting_value) { |
50 | 50 | $this->$setting_key = $setting_value; |
51 | 51 | } |
52 | 52 | |
53 | 53 | //Hooks |
54 | - add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this,'process_admin_options')); //Save plugin options |
|
55 | - add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields |
|
56 | - add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form |
|
57 | - add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification |
|
58 | - add_filter('woocommerce_payment_complete_order_status', array($this,'pagantisCompleteStatus'), 10, 3); |
|
54 | + add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this, 'process_admin_options')); //Save plugin options |
|
55 | + add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields |
|
56 | + add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form |
|
57 | + add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification |
|
58 | + add_filter('woocommerce_payment_complete_order_status', array($this, 'pagantisCompleteStatus'), 10, 3); |
|
59 | 59 | add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2); |
60 | 60 | } |
61 | 61 | |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function loadPagantisTranslation($mofile, $domain) |
69 | 69 | { |
70 | - if ('pagantis' === $domain) { |
|
71 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
70 | + if ('pagantis'===$domain) { |
|
71 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
72 | 72 | } |
73 | 73 | return $mofile; |
74 | 74 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $template_fields = array( |
88 | 88 | 'panel_header' => $this->title, |
89 | 89 | 'panel_description' => $this->method_description, |
90 | - 'button1_label' => __('Login to panel of ', 'pagantis') . ucfirst(WcPagantisGateway::METHOD_ID), |
|
90 | + 'button1_label' => __('Login to panel of ', 'pagantis').ucfirst(WcPagantisGateway::METHOD_ID), |
|
91 | 91 | 'button2_label' => __('Documentation', 'pagantis'), |
92 | 92 | 'logo' => $this->icon, |
93 | 93 | 'settings' => $this->generate_settings_html($this->form_fields, false) |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | public function pagantisCheckFields() |
102 | 102 | { |
103 | 103 | $error_string = ''; |
104 | - if ($this->settings['enabled'] !== 'yes') { |
|
104 | + if ($this->settings['enabled']!=='yes') { |
|
105 | 105 | return; |
106 | 106 | } elseif (!version_compare(phpversion(), '5.3.0', '>=')) { |
107 | - $error_string = __(' is not compatible with your php and/or curl version', 'pagantis'); |
|
107 | + $error_string = __(' is not compatible with your php and/or curl version', 'pagantis'); |
|
108 | 108 | $this->settings['enabled'] = 'no'; |
109 | 109 | } elseif ($this->settings['pagantis_public_key']=="" || $this->settings['pagantis_private_key']=="") { |
110 | 110 | $error_string = __(' is not configured correctly, the fields Public Key and Secret Key are mandatory for use this plugin', 'pagantis'); |
111 | 111 | $this->settings['enabled'] = 'no'; |
112 | 112 | } elseif (!in_array(get_woocommerce_currency(), $this->allowed_currencies)) { |
113 | - $error_string = __(' only can be used in Euros', 'pagantis'); |
|
113 | + $error_string = __(' only can be used in Euros', 'pagantis'); |
|
114 | 114 | $this->settings['enabled'] = 'no'; |
115 | - } elseif (getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS')<'2' |
|
116 | - || getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS')>'12') { |
|
115 | + } elseif (getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS') < '2' |
|
116 | + || getenv('PAGANTIS_SIMULATOR_MAX_INSTALLMENTS') > '12') { |
|
117 | 117 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis'); |
118 | - } elseif (getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS')<'2' |
|
119 | - || getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS')>'12') { |
|
118 | + } elseif (getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS') < '2' |
|
119 | + || getenv('PAGANTIS_SIMULATOR_START_INSTALLMENTS') > '12') { |
|
120 | 120 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis'); |
121 | - } elseif (getenv('PAGANTIS_DISPLAY_MIN_AMOUNT')<0) { |
|
121 | + } elseif (getenv('PAGANTIS_DISPLAY_MIN_AMOUNT') < 0) { |
|
122 | 122 | $error_string = __(' can not have a minimum amount less than 0', 'pagantis'); |
123 | 123 | } |
124 | 124 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | $shippingAddress = $order->get_address('shipping'); |
154 | 154 | $billingAddress = $order->get_address('billing'); |
155 | - if ($shippingAddress['address_1'] == '') { |
|
155 | + if ($shippingAddress['address_1']=='') { |
|
156 | 156 | $shippingAddress = $billingAddress; |
157 | 157 | } |
158 | 158 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | ->setFixPhone($shippingAddress['phone']) |
175 | 175 | ->setMobilePhone($shippingAddress['phone']) |
176 | 176 | ; |
177 | - $orderBillingAddress = new Address(); |
|
177 | + $orderBillingAddress = new Address(); |
|
178 | 178 | $orderBillingAddress |
179 | 179 | ->setZipCode($billingAddress['postcode']) |
180 | 180 | ->setFullName($billingAddress['fist_name']." ".$billingAddress['last_name']) |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | wc_get_template('iframe.php', $template_fields, '', $this->template_path); |
294 | 294 | } |
295 | 295 | } catch (\Exception $exception) { |
296 | - wc_add_notice(__('Payment error ', 'pagantis') . $exception->getMessage(), 'error'); |
|
296 | + wc_add_notice(__('Payment error ', 'pagantis').$exception->getMessage(), 'error'); |
|
297 | 297 | $checkout_url = get_permalink(wc_get_page_id('checkout')); |
298 | 298 | wp_redirect($checkout_url); |
299 | 299 | exit; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | public function pagantisNotification() |
307 | 307 | { |
308 | 308 | try { |
309 | - $origin = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'Notify' : 'Order'; |
|
309 | + $origin = ($_SERVER['REQUEST_METHOD']=='POST') ? 'Notify' : 'Order'; |
|
310 | 310 | |
311 | 311 | include_once('notifyController.php'); |
312 | 312 | $notify = new WcPagantisNotify(); |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function pagantisCompleteStatus($status, $order_id, $order) |
347 | 347 | { |
348 | - if ($order->get_payment_method() == WcPagantisGateway::METHOD_ID) { |
|
349 | - if ($order->get_status() == 'failed') { |
|
348 | + if ($order->get_payment_method()==WcPagantisGateway::METHOD_ID) { |
|
349 | + if ($order->get_status()=='failed') { |
|
350 | 350 | $status = 'processing'; |
351 | - } elseif ($order->get_status() == 'pending' && $status=='completed') { |
|
351 | + } elseif ($order->get_status()=='pending' && $status=='completed') { |
|
352 | 352 | $status = 'processing'; |
353 | 353 | } |
354 | 354 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | public function is_available() |
370 | 370 | { |
371 | 371 | if ($this->enabled==='yes' && $this->pagantis_public_key!='' && $this->pagantis_private_key!='' && |
372 | - $this->get_order_total()>getenv('PAGANTIS_DISPLAY_MIN_AMOUNT')) { |
|
372 | + $this->get_order_total() > getenv('PAGANTIS_DISPLAY_MIN_AMOUNT')) { |
|
373 | 373 | return true; |
374 | 374 | } |
375 | 375 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | $redirectUrl = $order->get_checkout_payment_url(true); //pagantisReceiptPage function |
399 | 399 | if (strpos($redirectUrl, 'order-pay=')===false) { |
400 | - $redirectUrl.= "&order-pay=".$order_id; |
|
400 | + $redirectUrl .= "&order-pay=".$order_id; |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | return array( |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | ); |
407 | 407 | |
408 | 408 | } catch (Exception $e) { |
409 | - wc_add_notice(__('Payment error ', 'pagantis') . $e->getMessage(), 'error'); |
|
409 | + wc_add_notice(__('Payment error ', 'pagantis').$e->getMessage(), 'error'); |
|
410 | 410 | return array(); |
411 | 411 | } |
412 | 412 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | private function generateUrl($url) |
459 | 459 | { |
460 | 460 | $parsed_url = parse_url($url); |
461 | - if ($parsed_url !== false) { |
|
461 | + if ($parsed_url!==false) { |
|
462 | 462 | $parsed_url['query'] = !isset($parsed_url['query']) ? '' : $parsed_url['query']; |
463 | 463 | parse_str($parsed_url['query'], $arrayParams); |
464 | 464 | foreach ($arrayParams as $keyParam => $valueParam) { |
@@ -506,11 +506,10 @@ discard block |
||
506 | 506 | private function getKeysUrl($order, $url) |
507 | 507 | { |
508 | 508 | $defaultFields = (get_class($order)=='WC_Order') ? |
509 | - array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : |
|
510 | - array(); |
|
509 | + array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : array(); |
|
511 | 510 | |
512 | 511 | $parsedUrl = parse_url($url); |
513 | - if ($parsedUrl !== false) { |
|
512 | + if ($parsedUrl!==false) { |
|
514 | 513 | //Replace parameters from url |
515 | 514 | $parsedUrl['query'] = $this->getKeysParametersUrl($parsedUrl['query'], $defaultFields); |
516 | 515 | |
@@ -555,7 +554,7 @@ discard block |
||
555 | 554 | foreach ($arrayParams as $keyParam => $valueParam) { |
556 | 555 | preg_match('#\{{.*?}\}#', $valueParam, $match); |
557 | 556 | if (count($match)) { |
558 | - $key = str_replace(array('{{','}}'), array('',''), $match[0]); |
|
557 | + $key = str_replace(array('{{', '}}'), array('', ''), $match[0]); |
|
559 | 558 | $arrayParams[$keyParam] = $defaultFields[$key]; |
560 | 559 | } |
561 | 560 | } |
@@ -570,13 +569,13 @@ discard block |
||
570 | 569 | */ |
571 | 570 | private function unparseUrl($parsed_url) |
572 | 571 | { |
573 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
572 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
574 | 573 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
575 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
576 | - $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
577 | - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
574 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
575 | + $query = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
|
576 | + $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
|
578 | 577 | $path = $parsed_url['path']; |
579 | - return $scheme . $host . $port . $path . $query . $fragment; |
|
578 | + return $scheme.$host.$port.$path.$query.$fragment; |
|
580 | 579 | } |
581 | 580 | |
582 | 581 | /** |
@@ -598,20 +597,20 @@ discard block |
||
598 | 597 | $is_guest = "false"; |
599 | 598 | $sign_up = substr($current_user->user_registered, 0, 10); |
600 | 599 | $customer_orders = get_posts(array( |
601 | - 'numberposts' => - 1, |
|
600 | + 'numberposts' => -1, |
|
602 | 601 | 'meta_key' => '_customer_user', |
603 | 602 | 'meta_value' => $current_user->ID, |
604 | - 'post_type' => array( 'shop_order' ), |
|
605 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded' ), |
|
603 | + 'post_type' => array('shop_order'), |
|
604 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'), |
|
606 | 605 | )); |
607 | 606 | } else { |
608 | 607 | $is_guest = "true"; |
609 | 608 | $customer_orders = get_posts(array( |
610 | - 'numberposts' => - 1, |
|
609 | + 'numberposts' => -1, |
|
611 | 610 | 'meta_key' => '_billing_email', |
612 | 611 | 'meta_value' => $billingEmail, |
613 | - 'post_type' => array( 'shop_order' ), |
|
614 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded'), |
|
612 | + 'post_type' => array('shop_order'), |
|
613 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'), |
|
615 | 614 | )); |
616 | 615 | foreach ($customer_orders as $customer_order) { |
617 | 616 | if (trim($sign_up)=='' || |
@@ -640,7 +639,7 @@ discard block |
||
640 | 639 | //Check if id exists |
641 | 640 | $resultsSelect = $wpdb->get_results("select * from $tableName where id='$orderId'"); |
642 | 641 | $countResults = count($resultsSelect); |
643 | - if ($countResults == 0) { |
|
642 | + if ($countResults==0) { |
|
644 | 643 | $wpdb->insert( |
645 | 644 | $tableName, |
646 | 645 | array('id' => $orderId, 'order_id' => $pagantisOrderId), |
@@ -665,7 +664,7 @@ discard block |
||
665 | 664 | global $wpdb; |
666 | 665 | $tableName = $wpdb->prefix.self::ORDERS_TABLE; |
667 | 666 | |
668 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
667 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
669 | 668 | $charset_collate = $wpdb->get_charset_collate(); |
670 | 669 | $sql = "CREATE TABLE $tableName ( id int, order_id varchar(50), wc_order_id varchar(50), |
671 | 670 | UNIQUE KEY id (id)) $charset_collate"; |