@@ -192,10 +192,10 @@ |
||
192 | 192 | |
193 | 193 | if (!$this->woocommerceOrder->has_status($isValidStatus)) { // TO CONFIRM |
194 | 194 | $logMessage = "WARNING checkMerchantOrderStatus." . |
195 | - " Merchant order id:".$this->woocommerceOrder->get_id(). |
|
196 | - " Merchant order status:".$this->woocommerceOrder->get_status(). |
|
197 | - " Pagantis order id:".$this->pagantisOrder->getStatus(). |
|
198 | - " Pagantis order status:".$this->pagantisOrder->getId(); |
|
195 | + " Merchant order id:".$this->woocommerceOrder->get_id(). |
|
196 | + " Merchant order status:".$this->woocommerceOrder->get_status(). |
|
197 | + " Pagantis order id:".$this->pagantisOrder->getStatus(). |
|
198 | + " Pagantis order status:".$this->pagantisOrder->getId(); |
|
199 | 199 | |
200 | 200 | $this->insertLog(null, $logMessage); |
201 | 201 | $this->woocommerceOrder->add_order_note($logMessage); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | private function checkConcurrency() |
108 | 108 | { |
109 | 109 | $this->woocommerceOrderId = $_GET['order-received']; |
110 | - if ($this->woocommerceOrderId == '') { |
|
110 | + if ($this->woocommerceOrderId=='') { |
|
111 | 111 | throw new QuoteNotFoundException(); |
112 | 112 | } |
113 | 113 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $queryResult = $wpdb->get_row("select order_id from $tableName where id='".$this->woocommerceOrderId."'"); |
140 | 140 | $this->pagantisOrderId = $queryResult->order_id; |
141 | 141 | |
142 | - if ($this->pagantisOrderId == '') { |
|
142 | + if ($this->pagantisOrderId=='') { |
|
143 | 143 | throw new NoIdentificationException(); |
144 | 144 | } |
145 | 145 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $status = '-'; |
174 | 174 | } |
175 | 175 | |
176 | - if ($status === Order::STATUS_CONFIRMED) { |
|
176 | + if ($status===Order::STATUS_CONFIRMED) { |
|
177 | 177 | return true; |
178 | 178 | } |
179 | 179 | throw new WrongStatusException($status); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | ); |
195 | 195 | |
196 | 196 | if (!$this->woocommerceOrder->has_status($isValidStatus)) { // TO CONFIRM |
197 | - $logMessage = "WARNING checkMerchantOrderStatus." . |
|
197 | + $logMessage = "WARNING checkMerchantOrderStatus.". |
|
198 | 198 | " Merchant order id:".$this->woocommerceOrder->get_id(). |
199 | 199 | " Merchant order status:".$this->woocommerceOrder->get_status(). |
200 | 200 | " Pagantis order id:".$this->pagantisOrder->getStatus(). |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $pagantisAmount = $this->pagantisOrder->getShoppingCart()->getTotalAmount(); |
218 | 218 | $wcAmount = (string) floor(100 * $this->woocommerceOrder->get_total()); |
219 | - if ($pagantisAmount != $wcAmount) { |
|
219 | + if ($pagantisAmount!=$wcAmount) { |
|
220 | 220 | throw new AmountMismatchException($pagantisAmount, $wcAmount); |
221 | 221 | } |
222 | 222 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->pagantisOrder = $this->orderClient->confirmOrder($this->pagantisOrderId); |
241 | 241 | } catch (\Exception $e) { |
242 | 242 | $this->pagantisOrder = $this->orderClient->getOrder($this->pagantisOrderId); |
243 | - if ($this->pagantisOrder->getStatus() !== Order::STATUS_CONFIRMED) { |
|
243 | + if ($this->pagantisOrder->getStatus()!==Order::STATUS_CONFIRMED) { |
|
244 | 244 | throw new UnknownException($e->getMessage()); |
245 | 245 | } else { |
246 | 246 | $logMessage = 'Concurrency issue: Order_id '.$this->pagantisOrderId.' was confirmed by other process'; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | global $wpdb; |
265 | 265 | $tableName = $wpdb->prefix.self::ORDERS_TABLE; |
266 | 266 | |
267 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
267 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
268 | 268 | $charset_collate = $wpdb->get_charset_collate(); |
269 | 269 | $sql = "CREATE TABLE $tableName (id int, order_id varchar(50), wc_order_id varchar(50), |
270 | 270 | UNIQUE KEY id (id)) $charset_collate"; |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | global $wpdb; |
283 | 283 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
284 | 284 | |
285 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
285 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
286 | 286 | $charset_collate = $wpdb->get_charset_collate(); |
287 | 287 | $sql = "CREATE TABLE $tableName ( id int NOT NULL AUTO_INCREMENT, log text NOT NULL, |
288 | 288 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (id)) $charset_collate"; |
@@ -339,12 +339,12 @@ discard block |
||
339 | 339 | $metadataOrder = $this->pagantisOrder->getMetadata(); |
340 | 340 | $metadataInfo = null; |
341 | 341 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
342 | - if ($metadataKey == 'promotedProduct') { |
|
343 | - $metadataInfo.= "/Producto promocionado = $metadataValue"; |
|
342 | + if ($metadataKey=='promotedProduct') { |
|
343 | + $metadataInfo .= "/Producto promocionado = $metadataValue"; |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
347 | - if ($metadataInfo != null) { |
|
347 | + if ($metadataInfo!=null) { |
|
348 | 348 | $this->woocommerceOrder->add_order_note($metadataInfo); |
349 | 349 | } |
350 | 350 | |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | { |
414 | 414 | global $wpdb; |
415 | 415 | $tableName = $wpdb->prefix.self::CONCURRENCY_TABLE; |
416 | - if ($orderId == null) { |
|
416 | + if ($orderId==null) { |
|
417 | 417 | $query = "DELETE FROM $tableName WHERE createdAt<(NOW()- INTERVAL ".self::CONCURRENCY_TIMEOUT." SECOND)"; |
418 | 418 | } else { |
419 | 419 | $query = "DELETE FROM $tableName WHERE order_id = $orderId"; |
420 | 420 | } |
421 | 421 | $resultDelete = $wpdb->query($query); |
422 | - if ($resultDelete === false) { |
|
422 | + if ($resultDelete===false) { |
|
423 | 423 | throw new ConcurrencyException(); |
424 | 424 | } |
425 | 425 | } |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | global $wpdb; |
435 | 435 | $tableName = $wpdb->prefix.self::CONCURRENCY_TABLE; |
436 | 436 | $insertResult = $wpdb->insert($tableName, array('order_id' => $orderId)); |
437 | - if ($insertResult === false) { |
|
438 | - if ($this->getOrigin() == 'Notify') { |
|
437 | + if ($insertResult===false) { |
|
438 | + if ($this->getOrigin()=='Notify') { |
|
439 | 439 | throw new ConcurrencyException(); |
440 | 440 | } else { |
441 | 441 | $query = sprintf( |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | ); |
447 | 447 | $resultSeconds = $wpdb->get_row($query); |
448 | 448 | $restSeconds = isset($resultSeconds) ? ($resultSeconds->rest) : 0; |
449 | - $secondsToExpire = ($restSeconds>self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds; |
|
450 | - sleep($secondsToExpire+1); |
|
449 | + $secondsToExpire = ($restSeconds > self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds; |
|
450 | + sleep($secondsToExpire + 1); |
|
451 | 451 | |
452 | 452 | $logMessage = sprintf( |
453 | 453 | "User waiting %s seconds, default seconds %s, bd time to expire %s seconds", |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | { |
473 | 473 | $this->unblockConcurrency($this->woocommerceOrderId); |
474 | 474 | |
475 | - if ($exception == null) { |
|
475 | + if ($exception==null) { |
|
476 | 476 | $jsonResponse = new JsonSuccessResponse(); |
477 | 477 | } else { |
478 | 478 | $jsonResponse = new JsonExceptionResponse(); |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $jsonResponse->setMerchantOrderId($this->woocommerceOrderId); |
483 | 483 | $jsonResponse->setPagantisOrderId($this->pagantisOrderId); |
484 | 484 | |
485 | - if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
485 | + if ($_SERVER['REQUEST_METHOD']=='POST') { |
|
486 | 486 | $jsonResponse->printResponse(); |
487 | 487 | } else { |
488 | 488 | return $jsonResponse; |
@@ -277,9 +277,9 @@ |
||
277 | 277 | if ($promotedProduct == 'true') { |
278 | 278 | $promotedAmount+=$product->getAmount(); |
279 | 279 | $promotedMessage = 'Promoted Item: ' . $product->getDescription() . |
280 | - ' Price: ' . $item['line_total'] . |
|
281 | - ' Qty: ' . $product->getQuantity() . |
|
282 | - ' Item ID: ' . $item['id_product']; |
|
280 | + ' Price: ' . $item['line_total'] . |
|
281 | + ' Qty: ' . $product->getQuantity() . |
|
282 | + ' Item ID: ' . $item['id_product']; |
|
283 | 283 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
284 | 284 | } |
285 | 285 | } |
@@ -54,38 +54,38 @@ discard block |
||
54 | 54 | $this->method_title = ucfirst($this->id); |
55 | 55 | |
56 | 56 | //Useful vars |
57 | - $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; |
|
57 | + $this->template_path = plugin_dir_path(__FILE__).'../templates/'; |
|
58 | 58 | $this->allowed_currencies = array("EUR"); |
59 | - $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; |
|
59 | + $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)).'/WC_Pagantis.php'; |
|
60 | 60 | $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false); |
61 | 61 | $this->language = strstr(get_locale(), '_', true); |
62 | 62 | |
63 | - if ($this->language == 'es' || $this->language == '') { |
|
63 | + if ($this->language=='es' || $this->language=='') { |
|
64 | 64 | $this->icon = esc_url(plugins_url('../assets/images/logopagamastarde.png', __FILE__)); |
65 | 65 | } else { |
66 | 66 | $this->icon = esc_url(plugins_url('../assets/images/logo.png', __FILE__)); |
67 | 67 | } |
68 | 68 | |
69 | 69 | //Panel form fields |
70 | - $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php');//Panel options |
|
70 | + $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php'); //Panel options |
|
71 | 71 | $this->init_settings(); |
72 | 72 | |
73 | 73 | $this->extraConfig = $this->getExtraConfig(); |
74 | 74 | $this->title = __($this->extraConfig['PAGANTIS_TITLE'], 'pagantis'); |
75 | 75 | $this->method_description = "Financial Payment Gateway. Enable the possibility for your customers to pay their order in confortable installments with Pagantis."; |
76 | 76 | |
77 | - $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='')?$this->extraConfig['PAGANTIS_URL_OK']:$this->generateOkUrl(); |
|
78 | - $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='')?$this->extraConfig['PAGANTIS_URL_KO']:$this->generateKoUrl(); |
|
77 | + $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='') ? $this->extraConfig['PAGANTIS_URL_OK'] : $this->generateOkUrl(); |
|
78 | + $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='') ? $this->extraConfig['PAGANTIS_URL_KO'] : $this->generateKoUrl(); |
|
79 | 79 | foreach ($this->settings as $setting_key => $setting_value) { |
80 | 80 | $this->$setting_key = $setting_value; |
81 | 81 | } |
82 | 82 | |
83 | 83 | //Hooks |
84 | - add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this,'process_admin_options')); //Save plugin options |
|
85 | - add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields |
|
86 | - add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form |
|
87 | - add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification |
|
88 | - add_filter('woocommerce_payment_complete_order_status', array($this,'pagantisCompleteStatus'), 10, 3); |
|
84 | + add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this, 'process_admin_options')); //Save plugin options |
|
85 | + add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields |
|
86 | + add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form |
|
87 | + add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification |
|
88 | + add_filter('woocommerce_payment_complete_order_status', array($this, 'pagantisCompleteStatus'), 10, 3); |
|
89 | 89 | add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2); |
90 | 90 | } |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function loadPagantisTranslation($mofile, $domain) |
99 | 99 | { |
100 | - if ('pagantis' === $domain) { |
|
101 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
100 | + if ('pagantis'===$domain) { |
|
101 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
102 | 102 | } |
103 | 103 | return $mofile; |
104 | 104 | } |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | public function pagantisCheckFields() |
131 | 131 | { |
132 | 132 | $error_string = ''; |
133 | - if ($this->settings['enabled'] !== 'yes') { |
|
133 | + if ($this->settings['enabled']!=='yes') { |
|
134 | 134 | return; |
135 | 135 | } elseif (!version_compare(phpversion(), '5.3.0', '>=')) { |
136 | - $error_string = __(' is not compatible with your php and/or curl version', 'pagantis'); |
|
136 | + $error_string = __(' is not compatible with your php and/or curl version', 'pagantis'); |
|
137 | 137 | $this->settings['enabled'] = 'no'; |
138 | 138 | } elseif ($this->settings['pagantis_public_key']=="" || $this->settings['pagantis_private_key']=="") { |
139 | 139 | $error_string = __(' is not configured correctly, the fields Public Key and Secret Key are mandatory for use this plugin', 'pagantis'); |
140 | 140 | $this->settings['enabled'] = 'no'; |
141 | 141 | } elseif (!in_array(get_woocommerce_currency(), $this->allowed_currencies)) { |
142 | - $error_string = __(' only can be used in Euros', 'pagantis'); |
|
142 | + $error_string = __(' only can be used in Euros', 'pagantis'); |
|
143 | 143 | $this->settings['enabled'] = 'no'; |
144 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']<'2' |
|
145 | - || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']>'12') { |
|
144 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] < '2' |
|
145 | + || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] > '12') { |
|
146 | 146 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis'); |
147 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']<'2' |
|
148 | - || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']>'12') { |
|
147 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] < '2' |
|
148 | + || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] > '12') { |
|
149 | 149 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis'); |
150 | - } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']<0) { |
|
150 | + } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] < 0) { |
|
151 | 151 | $error_string = __(' can not have a minimum amount less than 0', 'pagantis'); |
152 | 152 | } |
153 | 153 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | $shippingAddress = $order->get_address('shipping'); |
183 | 183 | $billingAddress = $order->get_address('billing'); |
184 | - if ($shippingAddress['address_1'] == '') { |
|
184 | + if ($shippingAddress['address_1']=='') { |
|
185 | 185 | $shippingAddress = $billingAddress; |
186 | 186 | } |
187 | 187 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | ->setNationalId($national_id) |
209 | 209 | ->setTaxId($tax_id) |
210 | 210 | ; |
211 | - $orderBillingAddress = new Address(); |
|
211 | + $orderBillingAddress = new Address(); |
|
212 | 212 | $orderBillingAddress |
213 | 213 | ->setZipCode($billingAddress['postcode']) |
214 | 214 | ->setFullName($billingAddress['first_name']." ".$billingAddress['last_name']) |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | $details->addProduct($product); |
277 | 277 | |
278 | 278 | $promotedProduct = $this->isPromoted($item['product_id']); |
279 | - if ($promotedProduct == 'true') { |
|
280 | - $promotedAmount+=$product->getAmount(); |
|
281 | - $promotedMessage = 'Promoted Item: ' . $product->getDescription() . |
|
282 | - ' Price: ' . $item['line_total'] . |
|
283 | - ' Qty: ' . $product->getQuantity() . |
|
284 | - ' Item ID: ' . $item['id_product']; |
|
279 | + if ($promotedProduct=='true') { |
|
280 | + $promotedAmount += $product->getAmount(); |
|
281 | + $promotedMessage = 'Promoted Item: '.$product->getDescription(). |
|
282 | + ' Price: '.$item['line_total']. |
|
283 | + ' Qty: '.$product->getQuantity(). |
|
284 | + ' Item ID: '.$item['id_product']; |
|
285 | 285 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
286 | 286 | } |
287 | 287 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | wc_get_template('iframe.php', $template_fields, '', $this->template_path); |
354 | 354 | } |
355 | 355 | } catch (\Exception $exception) { |
356 | - wc_add_notice(__('Payment error ', 'pagantis') . $exception->getMessage(), 'error'); |
|
356 | + wc_add_notice(__('Payment error ', 'pagantis').$exception->getMessage(), 'error'); |
|
357 | 357 | $this->insertLog($exception); |
358 | 358 | $checkout_url = get_permalink(wc_get_page_id('checkout')); |
359 | 359 | wp_redirect($checkout_url); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | public function pagantisNotification() |
368 | 368 | { |
369 | 369 | try { |
370 | - $origin = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'Notify' : 'Order'; |
|
370 | + $origin = ($_SERVER['REQUEST_METHOD']=='POST') ? 'Notify' : 'Order'; |
|
371 | 371 | |
372 | 372 | include_once('notifyController.php'); |
373 | 373 | $notify = new WcPagantisNotify(); |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | */ |
407 | 407 | public function pagantisCompleteStatus($status, $order_id, $order) |
408 | 408 | { |
409 | - if ($order->get_payment_method() == WcPagantisGateway::METHOD_ID) { |
|
410 | - if ($order->get_status() == 'failed') { |
|
409 | + if ($order->get_payment_method()==WcPagantisGateway::METHOD_ID) { |
|
410 | + if ($order->get_status()=='failed') { |
|
411 | 411 | $status = 'processing'; |
412 | - } elseif ($order->get_status() == 'pending' && $status=='completed') { |
|
412 | + } elseif ($order->get_status()=='pending' && $status=='completed') { |
|
413 | 413 | $status = 'processing'; |
414 | 414 | } |
415 | 415 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
434 | 434 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries)); |
435 | 435 | if ($this->enabled==='yes' && $this->pagantis_public_key!='' && $this->pagantis_private_key!='' && |
436 | - (int)$this->get_order_total()>$this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] && $allowedCountry) { |
|
436 | + (int) $this->get_order_total() > $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] && $allowedCountry) { |
|
437 | 437 | return true; |
438 | 438 | } |
439 | 439 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | |
462 | 462 | $redirectUrl = $order->get_checkout_payment_url(true); //pagantisReceiptPage function |
463 | 463 | if (strpos($redirectUrl, 'order-pay=')===false) { |
464 | - $redirectUrl.="&order-pay=".$order_id; |
|
464 | + $redirectUrl .= "&order-pay=".$order_id; |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | return array( |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | ); |
471 | 471 | |
472 | 472 | } catch (Exception $e) { |
473 | - wc_add_notice(__('Payment error ', 'pagantis') . $e->getMessage(), 'error'); |
|
473 | + wc_add_notice(__('Payment error ', 'pagantis').$e->getMessage(), 'error'); |
|
474 | 474 | return array(); |
475 | 475 | } |
476 | 476 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | private function generateUrl($url) |
535 | 535 | { |
536 | 536 | $parsed_url = parse_url($url); |
537 | - if ($parsed_url !== false) { |
|
537 | + if ($parsed_url!==false) { |
|
538 | 538 | $parsed_url['query'] = !isset($parsed_url['query']) ? '' : $parsed_url['query']; |
539 | 539 | parse_str($parsed_url['query'], $arrayParams); |
540 | 540 | foreach ($arrayParams as $keyParam => $valueParam) { |
@@ -582,11 +582,10 @@ discard block |
||
582 | 582 | private function getKeysUrl($order, $url) |
583 | 583 | { |
584 | 584 | $defaultFields = (get_class($order)=='WC_Order') ? |
585 | - array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : |
|
586 | - array(); |
|
585 | + array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : array(); |
|
587 | 586 | |
588 | 587 | $parsedUrl = parse_url($url); |
589 | - if ($parsedUrl !== false) { |
|
588 | + if ($parsedUrl!==false) { |
|
590 | 589 | //Replace parameters from url |
591 | 590 | $parsedUrl['query'] = $this->getKeysParametersUrl($parsedUrl['query'], $defaultFields); |
592 | 591 | |
@@ -631,7 +630,7 @@ discard block |
||
631 | 630 | foreach ($arrayParams as $keyParam => $valueParam) { |
632 | 631 | preg_match('#\{{.*?}\}#', $valueParam, $match); |
633 | 632 | if (count($match)) { |
634 | - $key = str_replace(array('{{','}}'), array('',''), $match[0]); |
|
633 | + $key = str_replace(array('{{', '}}'), array('', ''), $match[0]); |
|
635 | 634 | $arrayParams[$keyParam] = $defaultFields[$key]; |
636 | 635 | } |
637 | 636 | } |
@@ -646,13 +645,13 @@ discard block |
||
646 | 645 | */ |
647 | 646 | private function unparseUrl($parsed_url) |
648 | 647 | { |
649 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
648 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
650 | 649 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
651 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
652 | - $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
653 | - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
650 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
651 | + $query = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
|
652 | + $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
|
654 | 653 | $path = $parsed_url['path']; |
655 | - return $scheme . $host . $port . $path . $query . $fragment; |
|
654 | + return $scheme.$host.$port.$path.$query.$fragment; |
|
656 | 655 | } |
657 | 656 | |
658 | 657 | /** |
@@ -674,20 +673,20 @@ discard block |
||
674 | 673 | $is_guest = "false"; |
675 | 674 | $sign_up = substr($current_user->user_registered, 0, 10); |
676 | 675 | $customer_orders = get_posts(array( |
677 | - 'numberposts' => - 1, |
|
676 | + 'numberposts' => -1, |
|
678 | 677 | 'meta_key' => '_customer_user', |
679 | 678 | 'meta_value' => $current_user->ID, |
680 | - 'post_type' => array( 'shop_order' ), |
|
681 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded' ), |
|
679 | + 'post_type' => array('shop_order'), |
|
680 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'), |
|
682 | 681 | )); |
683 | 682 | } else { |
684 | 683 | $is_guest = "true"; |
685 | 684 | $customer_orders = get_posts(array( |
686 | - 'numberposts' => - 1, |
|
685 | + 'numberposts' => -1, |
|
687 | 686 | 'meta_key' => '_billing_email', |
688 | 687 | 'meta_value' => $billingEmail, |
689 | - 'post_type' => array( 'shop_order' ), |
|
690 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded'), |
|
688 | + 'post_type' => array('shop_order'), |
|
689 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'), |
|
691 | 690 | )); |
692 | 691 | foreach ($customer_orders as $customer_order) { |
693 | 692 | if (trim($sign_up)=='' || |
@@ -716,7 +715,7 @@ discard block |
||
716 | 715 | //Check if id exists |
717 | 716 | $resultsSelect = $wpdb->get_results("select * from $tableName where id='$orderId'"); |
718 | 717 | $countResults = count($resultsSelect); |
719 | - if ($countResults == 0) { |
|
718 | + if ($countResults==0) { |
|
720 | 719 | $wpdb->insert( |
721 | 720 | $tableName, |
722 | 721 | array('id' => $orderId, 'order_id' => $pagantisOrderId), |
@@ -741,7 +740,7 @@ discard block |
||
741 | 740 | global $wpdb; |
742 | 741 | $tableName = $wpdb->prefix.self::ORDERS_TABLE; |
743 | 742 | |
744 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
743 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
745 | 744 | $charset_collate = $wpdb->get_charset_collate(); |
746 | 745 | $sql = "CREATE TABLE $tableName ( id int, order_id varchar(50), wc_order_id varchar(50), |
747 | 746 | UNIQUE KEY id (id)) $charset_collate"; |
@@ -774,9 +773,9 @@ discard block |
||
774 | 773 | */ |
775 | 774 | private function getNationalId($order) |
776 | 775 | { |
777 | - foreach ((array)$order->get_meta_data() as $mdObject) { |
|
776 | + foreach ((array) $order->get_meta_data() as $mdObject) { |
|
778 | 777 | $data = $mdObject->get_data(); |
779 | - if ($data['key'] == 'vat_number') { |
|
778 | + if ($data['key']=='vat_number') { |
|
780 | 779 | return $data['value']; |
781 | 780 | } |
782 | 781 | } |
@@ -791,9 +790,9 @@ discard block |
||
791 | 790 | */ |
792 | 791 | private function getTaxId($order) |
793 | 792 | { |
794 | - foreach ((array)$order->get_meta_data() as $mdObject) { |
|
793 | + foreach ((array) $order->get_meta_data() as $mdObject) { |
|
795 | 794 | $data = $mdObject->get_data(); |
796 | - if ($data['key'] == 'billing_cfpiva') { |
|
795 | + if ($data['key']=='billing_cfpiva') { |
|
797 | 796 | return $data['value']; |
798 | 797 | } |
799 | 798 | } |
@@ -823,7 +822,7 @@ discard block |
||
823 | 822 | { |
824 | 823 | global $wpdb; |
825 | 824 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
826 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
825 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
827 | 826 | $charset_collate = $wpdb->get_charset_collate(); |
828 | 827 | $sql = "CREATE TABLE $tableName ( id int NOT NULL AUTO_INCREMENT, log text NOT NULL, |
829 | 828 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (id)) $charset_collate"; |
@@ -842,7 +841,7 @@ discard block |
||
842 | 841 | { |
843 | 842 | $metaProduct = get_post_meta($product_id); |
844 | 843 | return (array_key_exists('custom_product_pagantis_promoted', $metaProduct) && |
845 | - $metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
844 | + $metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
846 | 845 | } |
847 | 846 | |
848 | 847 | /** |
@@ -855,8 +854,8 @@ discard block |
||
855 | 854 | $promotedAmount = 0; |
856 | 855 | foreach ($items as $key => $item) { |
857 | 856 | $promotedProduct = $this->isPromoted($item['product_id']); |
858 | - if ($promotedProduct == 'true') { |
|
859 | - $promotedAmount+=$item['line_total']; |
|
857 | + if ($promotedProduct=='true') { |
|
858 | + $promotedAmount += $item['line_total']; |
|
860 | 859 | } |
861 | 860 | } |
862 | 861 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <script> |
2 | 2 | function findPriceSelector() |
3 | 3 | { |
4 | - var priceSelectors = <?php echo json_encode($priceSelector);?>; |
|
4 | + var priceSelectors = <?php echo json_encode($priceSelector); ?>; |
|
5 | 5 | return priceSelectors.find(function(candidateSelector) { |
6 | 6 | var priceDOM = document.querySelector(candidateSelector); |
7 | 7 | return (priceDOM != null ); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | function findPositionSelector() |
13 | 13 | { |
14 | - var positionSelector = '<?php echo $positionSelector;?>'; |
|
14 | + var positionSelector = '<?php echo $positionSelector; ?>'; |
|
15 | 15 | if (positionSelector === 'default') { |
16 | 16 | positionSelector = '.pagantisSimulator'; |
17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | function findQuantitySelector() |
23 | 23 | { |
24 | - var quantitySelectors = <?php echo json_encode($quantitySelector);?>; |
|
24 | + var quantitySelectors = <?php echo json_encode($quantitySelector); ?>; |
|
25 | 25 | return quantitySelectors.find(function(candidateSelector) { |
26 | 26 | var priceDOM = document.querySelector(candidateSelector); |
27 | 27 | return (priceDOM != null ); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | return finishInterval(); |
63 | 63 | } |
64 | 64 | |
65 | - var price = '<?php echo $total;?>'; |
|
65 | + var price = '<?php echo $total; ?>'; |
|
66 | 66 | |
67 | 67 | var country = '<?php echo $country; ?>'; |
68 | 68 | var locale = '<?php echo $locale; ?>'; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | var positionSelector = findPositionSelector(); |
76 | 76 | var priceSelector = findPriceSelector(); |
77 | - var promotedProduct = '<?php echo $promoted;?>'; |
|
77 | + var promotedProduct = '<?php echo $promoted; ?>'; |
|
78 | 78 | var quantitySelector = findQuantitySelector(); |
79 | 79 | |
80 | 80 | simulator_options = { |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | country: country, |
87 | 87 | itemAmountSelector: priceSelector, |
88 | 88 | amountParserConfig : { |
89 | - thousandSeparator: '<?php echo $thousandSeparator;?>', |
|
90 | - decimalSeparator: '<?php echo $decimalSeparator;?>' |
|
89 | + thousandSeparator: '<?php echo $thousandSeparator; ?>', |
|
90 | + decimalSeparator: '<?php echo $decimalSeparator; ?>' |
|
91 | 91 | }, |
92 | - numInstalments : '<?php echo $pagantisQuotesStart;?>', |
|
93 | - skin : <?php echo $pagantisSimulatorSkin;?>, |
|
94 | - position: <?php echo $pagantisSimulatorPosition;?> |
|
92 | + numInstalments : '<?php echo $pagantisQuotesStart; ?>', |
|
93 | + skin : <?php echo $pagantisSimulatorSkin; ?>, |
|
94 | + position: <?php echo $pagantisSimulatorPosition; ?> |
|
95 | 95 | }; |
96 | 96 | |
97 | 97 | if (promotedProduct == 'true') { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | </style> |
118 | 118 | <?php |
119 | -if ($promoted == 'true') { |
|
119 | +if ($promoted=='true') { |
|
120 | 120 | echo $promotedMessage; |
121 | 121 | } |
122 | 122 | ?> |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | register_activation_hook(__FILE__, array($this, 'pagantisActivation')); |
80 | 80 | add_action('woocommerce_product_options_general_product_data', array($this, 'pagantisPromotedProductTpl')); |
81 | 81 | add_action('woocommerce_process_product_meta', array($this, 'pagantisPromotedVarSave')); |
82 | - add_action('woocommerce_product_bulk_edit_start', array($this,'pagantisPromotedBulkTemplate')); |
|
83 | - add_action('woocommerce_product_bulk_edit_save', array($this,'pagantisPromotedBulkTemplateSave')); |
|
82 | + add_action('woocommerce_product_bulk_edit_start', array($this, 'pagantisPromotedBulkTemplate')); |
|
83 | + add_action('woocommerce_product_bulk_edit_save', array($this, 'pagantisPromotedBulkTemplateSave')); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $post_id = $product->get_id(); |
108 | 108 | $pagantis_promoted_value = $_REQUEST['pagantis_promoted']; |
109 | - if ($pagantis_promoted_value == 'on') { |
|
109 | + if ($pagantis_promoted_value=='on') { |
|
110 | 110 | $pagantis_promoted_value = 'yes'; |
111 | 111 | } else { |
112 | 112 | $pagantis_promoted_value = 'no'; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function pagantisPromotedVarSave($post_id) |
141 | 141 | { |
142 | 142 | $pagantis_promoted_value = $_POST['pagantis_promoted']; |
143 | - if ($pagantis_promoted_value == null) { |
|
143 | + if ($pagantis_promoted_value==null) { |
|
144 | 144 | $pagantis_promoted_value = 'no'; |
145 | 145 | } |
146 | 146 | update_post_meta($post_id, 'custom_product_pagantis_promoted', esc_attr($pagantis_promoted_value)); |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function loadPagantisTranslation($mofile, $domain) |
155 | 155 | { |
156 | - if ('pagantis' === $domain) { |
|
157 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
156 | + if ('pagantis'===$domain) { |
|
157 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
158 | 158 | } |
159 | 159 | return $mofile; |
160 | 160 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | global $wpdb; |
168 | 168 | |
169 | 169 | $tableName = $wpdb->prefix.self::CONCURRENCY_TABLE; |
170 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
170 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
171 | 171 | $charset_collate = $wpdb->get_charset_collate(); |
172 | 172 | $sql = "CREATE TABLE $tableName ( order_id int NOT NULL, |
173 | 173 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (order_id)) $charset_collate"; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
179 | 179 | |
180 | 180 | //Check if table exists |
181 | - $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName; |
|
181 | + $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName; |
|
182 | 182 | if ($tableExists) { |
183 | 183 | $charset_collate = $wpdb->get_charset_collate(); |
184 | 184 | $sql = "CREATE TABLE IF NOT EXISTS $tableName ( |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | //Updated value field to adapt to new length < v8.0.1 |
194 | 194 | $query = "select COLUMN_TYPE FROM information_schema.COLUMNS where TABLE_NAME='$tableName' AND COLUMN_NAME='value'"; |
195 | 195 | $results = $wpdb->get_results($query, ARRAY_A); |
196 | - if ($results['0']['COLUMN_TYPE'] == 'varchar(100)') { |
|
196 | + if ($results['0']['COLUMN_TYPE']=='varchar(100)') { |
|
197 | 197 | $sql = "ALTER TABLE $tableName MODIFY value varchar(1000)"; |
198 | 198 | $wpdb->query($sql); |
199 | 199 | } |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | or config='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'"; |
204 | 204 | $dbCurrentConfig = $wpdb->get_results($query, ARRAY_A); |
205 | 205 | foreach ($dbCurrentConfig as $item) { |
206 | - if ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
206 | + if ($item['config']=='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
207 | 207 | $css_price_selector = $this->preparePriceSelector($item['value']); |
208 | - if ($item['value'] != $css_price_selector) { |
|
208 | + if ($item['value']!=$css_price_selector) { |
|
209 | 209 | $wpdb->update( |
210 | 210 | $tableName, |
211 | 211 | array('value' => stripslashes($css_price_selector)), |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | array('%s') |
215 | 215 | ); |
216 | 216 | } |
217 | - } elseif ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
217 | + } elseif ($item['config']=='PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
218 | 218 | $css_quantity_selector = $this->prepareQuantitySelector($item['value']); |
219 | - if ($item['value'] != $css_quantity_selector) { |
|
219 | + if ($item['value']!=$css_quantity_selector) { |
|
220 | 220 | $wpdb->update( |
221 | 221 | $tableName, |
222 | 222 | array('value' => stripslashes($css_quantity_selector)), |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
234 | 234 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'"; |
235 | 235 | $results = $wpdb->get_results($query, ARRAY_A); |
236 | - if (count($results) == 0) { |
|
236 | + if (count($results)==0) { |
|
237 | 237 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR', 'value' => '.'), array('%s', '%s')); |
238 | 238 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR', 'value' => ','), array('%s', '%s')); |
239 | 239 | } |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | $locale = strtolower(strstr(get_locale(), '_', true)); |
280 | 280 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
281 | 281 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries)); |
282 | - if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' || |
|
283 | - $cfg['simulator'] !== 'yes' || $product->get_price() < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] || |
|
284 | - !$allowedCountry ) { |
|
282 | + if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']=='' || $cfg['pagantis_private_key']=='' || |
|
283 | + $cfg['simulator']!=='yes' || $product->get_price() < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] || |
|
284 | + !$allowedCountry) { |
|
285 | 285 | return; |
286 | 286 | } |
287 | 287 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function addPagantisGateway($methods) |
318 | 318 | { |
319 | - if (! class_exists('WC_Payment_Gateway')) { |
|
319 | + if (!class_exists('WC_Payment_Gateway')) { |
|
320 | 320 | return $methods; |
321 | 321 | } |
322 | 322 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function pagantisRowMeta($links, $file) |
373 | 373 | { |
374 | - if ($file == plugin_basename(__FILE__)) { |
|
374 | + if ($file==plugin_basename(__FILE__)) { |
|
375 | 375 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
376 | 376 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
377 | 377 | __('API documentation', 'pagantis').'</a>'; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
400 | 400 | $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc"; |
401 | 401 | $results = $wpdb->get_results($query); |
402 | - if (isset($results) && $privateKey == $secretKey) { |
|
402 | + if (isset($results) && $privateKey==$secretKey) { |
|
403 | 403 | foreach ($results as $key => $result) { |
404 | 404 | $response[$key]['timestamp'] = $result->createdAt; |
405 | 405 | $response[$key]['log'] = json_decode($result->log); |
@@ -426,12 +426,12 @@ discard block |
||
426 | 426 | |
427 | 427 | $filters = ($data->get_params()); |
428 | 428 | $secretKey = $filters['secret']; |
429 | - $cfg = get_option('woocommerce_pagantis_settings'); |
|
429 | + $cfg = get_option('woocommerce_pagantis_settings'); |
|
430 | 430 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
431 | - if ($privateKey != $secretKey) { |
|
431 | + if ($privateKey!=$secretKey) { |
|
432 | 432 | $response['status'] = 401; |
433 | 433 | $response['result'] = 'Unauthorized'; |
434 | - } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
434 | + } elseif ($_SERVER['REQUEST_METHOD']=='POST') { |
|
435 | 435 | if (count($_POST)) { |
436 | 436 | foreach ($_POST as $config => $value) { |
437 | 437 | if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | and tn.post_date<'".$to->format("Y-m-d")."' order by tn.post_date desc"; |
492 | 492 | $results = $wpdb->get_results($query); |
493 | 493 | |
494 | - if (isset($results) && $privateKey == $secretKey) { |
|
494 | + if (isset($results) && $privateKey==$secretKey) { |
|
495 | 495 | foreach ($results as $result) { |
496 | 496 | $key = $result->ID; |
497 | 497 | $response['message'][$key]['timestamp'] = $result->post_date; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | */ |
576 | 576 | private function prepareQuantitySelector($css_quantity_selector) |
577 | 577 | { |
578 | - if ($css_quantity_selector == 'default' || $css_quantity_selector == '') { |
|
578 | + if ($css_quantity_selector=='default' || $css_quantity_selector=='') { |
|
579 | 579 | $css_quantity_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']; |
580 | 580 | } elseif (!unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it |
581 | 581 | $css_quantity_selector = serialize(array($css_quantity_selector)); |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | */ |
592 | 592 | private function preparePriceSelector($css_price_selector) |
593 | 593 | { |
594 | - if ($css_price_selector == 'default' || $css_price_selector == '') { |
|
594 | + if ($css_price_selector=='default' || $css_price_selector=='') { |
|
595 | 595 | $css_price_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
596 | 596 | } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
597 | 597 | $css_price_selector = serialize(array($css_price_selector)); |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | { |
610 | 610 | $metaProduct = get_post_meta($product_id); |
611 | 611 | return (array_key_exists('custom_product_pagantis_promoted', $metaProduct) && |
612 | - $metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
612 | + $metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 |
@@ -33,24 +33,24 @@ discard block |
||
33 | 33 | const ORDERS_TABLE = 'posts'; |
34 | 34 | |
35 | 35 | public $defaultConfigs = array( |
36 | - 'PAGANTIS_TITLE'=>'Instant Financing', |
|
37 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.SIMPLE', |
|
38 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE', |
|
39 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
40 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
41 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
42 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
43 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'sdk.simulator.positions.INNER', |
|
44 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'a:3:{i:0;s:48:"div.summary *:not(del)>.woocommerce-Price-amount";i:1;s:54:"div.entry-summary *:not(del)>.woocommerce-Price-amount";i:2;s:36:"*:not(del)>.woocommerce-Price-amount";}', |
|
45 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'a:2:{i:0;s:22:"div.quantity input.qty";i:1;s:18:"div.quantity>input";}', |
|
46 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
47 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
48 | - 'PAGANTIS_URL_OK'=>'', |
|
49 | - 'PAGANTIS_URL_KO'=>'', |
|
50 | - 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:3:{i:0;s:2:"es";i:1;s:2:"it";i:2;s:2:"fr";}', |
|
51 | - 'PAGANTIS_PROMOTION_EXTRA' => '<p>Finance this product <span class="pmt-no-interest">without interest!</span></p>', |
|
52 | - 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR' => '.', |
|
53 | - 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR' => ',' |
|
36 | + 'PAGANTIS_TITLE'=>'Instant Financing', |
|
37 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.SIMPLE', |
|
38 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE', |
|
39 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
40 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
41 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
42 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
43 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'sdk.simulator.positions.INNER', |
|
44 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'a:3:{i:0;s:48:"div.summary *:not(del)>.woocommerce-Price-amount";i:1;s:54:"div.entry-summary *:not(del)>.woocommerce-Price-amount";i:2;s:36:"*:not(del)>.woocommerce-Price-amount";}', |
|
45 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'a:2:{i:0;s:22:"div.quantity input.qty";i:1;s:18:"div.quantity>input";}', |
|
46 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
47 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
48 | + 'PAGANTIS_URL_OK'=>'', |
|
49 | + 'PAGANTIS_URL_KO'=>'', |
|
50 | + 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:3:{i:0;s:2:"es";i:1;s:2:"it";i:2;s:2:"fr";}', |
|
51 | + 'PAGANTIS_PROMOTION_EXTRA' => '<p>Finance this product <span class="pmt-no-interest">without interest!</span></p>', |
|
52 | + 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR' => '.', |
|
53 | + 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR' => ',' |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | /** @var Array $extraConfig */ |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | if ($file == plugin_basename(__FILE__)) { |
375 | 375 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
376 | 376 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
377 | - __('API documentation', 'pagantis').'</a>'; |
|
377 | + __('API documentation', 'pagantis').'</a>'; |
|
378 | 378 | $links[] = '<a href="'.WcPagantis::SUPPORT_EML.'">'.__('Support', 'pagantis').'</a>'; |
379 | 379 | |
380 | 380 | return $links; |