@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function loadPagantisTranslation($mofile, $domain) |
| 85 | 85 | { |
| 86 | - if ('pagantis' === $domain) { |
|
| 87 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 86 | + if ('pagantis'===$domain) { |
|
| 87 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 88 | 88 | } |
| 89 | 89 | return $mofile; |
| 90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | global $wpdb; |
| 98 | 98 | |
| 99 | 99 | $tableName = $wpdb->prefix.self::CONCURRENCY_TABLE; |
| 100 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
| 100 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
| 101 | 101 | $charset_collate = $wpdb->get_charset_collate(); |
| 102 | 102 | $sql = "CREATE TABLE $tableName ( order_id int NOT NULL, |
| 103 | 103 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (order_id)) $charset_collate"; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $tableName = $wpdb->prefix.self::CONFIG_TABLE; |
| 109 | 109 | |
| 110 | 110 | //Check if table exists |
| 111 | - $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName; |
|
| 111 | + $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName; |
|
| 112 | 112 | if ($tableExists) { |
| 113 | 113 | $charset_collate = $wpdb->get_charset_collate(); |
| 114 | 114 | $sql = "CREATE TABLE IF NOT EXISTS $tableName ( |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | //Updated value field to adapt to new length < v8.0.1 |
| 124 | 124 | $query = "select COLUMN_TYPE FROM information_schema.COLUMNS where TABLE_NAME='$tableName' AND COLUMN_NAME='value'"; |
| 125 | 125 | $results = $wpdb->get_results($query, ARRAY_A); |
| 126 | - if ($results['0']['COLUMN_TYPE'] == 'varchar(100)') { |
|
| 126 | + if ($results['0']['COLUMN_TYPE']=='varchar(100)') { |
|
| 127 | 127 | $sql = "ALTER TABLE $tableName MODIFY value varchar(1000)"; |
| 128 | 128 | $wpdb->query($sql); |
| 129 | 129 | } |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | or config='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'"; |
| 134 | 134 | $dbCurrentConfig = $wpdb->get_results($query, ARRAY_A); |
| 135 | 135 | foreach ($dbCurrentConfig as $item) { |
| 136 | - if ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
| 136 | + if ($item['config']=='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
| 137 | 137 | $css_price_selector = $this->preparePriceSelector($item['value']); |
| 138 | - if ($item['value'] != $css_price_selector) { |
|
| 138 | + if ($item['value']!=$css_price_selector) { |
|
| 139 | 139 | $wpdb->update( |
| 140 | 140 | $tableName, |
| 141 | 141 | array('value' => stripslashes($css_price_selector)), |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | array('%s') |
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | - } elseif ($item['config'] == 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
| 147 | + } elseif ($item['config']=='PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
| 148 | 148 | $css_quantity_selector = $this->prepareQuantitySelector($item['value']); |
| 149 | - if ($item['value'] != $css_quantity_selector) { |
|
| 149 | + if ($item['value']!=$css_quantity_selector) { |
|
| 150 | 150 | $wpdb->update( |
| 151 | 151 | $tableName, |
| 152 | 152 | array('value' => stripslashes($css_quantity_selector)), |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | $locale = strtolower(strstr(get_locale(), '_', true)); |
| 201 | 201 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
| 202 | 202 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries)); |
| 203 | - if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' || |
|
| 204 | - $cfg['simulator'] !== 'yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] || |
|
| 205 | - !$allowedCountry ) { |
|
| 203 | + if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']=='' || $cfg['pagantis_private_key']=='' || |
|
| 204 | + $cfg['simulator']!=='yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] || |
|
| 205 | + !$allowedCountry) { |
|
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function addPagantisGateway($methods) |
| 230 | 230 | { |
| 231 | - if (! class_exists('WC_Payment_Gateway')) { |
|
| 231 | + if (!class_exists('WC_Payment_Gateway')) { |
|
| 232 | 232 | return $methods; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function pagantisRowMeta($links, $file) |
| 285 | 285 | { |
| 286 | - if ($file == plugin_basename(__FILE__)) { |
|
| 286 | + if ($file==plugin_basename(__FILE__)) { |
|
| 287 | 287 | $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
| 288 | 288 | $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'. |
| 289 | 289 | __('API documentation', 'pagantis').'</a>'; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
| 312 | 312 | $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc"; |
| 313 | 313 | $results = $wpdb->get_results($query); |
| 314 | - if (isset($results) && $privateKey == $secretKey) { |
|
| 314 | + if (isset($results) && $privateKey==$secretKey) { |
|
| 315 | 315 | foreach ($results as $key => $result) { |
| 316 | 316 | $response[$key]['timestamp'] = $result->createdAt; |
| 317 | 317 | $response[$key]['log'] = json_decode($result->log); |
@@ -338,12 +338,12 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $filters = ($data->get_params()); |
| 340 | 340 | $secretKey = $filters['secret']; |
| 341 | - $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 341 | + $cfg = get_option('woocommerce_pagantis_settings'); |
|
| 342 | 342 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
| 343 | - if ($privateKey != $secretKey) { |
|
| 343 | + if ($privateKey!=$secretKey) { |
|
| 344 | 344 | $response['status'] = 401; |
| 345 | 345 | $response['result'] = 'Unauthorized'; |
| 346 | - } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 346 | + } elseif ($_SERVER['REQUEST_METHOD']=='POST') { |
|
| 347 | 347 | if (count($_POST)) { |
| 348 | 348 | foreach ($_POST as $config => $value) { |
| 349 | 349 | if (isset($this->defaultConfigs[$config]) && $response['status']==null) { |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | where tn.post_type='shop_order' and tn.post_date>'".$from->format("Y-m-d")."' and tn.post_date<'".$to->format("Y-m-d")."' order by tn.post_date desc"; |
| 404 | 404 | $results = $wpdb->get_results($query); |
| 405 | 405 | |
| 406 | - if (isset($results) && $privateKey == $secretKey) { |
|
| 406 | + if (isset($results) && $privateKey==$secretKey) { |
|
| 407 | 407 | foreach ($results as $result) { |
| 408 | 408 | $key = $result->ID; |
| 409 | 409 | $response['message'][$key]['timestamp'] = $result->post_date; |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | */ |
| 488 | 488 | private function prepareQuantitySelector($css_quantity_selector) |
| 489 | 489 | { |
| 490 | - if ($css_quantity_selector == 'default' || $css_quantity_selector == '') { |
|
| 490 | + if ($css_quantity_selector=='default' || $css_quantity_selector=='') { |
|
| 491 | 491 | $css_quantity_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']; |
| 492 | 492 | } elseif (!unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it |
| 493 | 493 | $css_quantity_selector = serialize(array($css_quantity_selector)); |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | */ |
| 504 | 504 | private function preparePriceSelector($css_price_selector) |
| 505 | 505 | { |
| 506 | - if ($css_price_selector == 'default' || $css_price_selector == '') { |
|
| 506 | + if ($css_price_selector=='default' || $css_price_selector=='') { |
|
| 507 | 507 | $css_price_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
| 508 | 508 | } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
| 509 | 509 | $css_price_selector = serialize(array($css_price_selector)); |