Passed
Pull Request — master (#22)
by Cesar
05:36 queued 02:58
created
WC_Pagantis.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 (
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         $locale = strtolower(strstr(get_locale(), '_', true));
163 163
         $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']);
164 164
         $allowedCountry = (in_array(strtolower($locale), $allowedCountries));
165
-        if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] == '' || $cfg['pagantis_private_key'] == '' ||
166
-            $cfg['simulator'] !== 'yes' ||  $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] ||
167
-            !$allowedCountry ) {
165
+        if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']=='' || $cfg['pagantis_private_key']=='' ||
166
+            $cfg['simulator']!=='yes' || $product->price < $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] ||
167
+            !$allowedCountry) {
168 168
             return;
169 169
         }
170 170
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function addPagantisGateway($methods)
194 194
     {
195
-        if (! class_exists('WC_Payment_Gateway')) {
195
+        if (!class_exists('WC_Payment_Gateway')) {
196 196
             return $methods;
197 197
         }
198 198
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     public function pagantisRowMeta($links, $file)
249 249
     {
250
-        if ($file == plugin_basename(__FILE__)) {
250
+        if ($file==plugin_basename(__FILE__)) {
251 251
             $links[] = '<a href="'.WcPagantis::GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>';
252 252
             $links[] = '<a href="'.WcPagantis::PAGANTIS_DOC_URL.'" target="_blank">'.
253 253
             __('API documentation', 'pagantis').'</a>';
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $tableName = $wpdb->prefix.self::LOGS_TABLE;
276 276
         $query = "select * from $tableName where createdAt>$from and createdAt<$to order by createdAt desc";
277 277
         $results = $wpdb->get_results($query);
278
-        if (isset($results) && $privateKey == $secretKey) {
278
+        if (isset($results) && $privateKey==$secretKey) {
279 279
             foreach ($results as $key => $result) {
280 280
                 $response[$key]['timestamp'] = $result->createdAt;
281 281
                 $response[$key]['log']       = json_decode($result->log);
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
 
303 303
         $filters   = ($data->get_params());
304 304
         $secretKey = $filters['secret'];
305
-        $cfg  = get_option('woocommerce_pagantis_settings');
305
+        $cfg = get_option('woocommerce_pagantis_settings');
306 306
         $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null;
307
-        if ($privateKey != $secretKey) {
307
+        if ($privateKey!=$secretKey) {
308 308
             $response['status'] = 401;
309 309
             $response['result'] = 'Unauthorized';
310
-        } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
310
+        } elseif ($_SERVER['REQUEST_METHOD']=='POST') {
311 311
             if (count($_POST)) {
312 312
                 foreach ($_POST as $config => $value) {
313 313
                     if (isset($this->defaultConfigs[$config]) && $response['status']==null) {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 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";
368 368
         $results = $wpdb->get_results($query);
369 369
 
370
-        if (isset($results) && $privateKey == $secretKey) {
370
+        if (isset($results) && $privateKey==$secretKey) {
371 371
             foreach ($results as $result) {
372 372
                 $key = $result->ID;
373 373
                 $response['message'][$key]['timestamp'] = $result->post_date;
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
     private function prepareQuantitySelector()
451 451
     {
452 452
         $css_quantity_selector = $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'];
453
-        if ($css_quantity_selector == 'default' || $css_quantity_selector == '') {
453
+        if ($css_quantity_selector=='default' || $css_quantity_selector=='') {
454 454
             $css_quantity_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'];
455 455
         } elseif (!unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it
456 456
             $css_quantity_selector = serialize(array($css_quantity_selector));
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
     private function preparePriceSelector()
466 466
     {
467 467
         $css_price_selector = $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'];
468
-        if ($css_price_selector == 'default' || $css_price_selector == '') {
468
+        if ($css_price_selector=='default' || $css_price_selector=='') {
469 469
             $css_price_selector = $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'];
470 470
         } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it
471 471
             $css_price_selector = serialize(array($css_price_selector));
Please login to merge, or discard this patch.