@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
| 22 | -require_once(__DIR__ . '/includes/pg-functions.php'); |
|
| 22 | +require_once(__DIR__.'/includes/pg-functions.php'); |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Required minimums and constants |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | public function __construct() |
| 82 | 82 | { |
| 83 | 83 | require_once(plugin_dir_path(__FILE__).'/vendor/autoload.php'); |
| 84 | - require_once(PG_ABSPATH . '/includes/pg-functions.php'); |
|
| 85 | - require_once(PG_ABSPATH . '/includes/logger.php'); |
|
| 84 | + require_once(PG_ABSPATH.'/includes/pg-functions.php'); |
|
| 85 | + require_once(PG_ABSPATH.'/includes/logger.php'); |
|
| 86 | 86 | |
| 87 | 87 | $this->template_path = plugin_dir_path(__FILE__).'/templates/'; |
| 88 | 88 | |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | add_action('init', array($this, 'checkWcPriceSettings'), 10); |
| 100 | 100 | add_action('woocommerce_after_template_part', array($this, 'pagantisAddSimulatorHtmlDiv'), 10); |
| 101 | 101 | add_action('woocommerce_single_product_summary', array($this, 'pagantisInitProductSimulator'), 20); |
| 102 | - add_action('woocommerce_single_variation', array($this,'pagantisAddProductSnippetForVariations'), 30); |
|
| 102 | + add_action('woocommerce_single_variation', array($this, 'pagantisAddProductSnippetForVariations'), 30); |
|
| 103 | 103 | add_action('wp_enqueue_scripts', 'add_pagantis_widget_js'); |
| 104 | 104 | add_action('rest_api_init', array($this, 'pagantisRegisterEndpoint')); //Endpoint |
| 105 | 105 | add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2); |
| 106 | 106 | register_activation_hook(__FILE__, array($this, 'pagantisActivation')); |
| 107 | 107 | add_action('woocommerce_product_options_general_product_data', array($this, 'pagantisPromotedProductTpl')); |
| 108 | 108 | add_action('woocommerce_process_product_meta', array($this, 'pagantisPromotedVarSave')); |
| 109 | - add_action('woocommerce_product_bulk_edit_start', array($this,'pagantisPromotedBulkTemplate')); |
|
| 110 | - add_action('woocommerce_product_bulk_edit_save', array($this,'pagantisPromotedBulkTemplateSave')); |
|
| 109 | + add_action('woocommerce_product_bulk_edit_start', array($this, 'pagantisPromotedBulkTemplate')); |
|
| 110 | + add_action('woocommerce_product_bulk_edit_save', array($this, 'pagantisPromotedBulkTemplateSave')); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $post_id = $product->get_id(); |
| 135 | 135 | $pagantis_promoted_value = $_REQUEST['pagantis_promoted']; |
| 136 | - if ($pagantis_promoted_value === 'on') { |
|
| 136 | + if ($pagantis_promoted_value==='on') { |
|
| 137 | 137 | $pagantis_promoted_value = 'yes'; |
| 138 | 138 | } else { |
| 139 | 139 | $pagantis_promoted_value = 'no'; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | public function pagantisPromotedVarSave($post_id) |
| 168 | 168 | { |
| 169 | 169 | $pagantis_promoted_value = $_POST['pagantis_promoted']; |
| 170 | - if ($pagantis_promoted_value !== 'yes') { |
|
| 170 | + if ($pagantis_promoted_value!=='yes') { |
|
| 171 | 171 | $pagantis_promoted_value = 'no'; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function loadPagantisTranslation($mofile, $domain) |
| 183 | 183 | { |
| 184 | - if ('pagantis' === $domain) { |
|
| 185 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 184 | + if ('pagantis'===$domain) { |
|
| 185 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 186 | 186 | } |
| 187 | 187 | return $mofile; |
| 188 | 188 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | global $wpdb; |
| 196 | 196 | |
| 197 | 197 | $tableName = $wpdb->prefix.PG_CONCURRENCY_TABLE_NAME; |
| 198 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
| 198 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
| 199 | 199 | $charset_collate = $wpdb->get_charset_collate(); |
| 200 | 200 | $sql = "CREATE TABLE $tableName ( order_id int NOT NULL, |
| 201 | 201 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (order_id)) $charset_collate"; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 207 | 207 | |
| 208 | 208 | //Check if table exists |
| 209 | - $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName; |
|
| 209 | + $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName; |
|
| 210 | 210 | if ($tableExists) { |
| 211 | 211 | $charset_collate = $wpdb->get_charset_collate(); |
| 212 | 212 | $sql = "CREATE TABLE IF NOT EXISTS $tableName ( |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | //Updated value field to adapt to new length < v8.0.1 |
| 222 | 222 | $query = "select COLUMN_TYPE FROM information_schema.COLUMNS where TABLE_NAME='$tableName' AND COLUMN_NAME='value'"; |
| 223 | 223 | $results = $wpdb->get_results($query, ARRAY_A); |
| 224 | - if ($results['0']['COLUMN_TYPE'] == 'varchar(100)') { |
|
| 224 | + if ($results['0']['COLUMN_TYPE']=='varchar(100)') { |
|
| 225 | 225 | $sql = "ALTER TABLE $tableName MODIFY value varchar(1000)"; |
| 226 | 226 | $wpdb->query($sql); |
| 227 | 227 | } |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | or config='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'"; |
| 232 | 232 | $dbCurrentConfig = $wpdb->get_results($query, ARRAY_A); |
| 233 | 233 | foreach ($dbCurrentConfig as $item) { |
| 234 | - if ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
| 234 | + if ($item['config']=='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
| 235 | 235 | $css_price_selector = $this->preparePriceSelector($item['value']); |
| 236 | - if ($item['value'] != $css_price_selector) { |
|
| 236 | + if ($item['value']!=$css_price_selector) { |
|
| 237 | 237 | $wpdb->update( |
| 238 | 238 | $tableName, |
| 239 | 239 | array('value' => stripslashes($css_price_selector)), |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | array('%s') |
| 243 | 243 | ); |
| 244 | 244 | } |
| 245 | - } elseif ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
| 245 | + } elseif ($item['config']=='PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
| 246 | 246 | $css_quantity_selector = $this->prepareQuantitySelector($item['value']); |
| 247 | - if ($item['value'] != $css_quantity_selector) { |
|
| 247 | + if ($item['value']!=$css_quantity_selector) { |
|
| 248 | 248 | $wpdb->update( |
| 249 | 249 | $tableName, |
| 250 | 250 | array('value' => stripslashes($css_quantity_selector)), |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | // Making sure DB tables are created < v8.6.9 |
| 261 | - if (!isPgTableCreated(PG_LOGS_TABLE_NAME)){ |
|
| 261 | + if (!isPgTableCreated(PG_LOGS_TABLE_NAME)) { |
|
| 262 | 262 | createLogsTable(); |
| 263 | 263 | } |
| 264 | 264 | checkCartProcessTable(); |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 268 | 268 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'"; |
| 269 | 269 | $results = $wpdb->get_results($query, ARRAY_A); |
| 270 | - if (count($results) == 0) { |
|
| 270 | + if (count($results)==0) { |
|
| 271 | 271 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR', 'value' => '.'), array('%s', '%s')); |
| 272 | 272 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR', 'value' => ','), array('%s', '%s')); |
| 273 | 273 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 277 | 277 | $query = "select * from $tableName where config='PAGANTIS_DISPLAY_MAX_AMOUNT'"; |
| 278 | 278 | $results = $wpdb->get_results($query, ARRAY_A); |
| 279 | - if (count($results) == 0) { |
|
| 279 | + if (count($results)==0) { |
|
| 280 | 280 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_DISPLAY_MAX_AMOUNT', 'value' => '0'), array('%s', '%s')); |
| 281 | 281 | } |
| 282 | 282 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 285 | 285 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_DISPLAY_SITUATION'"; |
| 286 | 286 | $results = $wpdb->get_results($query, ARRAY_A); |
| 287 | - if (count($results) == 0) { |
|
| 287 | + if (count($results)==0) { |
|
| 288 | 288 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DISPLAY_SITUATION', 'value' => 'default'), array('%s', '%s')); |
| 289 | 289 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_SELECTOR_VARIATION', 'value' => 'default'), array('%s', '%s')); |
| 290 | 290 | } |
@@ -294,17 +294,17 @@ discard block |
||
| 294 | 294 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 295 | 295 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'"; |
| 296 | 296 | $results = $wpdb->get_results($query, ARRAY_A); |
| 297 | - if (count($results) == 0) { |
|
| 297 | + if (count($results)==0) { |
|
| 298 | 298 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT', 'value' => 'sdk.simulator.types.CHECKOUT_PAGE'), array('%s', '%s')); |
| 299 | 299 | $wpdb->update($tableName, array('value' => 'sdk.simulator.types.PRODUCT_PAGE'), array('config' => 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'), array('%s'), array('%s')); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | //Adapting to variable selector < v8.3.6 |
| 303 | - $variableSelector="div.summary div.woocommerce-variation.single_variation > div.woocommerce-variation-price span.price"; |
|
| 303 | + $variableSelector = "div.summary div.woocommerce-variation.single_variation > div.woocommerce-variation-price span.price"; |
|
| 304 | 304 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 305 | 305 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_SELECTOR_VARIATION' and value='default'"; |
| 306 | 306 | $results = $wpdb->get_results($query, ARRAY_A); |
| 307 | - if (count($results) == 0) { |
|
| 307 | + if (count($results)==0) { |
|
| 308 | 308 | $wpdb->update($tableName, array('value' => $variableSelector), array('config' => 'PAGANTIS_SIMULATOR_SELECTOR_VARIATION'), array('%s'), array('%s')); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 313 | 313 | $query = "select * from $tableName where config='PAGANTIS_TITLE_4x'"; |
| 314 | 314 | $results = $wpdb->get_results($query, ARRAY_A); |
| 315 | - if (count($results) == 0) { |
|
| 315 | + if (count($results)==0) { |
|
| 316 | 316 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_TITLE_4x', 'value' => 'Until 4 installments, without fees'), array('%s', '%s')); |
| 317 | 317 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_DISPLAY_MIN_AMOUNT_4x', 'value' => 1), array('%s', '%s')); |
| 318 | 318 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_DISPLAY_MAX_AMOUNT_4x', 'value' => 800), array('%s', '%s')); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 326 | 326 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR_4X'"; |
| 327 | 327 | $results = $wpdb->get_results($query, ARRAY_A); |
| 328 | - if (count($results) == 0) { |
|
| 328 | + if (count($results)==0) { |
|
| 329 | 329 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR_4X', 'value' => 'default'), array('%s', '%s')); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $tableName = $wpdb->prefix.PG_CONFIG_TABLE_NAME; |
| 342 | 342 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'"; |
| 343 | 343 | $results = $wpdb->get_results($query, ARRAY_A); |
| 344 | - if (count($results) == 0) { |
|
| 344 | + if (count($results)==0) { |
|
| 345 | 345 | $wpdb->update($tableName, array('value' => 'a:4:{i:0;s:52:"div.summary *:not(del)>.woocommerce-Price-amount bdi";i:1;s:48:"div.summary *:not(del)>.woocommerce-Price-amount";i:2;s:54:"div.entry-summary *:not(del)>.woocommerce-Price-amount";i:3;s:36:"*:not(del)>.woocommerce-Price-amount";}'), array('config' => 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'), array('%s'), array('%s')); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | $isAtcTplPresent = isTemplatePresent( |
| 435 | 435 | $template_name, |
| 436 | 436 | array('single-product/add-to-cart/variation-add-to-cart-button.php', |
| 437 | - 'single-product/add-to-cart/variation.php','single-product/add-to-cart/simple.php') |
|
| 437 | + 'single-product/add-to-cart/variation.php', 'single-product/add-to-cart/simple.php') |
|
| 438 | 438 | ); |
| 439 | 439 | |
| 440 | 440 | $html = apply_filters('pagantis_simulator_selector_html', '<div class="mainPagantisSimulator"></div><div class="pagantisSimulator"></div>'); |
@@ -446,10 +446,10 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | $pagantisSimulator4x = 'enabled'; |
| 449 | - if (!isPluginEnabled4x() || !areMerchantKeysSet4x() || !isCountryShopContextValid() || !isProductAmountValid4x()) { |
|
| 449 | + if (!isPluginEnabled4x() || !areMerchantKeysSet4x() || !isCountryShopContextValid() || !isProductAmountValid4x()) { |
|
| 450 | 450 | $pagantisSimulator4x = 'disabled'; |
| 451 | 451 | } |
| 452 | - if ($pagantisSimulator === 'disabled' && $pagantisSimulator4x === 'disabled') { |
|
| 452 | + if ($pagantisSimulator==='disabled' && $pagantisSimulator4x==='disabled') { |
|
| 453 | 453 | return; |
| 454 | 454 | } |
| 455 | 455 | |
@@ -505,12 +505,12 @@ discard block |
||
| 505 | 505 | $pagantisSimulator4x = 'disabled'; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - if ($pagantisSimulator === 'disabled' && $pagantisSimulator4x === 'disabled') { |
|
| 508 | + if ($pagantisSimulator==='disabled' && $pagantisSimulator4x==='disabled') { |
|
| 509 | 509 | return; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | $totalPrice = $product->get_price(); |
| 513 | - $formattedInstallments = number_format($totalPrice/4, 2); |
|
| 513 | + $formattedInstallments = number_format($totalPrice / 4, 2); |
|
| 514 | 514 | $simulatorMessage = sprintf(__('or 4 installments of %s€, without fees, with ', 'pagantis'), $formattedInstallments); |
| 515 | 515 | $post_id = $product->get_id(); |
| 516 | 516 | $simulatorData = array( |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | */ |
| 553 | 553 | public function addPagantisGateway($methods) |
| 554 | 554 | { |
| 555 | - if (! class_exists('WC_Payment_Gateway')) { |
|
| 555 | + if (!class_exists('WC_Payment_Gateway')) { |
|
| 556 | 556 | return $methods; |
| 557 | 557 | } |
| 558 | 558 | |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | */ |
| 618 | 618 | public function pagantisRowMeta($links, $file) |
| 619 | 619 | { |
| 620 | - if ($file == plugin_basename(__FILE__)) { |
|
| 620 | + if ($file==plugin_basename(__FILE__)) { |
|
| 621 | 621 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
| 622 | 622 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
| 623 | 623 | __('API documentation', 'pagantis').'</a>'; |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | $tableName = $wpdb->prefix.PG_LOGS_TABLE_NAME; |
| 647 | 647 | $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc"; |
| 648 | 648 | $results = $wpdb->get_results($query); |
| 649 | - if (isset($results) && ($privateKey == $secretKey || $privateKey4x == $secretKey)) { |
|
| 649 | + if (isset($results) && ($privateKey==$secretKey || $privateKey4x==$secretKey)) { |
|
| 650 | 650 | foreach ($results as $key => $result) { |
| 651 | 651 | $response[$key]['timestamp'] = $result->createdAt; |
| 652 | 652 | $response[$key]['log'] = json_decode($result->log); |
@@ -673,13 +673,13 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | $filters = ($data->get_params()); |
| 675 | 675 | $secretKey = $filters['secret']; |
| 676 | - $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 676 | + $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 677 | 677 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
| 678 | 678 | $privateKey4x = isset($cfg['pagantis_private_key_4x']) ? $cfg['pagantis_private_key_4x'] : null; |
| 679 | - if ($privateKey != $secretKey && $privateKey4x != $secretKey) { |
|
| 679 | + if ($privateKey!=$secretKey && $privateKey4x!=$secretKey) { |
|
| 680 | 680 | $response['status'] = 401; |
| 681 | 681 | $response['result'] = 'Unauthorized'; |
| 682 | - } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 682 | + } elseif ($_SERVER['REQUEST_METHOD']=='POST') { |
|
| 683 | 683 | if (count($_POST)) { |
| 684 | 684 | foreach ($_POST as $config => $value) { |
| 685 | 685 | if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | and tn.post_date<'".$to->format("Y-m-d")."' order by tn.post_date desc"; |
| 741 | 741 | $results = $wpdb->get_results($query); |
| 742 | 742 | |
| 743 | - if (isset($results) && ($privateKey == $secretKey || $privateKey4x == $secretKey)) { |
|
| 743 | + if (isset($results) && ($privateKey==$secretKey || $privateKey4x==$secretKey)) { |
|
| 744 | 744 | foreach ($results as $result) { |
| 745 | 745 | $key = $result->ID; |
| 746 | 746 | $response['message'][$key]['timestamp'] = $result->post_date; |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | */ |
| 814 | 814 | private function prepareQuantitySelector($css_quantity_selector) |
| 815 | 815 | { |
| 816 | - if ($css_quantity_selector == 'default' || $css_quantity_selector == '') { |
|
| 816 | + if ($css_quantity_selector=='default' || $css_quantity_selector=='') { |
|
| 817 | 817 | $css_quantity_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']; |
| 818 | 818 | } elseif (!unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it |
| 819 | 819 | $css_quantity_selector = serialize(array($css_quantity_selector)); |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | */ |
| 830 | 830 | private function preparePriceSelector($css_price_selector) |
| 831 | 831 | { |
| 832 | - if ($css_price_selector == 'default' || $css_price_selector == '') { |
|
| 832 | + if ($css_price_selector=='default' || $css_price_selector=='') { |
|
| 833 | 833 | $css_price_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
| 834 | 834 | } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
| 835 | 835 | $css_price_selector = serialize(array($css_price_selector)); |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | { |
| 848 | 848 | $metaProduct = get_post_meta($product_id); |
| 849 | 849 | return (array_key_exists('custom_product_pagantis_promoted', $metaProduct) && |
| 850 | - $metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
| 850 | + $metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | /** |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // Exit if accessed directly |
| 5 | 5 | } |
| 6 | 6 | |
@@ -22,44 +22,44 @@ discard block |
||
| 22 | 22 | * @version 1.0.0 |
| 23 | 23 | * @since 8.6.9 |
| 24 | 24 | */ |
| 25 | - public static function log( $message, $start_time = null, $end_time = null ) { |
|
| 26 | - if ( ! class_exists( 'WC_Logger' ) ) { |
|
| 25 | + public static function log($message, $start_time = null, $end_time = null) { |
|
| 26 | + if (!class_exists('WC_Logger')) { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if ( empty( self::$logger ) ) { |
|
| 31 | - if (version_compare( WC_VERSION, 3.0, '<' )) { |
|
| 30 | + if (empty(self::$logger)) { |
|
| 31 | + if (version_compare(WC_VERSION, 3.0, '<')) { |
|
| 32 | 32 | self::$logger = new WC_Logger(); |
| 33 | 33 | } else { |
| 34 | 34 | self::$logger = wc_get_logger(); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - if (!defined( 'WP_DEBUG' )) { |
|
| 38 | + if (!defined('WP_DEBUG')) { |
|
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if ( ! is_null( $start_time ) ) { |
|
| 42 | + if (!is_null($start_time)) { |
|
| 43 | 43 | |
| 44 | - $formatted_start_time = date_i18n( get_option( 'date_format' ) . ' g:ia', $start_time ); |
|
| 45 | - $end_time = is_null( $end_time ) ? current_time( 'timestamp' ) : $end_time; |
|
| 46 | - $formatted_end_time = date_i18n( get_option( 'date_format' ) . ' g:ia', $end_time ); |
|
| 47 | - $elapsed_time = round( abs( $end_time - $start_time ) / 60, 2 ); |
|
| 44 | + $formatted_start_time = date_i18n(get_option('date_format').' g:ia', $start_time); |
|
| 45 | + $end_time = is_null($end_time) ? current_time('timestamp') : $end_time; |
|
| 46 | + $formatted_end_time = date_i18n(get_option('date_format').' g:ia', $end_time); |
|
| 47 | + $elapsed_time = round(abs($end_time - $start_time) / 60, 2); |
|
| 48 | 48 | |
| 49 | - $log_entry = "\n" . '====Pagantis Version: ' . PG_VERSION . '====' . "\n"; |
|
| 50 | - $log_entry .= '====Start Log ' . $formatted_start_time . '====' . "\n" . $message . "\n"; |
|
| 51 | - $log_entry .= '====End Log ' . $formatted_end_time . ' (' . $elapsed_time . ')====' . "\n\n"; |
|
| 49 | + $log_entry = "\n".'====Pagantis Version: '.PG_VERSION.'===='."\n"; |
|
| 50 | + $log_entry .= '====Start Log '.$formatted_start_time.'===='."\n".$message."\n"; |
|
| 51 | + $log_entry .= '====End Log '.$formatted_end_time.' ('.$elapsed_time.')===='."\n\n"; |
|
| 52 | 52 | |
| 53 | 53 | } else { |
| 54 | - $log_entry = "\n" . '====Pagantis Version: ' . PG_VERSION . '====' . "\n"; |
|
| 55 | - $log_entry .= '====Start Log====' . "\n" . $message . "\n" . '====End Log====' . "\n\n"; |
|
| 54 | + $log_entry = "\n".'====Pagantis Version: '.PG_VERSION.'===='."\n"; |
|
| 55 | + $log_entry .= '====Start Log===='."\n".$message."\n".'====End Log===='."\n\n"; |
|
| 56 | 56 | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (version_compare( WC_VERSION, 3.0, '<' )) { |
|
| 60 | - self::$logger->add( self::PG_LOG_FILENAME, $log_entry ); |
|
| 59 | + if (version_compare(WC_VERSION, 3.0, '<')) { |
|
| 60 | + self::$logger->add(self::PG_LOG_FILENAME, $log_entry); |
|
| 61 | 61 | } else { |
| 62 | - self::$logger->debug( $log_entry, array( 'source' => self::PG_LOG_FILENAME ) ); |
|
| 62 | + self::$logger->debug($log_entry, array('source' => self::PG_LOG_FILENAME)); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |