[-] Classes : all classes and controllers now use their name in static calls instead of self (improve override) #PSFV-376

This commit is contained in:
rMalie
2012-01-19 10:14:10 +00:00
parent 60d466b2f7
commit eee9b353c1
82 changed files with 432 additions and 431 deletions
+8 -8
View File
@@ -103,7 +103,7 @@ class AddressFormatCore extends ObjectModel
* @fieldName is a property name
* @isIdField boolean to know if we have to allowed a property name started by 'id_'
*/
private function _checkValidateClassField($className, $fieldName, $isIdField)
protected function _checkValidateClassField($className, $fieldName, $isIdField)
{
$isValide = false;
@@ -142,7 +142,7 @@ class AddressFormatCore extends ObjectModel
* @patternName is the composition of the class and field name
* @fieldsValidate contains the list of available field for the Address class
*/
private function _checkLiableAssociation($patternName, $fieldsValidate)
protected function _checkLiableAssociation($patternName, $fieldsValidate)
{
$patternName = trim($patternName);
@@ -229,7 +229,7 @@ class AddressFormatCore extends ObjectModel
** example : (firstname) => 'Presta' will result (Presta)
** : (firstname-lastname) => 'Presta' and 'Shop' result '(Presta-Shop)'
*/
private static function _setOriginalDisplayFormat(&$formattedValueList, $currentLine, $currentKeyList)
protected static function _setOriginalDisplayFormat(&$formattedValueList, $currentLine, $currentKeyList)
{
if ($currentKeyList && is_array($currentKeyList))
if ($originalFormattedPatternList = explode(' ', $currentLine))
@@ -326,10 +326,10 @@ class AddressFormatCore extends ObjectModel
}
}
}
self::_setOriginalDisplayFormat($tab, $line, $keyList);
AddressFormat::_setOriginalDisplayFormat($tab, $line, $keyList);
}
}
self::cleanOrderedAddress($addressFormat);
AddressFormat::cleanOrderedAddress($addressFormat);
// Free the instanciate objects
foreach($temporyObject as &$object)
unset($object);
@@ -373,7 +373,7 @@ class AddressFormatCore extends ObjectModel
public static function generateAddressSmarty($params, &$smarty)
{
return self::generateAddress(
return AddressFormat::generateAddress(
$params['address'],
(isset($params['patternRules']) ? $params['patternRules'] : array()),
(isset($params['newLine']) ? $params['newLine'] : "\r\n"),
@@ -450,7 +450,7 @@ class AddressFormatCore extends ObjectModel
public static function getOrderedAddressFields($id_country = 0, $split_all = false, $cleaned = false)
{
$out = array();
$field_set = explode("\n", self::getAddressCountryFormat($id_country));
$field_set = explode("\n", AddressFormat::getAddressCountryFormat($id_country));
foreach ($field_set as $field_item)
if ($split_all)
{
@@ -515,7 +515,7 @@ class AddressFormatCore extends ObjectModel
return $out;
}
private function _getFormatDB($id_country)
protected function _getFormatDB($id_country)
{
$result = Db::getInstance()->getRow('
SELECT format
+2 -2
View File
@@ -1604,7 +1604,7 @@ class AdminControllerCore extends Controller
// @todo remove global keyword in translations files and use static
global $_LANGADM;
self::initModuleCacheTab();
AdminController::initModuleCacheTab();
if (!is_array($_LANGADM))
{
@@ -1661,7 +1661,7 @@ class AdminControllerCore extends Controller
$class = substr($class, 0, -10);
else if ($class == 'AdminTab')
$class = substr(get_class($this), 0, -10);
return self::translate($string, $class, $addslashes, $htmlentities);
return AdminController::translate($string, $class, $addslashes, $htmlentities);
}
/**
+1 -1
View File
@@ -914,7 +914,7 @@ abstract class AdminTabCore
if (!Shop::isFeatureActive())
return ;
if(!$assos = self::getAssoShop($this->table, $id_object))
if (!$assos = AdminTab::getAssoShop($this->table, $id_object))
return;
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$assos[1].($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
+5 -5
View File
@@ -44,16 +44,16 @@ class AliasCore extends ObjectModel
),
);
public function __construct($id = NULL, $alias = NULL, $search = NULL, $id_lang = NULL)
public function __construct($id = null, $alias = null, $search = null, $id_lang = null)
{
$this->def = self::getDefinition($this);
$this->def = Alias::getDefinition($this);
$this->setDefinitionRetrocompatibility();
if ($id)
parent::__construct($id);
else if ($alias && Validate::isValidSearch($alias))
{
if (!self::isFeatureActive())
if (!Alias::isFeatureActive())
{
$this->alias = trim($alias);
$this->search = trim($search);
@@ -96,7 +96,7 @@ class AliasCore extends ObjectModel
if (parent::delete())
{
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_ALIAS_FEATURE_ACTIVE', self::isCurrentlyUsed($this->def['table'], true));
Configuration::updateGlobalValue('PS_ALIAS_FEATURE_ACTIVE', Alias::isCurrentlyUsed($this->def['table'], true));
return true;
}
return false;
@@ -104,7 +104,7 @@ class AliasCore extends ObjectModel
public function getAliases()
{
if (!self::isFeatureActive())
if (!Alias::isFeatureActive())
return '';
$aliases = Db::getInstance()->executeS('
+1 -1
View File
@@ -202,7 +202,7 @@ class AttributeCore extends ObjectModel
Tools::displayAsDeprecated();
$id_product = (int)$arr['id_product'];
$qty = self::getAttributeQty($id_product);
$qty = Attribute::getAttributeQty($id_product);
if ($qty !== false)
{
+1 -1
View File
@@ -126,7 +126,7 @@ class AttributeGroupCore extends ObjectModel
IN ('.implode(', ', $to_remove).')') === false)
return false;
/* Remove combinations if they do not possess attributes anymore */
if (!self::cleanDeadCombinations())
if (!AttributeGroup::cleanDeadCombinations())
return false;
/* Also delete related attributes */
if (Db::getInstance()->execute('
+6 -6
View File
@@ -102,7 +102,7 @@ class CMSCategoryCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
$this->position = self::getLastPosition((int)$this->id_parent);
$this->position = CMSCategory::getLastPosition((int)$this->id_parent);
$this->level_depth = $this->calcLevelDepth();
foreach ($this->name AS $k => $value)
if (preg_match('/^[1-9]\./', $value))
@@ -185,7 +185,7 @@ class CMSCategoryCore extends ObjectModel
($active ? ' AND c.`active` = 1' : '');
$result = Db::getInstance()->executeS($sql);
foreach ($result as $row)
$category['children'][] = self::getRecurseCategory($id_lang, $row['id_cms_category'], $active, $links);
$category['children'][] = CMSCategory::getRecurseCategory($id_lang, $row['id_cms_category'], $active, $links);
$sql = 'SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms` c
@@ -208,12 +208,12 @@ class CMSCategoryCore extends ObjectModel
public static function recurseCMSCategory($categories, $current, $id_cms_category = 1, $id_selected = 1, $is_html = 0)
{
$html = '<option value="'.$id_cms_category.'"'.(($id_selected == $id_cms_category) ? ' selected="selected"' : '').'>'.
str_repeat('&nbsp;', $current['infos']['level_depth'] * 5).self::hideCMSCategoryPosition(stripslashes($current['infos']['name'])).'</option>';
str_repeat('&nbsp;', $current['infos']['level_depth'] * 5).CMSCategory::hideCMSCategoryPosition(stripslashes($current['infos']['name'])).'</option>';
if ($is_html == 0)
echo $html;
if (isset($categories[$id_cms_category]))
foreach (array_keys($categories[$id_cms_category]) AS $key)
$html .= self::recurseCMSCategory($categories, $categories[$id_cms_category][$key], $key, $id_selected, $is_html);
$html .= CMSCategory::recurseCMSCategory($categories, $categories[$id_cms_category][$key], $key, $id_selected, $is_html);
return $html;
}
@@ -257,7 +257,7 @@ class CMSCategoryCore extends ObjectModel
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.')');
self::cleanPositions($this->id_parent);
CMSCategory::cleanPositions($this->id_parent);
/* Delete pages which are in categories to delete */
$result = Db::getInstance()->executeS('
@@ -390,7 +390,7 @@ class CMSCategoryCore extends ObjectModel
*/
public static function getHomeCategories($id_lang, $active = true)
{
return self::getChildren(1, $id_lang, $active);
return CMSCategory::getChildren(1, $id_lang, $active);
}
public static function getChildren($id_parent, $id_lang, $active = true)
+7 -7
View File
@@ -470,7 +470,7 @@ class CartCore extends ObjectModel
}
// Thus you can avoid one query per product, because there will be only one query for all the products of the cart
Product::cacheProductsFeatures($products_ids);
self::cacheSomeAttributesLists($pa_ids, $this->id_lang);
Cart::cacheSomeAttributesLists($pa_ids, $this->id_lang);
$this->_products = array();
if (empty($result))
@@ -664,7 +664,7 @@ class CartCore extends ObjectModel
if (!$this->id)
return 0;
return self::getNbProducts($this->id);
return Cart::getNbProducts($this->id);
}
public static function getNbProducts($id)
@@ -1863,7 +1863,7 @@ class CartCore extends ObjectModel
'delay' => $delay,
'price' => $price,
'price_tax_exc' => $price_tax_exc,
'id_carrier' => self::intifier($key), // Need to translate to an integer for retrocompatibility reason, in 1.4 template we used intval
'id_carrier' => Cart::intifier($key), // Need to translate to an integer for retrocompatibility reason, in 1.4 template we used intval
'is_module' => false,
);
}
@@ -1877,7 +1877,7 @@ class CartCore extends ObjectModel
if (count($delivery_option) > 1 || empty($delivery_option))
return 0;
return self::intifier(reset($delivery_option));
return Cart::intifier(reset($delivery_option));
}
/**
@@ -1971,7 +1971,7 @@ class CartCore extends ObjectModel
$this->delivery_option = serialize($delivery_option);
}
private function getIdCarrierFromDeliveryOption($delivery_option)
protected function getIdCarrierFromDeliveryOption($delivery_option)
{
$delivery_option_list = $this->getDeliveryOptionList();
foreach ($delivery_option as $key => $value)
@@ -2160,7 +2160,7 @@ class CartCore extends ObjectModel
// If no product added, return 0
if ($order_total <= 0
&& (
!(self::getNbProducts($this->id) && is_null($product_list))
!(Cart::getNbProducts($this->id) && is_null($product_list))
||
(count($product_list) && !is_null($product_list))
))
@@ -2571,7 +2571,7 @@ class CartCore extends ObjectModel
*/
public static function getCartByOrderId($id_order)
{
if ($id_cart = self::getCartIdByOrderId($id_order))
if ($id_cart = Cart::getCartIdByOrderId($id_order))
return new Cart((int)$id_cart);
return false;
+10 -10
View File
@@ -152,12 +152,12 @@ class CategoryCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
$this->position = self::getLastPosition((int)$this->id_parent);
$this->position = Category::getLastPosition((int)$this->id_parent);
if (!isset($this->level_depth))
$this->level_depth = $this->calcLevelDepth();
$ret = parent::add($autodate);
if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)
self::regenerateEntireNtree();
Category::regenerateEntireNtree();
$this->updateGroup($this->groupBox);
Hook::exec('actionCategoryAdd', array('category' => $this));
return $ret;
@@ -179,11 +179,11 @@ class CategoryCore extends ObjectModel
$this->cleanPositions((int)$this->id_parent);
// If the parent category was changed, we don't want to have 2 categories with the same position
if ($this->getDuplicatePosition())
$this->position = self::getLastPosition((int)$this->id_parent);
$this->position = Category::getLastPosition((int)$this->id_parent);
$ret = parent::update($nullValues);
if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)
{
self::regenerateEntireNtree();
Category::regenerateEntireNtree();
$this->recalculateLevelDepth($this->id_category);
}
Hook::exec('actionCategoryUpdate', array('category' => $this));
@@ -246,7 +246,7 @@ class CategoryCore extends ObjectModel
str_repeat('&nbsp;', $current['infos']['level_depth'] * 5).stripslashes($current['infos']['name']).'</option>';
if (isset($categories[$id_category]))
foreach (array_keys($categories[$id_category]) as $key)
self::recurseCategory($categories, $categories[$id_category][$key], $key, $id_selected);
Category::recurseCategory($categories, $categories[$id_category][$key], $key, $id_selected);
}
@@ -291,7 +291,7 @@ class CategoryCore extends ObjectModel
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_product` WHERE `id_category` IN ('.$list.')');
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` IN ('.$list.')');
self::cleanPositions($this->id_parent);
Category::cleanPositions($this->id_parent);
/* Delete category images and its children images */
$tmp_category = new Category();
@@ -337,7 +337,7 @@ class CategoryCore extends ObjectModel
/* Rebuild the nested tree */
if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)
self::regenerateEntireNtree();
Category::regenerateEntireNtree();
Hook::exec('actionCategoryDelete', array('category' => $this));
@@ -395,7 +395,7 @@ class CategoryCore extends ObjectModel
foreach ($categories as $category)
$categories_array[(int)$category['id_parent']]['subcategories'][(int)$category['id_category']] = 1;
$n = 1;
self::_subTree($categories_array, 1, $n);
Category::_subTree($categories_array, 1, $n);
}
protected static function _subTree(&$categories, $id_category, &$n)
@@ -403,7 +403,7 @@ class CategoryCore extends ObjectModel
$left = (int)$n++;
if (isset($categories[(int)$id_category]['subcategories']))
foreach (array_keys($categories[(int)$id_category]['subcategories']) as $id_subcategory)
self::_subTree($categories, (int)$id_subcategory, $n);
Category::_subTree($categories, (int)$id_subcategory, $n);
$right = (int)$n++;
Db::getInstance()->execute('
@@ -660,7 +660,7 @@ class CategoryCore extends ObjectModel
*/
public static function getHomeCategories($id_lang, $active = true)
{
return self::getChildren(1, $id_lang, $active);
return Category::getChildren(1, $id_lang, $active);
}
public static function getRootCategory($id_lang = null, Shop $shop = null)
+7 -7
View File
@@ -93,7 +93,7 @@ class ConfigurationCore extends ObjectModel
*/
public static function getIdByName($key, $shopGroupID = null, $shopID = null)
{
self::getShopFromContext($shopGroupID, $shopID);
Configuration::getShopFromContext($shopGroupID, $shopID);
$sql = 'SELECT id_configuration
FROM '._DB_PREFIX_.'configuration
WHERE name = \''.pSQL($key).'\''
@@ -138,7 +138,7 @@ class ConfigurationCore extends ObjectModel
*/
static public function get($key, $langID = NULL, $shopGroupID = NULL, $shopID = NULL)
{
self::getShopFromContext($shopGroupID, $shopID);
Configuration::getShopFromContext($shopGroupID, $shopID);
$langID = (int)$langID;
if (!isset(self::$_CONF[$langID]))
$langID = 0;
@@ -158,7 +158,7 @@ class ConfigurationCore extends ObjectModel
static public function getGlobalValue($key, $langID = NULL)
{
return self::get($key, $langID, 0, 0);
return Configuration::get($key, $langID, 0, 0);
}
/**
@@ -174,7 +174,7 @@ class ConfigurationCore extends ObjectModel
$languages = Language::getLanguages();
$resultsArray = array();
foreach ($languages as $language)
$resultsArray[$language['id_lang']] = self::get($key, $language['id_lang'], $id_group_shop, $id_shop);
$resultsArray[$language['id_lang']] = Configuration::get($key, $language['id_lang'], $id_group_shop, $id_shop);
return $resultsArray;
}
@@ -191,7 +191,7 @@ class ConfigurationCore extends ObjectModel
throw new PrestaShopException('keys var is not an array');
$langID = (int)$langID;
self::getShopFromContext($shopGroupID, $shopID);
Configuration::getShopFromContext($shopGroupID, $shopID);
$results = array();
foreach ($keys as $key)
@@ -230,7 +230,7 @@ class ConfigurationCore extends ObjectModel
{
if (!Validate::isConfigName($key))
die(Tools::displayError());
self::getShopFromContext($id_group_shop, $id_shop);
Configuration::getShopFromContext($id_group_shop, $id_shop);
if (!is_array($values))
$values = array($values);
@@ -273,7 +273,7 @@ class ConfigurationCore extends ObjectModel
{
if (!Validate::isConfigName($key))
die(Tools::displayError());
self::getShopFromContext($shopGroupID, $shopID);
Configuration::getShopFromContext($shopGroupID, $shopID);
if (!is_array($values))
$values = array($values);
+20 -20
View File
@@ -94,7 +94,7 @@ class ConfigurationTestCore
{
$res = array();
foreach ($tests as $key => $test)
$res[$key] = self::run($key, $test);
$res[$key] = ConfigurationTest::run($key, $test);
return $res;
}
@@ -178,7 +178,7 @@ class ConfigurationTestCore
{
while (($file = readdir($dh)) !== false)
if (is_dir($dir.DIRECTORY_SEPARATOR.$file) && $file != '.' && $file != '..' && $file != '.svn')
if (!self::test_dir($relative_dir.DIRECTORY_SEPARATOR.$file, true))
if (!ConfigurationTest::test_dir($relative_dir.DIRECTORY_SEPARATOR.$file, true))
return false;
}
closedir($dh);
@@ -193,98 +193,98 @@ class ConfigurationTestCore
public static function test_config_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_sitemap($dir)
{
return self::test_file($dir);
return ConfigurationTest::test_file($dir);
}
public static function test_root_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_log_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_admin_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_img_dir($dir)
{
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_module_dir($dir)
{
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_cache_dir($dir)
{
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_tools_v2_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_cache_v2_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_download_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_mails_dir($dir)
{
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_translations_dir($dir)
{
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_theme_lang_dir($dir)
{
if (!file_exists($dir))
return true;
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_theme_pdf_lang_dir($dir)
{
if (!file_exists($dir))
return true;
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_theme_cache_dir($dir)
{
if (!file_exists($dir))
return true;
return self::test_dir($dir, true);
return ConfigurationTest::test_dir($dir, true);
}
public static function test_customizable_products_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_virtual_products_dir($dir)
{
return self::test_dir($dir);
return ConfigurationTest::test_dir($dir);
}
public static function test_mcrypt()
+1 -1
View File
@@ -295,7 +295,7 @@ class CountryCore extends ObjectModel
public function isNeedDni()
{
return (bool)self::isNeedDniByCountryId($this->id);
return Country::isNeedDniByCountryId($this->id);
}
public static function isNeedDniByCountryId($id_country)
+2 -2
View File
@@ -343,10 +343,10 @@ class CurrencyCore extends ObjectModel
// Default feed currency (EUR)
$isoCodeSource = strval($feed->source['iso_code']);
if (!$default_currency = self::getDefaultCurrency())
if (!$default_currency = Currency::getDefaultCurrency())
return Tools::displayError('No default currency');
$currencies = self::getCurrencies(true);
$currencies = Currency::getCurrencies(true);
foreach ($currencies as $currency)
$currency->refreshCurrency($feed->list, $isoCodeSource, $default_currency);
+3 -3
View File
@@ -498,7 +498,7 @@ class CustomerCore extends ObjectModel
// DEPRECATED
public function customerIdExists($id_customer)
{
return self::customerIdExistsStatic((int)$id_customer);
return Customer::customerIdExistsStatic((int)$id_customer);
}
public static function customerIdExistsStatic($id_customer)
@@ -559,7 +559,7 @@ class CustomerCore extends ObjectModel
public function getGroups()
{
return self::getGroupsStatic((int)$this->id);
return Customer::getGroupsStatic((int)$this->id);
}
/**
@@ -687,7 +687,7 @@ class CustomerCore extends ObjectModel
return false;
/* Customer is valid only if it can be load and if object password is the same as database one */
if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && self::checkPassword($this->id, $this->passwd))
if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && Customer::checkPassword($this->id, $this->passwd))
return true;
return false;
}
+3 -3
View File
@@ -283,7 +283,7 @@ class DispatcherCore
// FO dispatch
if (!defined('_PS_ADMIN_DIR_'))
{
$controllers = self::getControllers($this->controller_directories);
$controllers = Dispatcher::getControllers($this->controller_directories);
if (!isset($controllers[$this->controller]))
$this->controller = strtolower($this->controller_not_found);
$controller_class = $controllers[$this->controller];
@@ -306,7 +306,7 @@ class DispatcherCore
else
{
// Get controller class name
$controller_row = self::getAdminController($this->controller);
$controller_row = Dispatcher::getAdminController($this->controller);
if (empty($controller_row))
{
// We need controller_not_found to be the camelcase controller name
@@ -318,7 +318,7 @@ class DispatcherCore
// If Tab/Controller is in module, include it
if (!empty($controller_row['module']))
$controller_type = self::includeModuleClass($controller_row['module'], $controller_class);
$controller_type = Dispatcher::includeModuleClass($controller_row['module'], $controller_class);
// If it is an AdminTab, include it
else if (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$controller_class.'.php'))
{
+3 -3
View File
@@ -255,7 +255,7 @@ class EmployeeCore extends ObjectModel
case 1:
if ($context->shop->checkIfShopExist($context->shop->id))
{
if (!in_array($context->shop->id, self::getEmployeeShopById($id_employee)))
if (!in_array($context->shop->id, Employee::getEmployeeShopById($id_employee)))
return false;
}
else
@@ -267,7 +267,7 @@ class EmployeeCore extends ObjectModel
{
$shops = $context->shop->getIdShopsByIdGroupShop($context->shop->getGroupID());
foreach ($shops as $shop)
if (!in_array($shop, self::getEmployeeShopById($id_employee)))
if (!in_array($shop, Employee::getEmployeeShopById($id_employee)))
return false;
}
else
@@ -276,7 +276,7 @@ class EmployeeCore extends ObjectModel
case 3:
if ($context->employee->id_profile == _PS_ADMIN_PROFILE_ ||
$context->shop->getTotalShopsWhoExists() == self::getTotalEmployeeShopById($id_employee))
$context->shop->getTotalShopsWhoExists() == Employee::getTotalEmployeeShopById($id_employee))
return true;
else
return false;
+1 -1
View File
@@ -215,7 +215,7 @@ class FeatureCore extends ObjectModel
if ($position)
$feature->position = (int)$position;
else
$feature->position = self::getHigherPosition() + 1;
$feature->position = Feature::getHigherPosition() + 1;
$feature->add();
return $feature->id;
}
+1 -1
View File
@@ -48,7 +48,7 @@ class FileUploaderCore
}
}
private function toBytes($str)
protected function toBytes($str)
{
$val = trim($str);
$last = strtolower($str[strlen($str)-1]);
+2 -2
View File
@@ -191,7 +191,7 @@ class FrontControllerCore extends Controller
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
!self::isInWhitelistForGeolocation())
!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)
@@ -595,7 +595,7 @@ class FrontControllerCore extends Controller
if (is_object($record))
{
if (!in_array(strtoupper($record->country_code), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND !self::isInWhitelistForGeolocation())
if (!in_array(strtoupper($record->country_code), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) && !FrontController::isInWhitelistForGeolocation())
{
if (Configuration::get('PS_GEOLOCATION_BEHAVIOR') == _PS_GEOLOCATION_NO_CATALOG_)
$this->restrictedCountry = true;
+3 -3
View File
@@ -123,7 +123,7 @@ class GroupCore extends ObjectModel
public static function getPriceDisplayMethod($id_group)
{
if (!isset(self::$group_price_display_method[$id_group]))
if (!isset(Group::$group_price_display_method[$id_group]))
self::$group_price_display_method[$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `price_display_method`
FROM `'._DB_PREFIX_.'group`
@@ -133,7 +133,7 @@ class GroupCore extends ObjectModel
public static function getDefaultPriceDisplayMethod()
{
return self::getPriceDisplayMethod((int)Configuration::get('PS_CUSTOMER_GROUP'));
return Group::getPriceDisplayMethod((int)Configuration::get('PS_CUSTOMER_GROUP'));
}
public function add($autodate = true, $null_values = false)
@@ -163,7 +163,7 @@ class GroupCore extends ObjectModel
$this->truncateModulesRestrictions($this->id);
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', self::isCurrentlyUsed());
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', Group::isCurrentlyUsed());
// Add default group (id 3) to customers without groups
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_group` (
+4 -4
View File
@@ -250,12 +250,12 @@ class ImageCore extends ObjectModel
if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg'))
copy(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg', $new_path.'.jpg');
self::replaceAttributeImageAssociationId($combination_images, (int)$image_old->id, (int)$image_new->id);
Image::replaceAttributeImageAssociationId($combination_images, (int)$image_old->id, (int)$image_new->id);
}
else
return false;
}
return self::duplicateAttributeImageAssociations($combination_images);
return Image::duplicateAttributeImageAssociations($combination_images);
}
protected static function replaceAttributeImageAssociationId(&$combination_images, $saved_id, $id_image)
@@ -451,7 +451,7 @@ class ImageCore extends ObjectModel
if (preg_match('/^[0-9]+(\-(.*))?\.'.$format.'$/', $file))
unlink($path.$file);
else if (is_dir($path.$file) && (preg_match('/^[0-9]$/', $file)))
self::deleteAllImages($path.$file.'/', $format);
Image::deleteAllImages($path.$file.'/', $format);
}
// Can we remove the image folder?
@@ -509,7 +509,7 @@ class ImageCore extends ObjectModel
return false;
if (!$this->folder)
$this->folder = self::getImgFolderStatic($this->id);
$this->folder = Image::getImgFolderStatic($this->id);
return $this->folder;
}
+18 -17
View File
@@ -106,7 +106,7 @@ class LanguageCore extends ObjectModel
* Generate traslations files
*
*/
private function _generateFiles($newIso = null)
protected function _generateFiles($newIso = null)
{
$iso_code = $newIso?$newIso:$this->iso_code;
@@ -165,7 +165,7 @@ class LanguageCore extends ObjectModel
* @return array([theme dir] => array('name' => [theme name]))
* @deprecated will be removed in 1.6
*/
private function _getThemesList()
protected function _getThemesList()
{
Tools::displayAsDeprecated();
static $themes = array();
@@ -204,7 +204,7 @@ class LanguageCore extends ObjectModel
public function checkFiles()
{
return self::checkFilesWithIsoCode($this->iso_code);
return Language::checkFilesWithIsoCode($this->iso_code);
}
@@ -218,9 +218,10 @@ class LanguageCore extends ObjectModel
*/
public static function checkFilesWithIsoCode($iso_code)
{
if (isset(self::$_checkedLangs[$iso_code]) AND self::$_checkedLangs[$iso_code])
if (isset(self::$_checkedLangs[$iso_code]) && self::$_checkedLangs[$iso_code])
return true;
foreach (array_keys(self::getFilesList($iso_code, _THEME_NAME_, false, false, false, true)) as $key)
foreach (array_keys(Language::getFilesList($iso_code, _THEME_NAME_, false, false, false, true)) as $key)
if (!file_exists($key))
return false;
self::$_checkedLangs[$iso_code] = true;
@@ -390,7 +391,7 @@ class LanguageCore extends ObjectModel
if ($file != '.' && $file != '..')
{
if (is_dir($dir.'/'.$file))
self::recurseDeleteDir($dir.'/'.$file);
Language::recurseDeleteDir($dir.'/'.$file);
elseif (file_exists($dir.'/'.$file))
@unlink($dir.'/'.$file);
}
@@ -402,7 +403,7 @@ class LanguageCore extends ObjectModel
public function delete()
{
if (empty($this->iso_code))
$this->iso_code = self::getIsoById($this->id);
$this->iso_code = Language::getIsoById($this->id);
// Database translations deletion
$result = Db::getInstance()->executeS('SHOW TABLES FROM `'._DB_NAME_.'`');
@@ -418,30 +419,30 @@ class LanguageCore extends ObjectModel
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'search_word WHERE id_lang = '.(int)($this->id));
// Files deletion
foreach (self::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
foreach (Language::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
if (file_exists($key))
unlink($key);
$modList = scandir(_PS_MODULE_DIR_);
foreach ($modList as $mod)
{
self::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/'.$this->iso_code);
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/'.$this->iso_code);
$files = @scandir(_PS_MODULE_DIR_.$mod.'/mails/');
if (count($files) <= 2)
self::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/');
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod.'/mails/');
if(file_exists(_PS_MODULE_DIR_.$mod.'/'.$this->iso_code.'.php'))
{
unlink(_PS_MODULE_DIR_.$mod.'/'.$this->iso_code.'.php');
$files = @scandir(_PS_MODULE_DIR_.$mod);
if (count($files) <= 2)
self::recurseDeleteDir(_PS_MODULE_DIR_.$mod);
Language::recurseDeleteDir(_PS_MODULE_DIR_.$mod);
}
}
if (file_exists(_PS_MAIL_DIR_.$this->iso_code))
self::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code);
Language::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code);
if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
self::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
Language::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
if (!parent::delete())
return false;
@@ -488,7 +489,7 @@ class LanguageCore extends ObjectModel
public static function getLanguages($active = true, $id_shop = false)
{
if (!self::$_LANGUAGES)
self::loadLanguages();
Language::loadLanguages();
$languages = array();
foreach (self::$_LANGUAGES AS $language)
@@ -641,13 +642,13 @@ class LanguageCore extends ObjectModel
fclose($file);
}
else
self::_copyNoneFlag($insert_id);
Language::_copyNoneFlag($insert_id);
}
else
self::_copyNoneFlag($insert_id);
Language::_copyNoneFlag($insert_id);
}
else
self::_copyNoneFlag($insert_id);
Language::_copyNoneFlag($insert_id);
$files_copy = array('/en.jpg', '/en-default-thickbox.jpg', '/en-default-home.jpg', '/en-default-large.jpg', '/en-default-medium.jpg', '/en-default-small.jpg', '/en-default-large_scene.jpg');
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
+2 -2
View File
@@ -113,7 +113,7 @@ class LoggerCore extends ObjectModel
$log->object_id = intval($object_id);
}
self::sendByMail($log);
Logger::sendByMail($log);
if ($allow_duplicate || !$log->_isPresent())
{
@@ -145,7 +145,7 @@ class LoggerCore extends ObjectModel
*
* @return true if exists
*/
private function _isPresent()
protected function _isPresent()
{
if (!isset(self::$is_present[md5($this->message)]))
self::$is_present[$this->getHash()] = Db::getInstance()->getValue('SELECT COUNT(*)
+1 -1
View File
@@ -134,7 +134,7 @@ class ManufacturerCore extends ObjectModel
foreach ($selection as $id)
{
$this->id = (int)$id;
$this->id_address = self::getManufacturerAddress();
$this->id_address = Manufacturer::getManufacturerAddress();
$result = $result && $this->delete();
}
+19 -19
View File
@@ -137,7 +137,7 @@ class MediaCore
public static function packJSinHTMLpregCallback($preg_matches)
{
$preg_matches[1] = $preg_matches[1].'/* <![CDATA[ */';
$preg_matches[2] = self::packJS($preg_matches[2]);
$preg_matches[2] = Media::packJS($preg_matches[2]);
$preg_matches[count($preg_matches)-1] = '/* ]]> */'.$preg_matches[count($preg_matches)-1];
unset($preg_matches[0]);
$output = implode('', $preg_matches);
@@ -275,12 +275,12 @@ class MediaCore
$return = array();
if (file_exists($file_uri))
$return[] = self::getJSPath($file);
$return[] = Media::getJSPath($file);
else
$return[] = self::getJSPath(Tools::getCurrentUrlProtocolPrefix().'ajax.googleapis.com/ajax/libs/jquery/'.$version.'/jquery'.($minifier ? '.min.js' : '.js'));
$return[] = Media::getJSPath(Tools::getCurrentUrlProtocolPrefix().'ajax.googleapis.com/ajax/libs/jquery/'.$version.'/jquery'.($minifier ? '.min.js' : '.js'));
if ($addNoConflict)
$return[] = self::getJSPath(_PS_JS_DIR_.'jquery/jquery.noConflict.php?version='.$version);
$return[] = Media::getJSPath(_PS_JS_DIR_.'jquery/jquery.noConflict.php?version='.$version);
return $return;
}
@@ -300,13 +300,13 @@ class MediaCore
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
$ui_tmp = array();
if ($check_dependencies && array_key_exists($component, self::$jquery_ui_dependencies))
foreach(self::$jquery_ui_dependencies[$component]['dependencies'] as $dependency)
$ui_tmp[] = self::getJqueryUIPath($dependency, $theme, false);
foreach (self::$jquery_ui_dependencies[$component]['dependencies'] as $dependency)
$ui_tmp[] = Media::getJqueryUIPath($dependency, $theme, false);
if (self::$jquery_ui_dependencies[$component]['theme'] AND $check_dependencies)
{
$theme_css = self::getCSSPath($folder.'themes/'.$theme.'/jquery.ui.theme.css');
$comp_css = self::getCSSPath($folder.'themes/'.$theme.'/jquery.'.$component.'.css');
$theme_css = Media::getCSSPath($folder.'themes/'.$theme.'/jquery.ui.theme.css');
$comp_css = Media::getCSSPath($folder.'themes/'.$theme.'/jquery.'.$component.'.css');
if (!empty($theme_css) OR $theme_css)
$ui_path['css'] = array_merge($ui_path['css'], $theme_css);
if (!empty($comp_css) OR $comp_css)
@@ -323,15 +323,15 @@ class MediaCore
$ui_path['js'][] = $ui['js'];
$ui_path['css'][] = $ui['css'];
}
$ui_path['js'][] = self::getJSPath($folder.$file);
$ui_path['js'][] = Media::getJSPath($folder.$file);
}
else
$ui_path['js'] = self::getJSPath($folder.$file);
$ui_path['js'] = Media::getJSPath($folder.$file);
}
//add i18n file for datepicker
if ($component == 'ui.datepicker')
$ui_path['js'][] = self::getJSPath($folder.'i18n/jquery.ui.datepicker-'.Context::getContext()->language->iso_code.'.js');
$ui_path['js'][] = Media::getJSPath($folder.'i18n/jquery.ui.datepicker-'.Context::getContext()->language->iso_code.'.js');
return $ui_path;
}
@@ -352,12 +352,12 @@ class MediaCore
$url_data = parse_url($folder);
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
if (file_exists($file_uri.$file))
$plugin_path['js'] = self::getJSPath($folder.$file);
$plugin_path['js'] = Media::getJSPath($folder.$file);
else if (file_exists($file_uri.$name.'/'.$file))
$plugin_path['js'] = self::getJSPath($folder.$name.'/'.$file);
$plugin_path['js'] = Media::getJSPath($folder.$name.'/'.$file);
else
return false;
$plugin_path['css'] = self::getJqueryPluginCSSPath($name);
$plugin_path['css'] = Media::getJqueryPluginCSSPath($name);
return $plugin_path;
}
@@ -375,9 +375,9 @@ class MediaCore
$url_data = parse_url($folder);
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
if (file_exists($file_uri.$file))
return self::getCSSPath($folder.$file);
return Media::getCSSPath($folder.$file);
else if (file_exists($file_uri.$name.'/'.$file))
return self::getCSSPath($folder.$name.'/'.$file);
return Media::getCSSPath($folder.$name.'/'.$file);
else
return false;
}
@@ -442,7 +442,7 @@ class MediaCore
foreach ($media_infos['files'] as $file_infos)
{
if (file_exists($file_infos['path']))
$compressed_css_files[$media] .= self::minifyCSS(file_get_contents($file_infos['path']), $file_infos['uri'], $import_url);
$compressed_css_files[$media] .= Media::minifyCSS(file_get_contents($file_infos['path']), $file_infos['uri'], $import_url);
else
$compressed_css_files_not_found[] = $file_infos['path'];
}
@@ -528,7 +528,7 @@ class MediaCore
else
$compressed_js_files_not_found[] = $file_infos['path'];
}
$content = self::packJS($content);
$content = Media::packJS($content);
if (!empty($compressed_js_files_not_found))
$content = '/* WARNING ! file(s) not found : "'.
+1 -1
View File
@@ -68,7 +68,7 @@ class MetaCore extends ObjectModel
// Exclude page already filled
if ($excludeFilled)
{
$metas = self::getMetas();
$metas = Meta::getMetas();
foreach ($metas as $meta)
if (in_array($meta['page'], $selectedPages))
unset($selectedPages[array_search($meta['page'], $selectedPages)]);
+10 -10
View File
@@ -256,7 +256,7 @@ abstract class ModuleCore
*
* @param $upgrade_detail
*/
private function setUpgradeMessage($upgrade_detail)
protected function setUpgradeMessage($upgrade_detail)
{
// Store information if a module has been upgraded (memory optimization)
if ($upgrade_detail['available_upgrade'])
@@ -390,7 +390,7 @@ abstract class ModuleCore
* @param $registered_version
* @return bool to know directly if any files have been found
*/
private static function loadUpgradeVersionList($module_name, $module_version, $registered_version)
protected static function loadUpgradeVersionList($module_name, $module_version, $registered_version)
{
$list = array();
@@ -844,7 +844,7 @@ abstract class ModuleCore
$errors = array();
// Get modules directory list and memory limit
$modules_dir = self::getModulesDirOnDisk();
$modules_dir = Module::getModulesDirOnDisk();
$memory_limit = Tools::getMemoryLimit();
foreach ($modules_dir as $module)
@@ -893,12 +893,12 @@ abstract class ModuleCore
$item->warning = '';
foreach ($xml_module as $k => $v)
$item->$k = (string) $v;
$item->displayName = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->displayName), (string)$xml_module->name);
$item->description = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->description), (string)$xml_module->name);
$item->author = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->author), (string)$xml_module->name);
$item->displayName = Module::findTranslation($xml_module->name, Module::configXmlStringFormat($xml_module->displayName), (string)$xml_module->name);
$item->description = Module::findTranslation($xml_module->name, Module::configXmlStringFormat($xml_module->description), (string)$xml_module->name);
$item->author = Module::findTranslation($xml_module->name, Module::configXmlStringFormat($xml_module->author), (string)$xml_module->name);
if (isset($xml_module->confirmUninstall))
$item->confirmUninstall = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->confirmUninstall), (string)$xml_module->name);
$item->confirmUninstall = Module::findTranslation($xml_module->name, Module::configXmlStringFormat($xml_module->confirmUninstall), (string)$xml_module->name);
$item->active = 0;
$moduleList[] = $item;
@@ -1438,12 +1438,12 @@ abstract class ModuleCore
protected function _isTemplateOverloaded($template)
{
return self::_isTemplateOverloadedStatic($this->name, $template);
return Module::_isTemplateOverloadedStatic($this->name, $template);
}
public function display($file, $template, $cacheId = null, $compileId = null)
{
if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL)
if (($overloaded = Module::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === null)
$result = Tools::displayError('No template found for module').' '.basename($file,'.php');
else
{
@@ -1532,7 +1532,7 @@ abstract class ModuleCore
*/
public function getPermission($variable, $employee = null)
{
return self::getPermissionStatic($this->id, $variable, $employee);
return Module::getPermissionStatic($this->id, $variable, $employee);
}
/**
+2 -2
View File
@@ -306,12 +306,12 @@ abstract class ModuleGraphCore extends Module
public function getDate()
{
return self::getDateBetween($this->_employee);
return ModuleGraph::getDateBetween($this->_employee);
}
public static function getDateBetween($employee = null)
{
$employee = self::getEmployee($employee);
$employee = ModuleGraph::getEmployee($employee);
return ' \''.$employee->stats_date_from.' 00:00:00\' AND \''.$employee->stats_date_to.' 23:59:59\' ';
}
+10 -10
View File
@@ -33,7 +33,7 @@ class PackCore extends Product
public static function isPack($id_product)
{
if (!self::isFeatureActive())
if (!Pack::isFeatureActive())
return false;
if (!array_key_exists($id_product, self::$cacheIsPack))
@@ -46,7 +46,7 @@ class PackCore extends Product
public static function isPacked($id_product)
{
if (!self::isFeatureActive())
if (!Pack::isFeatureActive())
return false;
if (!array_key_exists($id_product, self::$cacheIsPacked))
@@ -61,7 +61,7 @@ class PackCore extends Product
{
$sum = 0;
$price_display_method = !self::$_taxCalculationMethod;
$items = self::getItems($id_product, Configuration::get('PS_LANG_DEFAULT'));
$items = Pack::getItems($id_product, Configuration::get('PS_LANG_DEFAULT'));
foreach ($items as $item)
$sum += $item->getPrice($price_display_method) * $item->pack_quantity;
return $sum;
@@ -69,7 +69,7 @@ class PackCore extends Product
public static function getItems($id_product, $id_lang)
{
if (!self::isFeatureActive())
if (!Pack::isFeatureActive())
return array();
if (array_key_exists($id_product, self::$cachePackItems))
@@ -89,10 +89,10 @@ class PackCore extends Product
public static function isInStock($id_product)
{
if (!self::isFeatureActive())
if (!Pack::isFeatureActive())
return true;
$items = self::getItems((int)$id_product, Configuration::get('PS_LANG_DEFAULT'));
$items = Pack::getItems((int)$id_product, Configuration::get('PS_LANG_DEFAULT'));
foreach ($items as $item)
{
@@ -105,7 +105,7 @@ class PackCore extends Product
public static function getItemTable($id_product, $id_lang, $full = false)
{
if (!self::isFeatureActive())
if (!Pack::isFeatureActive())
return array();
$sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity
@@ -134,7 +134,7 @@ class PackCore extends Product
public static function getPacksTable($id_product, $id_lang, $full = false, $limit = null)
{
if (!self::isFeatureActive())
if (!Pack::isFeatureActive())
return array();
$packs = Db::getInstance()->getValue('
@@ -176,7 +176,7 @@ class PackCore extends Product
{
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 0 WHERE id_product = '.(int)($id_product).' LIMIT 1') &&
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)($id_product)) &&
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', self::isCurrentlyUsed());
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', Pack::isCurrentlyUsed());
}
/**
@@ -240,7 +240,7 @@ class PackCore extends Product
if (!Pack::isPack($id_product))
return false;
$products = self::getItems($id_product, Configuration::get('PS_LANG_DEFAULT'));
$products = Pack::getItems($id_product, Configuration::get('PS_LANG_DEFAULT'));
foreach ($products as $product)
{
// if one product uses the advanced stock management
+3 -3
View File
@@ -483,7 +483,7 @@ abstract class PaymentModuleCore extends Module
* @param Object Address $the_address that needs to be txt formated
* @return String the txt formated address block
*/
private function _getTxtFormatedAddress($the_address)
protected function _getTxtFormatedAddress($the_address)
{
$out = '';
$adr_fields = AddressFormat::getOrderedAddressFields($the_address->id_country, false, true);
@@ -508,7 +508,7 @@ abstract class PaymentModuleCore extends Module
* @return String the txt formated address block
*/
private function _getFormatedAddress(Address $the_address, $line_sep, $fields_style = array())
protected function _getFormatedAddress(Address $the_address, $line_sep, $fields_style = array())
{
return AddressFormat::generateAddress($the_address, array('avoid' => array()), $line_sep, ' ', $fields_style);
}
@@ -517,7 +517,7 @@ abstract class PaymentModuleCore extends Module
* @param int $id_currency : this parameter is optionnal but on 1.5 version of Prestashop, it will be REQUIRED
* @return Currency
*/
public function getCurrency($current_id_currency = NULL)
public function getCurrency($current_id_currency = null)
{
if (!(int)$current_id_currency)
$current_id_currency = Context::getContext()->currency->id;
+13 -13
View File
@@ -461,7 +461,7 @@ class ProductCore extends ObjectModel
public static function getTaxCalculationMethod($id_customer = null)
{
if ($id_customer)
self::initPricesComputation((int)$id_customer);
Product::initPricesComputation((int)$id_customer);
return (int)self::$_taxCalculationMethod;
}
@@ -580,7 +580,7 @@ class ProductCore extends ObjectModel
public static function updateDefaultAttribute($id_product)
{
$id_product_attribute = self::getDefaultAttribute($id_product);
$id_product_attribute = Product::getDefaultAttribute($id_product);
Db::getInstance()->execute(
'UPDATE '._DB_PREFIX_.'product
SET cache_default_attribute = '.(int)$id_product_attribute.'
@@ -1874,7 +1874,7 @@ class ProductCore extends ObjectModel
$context = Context::getContext();
$current_date = date('Y-m-d H:i:s');
$ids_product = self::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context);
$ids_product = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context);
$groups = FrontController::getCurrentCustomerGroups();
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
@@ -1945,7 +1945,7 @@ class ProductCore extends ObjectModel
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way))
die (Tools::displayError());
$current_date = date('Y-m-d H:i:s');
$ids_product = self::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context);
$ids_product = Product::_getProductIdByDate((!$beginning ? $current_date : $beginning), (!$ending ? $current_date : $ending), $context);
$groups = FrontController::getCurrentCustomerGroups();
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
@@ -2671,9 +2671,9 @@ class ProductCore extends ObjectModel
foreach ($products_pack as $product_pack)
{
$tab_product_pack['id_product'] = (int)($product_pack->id);
$tab_product_pack['id_product_attribute'] = self::getDefaultAttribute($tab_product_pack['id_product'], 1);
$tab_product_pack['id_product_attribute'] = Product::getDefaultAttribute($tab_product_pack['id_product'], 1);
$tab_product_pack['cart_quantity'] = (int)($product_pack->pack_quantity * $product['cart_quantity']);
self::updateQuantity($tab_product_pack);
Product::updateQuantity($tab_product_pack);
}
}
@@ -2962,7 +2962,7 @@ class ProductCore extends ObjectModel
*/
public function getFeatures()
{
return self::getFeaturesStatic((int)$this->id);
return Product::getFeaturesStatic((int)$this->id);
}
public static function getFeaturesStatic($id_product)
@@ -3107,7 +3107,7 @@ class ProductCore extends ObjectModel
$return &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_attribute', $row, 'INSERT');
$id_product_attribute_new = (int)Db::getInstance()->Insert_ID();
if ($result_images = self::_getAttributeImageAssociations($id_product_attribute_old))
if ($result_images = Product::_getAttributeImageAssociations($id_product_attribute_old))
{
$combination_images['old'][$id_product_attribute_old] = $result_images;
$combination_images['new'][$id_product_attribute_new] = $result_images;
@@ -3289,7 +3289,7 @@ class ProductCore extends ObjectModel
// If customization is not activated, return success
if (!Customization::isFeatureActive())
return true;
if (($customizations = self::_getCustomizationFieldsNLabels($old_product_id)) === false)
if (($customizations = Product::_getCustomizationFieldsNLabels($old_product_id)) === false)
return false;
if (empty($customizations))
return true;
@@ -3526,7 +3526,7 @@ class ProductCore extends ObjectModel
public function getFrontFeatures($id_lang)
{
return self::getFrontFeaturesStatic($id_lang, $this->id);
return Product::getFrontFeaturesStatic($id_lang, $this->id);
}
public static function getAttachmentsStatic($id_lang, $id_product)
@@ -3541,7 +3541,7 @@ class ProductCore extends ObjectModel
public function getAttachments($id_lang)
{
return self::getAttachmentsStatic($id_lang, $this->id);
return Product::getAttachmentsStatic($id_lang, $this->id);
}
/*
@@ -4066,7 +4066,7 @@ class ProductCore extends ObjectModel
*/
public function getWsDefaultCombination()
{
return self::getDefaultAttribute($this->id);
return Product::getDefaultAttribute($this->id);
}
/**
@@ -4636,7 +4636,7 @@ class ProductCore extends ObjectModel
if (is_null($id_shop))
$id_shop = Context::getContext()->shop->getID(true);
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && self::usesAdvancedStockManagement($id_product) &&
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && Product::usesAdvancedStockManagement($id_product) &&
StockAvailable::dependsOnStock($id_product, $id_shop))
return $manager->getProductRealQuantities($id_product, $id_product_attribute, $id_warehouse, true);
else
+3 -3
View File
@@ -120,7 +120,7 @@ class ProductDownloadCore extends ObjectModel
if (parent::update($nullValues))
{
// Refresh cache of feature detachable because the row can be deactive
Configuration::updateGlobalValue('PS_VIRTUAL_PROD_FEATURE_ACTIVE', self::isCurrentlyUsed($this->def['table'], true));
Configuration::updateGlobalValue('PS_VIRTUAL_PROD_FEATURE_ACTIVE', ProductDownload::isCurrentlyUsed($this->def['table'], true));
return true;
}
return false;
@@ -178,7 +178,7 @@ class ProductDownloadCore extends ObjectModel
*/
public static function getIdFromIdProduct($id_product)
{
if (!self::isFeatureActive())
if (!ProductDownload::isFeatureActive())
return false;
if (array_key_exists($id_product, self::$_productIds))
return self::$_productIds[$id_product];
@@ -200,7 +200,7 @@ class ProductDownloadCore extends ObjectModel
*/
public static function getIdFromIdAttribute($id_product, $id_product_attribute)
{
if (!self::isFeatureActive())
if (!ProductDownload::isFeatureActive())
return false;
if (array_key_exists($id_product_attribute, self::$_productIds))
return self::$_productIds[$id_product];
+1 -1
View File
@@ -179,7 +179,7 @@ class ProductSaleCore
public static function removeProductSale($id_product, $qty = 1)
{
$nbrSales = self::getNbrSales($id_product);
$nbrSales = ProductSale::getNbrSales($id_product);
if ($nbrSales > 1)
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product_sale SET `quantity` = `quantity` - '.(int)($qty).', `sale_nbr` = `sale_nbr` - 1, `date_upd` = NOW() WHERE `id_product` = '.(int)($id_product));
elseif ($nbrSales == 1)
+1 -1
View File
@@ -98,7 +98,7 @@ class ProductSupplierCore extends ObjectModel
if ($res && $this->id_product_attribute == 0)
{
$items = self::getSupplierCollection($this->id_product, false);
$items = ProductSupplier::getSupplierCollection($this->id_product, false);
foreach ($items as $item)
{
if ($item->id_product_attribute > 0)
+1 -1
View File
@@ -100,7 +100,7 @@ class ProfileCore extends ObjectModel
public static function getProfileAccess($id_profile, $id_tab)
{
// getProfileAccesses is cached so there is no performance leak
$accesses = self::getProfileAccesses($id_profile);
$accesses = Profile::getProfileAccesses($id_profile);
return (isset($accesses[$id_tab]) ? $accesses[$id_tab] : false);
}
+4 -4
View File
@@ -80,7 +80,7 @@ class SceneCore extends ObjectModel
if (parent::update($nullValues))
{
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', self::isCurrentlyUsed($this->def['table'], true));
Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', Scene::isCurrentlyUsed($this->def['table'], true));
return true;
}
return false;
@@ -111,7 +111,7 @@ class SceneCore extends ObjectModel
if (parent::delete())
{
return $this->deleteImage() &&
Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', self::isCurrentlyUsed($this->def['table'], true));
Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', Scene::isCurrentlyUsed($this->def['table'], true));
}
return false;
}
@@ -193,7 +193,7 @@ class SceneCore extends ObjectModel
*/
public static function getScenes($id_category, $id_lang = NULL, $onlyActive = true, $liteResult = true, $hideScenePosition = true, Context $context = null)
{
if (!self::isFeatureActive())
if (!Scene::isFeatureActive())
return array();
if (!$context)
@@ -224,7 +224,7 @@ class SceneCore extends ObjectModel
*/
public function getProducts($onlyActive = true, $id_lang = NULL, $liteResult = true, Context $context = null)
{
if (!self::isFeatureActive())
if (!Scene::isFeatureActive())
return array();
if (!$context)
+10 -10
View File
@@ -105,7 +105,7 @@ class SpecificPriceCore extends ObjectModel
self::$_specificPriceCache = array();
Product::flushPriceCache();
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', self::isCurrentlyUsed($this->def['table']));
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table']));
return true;
}
return false;
@@ -156,7 +156,7 @@ class SpecificPriceCore extends ObjectModel
public static function getPriority($id_product)
{
if (!self::isFeatureActive())
if (!SpecificPrice::isFeatureActive())
return explode(';', Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES'));
if (!isset(self::$_cache_priorities[(int)$id_product]))
@@ -180,7 +180,7 @@ class SpecificPriceCore extends ObjectModel
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0)
{
if (!self::isFeatureActive())
if (!SpecificPrice::isFeatureActive())
return array();
/*
** The date is not taken into account for the cache, but this is for the better because it keeps the consistency for the whole script.
@@ -192,7 +192,7 @@ class SpecificPriceCore extends ObjectModel
{
$now = date('Y-m-d H:i:s');
self::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT *, '.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price`
WHERE `id_product` IN (0, '.(int)$id_product.')
AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.')
@@ -247,13 +247,13 @@ class SpecificPriceCore extends ObjectModel
public static function getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_product_attribute = null, $all_combinations = false, $id_customer = 0)
{
if (!self::isFeatureActive())
if (!SpecificPrice::isFeatureActive())
return array();
$now = date('Y-m-d H:i:s');
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *,
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
'.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price`
WHERE
`id_product` IN(0, '.(int)$id_product.') AND
@@ -292,13 +292,13 @@ class SpecificPriceCore extends ObjectModel
public static function getQuantityDiscount($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0)
{
if (!self::isFeatureActive())
if (!SpecificPrice::isFeatureActive())
return array();
$now = date('Y-m-d H:i:s');
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT *,
'.self::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
'.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price`
WHERE
`id_product` IN(0, '.(int)$id_product.') AND
@@ -321,7 +321,7 @@ class SpecificPriceCore extends ObjectModel
public static function getProductIdByDate($id_shop, $id_currency, $id_country, $id_group, $beginning, $ending, $id_customer = 0)
{
if (!self::isFeatureActive())
if (!SpecificPrice::isFeatureActive())
return array();
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
@@ -352,7 +352,7 @@ class SpecificPriceCore extends ObjectModel
if (Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'specific_price` WHERE `id_product` = '.(int)$id_product))
{
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', self::isCurrentlyUsed('specific_price'));
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed('specific_price'));
return true;
}
return false;
+8 -8
View File
@@ -76,12 +76,12 @@ class TabCore extends ObjectModel
*/
public function add($autodate = true, $null_values = false)
{
$this->position = self::getNewLastPosition($this->id_parent);
$this->position = Tab::getNewLastPosition($this->id_parent);
if (parent::add($autodate, $null_values))
{
// refresh cache when adding new tab
self::$_getIdFromClassName[$this->class_name] = $this->id;
return self::initAccess($this->id);
return Tab::initAccess($this->id);
}
return false;
}
@@ -138,7 +138,7 @@ class TabCore extends ObjectModel
*/
public static function getCurrentTabId()
{
return self::getIdFromClassName(Tools::getValue('tab'));
return Tab::getIdFromClassName(Tools::getValue('tab'));
}
/**
@@ -274,7 +274,7 @@ class TabCore extends ObjectModel
*/
public static function enablingForModule($module)
{
$tabs = self::getCollectionFromModule($module);
$tabs = Tab::getCollectionFromModule($module);
if (!empty($tabs)) {
foreach ($tabs as $tab) {
$tab->active = 1;
@@ -293,7 +293,7 @@ class TabCore extends ObjectModel
*/
public static function disablingForModule($module)
{
$tabs = self::getCollectionFromModule($module);
$tabs = Tab::getCollectionFromModule($module);
if (!empty($tabs)) {
foreach ($tabs as $tab) {
$tab->active = 0;
@@ -312,8 +312,8 @@ class TabCore extends ObjectModel
*/
public static function getInstanceFromClassName($class_name)
{
$id_tab = (int)self::getIdFromClassName($class_name);
return new self($id_tab);
$id_tab = (int)Tab::getIdFromClassName($class_name);
return new Tab($id_tab);
}
public static function getNbTabs($id_parent = null)
@@ -342,7 +342,7 @@ class TabCore extends ObjectModel
public function move($direction)
{
$nb_tabs = self::getNbTabs($this->id_parent);
$nb_tabs = Tab::getNbTabs($this->id_parent);
if ($direction != 'l' && $direction != 'r')
return false;
if ($nb_tabs <= 1)
+1 -1
View File
@@ -54,7 +54,7 @@ class TagCore extends ObjectModel
public function __construct($id = null, $name = null, $id_lang = null)
{
$this->def = self::getDefinition($this);
$this->def = Tag::getDefinition($this);
$this->setDefinitionRetrocompatibility();
if ($id)
+63 -63
View File
@@ -54,7 +54,7 @@ class ToolsCore
}
for ($i = 0, $passwd = ''; $i < $length; $i++)
$passwd .= self::substr($str, mt_rand(0, self::strlen($str) - 1), 1);
$passwd .= Tools::substr($str, mt_rand(0, Tools::strlen($str) - 1), 1);
return $passwd;
}
@@ -84,7 +84,7 @@ class ToolsCore
{
$url = substr($url, strlen('index.php?controller='));
if (Configuration::get('PS_REWRITING_SETTINGS'))
$url = self::strReplaceFirst('&', '?' , $url);
$url = Tools::strReplaceFirst('&', '?', $url);
}
$explode = explode('?', $url);
@@ -199,7 +199,7 @@ class ToolsCore
public static function getShopDomain($http = false, $entities = false)
{
if (!$domain = ShopUrl::getMainShopDomain())
$domain = self::getHttpHost();
$domain = Tools::getHttpHost();
if ($entities)
$domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
if ($http)
@@ -217,7 +217,7 @@ class ToolsCore
public static function getShopDomainSsl($http = false, $entities = false)
{
if (!$domain = ShopUrl::getMainShopDomainSSL())
$domain = self::getHttpHost();
$domain = Tools::getHttpHost();
if ($entities)
$domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
if ($http)
@@ -281,7 +281,7 @@ class ToolsCore
*/
public static function getCurrentUrlProtocolPrefix()
{
if(self::usingSecureMode())
if (Tools::usingSecureMode())
return 'https://';
else
return 'http://';
@@ -295,7 +295,7 @@ class ToolsCore
*/
public static function secureReferrer($referrer)
{
if (preg_match('/^http[s]?:\/\/'.self::getServerName().'(:'._PS_SSL_PORT_.')?\/.*$/Ui', $referrer))
if (preg_match('/^http[s]?:\/\/'.Tools::getServerName().'(:'._PS_SSL_PORT_.')?\/.*$/Ui', $referrer))
return $referrer;
return __PS_BASE_URI__;
}
@@ -346,8 +346,8 @@ class ToolsCore
/* Automatically detect language if not already defined */
if (!$cookie->id_lang AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$array = explode(',', self::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
if (self::strlen($array[0]) > 2)
$array = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
if (Tools::strlen($array[0]) > 2)
{
$tab = explode('-', $array[0]);
$string = $tab[0];
@@ -379,7 +379,7 @@ class ToolsCore
{
if (!$context)
$context = Context::getContext();
if ($id_lang = (int)(self::getValue('id_lang')) AND Validate::isUnsignedId($id_lang))
if ($id_lang = (int)Tools::getValue('id_lang') && Validate::isUnsignedId($id_lang))
$context->cookie->id_lang = $id_lang;
$language = new Language($id_lang);
@@ -394,7 +394,7 @@ class ToolsCore
*/
public static function setCurrency($cookie)
{
if (self::isSubmit('SubmitCurrency'))
if (Tools::isSubmit('SubmitCurrency'))
if (isset($_POST['id_currency']) AND is_numeric($_POST['id_currency']))
{
$currency = Currency::getCurrencyInstance((int)($_POST['id_currency']));
@@ -454,7 +454,7 @@ class ToolsCore
$ret = 0;
if (($isNegative = ($price < 0)))
$price *= -1;
$price = self::ps_round($price, $c_decimals);
$price = Tools::ps_round($price, $c_decimals);
switch ($c_format)
{
/* X 0,000.00 */
@@ -487,9 +487,9 @@ class ToolsCore
{
$currency = Currency::getCurrencyInstance((int)($params['currency']));
if (Validate::isLoadedObject($currency))
return self::displayPrice($params['price'], $currency, false);
return Tools::displayPrice($params['price'], $currency, false);
}
return self::displayPrice($params['price']);
return Tools::displayPrice($params['price']);
}
/**
@@ -570,7 +570,7 @@ class ToolsCore
*/
public static function dateFormat($params, &$smarty)
{
return self::displayDate($params['date'], Context::getContext()->language->id, (isset($params['full']) ? $params['full'] : false));
return Tools::displayDate($params['date'], Context::getContext()->language->id, (isset($params['full']) ? $params['full'] : false));
}
/**
@@ -644,7 +644,7 @@ class ToolsCore
if ($file != '.' AND $file != '..')
{
if (is_dir($dirname.$file))
self::deleteDirectory($dirname.$file, true);
Tools::deleteDirectory($dirname.$file, true);
elseif (file_exists($dirname.$file))
unlink($dirname.$file);
}
@@ -714,7 +714,7 @@ class ToolsCore
*/
public static function d($object, $kill = true)
{
return (self::dieObject($object, $kill));
return (Tools::dieObject($object, $kill));
}
/**
@@ -724,7 +724,7 @@ class ToolsCore
*/
public static function p($object)
{
return (self::dieObject($object, false));
return (Tools::dieObject($object, false));
}
/**
@@ -750,10 +750,10 @@ class ToolsCore
{
global $maintenance;
if (!(isset($maintenance) AND (!in_array(self::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))))
if (!(isset($maintenance) && (!in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))))
{
/* Products specifics meta tags */
if ($id_product = self::getValue('id_product'))
if ($id_product = Tools::getValue('id_product'))
{
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
FROM `'._DB_PREFIX_.'product` p
@@ -766,16 +766,16 @@ class ToolsCore
{
if (empty($row['meta_description']))
$row['meta_description'] = strip_tags($row['description_short']);
return self::completeMetaTags($row, $row['name']);
return Tools::completeMetaTags($row, $row['name']);
}
}
/* Categories specifics meta tags */
elseif ($id_category = self::getValue('id_category'))
else if ($id_category = Tools::getValue('id_category'))
{
if (!empty($title))
$title = ' - '.$title;
$page_number = (int)self::getValue('p');
$page_number = (int)Tools::getValue('p');
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
FROM `'._DB_PREFIX_.'category_lang` cl
@@ -794,14 +794,14 @@ class ToolsCore
if (!empty($title))
$row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['name']);
return Tools::completeMetaTags($row, $row['name']);
}
}
/* Manufacturers specifics meta tags */
elseif ($id_manufacturer = self::getValue('id_manufacturer'))
else if ($id_manufacturer = Tools::getValue('id_manufacturer'))
{
$page_number = (int)self::getValue('p');
$page_number = (int)Tools::getValue('p');
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`
FROM `'._DB_PREFIX_.'manufacturer_lang` ml
@@ -813,12 +813,12 @@ class ToolsCore
$row['meta_description'] = strip_tags($row['meta_description']);
$row['meta_title'] .= $row['name'] . (!empty($page_number) ? ' ('.$page_number.')' : '');
$row['meta_title'] .= ' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['meta_title']);
return Tools::completeMetaTags($row, $row['meta_title']);
}
}
/* Suppliers specifics meta tags */
elseif ($id_supplier = self::getValue('id_supplier'))
else if ($id_supplier = Tools::getValue('id_supplier'))
{
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`
@@ -832,12 +832,12 @@ class ToolsCore
$row['meta_description'] = strip_tags($row['meta_description']);
if (!empty($row['meta_title']))
$row['meta_title'] = $row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['name']);
return Tools::completeMetaTags($row, $row['name']);
}
}
/* CMS specifics meta tags */
elseif ($id_cms = self::getValue('id_cms'))
else if ($id_cms = Tools::getValue('id_cms'))
{
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `meta_title`, `meta_description`, `meta_keywords`
@@ -846,12 +846,12 @@ class ToolsCore
if ($row)
{
$row['meta_title'] = $row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['meta_title']);
return Tools::completeMetaTags($row, $row['meta_title']);
}
}
/* CMS category specifics meta tags */
elseif ($id_cms = self::getValue('id_cms_category'))
else if ($id_cms = Tools::getValue('id_cms_category'))
{
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `meta_title`, `meta_description`, `meta_keywords`
@@ -860,13 +860,13 @@ class ToolsCore
if ($row)
{
$row['meta_title'] = $row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['meta_title']);
return Tools::completeMetaTags($row, $row['meta_title']);
}
}
}
/* Default meta tags */
return self::getHomeMetaTags($id_lang, $page_name);
return Tools::getHomeMetaTags($id_lang, $page_name);
}
/**
@@ -920,9 +920,9 @@ class ToolsCore
if (!$context)
$context = Context::getContext();
if ($page === true)
return (self::encrypt($context->customer->id.$context->customer->passwd.$_SERVER['SCRIPT_NAME']));
return (Tools::encrypt($context->customer->id.$context->customer->passwd.$_SERVER['SCRIPT_NAME']));
else
return (self::encrypt($context->customer->id.$context->customer->passwd.$page));
return (Tools::encrypt($context->customer->id.$context->customer->passwd.$page));
}
/**
@@ -932,7 +932,7 @@ class ToolsCore
*/
public static function getAdminToken($string)
{
return !empty($string) ? self::encrypt($string) : false;
return !empty($string) ? Tools::encrypt($string) : false;
}
public static function getAdminTokenLite($tab, Context $context = null)
@@ -993,10 +993,10 @@ class ToolsCore
foreach ($categories AS $category)
{
$fullPath .=
(($n < $nCategories OR $linkOntheLastItem) ? '<a href="'.self::safeOutput($context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'])).'" title="'.htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').'">' : '').
(($n < $nCategories || $linkOntheLastItem) ? '<a href="'.Tools::safeOutput($context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'])).'" title="'.htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').'">' : '').
htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').
(($n < $nCategories OR $linkOntheLastItem) ? '</a>' : '').
(($n++ != $nCategories OR !empty($path)) ? '<span class="navigation-pipe">'.$pipe.'</span>' : '');
(($n < $nCategories || $linkOntheLastItem) ? '</a>' : '').
(($n++ != $nCategories || !empty($path)) ? '<span class="navigation-pipe">'.$pipe.'</span>' : '');
}
return $fullPath.$path;
@@ -1006,15 +1006,15 @@ class ToolsCore
{
$category = new CMSCategory($id_category, $context->language->id);
if (!Validate::isLoadedObject($category))
die(self::displayError());
die(Tools::displayError());
$categoryLink = $context->link->getCMSCategoryLink($category);
if ($path != $category->name)
$fullPath .= '<a href="'.self::safeOutput($categoryLink).'">'.htmlentities($category->name, ENT_NOQUOTES, 'UTF-8').'</a><span class="navigation-pipe">'.$pipe.'</span>'.$path;
$fullPath .= '<a href="'.Tools::safeOutput($categoryLink).'">'.htmlentities($category->name, ENT_NOQUOTES, 'UTF-8').'</a><span class="navigation-pipe">'.$pipe.'</span>'.$path;
else
$fullPath = ($linkOntheLastItem ? '<a href="'.self::safeOutput($categoryLink).'">' : '').htmlentities($path, ENT_NOQUOTES, 'UTF-8').($linkOntheLastItem ? '</a>' : '');
$fullPath = ($linkOntheLastItem ? '<a href="'.Tools::safeOutput($categoryLink).'">' : '').htmlentities($path, ENT_NOQUOTES, 'UTF-8').($linkOntheLastItem ? '</a>' : '');
return self::getPath($category->id_parent, $fullPath, $linkOntheLastItem, $categoryType);
return Tools::getPath($category->id_parent, $fullPath, $linkOntheLastItem, $categoryType);
}
}
@@ -1043,7 +1043,7 @@ class ToolsCore
if ($id_category == $defaultCategory)
return htmlentities($end, ENT_NOQUOTES, 'UTF-8');
return self::getPath($id_category, $category->name, true, $type_cat).'<span class="navigation-pipe">'.$pipe.'</span> <span class="navigation_product">'.htmlentities($end, ENT_NOQUOTES, 'UTF-8').'</span>';
return Tools::getPath($id_category, $category->name, true, $type_cat).'<span class="navigation-pipe">'.$pipe.'</span> <span class="navigation_product">'.htmlentities($end, ENT_NOQUOTES, 'UTF-8').'</span>';
}
/**
@@ -1055,7 +1055,7 @@ class ToolsCore
*/
public static function link_rewrite($str, $utf8_decode = false)
{
return self::str2url($str);
return Tools::str2url($str);
}
/**
@@ -1071,7 +1071,7 @@ class ToolsCore
$str = mb_strtolower($str, 'utf-8');
$str = trim($str);
$str = self::replaceAccentedChars($str);
$str = Tools::replaceAccentedChars($str);
// Remove all non-whitelist chars.
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u','', $str);
@@ -1126,10 +1126,10 @@ class ToolsCore
** For other purposes use the smarty function instead */
public static function truncate($str, $maxLen, $suffix = '...')
{
if (self::strlen($str) <= $maxLen)
if (Tools::strlen($str) <= $maxLen)
return $str;
$str = utf8_decode($str);
return (utf8_encode(substr($str, 0, $maxLen - self::strlen($suffix)).$suffix));
return (utf8_encode(substr($str, 0, $maxLen - Tools::strlen($suffix)).$suffix));
}
/**
@@ -1171,7 +1171,7 @@ class ToolsCore
{
$tab = explode(' ', $date);
if (!isset($tab[1]))
$date .= ' ' . self::hourGenerate(0, 0, 0);
$date .= ' '.Tools::hourGenerate(0, 0, 0);
return $date;
}
@@ -1179,7 +1179,7 @@ class ToolsCore
{
$tab = explode(' ', $date);
if (!isset($tab[1]))
$date .= ' ' . self::hourGenerate(23, 59, 59);
$date .= ' '.Tools::hourGenerate(23, 59, 59);
return $date;
}
@@ -1223,13 +1223,13 @@ class ToolsCore
if (is_array($str))
return false;
if (function_exists('mb_substr'))
return mb_substr($str, (int)($start), ($length === false ? self::strlen($str) : (int)($length)), $encoding);
return substr($str, $start, ($length === false ? self::strlen($str) : (int)($length)));
return mb_substr($str, (int)($start), ($length === false ? Tools::strlen($str) : (int)($length)), $encoding);
return substr($str, $start, ($length === false ? Tools::strlen($str) : (int)($length)));
}
static function ucfirst($str)
{
return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1);
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
}
public static function orderbyPrice(&$array, $orderWay)
@@ -1269,9 +1269,9 @@ class ToolsCore
{
$method = (int)(Configuration::get('PS_PRICE_ROUND_MODE'));
if ($method == PS_ROUND_UP)
return self::ceilf($value, $precision);
return Tools::ceilf($value, $precision);
elseif ($method == PS_ROUND_DOWN)
return self::floorf($value, $precision);
return Tools::floorf($value, $precision);
return round($value, $precision);
}
@@ -1465,12 +1465,12 @@ class ToolsCore
{
global $current_css_file;
$protocol_link = self::getCurrentUrlProtocolPrefix();
$protocol_link = Tools::getCurrentUrlProtocolPrefix();
if (array_key_exists(1, $matches))
{
$tmp = dirname($current_css_file).'/'.$matches[1];
return 'url(\''.$protocol_link.self::getMediaServer($tmp).$tmp.'\')';
return 'url(\''.$protocol_link.Tools::getMediaServer($tmp).$tmp.'\')';
}
return false;
}
@@ -1541,7 +1541,7 @@ class ToolsCore
if (self::$_cache_nb_media_servers AND ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
return constant('_MEDIA_SERVER_'.$id_media_server.'_');
return self::getHttpHost();
return Tools::getHttpHost();
}
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null)
@@ -1773,7 +1773,7 @@ FileETag INode MTime Size
trigger_error($message, E_WARNING);
$class = isset($callee['class']) ? $callee['class'] : null;
self::throwDeprecated($error, $message, $class);
Tools::throwDeprecated($error, $message, $class);
}
public static function displayFileAsDeprecated()
@@ -1784,7 +1784,7 @@ FileETag INode MTime Size
$message = 'The file '.$callee['file'].' is deprecated and will be removed in the next major version.';
$class = isset($callee['class']) ? $callee['class'] : null;
self::throwDeprecated($error, $message, $class);
Tools::throwDeprecated($error, $message, $class);
}
protected static function throwDeprecated($error, $message, $class)
@@ -2073,7 +2073,7 @@ FileETag INode MTime Size
{
$memory_limit = @ini_get('memory_limit');
return self::getOctets($memory_limit);
return Tools::getOctets($memory_limit);
}
/**
@@ -2113,8 +2113,8 @@ FileETag INode MTime Size
*/
public static function getMaxUploadSize($max_size = 0)
{
$post_max_size = self::convertBytes(ini_get('post_max_size'));
$upload_max_filesize = self::convertBytes(ini_get('upload_max_filesize'));
$post_max_size = Tools::convertBytes(ini_get('post_max_size'));
$upload_max_filesize = Tools::convertBytes(ini_get('upload_max_filesize'));
if ($max_size > 0)
$result = min($post_max_size, $upload_max_filesize, $max_size);
else
+11 -11
View File
@@ -120,7 +120,7 @@ class ValidateCore
*/
public static function isOptFloat($float)
{
return empty($float) OR self::isFloat($float);
return empty($float) || Validate::isFloat($float);
}
/**
@@ -394,7 +394,7 @@ class ValidateCore
public static function isPasswdAdmin($passwd)
{
return self::isPasswd($passwd, 8);
return Validate::isPasswd($passwd, 8);
}
/**
@@ -622,12 +622,12 @@ class ValidateCore
*/
public static function isUnsignedId($id)
{
return self::isUnsignedInt($id); /* Because an id could be equal to zero when there is no association */
return Validate::isUnsignedInt($id); /* Because an id could be equal to zero when there is no association */
}
public static function isNullOrUnsignedId($id)
{
return is_null($id) OR self::isUnsignedId($id);
return is_null($id) || Validate::isUnsignedId($id);
}
/**
@@ -671,7 +671,7 @@ class ValidateCore
*/
public static function isUrlOrEmpty($url)
{
return empty($url) || self::isUrl($url);
return empty($url) || Validate::isUrl($url);
}
/**
@@ -906,7 +906,7 @@ class ValidateCore
{
if (sizeof($ids))
foreach($ids as $id)
if ($id == 0 || !self::isUnsignedInt($id))
if ($id == 0 || !Validate::isUnsignedInt($id))
return false;
return true;
}
@@ -920,15 +920,15 @@ class ValidateCore
{
foreach ($zones as $zone)
{
if (!isset($zone['x1']) || !self::isUnsignedInt($zone['x1']))
if (!isset($zone['x1']) || !Validate::isUnsignedInt($zone['x1']))
return false;
if (!isset($zone['y1']) || !self::isUnsignedInt($zone['y1']))
if (!isset($zone['y1']) || !Validate::isUnsignedInt($zone['y1']))
return false;
if (!isset($zone['width']) || !self::isUnsignedInt($zone['width']))
if (!isset($zone['width']) || !Validate::isUnsignedInt($zone['width']))
return false;
if (!isset($zone['height']) || !self::isUnsignedInt($zone['height']))
if (!isset($zone['height']) || !Validate::isUnsignedInt($zone['height']))
return false;
if (!isset($zone['id_product']) || !self::isUnsignedInt($zone['id_product']))
if (!isset($zone['id_product']) || !Validate::isUnsignedInt($zone['id_product']))
return false;
}
return true;
+1 -1
View File
@@ -138,7 +138,7 @@ class CacheFsCore extends Cache
if (mkdir($new_dir))
if (chmod($new_dir, 0777))
if ($level_depth - 1 > 0)
self::createCacheDirectories($level_depth - 1, $new_dir);
CacheFs::createCacheDirectories($level_depth - 1, $new_dir);
}
}
+1 -1
View File
@@ -67,7 +67,7 @@ class CacheMemcacheCore extends Cache
public function connect()
{
$this->memcache = new Memcache();
$servers = self::getMemcachedServers();
$servers = CacheMemcache::getMemcachedServers();
if (!$servers)
return false;
foreach ($servers AS $server)
+1 -1
View File
@@ -1041,7 +1041,7 @@ class OrderCore extends ObjectModel
if ($order_invoice->number)
Configuration::updateValue('PS_INVOICE_START_NUMBER', false);
else
$order_invoice->number = self::getLastInvoiceNumber() + 1;
$order_invoice->number = Order::getLastInvoiceNumber() + 1;
$order_invoice->total_discount_tax_excl = $this->total_discounts_tax_excl;
$order_invoice->total_discount_tax_incl = $this->total_discounts_tax_incl;
+3 -3
View File
@@ -86,10 +86,10 @@ class OrderReturnCore extends ObjectModel
die(Tools::displayError());
$products = $order->getProducts();
/* Products already returned */
$order_return = self::getOrdersReturn($order->id_customer, $order->id, true);
$order_return = OrderReturn::getOrdersReturn($order->id_customer, $order->id, true);
foreach ($order_return AS $or)
{
$order_return_products = self::getOrdersReturnProducts($or['id_order_return'], $order);
$order_return_products = OrderReturn::getOrdersReturnProducts($or['id_order_return'], $order);
foreach ($order_return_products AS $key => $orp)
$products[$key]['product_quantity'] -= (int)($orp['product_quantity']);
}
@@ -159,7 +159,7 @@ class OrderReturnCore extends ObjectModel
public static function getOrdersReturnProducts($orderReturnId, $order)
{
$productsRet = self::getOrdersReturnDetail($orderReturnId);
$productsRet = OrderReturn::getOrdersReturnDetail($orderReturnId);
$products = $order->getProducts();
$tmp = array();
foreach ($productsRet AS $return_detail)
+1 -1
View File
@@ -108,7 +108,7 @@ class OrderSlipCore extends ObjectModel
public static function getOrdersSlipProducts($orderSlipId, $order)
{
$cart_rules = $order->getCartRules(true);
$productsRet = self::getOrdersSlipDetail($orderSlipId);
$productsRet = OrderSlip::getOrdersSlipDetail($orderSlipId);
$products = $order->getProductsDetail();
$tmp = array();
+1 -1
View File
@@ -40,7 +40,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate
// header informations
$this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
$this->title = self::l('Delivery').' #'.Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id).sprintf('%06d', $this->order_invoice->delivery_number);
$this->title = HTMLTemplateDeliverySlip::l('Delivery').' #'.Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id).sprintf('%06d', $this->order_invoice->delivery_number);
// footer informations
$this->shop = new Shop((int)$this->order->id_shop);
+1 -1
View File
@@ -42,7 +42,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
// header informations
$this->date = Tools::displayDate($order_invoice->date_add, (int)$this->order->id_lang);
$this->title = self::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).sprintf('%06d', $order_invoice->number);
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).sprintf('%06d', $order_invoice->number);
// footer informations
$this->shop = new Shop((int)$this->order->id_shop);
+1 -1
View File
@@ -47,7 +47,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
// header informations
$this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
$this->title = self::l('Slip #').sprintf('%06d', $this->order_slip->id);
$this->title = HTMLTemplateOrderSlip::l('Slip #').sprintf('%06d', $this->order_slip->id);
// footer informations
$this->shop = new Shop((int)$this->order->id_shop);
+4 -4
View File
@@ -47,7 +47,7 @@ class HTMLTemplateSupplyOrderFormCore extends HTMLTemplate
// header informations
$this->date = Tools::displayDate($supply_order->date_add, (int)$this->supply_order->id_lang);
$this->title = self::l('Supply order form').sprintf(' %s', $supply_order->reference);
$this->title = HTMLTemplateSupplyOrderForm::l('Supply order form').sprintf(' %s', $supply_order->reference);
}
/**
@@ -88,7 +88,7 @@ class HTMLTemplateSupplyOrderFormCore extends HTMLTemplate
*/
public function getFilename()
{
return (self::l('SupplyOrderForm').sprintf('_%s', $this->supply_order->reference).'.pdf');
return (HTMLTemplateSupplyOrderForm::l('SupplyOrderForm').sprintf('_%s', $this->supply_order->reference).'.pdf');
}
protected function getTaxOrderSummary()
@@ -121,8 +121,8 @@ class HTMLTemplateSupplyOrderFormCore extends HTMLTemplate
public function getFooter()
{
$this->address = $this->address_warehouse;
$free_text = self::l('DE: Discount excluded ');
$free_text .= self::l(' DI: Discount included');
$free_text = HTMLTemplateSupplyOrderForm::l('DE: Discount excluded ');
$free_text .= HTMLTemplateSupplyOrderForm::l(' DI: Discount included');
$this->smarty->assign(array(
'shop_address' => $this->getShopAddress(),
+3 -3
View File
@@ -154,7 +154,7 @@ class ShopCore extends ObjectModel
public function delete()
{
if (self::has_dependency($this->id) || !$res = parent::delete())
if (Shop::has_dependency($this->id) || !$res = parent::delete())
return false;
foreach (Shop::getAssoTables() as $table_name => $row)
@@ -494,7 +494,7 @@ class ShopCore extends ObjectModel
'name' => $row['group_name'],
'share_customer' => $row['share_customer'],
'share_order' => $row['share_order'],
'totalShops' => self::getTotalShopsByIdGroupShop($row['id_group_shop']),
'totalShops' => Shop::getTotalShopsByIdGroupShop($row['id_group_shop']),
'shops' => array(),
);
@@ -896,7 +896,7 @@ class ShopCore extends ObjectModel
public static function getShopWithoutUrls($id_shop = false)
{
$without = array();
$shops = self::getShops();
$shops = Shop::getShops();
foreach ($shops as $shop)
if ((!$id_shop || $shop['id_shop'] == $id_shop) && empty($shop['domain']) && empty($shop['uri']))
$without[] = $shop;
+2 -2
View File
@@ -168,9 +168,9 @@ class StockAvailableCore extends ObjectModel
// In case there are no warehouses, removes product from StockAvailable
if (count($ids_warehouse) == 0)
{
self::removeProductFromStockAvailable($id_product);
StockAvailable::removeProductFromStockAvailable($id_product);
foreach ($ids_product_attribute as $id_product_attribute)
self::removeProductFromStockAvailable($id_product, $id_product_attribute);
StockAvailable::removeProductFromStockAvailable($id_product, $id_product_attribute);
}
}
+6 -6
View File
@@ -281,20 +281,20 @@ class SupplyOrderDetailCore extends ObjectModel
foreach ($fields_required as $field)
if (($value = $this->{$field}) == false && (string)$value != '0')
if (!$this->id || $field != 'passwd')
$errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities)
$errors[] = '<b>'.SupplyOrderDetail::displayFieldName($field, get_class($this), $htmlentities)
.'</b> '.Tools::displayError('is required.');
/* Checks maximum fields sizes */
foreach ($this->fieldsSize as $field => $max_length)
if ($value = $this->{$field} && Tools::strlen($value) > $max_length)
$errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities)
$errors[] = '<b>'.SupplyOrderDetail::displayFieldName($field, get_class($this), $htmlentities)
.'</b> '.Tools::displayError('is too long.').' ('.Tools::displayError('Maximum length:').' '.$max_length.')';
/* Checks fields validity */
foreach ($this->fieldsValidate as $field => $function)
if ($value = $this->{$field})
if (!Validate::$function($value) && (!empty($value) || in_array($field, $this->fieldsRequired)))
$errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.');
$errors[] = '<b>'.SupplyOrderDetail::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.');
else
if ($field == 'passwd')
if ($value = Tools::getValue($field))
@@ -303,13 +303,13 @@ class SupplyOrderDetailCore extends ObjectModel
$this->{$field} = $value;
if ($this->quantity_expected <= 0)
$errors[] = '<b>'.self::displayFieldName('quantity_expected', get_class($this)).'</b> '.Tools::displayError('is invalid.');
$errors[] = '<b>'.SupplyOrderDetail::displayFieldName('quantity_expected', get_class($this)).'</b> '.Tools::displayError('is invalid.');
if ($this->tax_rate < 0 || $this->tax_rate > 100)
$errors[] = '<b>'.self::displayFieldName('tax_rate', get_class($this)).'</b> '.Tools::displayError('is invalid.');
$errors[] = '<b>'.SupplyOrderDetail::displayFieldName('tax_rate', get_class($this)).'</b> '.Tools::displayError('is invalid.');
if ($this->discount_rate < 0 || $this->discount_rate > 100)
$errors[] = '<b>'.self::displayFieldName('discount_rate', get_class($this)).'</b> '.Tools::displayError('is invalid.');
$errors[] = '<b>'.SupplyOrderDetail::displayFieldName('discount_rate', get_class($this)).'</b> '.Tools::displayError('is invalid.');
return $errors;
}
+1 -1
View File
@@ -312,7 +312,7 @@ class WarehouseCore extends ObjectModel
// if it's a pack, returns warehouses if and only if some products use the advanced stock management
if (Pack::isPack($id_product))
{
$warehouses = self::getPackWarehouses($id_product);
$warehouses = Warehouse::getPackWarehouses($id_product);
$res = array();
foreach ($warehouses as $warehouse)
$res[]['id_warehouse'] = $warehouse;