diff --git a/classes/CMSCategory.php b/classes/CMSCategory.php index 5b05fb1a1..a348a29cd 100644 --- a/classes/CMSCategory.php +++ b/classes/CMSCategory.php @@ -27,46 +27,46 @@ class CMSCategoryCore extends ObjectModel { - public $id; + public $id; /** @var integer CMSCategory ID */ - public $id_cms_category; + public $id_cms_category; /** @var string Name */ - public $name; + public $name; /** @var boolean Status for display */ - public $active = 1; + public $active = 1; /** @var string Description */ - public $description; + public $description; /** @var integer Parent CMSCategory ID */ - public $id_parent; + public $id_parent; /** @var integer category position */ - public $position; + public $position; /** @var integer Parents number */ - public $level_depth; + public $level_depth; /** @var string string used in rewrited URL */ - public $link_rewrite; + public $link_rewrite; /** @var string Meta title */ - public $meta_title; + public $meta_title; /** @var string Meta keywords */ - public $meta_keywords; + public $meta_keywords; /** @var string Meta description */ - public $meta_description; + public $meta_description; /** @var string Object creation date */ - public $date_add; + public $date_add; /** @var string Object last modification date */ - public $date_upd; + public $date_upd; protected static $_links = array(); @@ -95,7 +95,7 @@ class CMSCategoryCore extends ObjectModel ), ); - public function __construct($id_cms_category = NULL, $id_lang = NULL) + public function __construct($id_cms_category = null, $id_lang = null) { parent::__construct($id_cms_category, $id_lang); } @@ -104,7 +104,7 @@ class CMSCategoryCore extends ObjectModel { $this->position = CMSCategory::getLastPosition((int)$this->id_parent); $this->level_depth = $this->calcLevelDepth(); - foreach ($this->name AS $k => $value) + foreach ($this->name as $k => $value) if (preg_match('/^[1-9]\./', $value)) $this->name[$k] = '0'.$value; $ret = parent::add($autodate); @@ -115,7 +115,7 @@ class CMSCategoryCore extends ObjectModel public function update($nullValues = false) { $this->level_depth = $this->calcLevelDepth(); - foreach ($this->name AS $k => $value) + foreach ($this->name as $k => $value) if (preg_match('/^[1-9]\./', $value)) $this->name[$k] = '0'.$value; return parent::update(); @@ -131,7 +131,7 @@ class CMSCategoryCore extends ObjectModel * * @return array Subcategories lite tree */ - function recurseLiteCategTree($maxDepth = 3, $currentDepth = 0, $id_lang = NULL, $excludedIdsArray = NULL, Link $link = null) + public function recurseLiteCategTree($maxDepth = 3, $currentDepth = 0, $id_lang = null, $excludedIdsArray = null, Link $link = null) { if (!$link) $link = Context::getContext()->link; @@ -139,16 +139,17 @@ class CMSCategoryCore extends ObjectModel if (is_null($id_lang)) $id_lang = Context::getContext()->language->id; - //recursivity for subcategories + // recursivity for subcategories $children = array(); - if (($maxDepth == 0 OR $currentDepth < $maxDepth) AND $subcats = $this->getSubCategories($id_lang, true) AND sizeof($subcats)) + $subcats = $this->getSubCategories($id_lang, true); + if (($maxDepth == 0 || $currentDepth < $maxDepth) && $subcats && count($subcats)) foreach ($subcats as &$subcat) { if (!$subcat['id_cms_category']) break; - elseif ( !is_array($excludedIdsArray) || !in_array($subcat['id_cms_category'], $excludedIdsArray) ) + elseif (!is_array($excludedIdsArray) || !in_array($subcat['id_cms_category'], $excludedIdsArray)) { - $categ = new CMSCategory($subcat['id_cms_category'] ,$id_lang); + $categ = new CMSCategory($subcat['id_cms_category'], $id_lang); $categ->name = CMSCategory::hideCMSCategoryPosition($categ->name); $children[] = $categ->recurseLiteCategTree($maxDepth, $currentDepth + 1, $id_lang, $excludedIdsArray); } @@ -163,7 +164,7 @@ class CMSCategoryCore extends ObjectModel ); } - static public function getRecurseCategory($id_lang = null, $current = 1, $active = 1, $links = 0, Link $link = null, Shop $shop = null) + public static function getRecurseCategory($id_lang = null, $current = 1, $active = 1, $links = 0, Link $link = null, Shop $shop = null) { if (!$link) $link = Context::getContext()->link; @@ -199,7 +200,7 @@ class CMSCategoryCore extends ObjectModel if ($links == 1) { $category['link'] = $link->getCMSCategoryLink($current, $category['link_rewrite']); - foreach($category['cms'] as $key => $cms) + foreach ($category['cms'] as $key => $cms) $category['cms'][$key]['link'] = $link->getCMSLink($cms['id_cms'], $cms['link_rewrite']); } return $category; @@ -212,13 +213,11 @@ class CMSCategoryCore extends ObjectModel if ($is_html == 0) echo $html; if (isset($categories[$id_cms_category])) - foreach (array_keys($categories[$id_cms_category]) AS $key) + foreach (array_keys($categories[$id_cms_category]) as $key) $html .= CMSCategory::recurseCMSCategory($categories, $categories[$id_cms_category][$key], $key, $id_selected, $is_html); return $html; } - - /** * Recursively add specified CMSCategory childs to $toDelete array * @@ -227,14 +226,14 @@ class CMSCategoryCore extends ObjectModel */ protected function recursiveDelete(&$toDelete, $id_cms_category) { - if (!is_array($toDelete) OR !$id_cms_category) + if (!is_array($toDelete) || !$id_cms_category) die(Tools::displayError()); $result = Db::getInstance()->executeS(' SELECT `id_cms_category` FROM `'._DB_PREFIX_.'cms_category` WHERE `id_parent` = '.(int)($id_cms_category)); - foreach ($result AS $row) + foreach ($result as $row) { $toDelete[] = (int)($row['id_cms_category']); $this->recursiveDelete($toDelete, (int)($row['id_cms_category'])); @@ -253,7 +252,7 @@ class CMSCategoryCore extends ObjectModel $toDelete = array_unique($toDelete); /* Delete CMS Category and its child from database */ - $list = sizeof($toDelete) > 1 ? implode(',', $toDelete) : (int)($this->id); + $list = count($toDelete) > 1 ? implode(',', $toDelete) : (int)($this->id); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cms_category` WHERE `id_cms_category` IN ('.$list.')'); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cms_category_lang` WHERE `id_cms_category` IN ('.$list.')'); @@ -281,7 +280,7 @@ class CMSCategoryCore extends ObjectModel public function deleteSelection($categories) { $return = 1; - foreach ($categories AS $id_category_cms) + foreach ($categories as $id_category_cms) { $category_cms = new CMSCategory((int)($id_category_cms)); $return &= $category_cms->delete(); @@ -326,7 +325,7 @@ class CMSCategoryCore extends ObjectModel return $result; $categories = array(); - foreach ($result AS $row) + foreach ($result as $row) $categories[$row['id_parent']][$row['id_cms_category']]['infos'] = $row; return $categories; } @@ -362,11 +361,9 @@ class CMSCategoryCore extends ObjectModel GROUP BY c.`id_cms_category` ORDER BY `name` ASC'); - /* Modify SQL result */ - foreach ($result AS &$row) - { + // Modify SQL result + foreach ($result as &$row) $row['name'] = CMSCategory::hideCMSCategoryPosition($row['name']); - } return $result; } @@ -409,7 +406,7 @@ class CMSCategoryCore extends ObjectModel /* Modify SQL result */ $resultsArray = array(); - foreach ($result AS $row) + foreach ($result as $row) { $row['name'] = CMSCategory::hideCMSCategoryPosition($row['name']); $resultsArray[] = $row; @@ -441,7 +438,7 @@ class CMSCategoryCore extends ObjectModel public static function getLinkRewrite($id_cms_category, $id_lang) { - if (!Validate::isUnsignedId($id_cms_category) OR !Validate::isUnsignedId($id_lang)) + if (!Validate::isUnsignedId($id_cms_category) || !Validate::isUnsignedId($id_lang)) return false; if (isset(self::$_links[$id_cms_category.'-'.$id_lang])) @@ -464,7 +461,7 @@ class CMSCategoryCore extends ObjectModel return $link->getCMSCategoryLink($this->id, $this->link_rewrite); } - public function getName($id_lang = NULL) + public function getName($id_lang = null) { $context = Context::getContext(); @@ -547,7 +544,7 @@ class CMSCategoryCore extends ObjectModel $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); $categories[] = $result[0]; - if(!$result OR $result[0]['id_parent'] == 1) + if (!$result || $result[0]['id_parent'] == 1) return $categories; $idCurrent = $result[0]['id_parent']; } @@ -562,8 +559,8 @@ class CMSCategoryCore extends ObjectModel ORDER BY cp.`position` ASC' )) return false; - foreach ($res AS $category) - if ((int)($category['id_cms_category']) == (int)($this->id)) + foreach ($res as $category) + if ((int)$category['id_cms_category'] == (int)$this->id) $movedCategory = $category; if (!isset($movedCategory) || !isset($position)) @@ -575,14 +572,14 @@ class CMSCategoryCore extends ObjectModel SET `position`= `position` '.($way ? '- 1' : '+ 1').' WHERE `position` '.($way - ? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)($position) - : '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)($position)).' + ? '> '.(int)($movedCategory['position']).' AND `position` <= '.(int)$position + : '< '.(int)($movedCategory['position']).' AND `position` >= '.(int)$position).' AND `id_parent`='.(int)($movedCategory['id_parent'])) - AND Db::getInstance()->execute(' + && Db::getInstance()->execute(' UPDATE `'._DB_PREFIX_.'cms_category` - SET `position` = '.(int)($position).' - WHERE `id_parent` = '.(int)($movedCategory['id_parent']).' - AND `id_cms_category`='.(int)($movedCategory['id_cms_category']))); + SET `position` = '.(int)$position.' + WHERE `id_parent` = '.(int)$movedCategory['id_parent'].' + AND `id_cms_category`='.(int)$movedCategory['id_cms_category'])); } public static function cleanPositions($id_category_parent) @@ -592,8 +589,9 @@ class CMSCategoryCore extends ObjectModel FROM `'._DB_PREFIX_.'cms_category` WHERE `id_parent` = '.(int)($id_category_parent).' ORDER BY `position`'); - $sizeof = sizeof($result); - for ($i = 0; $i < $sizeof; ++$i){ + $sizeof = count($result); + for ($i = 0; $i < $sizeof; ++$i) + { $sql = ' UPDATE `'._DB_PREFIX_.'cms_category` SET `position` = '.(int)($i).' @@ -608,7 +606,8 @@ class CMSCategoryCore extends ObjectModel { return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'cms_category` WHERE `id_parent` = '.(int)($id_category_parent))); } - public static function getUrlRewriteInformations($id_category) + + public static function getUrlRewriteInformations($id_category) { $sql = ' SELECT l.`id_lang`, c.`link_rewrite` diff --git a/classes/Combination.php b/classes/Combination.php index 83a2f9482..af00caa02 100644 --- a/classes/Combination.php +++ b/classes/Combination.php @@ -90,18 +90,16 @@ class CombinationCore extends ObjectModel public function delete() { - if (!parent::delete() OR $this->deleteAssociations() === false) + if (!parent::delete() || $this->deleteAssociations() === false) return false; return true; } public function deleteAssociations() { - if ( - Db::getInstance()->execute(' + if (Db::getInstance()->execute(' DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` - WHERE `id_product_attribute` = '.(int)($this->id)) === false - ) + WHERE `id_product_attribute` = '.(int)$this->id) === false) return false; return true; } diff --git a/classes/CompareProduct.php b/classes/CompareProduct.php index f5515512e..1902cb01d 100644 --- a/classes/CompareProduct.php +++ b/classes/CompareProduct.php @@ -63,7 +63,7 @@ class CompareProductCore extends ObjectModel $compareProducts = null; if ($results) - foreach($results as $result) + foreach ($results as $result) $compareProducts[] = $result['id_product']; return $compareProducts; diff --git a/classes/Configuration.php b/classes/Configuration.php index a2465a2c6..81bf804db 100644 --- a/classes/Configuration.php +++ b/classes/Configuration.php @@ -27,22 +27,22 @@ class ConfigurationCore extends ObjectModel { - public $id; + public $id; /** @var string Key */ - public $name; + public $name; - public $id_group_shop; - public $id_shop; + public $id_group_shop; + public $id_shop; /** @var string Value */ - public $value; + public $value; /** @var string Object creation date */ - public $date_add; + public $date_add; /** @var string Object last modification date */ - public $date_upd; + public $date_upd; /** * @see ObjectModel::$definition @@ -104,7 +104,7 @@ class ConfigurationCore extends ObjectModel /** * Load all configuration data */ - static public function loadConfiguration() + public static function loadConfiguration() { self::$_CONF = array(); $sql = 'SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_group_shop, c.id_shop @@ -136,7 +136,7 @@ class ConfigurationCore extends ObjectModel * @param integer $id_lang Language ID * @return string Value */ - static public function get($key, $langID = NULL, $shopGroupID = NULL, $shopID = NULL) + public static function get($key, $langID = null, $shopGroupID = null, $shopID = null) { Configuration::getShopFromContext($shopGroupID, $shopID); $langID = (int)$langID; @@ -156,7 +156,7 @@ class ConfigurationCore extends ObjectModel return false; } - static public function getGlobalValue($key, $langID = NULL) + public static function getGlobalValue($key, $langID = null) { return Configuration::get($key, $langID, 0, 0); } @@ -169,7 +169,7 @@ class ConfigurationCore extends ObjectModel * @param int $shopID * @return array Values in multiple languages */ - static public function getInt($key, $id_group_shop = NULL, $id_shop = NULL) + public static function getInt($key, $id_group_shop = null, $id_shop = null) { $languages = Language::getLanguages(); $resultsArray = array(); @@ -185,7 +185,7 @@ class ConfigurationCore extends ObjectModel * @param integer $id_lang Language ID * @return array Values */ - static public function getMultiple($keys, $langID = NULL, $shopGroupID = NULL, $shopID = NULL) + public static function getMultiple($keys, $langID = null, $shopGroupID = null, $shopID = null) { if (!is_array($keys)) throw new PrestaShopException('keys var is not an array'); @@ -226,7 +226,7 @@ class ConfigurationCore extends ObjectModel * @param int $shopGroupID * @param int $shopID */ - static public function set($key, $values, $id_group_shop = NULL, $id_shop = NULL) + public static function set($key, $values, $id_group_shop = null, $id_shop = null) { if (!Validate::isConfigName($key)) die(Tools::displayError()); @@ -254,7 +254,7 @@ class ConfigurationCore extends ObjectModel * @param bool $html * @return bool */ - static public function updateGlobalValue($key, $values, $html = false) + public static function updateGlobalValue($key, $values, $html = false) { return Configuration::updateValue($key, $values, $html, 0, 0); } @@ -269,7 +269,7 @@ class ConfigurationCore extends ObjectModel * @param int $shopID * @return boolean Update result */ - static public function updateValue($key, $values, $html = false, $shopGroupID = null, $shopID = null) + public static function updateValue($key, $values, $html = false, $shopGroupID = null, $shopID = null) { if (!Validate::isConfigName($key)) die(Tools::displayError()); diff --git a/classes/ConfigurationTest.php b/classes/ConfigurationTest.php index 28e9d1793..b2f5faa06 100644 --- a/classes/ConfigurationTest.php +++ b/classes/ConfigurationTest.php @@ -72,7 +72,6 @@ class ConfigurationTestCore */ public static function getDefaultTestsOp() { - return array( 'fopen' => false, 'register_globals' => false, @@ -127,7 +126,7 @@ class ConfigurationTestCore public static function test_upload() { - return ini_get('file_uploads'); + return ini_get('file_uploads'); } public static function test_fopen() @@ -163,7 +162,7 @@ class ConfigurationTestCore public static function test_dir($relative_dir, $recursive = false) { $dir = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.ltrim($relative_dir, '/'); - if (!file_exists($dir) OR !$dh = opendir($dir)) + if (!file_exists($dir) || !$dh = opendir($dir)) return false; $dummy = rtrim($dir, '/').'/'.uniqid(); if (@file_put_contents($dummy, 'test')) @@ -188,7 +187,7 @@ class ConfigurationTestCore public static function test_file($file_relative) { $file = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file_relative; - return (file_exists($file) AND is_writable($file)); + return (file_exists($file) && is_writable($file)); } public static function test_config_dir($dir) diff --git a/classes/ConnectionsSource.php b/classes/ConnectionsSource.php index 56c494989..50c5d9a36 100644 --- a/classes/ConnectionsSource.php +++ b/classes/ConnectionsSource.php @@ -59,18 +59,18 @@ class ConnectionsSourceCore extends ObjectModel { if (!$cookie) $cookie = Context::getContext()->cookie; - if (!isset($cookie->id_connections) OR !Validate::isUnsignedId($cookie->id_connections)) + if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) return false; - if (!isset($_SERVER['HTTP_REFERER']) AND !Configuration::get('TRACKING_DIRECT_TRAFFIC')) + if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) return false; $source = new ConnectionsSource(); - if (isset($_SERVER['HTTP_REFERER']) AND Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) + if (isset($_SERVER['HTTP_REFERER']) && Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) { $parsed = parse_url($_SERVER['HTTP_REFERER']); $parsed_host = parse_url(Tools::getProtocol().Tools::getHttpHost(false, false).__PS_BASE_URI__); if ((preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false))) - AND !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) + && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) return false; if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) { diff --git a/classes/Controller.php b/classes/Controller.php index 7a2765d4a..2423c6ccb 100644 --- a/classes/Controller.php +++ b/classes/Controller.php @@ -233,9 +233,9 @@ abstract class ControllerCore public function addCSS($css_uri, $css_media_type = 'all') { if (is_array($css_uri)) - foreach($css_uri as $css_file => $media) + foreach ($css_uri as $css_file => $media) { - if (is_string($css_file) AND strlen($css_file) > 1) + if (is_string($css_file) && strlen($css_file) > 1) { $css_path = Media::getCSSPath($css_file, $media); if ($css_path) @@ -248,7 +248,7 @@ abstract class ControllerCore $this->css_files = array_merge($css_path, $this->css_files); } } - else if (is_string($css_uri) AND strlen($css_uri) > 1) + else if (is_string($css_uri) && strlen($css_uri) > 1) { $css_path = Media::getCSSPath($css_uri, $css_media_type); if ($css_path) @@ -265,7 +265,7 @@ abstract class ControllerCore public function addJS($js_uri) { if (is_array($js_uri)) - foreach($js_uri as $js_file) + foreach ($js_uri as $js_file) { $js_path = Media::getJSPath($js_file); if ($js_path) @@ -300,7 +300,7 @@ abstract class ControllerCore { $ui_path = array(); if (is_array($component)) - foreach($component as $ui) + foreach ($component as $ui) $ui_path = Media::getJqueryUIPath($ui, $theme, $check_dependencies); else $ui_path = Media::getJqueryUIPath($component, $theme, $check_dependencies); @@ -320,7 +320,7 @@ abstract class ControllerCore $plugin_path = array(); if (is_array($name)) { - foreach($name as $plugin) + foreach ($name as $plugin) { $plugin_path = Media::getJqueryPluginPath($plugin, $folder); $this->addJS($plugin_path['js']); diff --git a/classes/Currency.php b/classes/Currency.php index e6a2ee369..f7b78c723 100644 --- a/classes/Currency.php +++ b/classes/Currency.php @@ -123,18 +123,17 @@ class CurrencyCore extends ObjectModel * @param int|string $iso_code int for iso code number string for iso code * @return boolean */ - public static function exists ($iso_code) + public static function exists($iso_code) { - if(is_int($iso_code)) + if (is_int($iso_code)) $id_currency_exists = Currency::getIdByIsoCodeNum($iso_code); else $id_currency_exists = Currency::getIdByIsoCode($iso_code); - if ($id_currency_exists){ + if ($id_currency_exists) return true; - } else { + else return false; - } } public function deleteSelection($selection) @@ -173,7 +172,7 @@ class CurrencyCore extends ObjectModel * @param string $side left or right * @return string formated sign */ - public function getSign($side=NULL) + public function getSign($side = null) { if (!$side) return $this->sign; @@ -296,7 +295,7 @@ class CurrencyCore extends ObjectModel $conversion_rate = 1; if ($defaultCurrency->iso_code != $isoCodeSource) { - foreach ($data->currency AS $currency) + foreach ($data->currency as $currency) if ($currency['iso_code'] == $defaultCurrency->iso_code) { $conversion_rate = round((float)$currency['rate'], 6); @@ -312,15 +311,15 @@ class CurrencyCore extends ObjectModel $rate = 1; else { - foreach ($data->currency AS $obj) + foreach ($data->currency as $obj) if ($this->iso_code == strval($obj['iso_code'])) { - $rate = (float) $obj['rate']; + $rate = (float)$obj['rate']; break; } } - $this->conversion_rate = round($rate / $conversion_rate, 6); + $this->conversion_rate = round($rate / $conversion_rate, 6); } $this->update(); } diff --git a/classes/Customer.php b/classes/Customer.php index 0326eeb8d..a0d476b6d 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -730,19 +730,19 @@ class CustomerCore extends ObjectModel public function getOutstanding() { $query = new DbQuery(); - $query->select('SUM(oi.total_paid_tax_incl)') - ->from('order_invoice', 'oi') - ->leftJoin('orders', 'o', 'oi.id_order = o.id_order') - ->groupBy('o.id_customer') - ->where('o.id_customer = '.(int)$this->id); + $query->select('SUM(oi.total_paid_tax_incl)'); + $query->from('order_invoice', 'oi'); + $query->leftJoin('orders', 'o', 'oi.id_order = o.id_order'); + $query->groupBy('o.id_customer'); + $query->where('o.id_customer = '.(int)$this->id); $total_paid = (float)Db::getInstance()->getValue($query->build()); $query = new DbQuery(); - $query->select('SUM(op.amount)') - ->from('order_payment', 'op') - ->leftJoin('orders', 'o', 'op.id_order = o.id_order') - ->groupBy('o.id_customer') - ->where('o.id_customer = '.(int)$this->id); + $query->select('SUM(op.amount)'); + $query->from('order_payment', 'op'); + $query->leftJoin('orders', 'o', 'op.id_order = o.id_order'); + $query->groupBy('o.id_customer'); + $query->where('o.id_customer = '.(int)$this->id); $total_rest = (float)Db::getInstance()->getValue($query->build()); return $total_paid - $total_rest; diff --git a/classes/Customization.php b/classes/Customization.php index 0d2eb0a05..263aac4f5 100644 --- a/classes/Customization.php +++ b/classes/Customization.php @@ -36,7 +36,7 @@ class CustomizationCore WHERE ore.`id_order` = '.(int)($id_order).' AND ord.`id_customization` != 0')) === false) return false; $customizations = array(); - foreach ($result AS $row) + foreach ($result as $row) $customizations[(int)($row['id_customization'])] = $row; return $customizations; } @@ -46,7 +46,7 @@ class CustomizationCore if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `id_customization`, `quantity` FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)($id_cart))) return false; $customizations = array(); - foreach ($result AS $row) + foreach ($result as $row) $customizations[(int)($row['id_customization'])] = $row; return $customizations; } @@ -54,8 +54,8 @@ class CustomizationCore public static function countCustomizationQuantityByProduct($customizations) { $total = array(); - foreach ($customizations AS $customization) - $total[(int)($customization['id_order_detail'])] = !isset($total[(int)($customization['id_order_detail'])]) ? (int)($customization['quantity']) : $total[(int)($customization['id_order_detail'])] + (int)($customization['quantity']); + foreach ($customizations as $customization) + $total[(int)$customization['id_order_detail']] = !isset($total[(int)$customization['id_order_detail']]) ? (int)$customization['quantity'] : $total[(int)$customization['id_order_detail']] + (int)$customization['quantity']; return $total; } @@ -79,7 +79,7 @@ class CustomizationCore $quantities = array(); $in_values = ''; - foreach($ids_customizations as $key => $id_customization) + foreach ($ids_customizations as $key => $id_customization) { if ($key > 0) $in_values .= ','; $in_values .= (int)($id_customization); @@ -87,12 +87,12 @@ class CustomizationCore if (!empty($in_values)) { - $results = Db::getInstance()->executeS( + $results = Db::getInstance()->executeS( 'SELECT `id_customization`, `id_product`, `quantity`, `quantity_refunded`, `quantity_returned` FROM `'._DB_PREFIX_.'customization` WHERE `id_customization` IN ('.$in_values.')'); - foreach($results as $row) + foreach ($results as $row) $quantities[$row['id_customization']] = $row; } @@ -103,14 +103,14 @@ class CustomizationCore { $quantity = array(); - $results = Db::getInstance()->executeS(' + $results = Db::getInstance()->executeS(' SELECT `id_product`, `id_product_attribute`, SUM(`quantity`) AS quantity FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.(int)$id_cart.' GROUP BY `id_cart`, `id_product`, `id_product_attribute` '); - foreach($results as $row) + foreach ($results as $row) $quantity[$row['id_product']][$row['product_attribute_id']] = $row['quantity']; return $quantity; diff --git a/classes/DateRange.php b/classes/DateRange.php index 35f5982df..6e939f4e2 100644 --- a/classes/DateRange.php +++ b/classes/DateRange.php @@ -48,7 +48,7 @@ class DateRangeCore extends ObjectModel SELECT `id_date_range`, `time_end` FROM `'._DB_PREFIX_.'date_range` WHERE `time_end` = (SELECT MAX(`time_end`) FROM `'._DB_PREFIX_.'date_range`)'); - if (!$result['id_date_range'] OR strtotime($result['time_end']) < strtotime(date('Y-m-d H:i:s'))) + if (!$result['id_date_range'] || strtotime($result['time_end']) < strtotime(date('Y-m-d H:i:s'))) { // The default range is set to 1 day less 1 second (in seconds) $rangeSize = 86399; diff --git a/classes/Discount.php b/classes/Discount.php index 5fef0cf10..c2c562c05 100644 --- a/classes/Discount.php +++ b/classes/Discount.php @@ -128,7 +128,7 @@ class DiscountCore extends CartRule $obj = $this->parent; if (in_array($method, array('add', 'update', 'getIdByName', 'getCustomerDiscounts', 'getValue', 'discountExists', 'createOrderDiscount', 'getVouchersToCartDisplay'))) $obj = $this; - return call_user_func_array(array(obj, $method), $args); + return call_user_func_array(array($obj, $method), $args); } /** @@ -163,8 +163,8 @@ class DiscountCore extends CartRule * @deprecated 1.5.0.1 */ public static function getCustomerDiscounts($id_lang, $id_customer, $active = false, $includeGenericOnes = true, $hasStock = false, Cart $cart = null) - { - return parent::getCustomerCartRules($id_lang, $id_customer, $active, $includeGenericOnes, $hasStock, $cart); + { + return parent::getCustomerCartRules($id_lang, $id_customer, $active, $includeGenericOnes, $hasStock, $cart); } /** diff --git a/classes/FrontController.php b/classes/FrontController.php index a47f7f9e2..9ef796155 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -105,13 +105,13 @@ class FrontControllerCore extends Controller $css_files = $this->css_files; $js_files = $this->js_files; - if ($this->ssl AND !Tools::usingSecureMode() AND Configuration::get('PS_SSL_ENABLED')) + if ($this->ssl && !Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) { header('HTTP/1.1 301 Moved Permanently'); header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']); exit(); } - else if (Configuration::get('PS_SSL_ENABLED') AND Tools::usingSecureMode() AND !($this->ssl)) + else if (Configuration::get('PS_SSL_ENABLED') && Tools::usingSecureMode() && !($this->ssl)) { header('HTTP/1.1 301 Moved Permanently'); header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']); @@ -134,15 +134,15 @@ class FrontControllerCore extends Controller ob_start(); // Switch language if needed and init cookie language - if ($iso = Tools::getValue('isolang') AND Validate::isLanguageIsoCode($iso) AND ($id_lang = (int)(Language::getIdByIso($iso)))) + if ($iso = Tools::getValue('isolang') && Validate::isLanguageIsoCode($iso) && ($id_lang = (int)(Language::getIdByIso($iso)))) $_GET['id_lang'] = $id_lang; Tools::switchLanguage(); Tools::setCookieLanguage($this->context->cookie); $currency = Tools::setCurrency($this->context->cookie); - $protocol_link = (Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://' : 'http://'; - $useSSL = ((isset($this->ssl) AND $this->ssl AND Configuration::get('PS_SSL_ENABLED')) OR Tools::usingSecureMode()) ? true : false; + $protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://'; + $useSSL = ((isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED')) || Tools::usingSecureMode()) ? true : false; $protocol_content = ($useSSL) ? 'https://' : 'http://'; $link = new Link($protocol_link, $protocol_content); $this->context->link = $link; @@ -150,31 +150,31 @@ class FrontControllerCore extends Controller if ($id_cart = (int)$this->recoverCart()) $this->context->cookie->id_cart = (int)$id_cart; - if ($this->auth AND !$this->context->customer->isLogged($this->guestAllowed)) + if ($this->auth && !$this->context->customer->isLogged($this->guestAllowed)) Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : '')); /* Theme is missing or maintenance */ if (!is_dir(_PS_THEME_DIR_)) die(Tools::displayError('Current theme unavailable. Please check your theme directory name and permissions.')); - elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' AND !(int)(Configuration::get('PS_SHOP_ENABLE'))) + elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' && !(int)(Configuration::get('PS_SHOP_ENABLE'))) $this->maintenance = true; elseif (Configuration::get('PS_GEOLOCATION_ENABLED')) if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault)) $this->context->country = $newDefault; - if (isset($_GET['logout']) OR ($this->context->customer->logged AND Customer::isBanned($this->context->customer->id))) + if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id))) { $this->context->customer->logout(); // Login information have changed, so we check if the cart rules still apply CartRule::autoRemoveFromCart(); - Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL); + Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null); } elseif (isset($_GET['mylogout'])) { $this->context->customer->mylogout(); - Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL); + Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null); } $_MODULES = array(); @@ -186,13 +186,13 @@ class FrontControllerCore extends Controller if ($cart->OrderExists()) unset($this->context->cookie->id_cart, $cart, $this->context->cookie->checkedTOS); /* Delete product of cart, if user can't make an order from his country */ - elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) AND - !in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND - $cart->nbProducts() AND intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 AND + elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) && + !in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) && + $cart->nbProducts() && intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 && !FrontController::isInWhitelistForGeolocation()) unset($this->context->cookie->id_cart, $cart); // update cart values - elseif ($this->context->cookie->id_customer != $cart->id_customer OR $this->context->cookie->id_lang != $cart->id_lang OR $currency->id != $cart->id_currency) + elseif ($this->context->cookie->id_customer != $cart->id_customer || $this->context->cookie->id_lang != $cart->id_lang || $currency->id != $cart->id_currency) { if ($this->context->cookie->id_customer) $cart->id_customer = (int)($this->context->cookie->id_customer); @@ -220,7 +220,7 @@ class FrontControllerCore extends Controller } } - if (!isset($cart) OR !$cart->id) + if (!isset($cart) || !$cart->id) { $cart = new Cart(); $cart->id_lang = (int)($this->context->cookie->id_lang); @@ -313,7 +313,7 @@ class FrontControllerCore extends Controller 'display_tax_label' => (bool)$display_tax_label, 'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'), 'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'), - 'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE') OR !(bool)Group::getCurrent()->show_prices, + 'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE') || !(bool)Group::getCurrent()->show_prices, 'b2b_enable' => (bool)Configuration::get('PS_B2B_ENABLE') )); @@ -341,7 +341,7 @@ class FrontControllerCore extends Controller ); foreach ($assignArray as $assignKey => $assignValue) - if (substr($assignValue, 0, 1) == '/' OR $protocol_content == 'https://') + if (substr($assignValue, 0, 1) == '/' || $protocol_content == 'https://') $this->context->smarty->assign($assignKey, $protocol_content.Tools::getMediaServer($assignValue).$assignValue); else $this->context->smarty->assign($assignKey, $assignValue); @@ -363,7 +363,7 @@ class FrontControllerCore extends Controller $this->displayRestrictedCountryPage(); //live edit - if (Tools::isSubmit('live_edit') AND $ad = Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) + if (Tools::isSubmit('live_edit') && $ad = Tools::getValue('ad') && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) if (!is_dir(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$ad)) die(Tools::displayError()); @@ -373,11 +373,11 @@ class FrontControllerCore extends Controller // Customer wasn't defined at all $customer = new StdClass(); - if($this->context->cookie->id_country) + if ($this->context->cookie->id_country) $customer->geoloc_id_country = (int)$this->context->cookie->id_country; - if($this->context->cookie->id_state) + if ($this->context->cookie->id_state) $customer->geoloc_id_state = (int)$this->context->cookie->id_state; - if($this->context->cookie->postcode) + if ($this->context->cookie->postcode) $customer->geoloc_postcode = (int)$this->context->cookie->postcode; $this->context->cart = $cart; @@ -425,7 +425,7 @@ class FrontControllerCore extends Controller Tools::displayAsDeprecated(); $this->initHeader(); $hook_header = Hook::exec('displayHeader'); - if ((Configuration::get('PS_CSS_THEME_CACHE') OR Configuration::get('PS_JS_THEME_CACHE')) AND is_writable(_PS_THEME_DIR_.'cache')) + if ((Configuration::get('PS_CSS_THEME_CACHE') || Configuration::get('PS_JS_THEME_CACHE')) && is_writable(_PS_THEME_DIR_.'cache')) { // CSS compressor management if (Configuration::get('PS_CSS_THEME_CACHE')) @@ -481,7 +481,7 @@ class FrontControllerCore extends Controller Tools::safePostVars(); // assign css_files and js_files at the very last time - if ((Configuration::get('PS_CSS_THEME_CACHE') OR Configuration::get('PS_JS_THEME_CACHE')) AND is_writable(_PS_THEME_DIR_.'cache')) + if ((Configuration::get('PS_CSS_THEME_CACHE') || Configuration::get('PS_JS_THEME_CACHE')) && is_writable(_PS_THEME_DIR_.'cache')) { // CSS compressor management if (Configuration::get('PS_CSS_THEME_CACHE')) @@ -523,7 +523,7 @@ class FrontControllerCore extends Controller $this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl'); // live edit - if (Tools::isSubmit('live_edit') AND $ad = Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) + if (Tools::isSubmit('live_edit') && $ad = Tools::getValue('ad') && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) { $this->context->smarty->assign(array('ad' => $ad, 'live_edit' => true)); $this->context->smarty->display(_PS_ALL_THEMES_DIR_.'live_edit.tpl'); @@ -572,7 +572,7 @@ class FrontControllerCore extends Controller $strParams = ((strpos($canonicalURL, '?') === false) ? '?' : '&').implode('&', $params); header('HTTP/1.0 301 Moved'); - if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) + if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) die('[Debug] This page has moved
Please use the following URL instead: '.$canonicalURL.$strParams.''); Tools::redirectLink($canonicalURL.$strParams); } @@ -585,7 +585,7 @@ class FrontControllerCore extends Controller /* Check if Maxmind Database exists */ if (file_exists(_PS_GEOIP_DIR_.'GeoLiteCity.dat')) { - if (!isset($this->context->cookie->iso_code_country) OR (isset($this->context->cookie->iso_code_country) AND !in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))))) + if (!isset($this->context->cookie->iso_code_country) || (isset($this->context->cookie->iso_code_country) && !in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))))) { include_once(_PS_GEOIP_DIR_.'geoipcity.inc'); include_once(_PS_GEOIP_DIR_.'geoipregionvars.php'); @@ -616,9 +616,9 @@ class FrontControllerCore extends Controller if (isset($this->context->cookie->iso_code_country) && ($id_country = Country::getByIso(strtoupper($this->context->cookie->iso_code_country)))) { /* Update defaultCountry */ - if($defaultCountry->iso_code != $this->context->cookie->iso_code_country) + if ($defaultCountry->iso_code != $this->context->cookie->iso_code_country) $defaultCountry = new Country($id_country); - if (isset($hasBeenSet) AND $hasBeenSet) + if (isset($hasBeenSet) && $hasBeenSet) $this->context->cookie->id_currency = (int)(Currency::getCurrencyInstance($defaultCountry->id_currency ? (int)$defaultCountry->id_currency : Configuration::get('PS_CURRENCY_DEFAULT'))->id); return $defaultCountry; } @@ -644,12 +644,12 @@ class FrontControllerCore extends Controller $this->addjqueryPlugin('easing'); $this->addJS(_PS_JS_DIR_.'tools.js'); - if (Tools::isSubmit('live_edit') AND Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) + if (Tools::isSubmit('live_edit') && Tools::getValue('ad') && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) { $this->addJqueryUI('ui.sortable'); $this->addjqueryPlugin('fancybox'); $this->addJS(_PS_JS_DIR_.'hookLiveEdit.js'); - $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'all'); //TODO + $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'all'); // @TODO } if ($this->context->language->is_rtl) $this->addCSS(_THEME_CSS_DIR_.'rtl.css'); @@ -683,10 +683,9 @@ class FrontControllerCore extends Controller public function getLiveEditFooter() { - if (Tools::isSubmit('live_edit') + if (Tools::isSubmit('live_edit') && ($ad = Tools::getValue('ad')) - && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_)) - ) + && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) { $data = $this->context->smarty->createData(); $data->assign(array( @@ -739,7 +738,7 @@ class FrontControllerCore extends Controller // Clean duplicate values $nArray = array_unique($nArray); asort($nArray); - $this->n = abs((int)(Tools::getValue('n', ((isset($this->context->cookie->nb_item_per_page) AND $this->context->cookie->nb_item_per_page >= 10) ? $this->context->cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')))))); + $this->n = abs((int)(Tools::getValue('n', ((isset($this->context->cookie->nb_item_per_page) && $this->context->cookie->nb_item_per_page >= 10) ? $this->context->cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')))))); $this->p = abs((int)(Tools::getValue('p', 1))); $current_url = tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']); @@ -751,7 +750,7 @@ class FrontControllerCore extends Controller if ($this->p < 0) $this->p = 0; - if (isset($this->context->cookie->nb_item_per_page) AND $this->n != $this->context->cookie->nb_item_per_page AND in_array($this->n, $nArray)) + if (isset($this->context->cookie->nb_item_per_page) && $this->n != $this->context->cookie->nb_item_per_page && in_array($this->n, $nArray)) $this->context->cookie->nb_item_per_page = $this->n; if ($this->p > ($nbProducts / $this->n)) @@ -802,7 +801,7 @@ class FrontControllerCore extends Controller $allowed = false; $userIp = Tools::getRemoteAddr(); $ips = explode(';', Configuration::get('PS_GEOLOCATION_WHITELIST')); - if (is_array($ips) && sizeof($ips)) + if (is_array($ips) && count($ips)) foreach ($ips as $ip) if (!empty($ip) && strpos($userIp, $ip) === 0) $allowed = true; @@ -875,7 +874,7 @@ class FrontControllerCore extends Controller if (Validate::isLoadedObject($cart)) { $customer = new Customer((int)$cart->id_customer); - if(Validate::isLoadedObject($customer)) + if (Validate::isLoadedObject($customer)) { $this->context->cookie->id_customer = (int)$customer->id; $this->context->cookie->customer_lastname = $customer->lastname; @@ -884,7 +883,6 @@ class FrontControllerCore extends Controller $this->context->cookie->is_guest = $customer->isGuest(); $this->context->cookie->passwd = $customer->passwd; $this->context->cookie->email = $customer->email; - $this->context->cookie->checkedTOS = true; return $id_cart; } } diff --git a/classes/GroupReduction.php b/classes/GroupReduction.php index a44fc1aa6..3796cdfbb 100644 --- a/classes/GroupReduction.php +++ b/classes/GroupReduction.php @@ -104,8 +104,8 @@ class GroupReductionCore extends ObjectModel $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT p.`id_product` FROM `'._DB_PREFIX_.'product` p - WHERE p.`id_category_default` = '.(int)$this->id_category - , false); + WHERE p.`id_category_default` = '.(int)$this->id_category, + false); $ids = array(); foreach ($products as $product) @@ -154,8 +154,8 @@ class GroupReductionCore extends ObjectModel return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT gr.`id_group` as id_group, gr.`reduction` as reduction FROM `'._DB_PREFIX_.'group_reduction` gr - WHERE `id_category` = '.(int)$id_category - , false); + WHERE `id_category` = '.(int)$id_category, + false); } public static function getGroupReductionByCategoryId($id_category) @@ -163,13 +163,13 @@ class GroupReductionCore extends ObjectModel return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT gr.`id_group_reduction` as id_group_reduction FROM `'._DB_PREFIX_.'group_reduction` gr - WHERE `id_category` = '.(int)$id_category - , false); + WHERE `id_category` = '.(int)$id_category, + false); } public static function setProductReduction($id_product, $id_group, $id_category, $reduction) { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' + Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT pgr.`id_product`, pgr.`id_group`, pgr.`reduction` FROM `'._DB_PREFIX_.'product_group_reduction_cache` pgr WHERE pgr.`id_product` = '.(int)$id_product diff --git a/classes/Guest.php b/classes/Guest.php index 8afa8f7df..0decc4b81 100644 --- a/classes/Guest.php +++ b/classes/Guest.php @@ -72,7 +72,7 @@ class GuestCore extends ObjectModel ), ); - function userAgent() + public function userAgent() { $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''; @@ -96,7 +96,7 @@ class GuestCore extends ObjectModel } // Only the first language is returned - return (sizeof($langsArray) ? key($langsArray) : ''); + return (count($langsArray) ? key($langsArray) : ''); } protected function getBrowser($userAgent) @@ -121,7 +121,7 @@ class GuestCore extends ObjectModel return $result['id_web_browser']; } - return NULL; + return null; } protected function getOs($userAgent) @@ -142,7 +142,7 @@ class GuestCore extends ObjectModel return $result['id_operating_system']; } - return NULL; + return null; } public static function getFromCustomer($id_customer) @@ -177,9 +177,9 @@ class GuestCore extends ObjectModel public static function setNewGuest($cookie) { - $guest = new Guest(isset($cookie->id_customer) ? Guest::getFromCustomer((int)($cookie->id_customer)) : NULL); + $guest = new Guest(isset($cookie->id_customer) ? Guest::getFromCustomer((int)($cookie->id_customer)) : null); $guest->userAgent(); - if ($guest->id_operating_system OR $guest->id_web_browser) + if ($guest->id_operating_system || $guest->id_web_browser) { $guest->save(); $cookie->id_guest = (int)($guest->id); diff --git a/classes/HelpAccess.php b/classes/HelpAccess.php index ac02254f5..13bbb4efc 100644 --- a/classes/HelpAccess.php +++ b/classes/HelpAccess.php @@ -83,12 +83,12 @@ class HelpAccessCore $res = @file_get_contents($url, 0, $ctx); $infos = preg_split('/\|/', $res); - if (sizeof($infos) > 0) + if (count($infos) > 0) { $version = trim($infos[0]); if (!empty($version)) { - if (sizeof($infos) > 1) + if (count($infos) > 1) $tooltip = trim($infos[1]); } } diff --git a/classes/Hook.php b/classes/Hook.php index 484613e50..1c8f39ec1 100644 --- a/classes/Hook.php +++ b/classes/Hook.php @@ -411,7 +411,7 @@ font-style:italic;">