@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | public function initContent() |
19 | 19 | { |
20 | 20 | $this->authorize(); |
21 | - $method = Tools::strtolower($_SERVER['REQUEST_METHOD']) . "Method"; |
|
21 | + $method = Tools::strtolower($_SERVER['REQUEST_METHOD'])."Method"; |
|
22 | 22 | if (method_exists($this, $method)) { |
23 | 23 | header('HTTP/1.1 200 Ok', true, 200); |
24 | 24 | header('Content-Type: application/json', true); |
25 | 25 | $result = json_encode($this->{$method}()); |
26 | - header('Content-Length: ' . Tools::strlen($result)); |
|
26 | + header('Content-Length: '.Tools::strlen($result)); |
|
27 | 27 | echo $result; |
28 | 28 | exit(); |
29 | 29 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getExtraConfigs() |
41 | 41 | { |
42 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'pmt_config'; |
|
42 | + $sql_content = 'select * from '._DB_PREFIX_.'pmt_config'; |
|
43 | 43 | $dbConfigs = Db::getInstance()->executeS($sql_content); |
44 | 44 | |
45 | 45 | // Convert a multimple dimension array for SQL insert statements into a simple key/value |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | Db::getInstance()->update( |
70 | 70 | 'pmt_config', |
71 | 71 | array('value' => pSQL($value)), |
72 | - 'config = \''. pSQL($config) .'\'' |
|
72 | + 'config = \''.pSQL($config).'\'' |
|
73 | 73 | ); |
74 | 74 | } else { |
75 | 75 | $errors[$config] = $value; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getMethod() |
95 | 95 | { |
96 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'pmt_config'; |
|
96 | + $sql_content = 'select * from '._DB_PREFIX_.'pmt_config'; |
|
97 | 97 | $dbConfigs = Db::getInstance()->executeS($sql_content); |
98 | 98 | |
99 | 99 | $simpleDbConfigs = array(); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $parsedUrl = parse_url($url); |
36 | 36 | $separator = ($parsedUrl['query'] == null) ? '?' : '&'; |
37 | - $redirectUrl = $url. $separator . http_build_query($parameters); |
|
37 | + $redirectUrl = $url.$separator.http_build_query($parameters); |
|
38 | 38 | Tools::redirect($redirectUrl); |
39 | 39 | } |
40 | 40 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $response = $exception->getMessage(); |
77 | 77 | } else { |
78 | 78 | $response = 'Unable to serialize log.'. |
79 | - 'data: '. json_encode($data). |
|
80 | - 'exception: '. json_encode($exception); |
|
79 | + 'data: '.json_encode($data). |
|
80 | + 'exception: '.json_encode($exception); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -64,7 +64,7 @@ |
||
64 | 64 | if (isset($data['trace'])) { |
65 | 65 | $logEntry->setTrace($data['trace']); |
66 | 66 | } |
67 | - } elseif (!is_null($exception)) { |
|
67 | + } elseif (!is_null($exception)) { |
|
68 | 68 | $logEntry->error($exception); |
69 | 69 | } |
70 | 70 |
@@ -351,7 +351,7 @@ |
||
351 | 351 | */ |
352 | 352 | public function cancelProcess($response = null) |
353 | 353 | { |
354 | - if ($this->merchantOrder && $this->processError === true) { |
|
354 | + if ($this->merchantOrder && $this->processError === true) { |
|
355 | 355 | sleep(5); |
356 | 356 | $id = (!is_null($this->pmtOrder))?$this->pmtOrder->getId():null; |
357 | 357 | $status = (!is_null($this->pmtOrder))?$this->pmtOrder->getStatus():null; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | private function getPmtOrderId() |
195 | 195 | { |
196 | 196 | try { |
197 | - $this->pmtOrderId= Db::getInstance()->getValue( |
|
197 | + $this->pmtOrderId = Db::getInstance()->getValue( |
|
198 | 198 | 'select order_id from '._DB_PREFIX_.'pmt_order where id = '.$this->merchantOrderId |
199 | 199 | ); |
200 | 200 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | Configuration::get('PS_OS_PAYMENT'), |
277 | 277 | $this->merchantOrder->getOrderTotal(true), |
278 | 278 | $this->module->displayName, |
279 | - 'pmtOrderId: ' . $this->pmtOrder->getId(), |
|
279 | + 'pmtOrderId: '.$this->pmtOrder->getId(), |
|
280 | 280 | array('transaction_id' => $this->pmtOrderId), |
281 | 281 | null, |
282 | 282 | false, |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | protected function unblockConcurrency() |
336 | 336 | { |
337 | 337 | try { |
338 | - Db::getInstance()->delete('pmt_cart_process', 'timestamp < ' . (time() - 6)); |
|
338 | + Db::getInstance()->delete('pmt_cart_process', 'timestamp < '.(time() - 6)); |
|
339 | 339 | } catch (\Exception $exception) { |
340 | 340 | throw new ConcurrencyException(); |
341 | 341 | } |
@@ -353,15 +353,15 @@ discard block |
||
353 | 353 | { |
354 | 354 | if ($this->merchantOrder && $this->processError === true) { |
355 | 355 | sleep(5); |
356 | - $id = (!is_null($this->pmtOrder))?$this->pmtOrder->getId():null; |
|
357 | - $status = (!is_null($this->pmtOrder))?$this->pmtOrder->getStatus():null; |
|
356 | + $id = (!is_null($this->pmtOrder)) ? $this->pmtOrder->getId() : null; |
|
357 | + $status = (!is_null($this->pmtOrder)) ? $this->pmtOrder->getStatus() : null; |
|
358 | 358 | $this->module->validateOrder( |
359 | 359 | $this->merchantOrderId, |
360 | 360 | Configuration::get('PS_OS_ERROR'), |
361 | 361 | $this->merchantOrder->getOrderTotal(true), |
362 | 362 | $this->module->displayName, |
363 | - ' pmtOrderId: ' . $id . |
|
364 | - ' pmtStatusId:' . $status, |
|
363 | + ' pmtOrderId: '.$id. |
|
364 | + ' pmtStatusId:'.$status, |
|
365 | 365 | null, |
366 | 366 | null, |
367 | 367 | false, |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | 'id_cart' => $this->merchantOrderId, |
398 | 398 | 'key' => $this->config['secureKey'], |
399 | 399 | 'id_module' => $this->module->id, |
400 | - 'id_order' => ($this->pmtOrder)?$this->pmtOrder->getId(): null, |
|
400 | + 'id_order' => ($this->pmtOrder) ? $this->pmtOrder->getId() : null, |
|
401 | 401 | ); |
402 | - $url = ($error)? $this->config['urlKO'] : $this->config['urlOK']; |
|
402 | + $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK']; |
|
403 | 403 | return $this->redirect($url, $parameters); |
404 | 404 | } |
405 | 405 | } |
@@ -768,6 +768,6 @@ |
||
768 | 768 | } |
769 | 769 | } |
770 | 770 | |
771 | - return $default; |
|
771 | + return $default; |
|
772 | 772 | } |
773 | 773 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | -define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_. '/paylater'); |
|
14 | +define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_.'/paylater'); |
|
15 | 15 | |
16 | 16 | require _PS_PAYLATER_DIR.'/vendor/autoload.php'; |
17 | 17 | |
@@ -194,18 +194,18 @@ discard block |
||
194 | 194 | public function checkHooks() |
195 | 195 | { |
196 | 196 | try { |
197 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where |
|
198 | - id_module = \'' . Module::getModuleIdByName($this->name) . '\' and |
|
199 | - id_shop = \'' . Shop::getContextShopID() . '\' and |
|
200 | - id_hook = \'' . Hook::getIdByName('header') . '\''; |
|
197 | + $sql_content = 'select * from '._DB_PREFIX_.'hook_module where |
|
198 | + id_module = \'' . Module::getModuleIdByName($this->name).'\' and |
|
199 | + id_shop = \'' . Shop::getContextShopID().'\' and |
|
200 | + id_hook = \'' . Hook::getIdByName('header').'\''; |
|
201 | 201 | $hook_exists = Db::getInstance()->ExecuteS($sql_content); |
202 | 202 | if (empty($hook_exists)) { |
203 | - $sql_insert = 'insert into ' . _DB_PREFIX_. 'hook_module |
|
203 | + $sql_insert = 'insert into '._DB_PREFIX_.'hook_module |
|
204 | 204 | (id_module, id_shop, id_hook, position) |
205 | 205 | values |
206 | - (\''. Module::getModuleIdByName($this->name) . '\', |
|
207 | - \''. Shop::getContextShopID() . '\', |
|
208 | - \''. Hook::getIdByName('header') . '\', |
|
206 | + (\''. Module::getModuleIdByName($this->name).'\', |
|
207 | + \''. Shop::getContextShopID().'\', |
|
208 | + \''. Hook::getIdByName('header').'\', |
|
209 | 209 | 150)'; |
210 | 210 | Db::getInstance()->execute($sql_insert); |
211 | 211 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function checkEnvVariables() |
221 | 221 | { |
222 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'pmt_config'; |
|
222 | + $sql_content = 'select * from '._DB_PREFIX_.'pmt_config'; |
|
223 | 223 | $dbConfigs = Db::getInstance()->executeS($sql_content); |
224 | 224 | |
225 | 225 | // Convert a multimple dimension array for SQL insert statements into a simple key/value |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } else { |
318 | 318 | $this->context->controller->addJS('https://cdn.pagamastarde.com/js/pmt-v2/sdk.js'); |
319 | 319 | } |
320 | - $this->context->controller->addJS($this->getPathUri(). 'views/js/simulator.js'); |
|
320 | + $this->context->controller->addJS($this->getPathUri().'views/js/simulator.js'); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $paymentOption |
367 | 367 | ->setCallToActionText($pmtTitle) |
368 | 368 | ->setAction($link->getModuleLink('paylater', 'payment')) |
369 | - ->setLogo($this->getPathUri(). 'logo.gif') |
|
369 | + ->setLogo($this->getPathUri().'logo.gif') |
|
370 | 370 | ->setModuleName(__CLASS__) |
371 | 371 | ; |
372 | 372 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | 'input' => array( |
397 | 397 | array( |
398 | 398 | 'name' => 'pmt_is_enabled', |
399 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
399 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
400 | 400 | 'label' => $this->l('Module is enabled'), |
401 | 401 | 'prefix' => '<i class="icon icon-key"></i>', |
402 | 402 | 'class' => 't', |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | ), |
437 | 437 | array( |
438 | 438 | 'name' => 'pmt_simulator_is_enabled', |
439 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
439 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
440 | 440 | 'label' => $this->l('Simulator is enabled'), |
441 | 441 | 'prefix' => '<i class="icon icon-key"></i>', |
442 | 442 | 'class' => 't', |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $message = $this->displayError($error); |
553 | 553 | } |
554 | 554 | |
555 | - $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png'; |
|
555 | + $logo = $this->getPathUri().'views/img/logo_pagamastarde.png'; |
|
556 | 556 | $tpl = $this->local_path.'views/templates/admin/config-info.tpl'; |
557 | 557 | $this->context->smarty->assign(array( |
558 | 558 | 'logo' => $logo, |
@@ -746,10 +746,10 @@ discard block |
||
746 | 746 | */ |
747 | 747 | public function checkLogoExists() |
748 | 748 | { |
749 | - $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png'; |
|
750 | - if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) { |
|
749 | + $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png'; |
|
750 | + if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) { |
|
751 | 751 | copy( |
752 | - _PS_PAYLATER_DIR . '/views/img/logo-64x64.png', |
|
752 | + _PS_PAYLATER_DIR.'/views/img/logo-64x64.png', |
|
753 | 753 | $logo |
754 | 754 | ); |
755 | 755 | } |
@@ -761,9 +761,9 @@ discard block |
||
761 | 761 | return ''; |
762 | 762 | } |
763 | 763 | |
764 | - $sql = 'SELECT value FROM '._DB_PREFIX_.'pmt_config where config = \'' . pSQL($config) . '\' limit 1'; |
|
764 | + $sql = 'SELECT value FROM '._DB_PREFIX_.'pmt_config where config = \''.pSQL($config).'\' limit 1'; |
|
765 | 765 | if ($results = Db::getInstance()->ExecuteS($sql)) { |
766 | - if ( is_array($results) && count($results) === 1 && isset($results[0]['value']) ) { |
|
766 | + if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) { |
|
767 | 767 | return $results[0]['value']; |
768 | 768 | } |
769 | 769 | } |