@@ -32,10 +32,11 @@ |
||
32 | 32 | // Assign template, on 1.4 create it else assign for 1.5 |
33 | 33 | public function setTemplate($template) |
34 | 34 | { |
35 | - if (_PS_VERSION_ >= '1.5') |
|
36 | - parent::setTemplate($template); |
|
37 | - else |
|
38 | - $this->template = $template; |
|
35 | + if (_PS_VERSION_ >= '1.5') { |
|
36 | + parent::setTemplate($template); |
|
37 | + } else { |
|
38 | + $this->template = $template; |
|
39 | + } |
|
39 | 40 | } |
40 | 41 | |
41 | 42 | // Overload displayContent for 1.4 |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | * International Registered Trademark & Property of PrestaShop SA |
25 | 25 | */ |
26 | 26 | |
27 | -if ((bool)Configuration::get('PS_MOBILE_DEVICE')) |
|
27 | +if ((bool)Configuration::get('PS_MOBILE_DEVICE')) { |
|
28 | 28 | require_once(_PS_MODULE_DIR_ . '/mobile_theme/Mobile_Detect.php'); |
29 | +} |
|
29 | 30 | |
30 | 31 | // Retro 1.3, 'class_exists' cause problem with autoload... |
31 | 32 | if (version_compare(_PS_VERSION_, '1.4', '<')) |
@@ -163,8 +164,7 @@ discard block |
||
163 | 164 | $this->country = new Country((int)$cookie->id_country); |
164 | 165 | $this->customer = new CustomerBackwardModule((int)$cookie->id_customer); |
165 | 166 | $this->employee = new Employee((int)$cookie->id_employee); |
166 | - } |
|
167 | - else |
|
167 | + } else |
|
168 | 168 | { |
169 | 169 | $this->currency = null; |
170 | 170 | $this->language = null; |
@@ -175,8 +175,9 @@ discard block |
||
175 | 175 | |
176 | 176 | $this->shop = new ShopBackwardModule(); |
177 | 177 | |
178 | - if ((bool)Configuration::get('PS_MOBILE_DEVICE')) |
|
179 | - $this->mobile_detect = new Mobile_Detect(); |
|
178 | + if ((bool)Configuration::get('PS_MOBILE_DEVICE')) { |
|
179 | + $this->mobile_detect = new Mobile_Detect(); |
|
180 | + } |
|
180 | 181 | } |
181 | 182 | |
182 | 183 | public function getMobileDevice() |
@@ -189,16 +190,19 @@ discard block |
||
189 | 190 | switch ((int)Configuration::get('PS_MOBILE_DEVICE')) |
190 | 191 | { |
191 | 192 | case 0: // Only for mobile device |
192 | - if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet()) |
|
193 | - $this->mobile_device = true; |
|
193 | + if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet()) { |
|
194 | + $this->mobile_device = true; |
|
195 | + } |
|
194 | 196 | break; |
195 | 197 | case 1: // Only for touchpads |
196 | - if ($this->mobile_detect->isTablet() && !$this->mobile_detect->isMobile()) |
|
197 | - $this->mobile_device = true; |
|
198 | + if ($this->mobile_detect->isTablet() && !$this->mobile_detect->isMobile()) { |
|
199 | + $this->mobile_device = true; |
|
200 | + } |
|
198 | 201 | break; |
199 | 202 | case 2: // For touchpad or mobile devices |
200 | - if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet()) |
|
201 | - $this->mobile_device = true; |
|
203 | + if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet()) { |
|
204 | + $this->mobile_device = true; |
|
205 | + } |
|
202 | 206 | break; |
203 | 207 | } |
204 | 208 | } |
@@ -221,8 +225,9 @@ discard block |
||
221 | 225 | */ |
222 | 226 | public static function getContext() |
223 | 227 | { |
224 | - if (!isset(self::$instance)) |
|
225 | - self::$instance = new Context(); |
|
228 | + if (!isset(self::$instance)) { |
|
229 | + self::$instance = new Context(); |
|
230 | + } |
|
226 | 231 | return self::$instance; |
227 | 232 | } |
228 | 233 | |
@@ -241,8 +246,9 @@ discard block |
||
241 | 246 | */ |
242 | 247 | public static function shop() |
243 | 248 | { |
244 | - if (!self::$instance->shop->getContextType()) |
|
245 | - return ShopBackwardModule::CONTEXT_ALL; |
|
249 | + if (!self::$instance->shop->getContextType()) { |
|
250 | + return ShopBackwardModule::CONTEXT_ALL; |
|
251 | + } |
|
246 | 252 | return self::$instance->shop->getContextType(); |
247 | 253 | } |
248 | 254 | } |
@@ -315,10 +321,11 @@ discard block |
||
315 | 321 | |
316 | 322 | public function addJquery() |
317 | 323 | { |
318 | - if (_PS_VERSION_ < '1.5') |
|
319 | - $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.4.4.min.js'); |
|
320 | - elseif (_PS_VERSION_ >= '1.5') |
|
321 | - $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.7.2.min.js'); |
|
324 | + if (_PS_VERSION_ < '1.5') { |
|
325 | + $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.4.4.min.js'); |
|
326 | + } elseif (_PS_VERSION_ >= '1.5') { |
|
327 | + $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.7.2.min.js'); |
|
328 | + } |
|
322 | 329 | } |
323 | 330 | |
324 | 331 | } |
@@ -339,12 +346,14 @@ discard block |
||
339 | 346 | */ |
340 | 347 | public function isLogged($with_guest = false) |
341 | 348 | { |
342 | - if (!$with_guest && $this->is_guest == 1) |
|
343 | - return false; |
|
349 | + if (!$with_guest && $this->is_guest == 1) { |
|
350 | + return false; |
|
351 | + } |
|
344 | 352 | |
345 | 353 | /* Customer is valid only if it can be load and if object password is the same as database one */ |
346 | - if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && Customer::checkPassword($this->id, $this->passwd)) |
|
347 | - return true; |
|
354 | + if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && Customer::checkPassword($this->id, $this->passwd)) { |
|
355 | + return true; |
|
356 | + } |
|
348 | 357 | return false; |
349 | 358 | } |
350 | 359 | } |
@@ -30,19 +30,21 @@ |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // Get out if the context is already defined |
33 | -if (!in_array('Context', get_declared_classes())) |
|
33 | +if (!in_array('Context', get_declared_classes())) { |
|
34 | 34 | require_once(dirname(__FILE__).'/Context.php'); |
35 | +} |
|
35 | 36 | |
36 | 37 | //1.3 compatibility |
37 | 38 | if (_PS_VERSION_ >= '1.4') { |
38 | 39 | // Get out if the Display (BWDisplay to avoid any conflict)) is already defined |
39 | - if (!in_array('BWDisplay', get_declared_classes())) |
|
40 | - require_once(dirname(__FILE__).'/Display.php'); |
|
41 | -} |
|
40 | + if (!in_array('BWDisplay', get_declared_classes())) { |
|
41 | + require_once(dirname(__FILE__).'/Display.php'); |
|
42 | + } |
|
43 | + } |
|
42 | 44 | // If not under an object we don't have to set the context |
43 | -if (!isset($this)) |
|
45 | +if (!isset($this)) { |
|
44 | 46 | return; |
45 | -else if (isset($this->context)) |
|
47 | +} else if (isset($this->context)) |
|
46 | 48 | { |
47 | 49 | // If we are under an 1.5 version and backoffice, we have to set some backward variable |
48 | 50 | if (_PS_VERSION_ >= '1.5' && isset($this->context->employee->id) && $this->context->employee->id && isset(AdminController::$currentIndex) && !empty(AdminController::$currentIndex)) |