@@ -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 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function addPagantisGateway($methods) |
317 | 317 | { |
318 | - if (! class_exists('WC_Payment_Gateway')) { |
|
318 | + if (!class_exists('WC_Payment_Gateway')) { |
|
319 | 319 | return $methods; |
320 | 320 | } |
321 | 321 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function pagantisRowMeta($links, $file) |
372 | 372 | { |
373 | - if ($file == plugin_basename(__FILE__)) { |
|
373 | + if ($file==plugin_basename(__FILE__)) { |
|
374 | 374 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
375 | 375 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
376 | 376 | __('API documentation', 'pagantis').'</a>'; |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
399 | 399 | $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc"; |
400 | 400 | $results = $wpdb->get_results($query); |
401 | - if (isset($results) && $privateKey == $secretKey) { |
|
401 | + if (isset($results) && $privateKey==$secretKey) { |
|
402 | 402 | foreach ($results as $key => $result) { |
403 | 403 | $response[$key]['timestamp'] = $result->createdAt; |
404 | 404 | $response[$key]['log'] = json_decode($result->log); |
@@ -425,12 +425,12 @@ discard block |
||
425 | 425 | |
426 | 426 | $filters = ($data->get_params()); |
427 | 427 | $secretKey = $filters['secret']; |
428 | - $cfg = get_option('woocommerce_pagantis_settings'); |
|
428 | + $cfg = get_option('woocommerce_pagantis_settings'); |
|
429 | 429 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
430 | - if ($privateKey != $secretKey) { |
|
430 | + if ($privateKey!=$secretKey) { |
|
431 | 431 | $response['status'] = 401; |
432 | 432 | $response['result'] = 'Unauthorized'; |
433 | - } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
433 | + } elseif ($_SERVER['REQUEST_METHOD']=='POST') { |
|
434 | 434 | if (count($_POST)) { |
435 | 435 | foreach ($_POST as $config => $value) { |
436 | 436 | if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | and tn.post_date<'".$to->format("Y-m-d")."' order by tn.post_date desc"; |
491 | 491 | $results = $wpdb->get_results($query); |
492 | 492 | |
493 | - if (isset($results) && $privateKey == $secretKey) { |
|
493 | + if (isset($results) && $privateKey==$secretKey) { |
|
494 | 494 | foreach ($results as $result) { |
495 | 495 | $key = $result->ID; |
496 | 496 | $response['message'][$key]['timestamp'] = $result->post_date; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | */ |
575 | 575 | private function prepareQuantitySelector($css_quantity_selector) |
576 | 576 | { |
577 | - if ($css_quantity_selector == 'default' || $css_quantity_selector == '') { |
|
577 | + if ($css_quantity_selector=='default' || $css_quantity_selector=='') { |
|
578 | 578 | $css_quantity_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']; |
579 | 579 | } elseif (!unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it |
580 | 580 | $css_quantity_selector = serialize(array($css_quantity_selector)); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | private function preparePriceSelector($css_price_selector) |
592 | 592 | { |
593 | - if ($css_price_selector == 'default' || $css_price_selector == '') { |
|
593 | + if ($css_price_selector=='default' || $css_price_selector=='') { |
|
594 | 594 | $css_price_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
595 | 595 | } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
596 | 596 | $css_price_selector = serialize(array($css_price_selector)); |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | private function isPromoted($product_id) |
608 | 608 | { |
609 | 609 | $metaProduct = get_post_meta($product_id); |
610 | - return ($metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
610 | + return ($metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 |
@@ -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 | ?> |