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