Passed
Pull Request — master (#47)
by
unknown
06:27 queued 04:03
created
pagantis.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     exit;
12 12
 }
13 13
 
14
-define('_PS_PAGANTIS_DIR', _PS_MODULE_DIR_. '/pagantis');
14
+define('_PS_PAGANTIS_DIR', _PS_MODULE_DIR_.'/pagantis');
15 15
 define('PROMOTIONS_CATEGORY', 'pagantis-promotion-product');
16 16
 define('PROMOTIONS_CATEGORY_NAME', 'Pagantis Promoted Product');
17 17
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         Configuration::updateValue('pagantis_public_key', '');
121 121
         Configuration::updateValue('pagantis_private_key', '');
122 122
 
123
-        $return =  (parent::install()
123
+        $return = (parent::install()
124 124
             && $this->registerHook('displayShoppingCart')
125 125
             && $this->registerHook('paymentOptions')
126 126
             && $this->registerHook('displayRightColumn')
@@ -202,18 +202,18 @@  discard block
 block discarded – undo
202 202
     public function checkHooks()
203 203
     {
204 204
         try {
205
-            $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where 
206
-            id_module = \'' . Module::getModuleIdByName($this->name) . '\' and 
207
-            id_shop = \'' . Shop::getContextShopID() . '\' and 
208
-            id_hook = \'' . Hook::getIdByName('header') . '\'';
205
+            $sql_content = 'select * from '._DB_PREFIX_.'hook_module where 
206
+            id_module = \'' . Module::getModuleIdByName($this->name).'\' and 
207
+            id_shop = \'' . Shop::getContextShopID().'\' and 
208
+            id_hook = \'' . Hook::getIdByName('header').'\'';
209 209
             $hook_exists = Db::getInstance()->ExecuteS($sql_content);
210 210
             if (empty($hook_exists)) {
211
-                $sql_insert = 'insert into ' . _DB_PREFIX_.  'hook_module 
211
+                $sql_insert = 'insert into '._DB_PREFIX_.'hook_module 
212 212
             (id_module, id_shop, id_hook, position)
213 213
             values
214
-            (\''. Module::getModuleIdByName($this->name) . '\',
215
-            \''. Shop::getContextShopID() . '\',
216
-            \''. Hook::getIdByName('header') . '\',
214
+            (\''. Module::getModuleIdByName($this->name).'\',
215
+            \''. Shop::getContextShopID().'\',
216
+            \''. Hook::getIdByName('header').'\',
217 217
             150)';
218 218
                 Db::getInstance()->execute($sql_insert);
219 219
             }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function checkEnvVariables()
229 229
     {
230
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config';
230
+        $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config';
231 231
         $dbConfigs = Db::getInstance()->executeS($sql_content);
232 232
 
233 233
         // Convert a multimple dimension array for SQL insert statements into a simple key/value
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         } else {
331 331
             $this->context->controller->addJS($url);
332 332
         }
333
-        $this->context->controller->addJS($this->getPathUri(). 'views/js/simulator.js');
333
+        $this->context->controller->addJS($this->getPathUri().'views/js/simulator.js');
334 334
     }
335 335
 
336 336
     /**
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         $paymentOption
395 395
             ->setCallToActionText($pagantisTitle)
396 396
             ->setAction($link->getModuleLink('pagantis', 'payment'))
397
-            ->setLogo($this->getPathUri(). 'views/img/' . $logo)
397
+            ->setLogo($this->getPathUri().'views/img/'.$logo)
398 398
             ->setModuleName(__CLASS__)
399 399
         ;
400 400
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                 'input' => array(
422 422
                     array(
423 423
                         'name' => 'pagantis_is_enabled',
424
-                        'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
424
+                        'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
425 425
                         'label' => $this->l('Module is enabled'),
426 426
                         'prefix' => '<i class="icon icon-key"></i>',
427 427
                         'class' => 't',
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                     ),
462 462
                     array(
463 463
                         'name' => 'pagantis_simulator_is_enabled',
464
-                        'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
464
+                        'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
465 465
                         'label' => $this->l('Simulator is enabled'),
466 466
                         'prefix' => '<i class="icon icon-key"></i>',
467 467
                         'class' => 't',
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
             $message = $this->displayError($error);
578 578
         }
579 579
 
580
-        $logo = $this->getPathUri(). 'views/img/logo_pagantis.png';
580
+        $logo = $this->getPathUri().'views/img/logo_pagantis.png';
581 581
         if ($this->language == 'ES' || $this->language == null) {
582
-            $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png';
582
+            $logo = $this->getPathUri().'views/img/logo_pagamastarde.png';
583 583
         }
584 584
         $tpl = $this->local_path.'views/templates/admin/config-info.tpl';
585 585
         $this->context->smarty->assign(array(
@@ -803,17 +803,17 @@  discard block
 block discarded – undo
803 803
      */
804 804
     public function checkLogoExists()
805 805
     {
806
-        $logoPmt = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/pagamastarde.png';
807
-        $logoPg = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/pagantis.png';
808
-        if (!file_exists($logoPmt) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
806
+        $logoPmt = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/pagamastarde.png';
807
+        $logoPg = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/pagantis.png';
808
+        if (!file_exists($logoPmt) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
809 809
             copy(
810
-                _PS_PAGANTIS_DIR . '/views/img/logo_pagamastarde.png',
810
+                _PS_PAGANTIS_DIR.'/views/img/logo_pagamastarde.png',
811 811
                 $logoPmt
812 812
             );
813 813
         }
814
-        if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
814
+        if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
815 815
             copy(
816
-                _PS_PAGANTIS_DIR . '/views/img/logo_pagantis.png',
816
+                _PS_PAGANTIS_DIR.'/views/img/logo_pagantis.png',
817 817
                 $logoPg
818 818
             );
819 819
         }
@@ -828,16 +828,16 @@  discard block
 block discarded – undo
828 828
         if (!in_array(PROMOTIONS_CATEGORY_NAME, $categories)) {
829 829
             /** @var CategoryCore $category */
830 830
             $category = new Category();
831
-            $categoryArray = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY );
831
+            $categoryArray = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY);
832 832
             $category->is_root_category = false;
833 833
             $category->link_rewrite = $categoryArray;
834 834
             $category->meta_description = $categoryArray;
835 835
             $category->meta_keywords = $categoryArray;
836 836
             $category->meta_title = $categoryArray;
837
-            $category->name = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME);
837
+            $category->name = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME);
838 838
             $category->id_parent = Configuration::get('PS_HOME_CATEGORY');
839
-            $category->active=0;
840
-            $description = 'Pagantis: Products with this category have free financing assumed by the merchant. ' .
839
+            $category->active = 0;
840
+            $description = 'Pagantis: Products with this category have free financing assumed by the merchant. '.
841 841
                 'Use it to promote your products or brands.';
842 842
             $category->description = $this->l($description);
843 843
             $category->save();
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
             return '';
852 852
         }
853 853
 
854
-        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($config) . '\' limit 1';
854
+        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($config).'\' limit 1';
855 855
         if ($results = Db::getInstance()->ExecuteS($sql)) {
856 856
             if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) {
857 857
                 return $results[0]['value'];
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         if (count($langArray) != 2 && isset($lang['locale'])) {
872 872
             $langArray = explode("-", $lang['locale']);
873 873
         }
874
-        $this->language = Tools::strtoupper($langArray[count($langArray)-1]);
874
+        $this->language = Tools::strtoupper($langArray[count($langArray) - 1]);
875 875
         // Prevent null language detection
876 876
         $this->language = ($this->language) ? $this->language : 'ES';
877 877
     }
Please login to merge, or discard this patch.