@@ -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 ); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | function findDestinationSim() |
| 50 | 50 | { |
| 51 | - var destinationSim = '<?php echo $finalDestination;?>'; |
|
| 51 | + var destinationSim = '<?php echo $finalDestination; ?>'; |
|
| 52 | 52 | if (destinationSim === 'default' || destinationSim == '') { |
| 53 | 53 | destinationSim = 'woocommerce-product-details__short-description'; |
| 54 | 54 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | var positionSelector = findPositionSelector(); |
| 93 | 93 | var priceSelector = findPriceSelector(); |
| 94 | - var promotedProduct = '<?php echo $promoted;?>'; |
|
| 94 | + var promotedProduct = '<?php echo $promoted; ?>'; |
|
| 95 | 95 | var quantitySelector = findQuantitySelector(); |
| 96 | 96 | |
| 97 | 97 | simulator_options = { |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | country: country, |
| 104 | 104 | itemAmountSelector: priceSelector, |
| 105 | 105 | amountParserConfig : { |
| 106 | - thousandSeparator: '<?php echo $thousandSeparator;?>', |
|
| 107 | - decimalSeparator: '<?php echo $decimalSeparator;?>' |
|
| 106 | + thousandSeparator: '<?php echo $thousandSeparator; ?>', |
|
| 107 | + decimalSeparator: '<?php echo $decimalSeparator; ?>' |
|
| 108 | 108 | }, |
| 109 | - numInstalments : '<?php echo $pagantisQuotesStart;?>', |
|
| 110 | - skin : <?php echo $pagantisSimulatorSkin;?>, |
|
| 111 | - position: <?php echo $pagantisSimulatorPosition;?> |
|
| 109 | + numInstalments : '<?php echo $pagantisQuotesStart; ?>', |
|
| 110 | + skin : <?php echo $pagantisSimulatorSkin; ?>, |
|
| 111 | + position: <?php echo $pagantisSimulatorPosition; ?> |
|
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | 114 | window.pgSDK = sdk; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | if (window.WCSimulatorId != '') |
| 139 | 139 | { |
| 140 | - var updateSelector = '<?php echo $variationSelector;?>'; |
|
| 140 | + var updateSelector = '<?php echo $variationSelector; ?>'; |
|
| 141 | 141 | |
| 142 | 142 | if (updateSelector == 'default' || updateSelector === '') |
| 143 | 143 | { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | </style> |
| 172 | 172 | <?php |
| 173 | -if ($promoted == 'true') { |
|
| 173 | +if ($promoted=='true') { |
|
| 174 | 174 | echo $promotedMessage; |
| 175 | 175 | } |
| 176 | 176 | ?> |
@@ -33,28 +33,28 @@ discard block |
||
| 33 | 33 | const ORDERS_TABLE = 'posts'; |
| 34 | 34 | |
| 35 | 35 | public $defaultConfigs = array( |
| 36 | - 'PAGANTIS_TITLE'=>'Pago en cuotas', |
|
| 37 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.PRODUCT_PAGE', |
|
| 38 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'=>'sdk.simulator.types.CHECKOUT_PAGE', |
|
| 39 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE', |
|
| 40 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 41 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 42 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 43 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 44 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'sdk.simulator.positions.INNER', |
|
| 45 | - '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";}', |
|
| 46 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'a:2:{i:0;s:22:"div.quantity input.qty";i:1;s:18:"div.quantity>input";}', |
|
| 47 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 48 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 49 | - 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
| 50 | - 'PAGANTIS_URL_OK'=>'', |
|
| 51 | - 'PAGANTIS_URL_KO'=>'', |
|
| 52 | - 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:3:{i:0;s:2:"es";i:1;s:2:"it";i:2;s:2:"fr";}', |
|
| 53 | - 'PAGANTIS_PROMOTION_EXTRA' => '<p>Finance this product <span class="pg-no-interest">without interest!</span></p>', |
|
| 54 | - 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR' => '.', |
|
| 55 | - 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR' => ',', |
|
| 56 | - 'PAGANTIS_SIMULATOR_DISPLAY_SITUATION' => 'default', |
|
| 57 | - 'PAGANTIS_SIMULATOR_SELECTOR_VARIATION' => 'default' |
|
| 36 | + 'PAGANTIS_TITLE'=>'Pago en cuotas', |
|
| 37 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.PRODUCT_PAGE', |
|
| 38 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'=>'sdk.simulator.types.CHECKOUT_PAGE', |
|
| 39 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE', |
|
| 40 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 41 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 42 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 43 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 44 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'sdk.simulator.positions.INNER', |
|
| 45 | + '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";}', |
|
| 46 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'a:2:{i:0;s:22:"div.quantity input.qty";i:1;s:18:"div.quantity>input";}', |
|
| 47 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 48 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 49 | + 'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0, |
|
| 50 | + 'PAGANTIS_URL_OK'=>'', |
|
| 51 | + 'PAGANTIS_URL_KO'=>'', |
|
| 52 | + 'PAGANTIS_ALLOWED_COUNTRIES' => 'a:3:{i:0;s:2:"es";i:1;s:2:"it";i:2;s:2:"fr";}', |
|
| 53 | + 'PAGANTIS_PROMOTION_EXTRA' => '<p>Finance this product <span class="pg-no-interest">without interest!</span></p>', |
|
| 54 | + 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR' => '.', |
|
| 55 | + 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR' => ',', |
|
| 56 | + 'PAGANTIS_SIMULATOR_DISPLAY_SITUATION' => 'default', |
|
| 57 | + 'PAGANTIS_SIMULATOR_SELECTOR_VARIATION' => 'default' |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | /** @var Array $extraConfig */ |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | if ($file == plugin_basename(__FILE__)) { |
| 410 | 410 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
| 411 | 411 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
| 412 | - __('API documentation', 'pagantis').'</a>'; |
|
| 412 | + __('API documentation', 'pagantis').'</a>'; |
|
| 413 | 413 | $links[] = '<a href="'.WcPagantis::SUPPORT_EML.'">'.__('Support', 'pagantis').'</a>'; |
| 414 | 414 | |
| 415 | 415 | return $links; |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | register_activation_hook(__FILE__, array($this, 'pagantisActivation')); |
| 84 | 84 | add_action('woocommerce_product_options_general_product_data', array($this, 'pagantisPromotedProductTpl')); |
| 85 | 85 | add_action('woocommerce_process_product_meta', array($this, 'pagantisPromotedVarSave')); |
| 86 | - add_action('woocommerce_product_bulk_edit_start', array($this,'pagantisPromotedBulkTemplate')); |
|
| 87 | - add_action('woocommerce_product_bulk_edit_save', array($this,'pagantisPromotedBulkTemplateSave')); |
|
| 86 | + add_action('woocommerce_product_bulk_edit_start', array($this, 'pagantisPromotedBulkTemplate')); |
|
| 87 | + add_action('woocommerce_product_bulk_edit_save', array($this, 'pagantisPromotedBulkTemplateSave')); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $post_id = $product->get_id(); |
| 112 | 112 | $pagantis_promoted_value = $_REQUEST['pagantis_promoted']; |
| 113 | - if ($pagantis_promoted_value == 'on') { |
|
| 113 | + if ($pagantis_promoted_value=='on') { |
|
| 114 | 114 | $pagantis_promoted_value = 'yes'; |
| 115 | 115 | } else { |
| 116 | 116 | $pagantis_promoted_value = 'no'; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | public function pagantisPromotedVarSave($post_id) |
| 145 | 145 | { |
| 146 | 146 | $pagantis_promoted_value = $_POST['pagantis_promoted']; |
| 147 | - if ($pagantis_promoted_value == null) { |
|
| 147 | + if ($pagantis_promoted_value==null) { |
|
| 148 | 148 | $pagantis_promoted_value = 'no'; |
| 149 | 149 | } |
| 150 | 150 | update_post_meta($post_id, 'custom_product_pagantis_promoted', esc_attr($pagantis_promoted_value)); |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function loadPagantisTranslation($mofile, $domain) |
| 159 | 159 | { |
| 160 | - if ('pagantis' === $domain) { |
|
| 161 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 160 | + if ('pagantis'===$domain) { |
|
| 161 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 162 | 162 | } |
| 163 | 163 | return $mofile; |
| 164 | 164 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | global $wpdb; |
| 172 | 172 | |
| 173 | 173 | $tableName = $wpdb->prefix.self::CONCURRENCY_TABLE; |
| 174 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
| 174 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
| 175 | 175 | $charset_collate = $wpdb->get_charset_collate(); |
| 176 | 176 | $sql = "CREATE TABLE $tableName ( order_id int NOT NULL, |
| 177 | 177 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (order_id)) $charset_collate"; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 183 | 183 | |
| 184 | 184 | //Check if table exists |
| 185 | - $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName; |
|
| 185 | + $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName; |
|
| 186 | 186 | if ($tableExists) { |
| 187 | 187 | $charset_collate = $wpdb->get_charset_collate(); |
| 188 | 188 | $sql = "CREATE TABLE IF NOT EXISTS $tableName ( |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | //Updated value field to adapt to new length < v8.0.1 |
| 198 | 198 | $query = "select COLUMN_TYPE FROM information_schema.COLUMNS where TABLE_NAME='$tableName' AND COLUMN_NAME='value'"; |
| 199 | 199 | $results = $wpdb->get_results($query, ARRAY_A); |
| 200 | - if ($results['0']['COLUMN_TYPE'] == 'varchar(100)') { |
|
| 200 | + if ($results['0']['COLUMN_TYPE']=='varchar(100)') { |
|
| 201 | 201 | $sql = "ALTER TABLE $tableName MODIFY value varchar(1000)"; |
| 202 | 202 | $wpdb->query($sql); |
| 203 | 203 | } |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | or config='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'"; |
| 208 | 208 | $dbCurrentConfig = $wpdb->get_results($query, ARRAY_A); |
| 209 | 209 | foreach ($dbCurrentConfig as $item) { |
| 210 | - if ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
| 210 | + if ($item['config']=='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
| 211 | 211 | $css_price_selector = $this->preparePriceSelector($item['value']); |
| 212 | - if ($item['value'] != $css_price_selector) { |
|
| 212 | + if ($item['value']!=$css_price_selector) { |
|
| 213 | 213 | $wpdb->update( |
| 214 | 214 | $tableName, |
| 215 | 215 | array('value' => stripslashes($css_price_selector)), |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | array('%s') |
| 219 | 219 | ); |
| 220 | 220 | } |
| 221 | - } elseif ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
| 221 | + } elseif ($item['config']=='PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
| 222 | 222 | $css_quantity_selector = $this->prepareQuantitySelector($item['value']); |
| 223 | - if ($item['value'] != $css_quantity_selector) { |
|
| 223 | + if ($item['value']!=$css_quantity_selector) { |
|
| 224 | 224 | $wpdb->update( |
| 225 | 225 | $tableName, |
| 226 | 226 | array('value' => stripslashes($css_quantity_selector)), |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 238 | 238 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'"; |
| 239 | 239 | $results = $wpdb->get_results($query, ARRAY_A); |
| 240 | - if (count($results) == 0) { |
|
| 240 | + if (count($results)==0) { |
|
| 241 | 241 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR', 'value' => '.'), array('%s', '%s')); |
| 242 | 242 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR', 'value' => ','), array('%s', '%s')); |
| 243 | 243 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 247 | 247 | $query = "select * from $tableName where config='PAGANTIS_DISPLAY_MAX_AMOUNT'"; |
| 248 | 248 | $results = $wpdb->get_results($query, ARRAY_A); |
| 249 | - if (count($results) == 0) { |
|
| 249 | + if (count($results)==0) { |
|
| 250 | 250 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_DISPLAY_MAX_AMOUNT', 'value' => '0'), array('%s', '%s')); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 255 | 255 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_DISPLAY_SITUATION'"; |
| 256 | 256 | $results = $wpdb->get_results($query, ARRAY_A); |
| 257 | - if (count($results) == 0) { |
|
| 257 | + if (count($results)==0) { |
|
| 258 | 258 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DISPLAY_SITUATION', 'value' => 'default'), array('%s', '%s')); |
| 259 | 259 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_SELECTOR_VARIATION', 'value' => 'default'), array('%s', '%s')); |
| 260 | 260 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 264 | 264 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'"; |
| 265 | 265 | $results = $wpdb->get_results($query, ARRAY_A); |
| 266 | - if (count($results) == 0) { |
|
| 266 | + if (count($results)==0) { |
|
| 267 | 267 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT', 'value' => 'sdk.simulator.types.CHECKOUT_PAGE'), array('%s', '%s')); |
| 268 | 268 | $wpdb->update($tableName, array('value' => 'sdk.simulator.types.PRODUCT_PAGE'), array('config' => 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'), array('%s'), array('%s')); |
| 269 | 269 | } |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | $minAmount = $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']; |
| 313 | 313 | $maxAmount = $this->extraConfig['PAGANTIS_DISPLAY_MAX_AMOUNT']; |
| 314 | 314 | $totalPrice = $product->get_price(); |
| 315 | - $validAmount = ($totalPrice>=$minAmount && ($totalPrice<=$maxAmount || $maxAmount=='0')); |
|
| 316 | - if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' || |
|
| 317 | - $cfg['simulator'] !== 'yes' || !$allowedCountry || !$validAmount) { |
|
| 315 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount=='0')); |
|
| 316 | + if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']=='' || $cfg['pagantis_private_key']=='' || |
|
| 317 | + $cfg['simulator']!=='yes' || !$allowedCountry || !$validAmount) { |
|
| 318 | 318 | return; |
| 319 | 319 | } |
| 320 | 320 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | public function addPagantisGateway($methods) |
| 353 | 353 | { |
| 354 | - if (! class_exists('WC_Payment_Gateway')) { |
|
| 354 | + if (!class_exists('WC_Payment_Gateway')) { |
|
| 355 | 355 | return $methods; |
| 356 | 356 | } |
| 357 | 357 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | public function pagantisRowMeta($links, $file) |
| 408 | 408 | { |
| 409 | - if ($file == plugin_basename(__FILE__)) { |
|
| 409 | + if ($file==plugin_basename(__FILE__)) { |
|
| 410 | 410 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
| 411 | 411 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
| 412 | 412 | __('API documentation', 'pagantis').'</a>'; |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
| 435 | 435 | $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc"; |
| 436 | 436 | $results = $wpdb->get_results($query); |
| 437 | - if (isset($results) && $privateKey == $secretKey) { |
|
| 437 | + if (isset($results) && $privateKey==$secretKey) { |
|
| 438 | 438 | foreach ($results as $key => $result) { |
| 439 | 439 | $response[$key]['timestamp'] = $result->createdAt; |
| 440 | 440 | $response[$key]['log'] = json_decode($result->log); |
@@ -461,12 +461,12 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | $filters = ($data->get_params()); |
| 463 | 463 | $secretKey = $filters['secret']; |
| 464 | - $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 464 | + $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 465 | 465 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
| 466 | - if ($privateKey != $secretKey) { |
|
| 466 | + if ($privateKey!=$secretKey) { |
|
| 467 | 467 | $response['status'] = 401; |
| 468 | 468 | $response['result'] = 'Unauthorized'; |
| 469 | - } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 469 | + } elseif ($_SERVER['REQUEST_METHOD']=='POST') { |
|
| 470 | 470 | if (count($_POST)) { |
| 471 | 471 | foreach ($_POST as $config => $value) { |
| 472 | 472 | if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | and tn.post_date<'".$to->format("Y-m-d")."' order by tn.post_date desc"; |
| 527 | 527 | $results = $wpdb->get_results($query); |
| 528 | 528 | |
| 529 | - if (isset($results) && $privateKey == $secretKey) { |
|
| 529 | + if (isset($results) && $privateKey==$secretKey) { |
|
| 530 | 530 | foreach ($results as $result) { |
| 531 | 531 | $key = $result->ID; |
| 532 | 532 | $response['message'][$key]['timestamp'] = $result->post_date; |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | */ |
| 611 | 611 | private function prepareQuantitySelector($css_quantity_selector) |
| 612 | 612 | { |
| 613 | - if ($css_quantity_selector == 'default' || $css_quantity_selector == '') { |
|
| 613 | + if ($css_quantity_selector=='default' || $css_quantity_selector=='') { |
|
| 614 | 614 | $css_quantity_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']; |
| 615 | 615 | } elseif (!unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it |
| 616 | 616 | $css_quantity_selector = serialize(array($css_quantity_selector)); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | */ |
| 627 | 627 | private function preparePriceSelector($css_price_selector) |
| 628 | 628 | { |
| 629 | - if ($css_price_selector == 'default' || $css_price_selector == '') { |
|
| 629 | + if ($css_price_selector=='default' || $css_price_selector=='') { |
|
| 630 | 630 | $css_price_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
| 631 | 631 | } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
| 632 | 632 | $css_price_selector = serialize(array($css_price_selector)); |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | { |
| 645 | 645 | $metaProduct = get_post_meta($product_id); |
| 646 | 646 | return (array_key_exists('custom_product_pagantis_promoted', $metaProduct) && |
| 647 | - $metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
| 647 | + $metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |