[+] Dispatcher
This commit is contained in:
@@ -92,7 +92,7 @@ class FrontControllerCore
|
||||
$link = new Link();
|
||||
|
||||
if ($this->auth AND !$cookie->isLogged($this->guestAllowed))
|
||||
Tools::redirect('authentication.php'.($this->authRedirection ? '?back='.$this->authRedirection : ''));
|
||||
Tools::redirect('index.php/authentication'.($this->authRedirection ? '?back='.$this->authRedirection : ''));
|
||||
|
||||
/* Theme is missing or maintenance */
|
||||
if (!is_dir(_PS_THEME_DIR_))
|
||||
|
||||
+35
-34
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -43,17 +43,17 @@ class LinkCore
|
||||
|
||||
/**
|
||||
* This function returns a link to delete a customization picture file
|
||||
*
|
||||
* @param mixed $product
|
||||
* @param mixed $id_picture
|
||||
*
|
||||
* @param mixed $product
|
||||
* @param mixed $id_picture
|
||||
* @return void
|
||||
*/
|
||||
public function getProductDeletePictureLink($product, $id_picture){
|
||||
if (is_object($product))
|
||||
return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink().((isset($product->category) AND !empty($product->category) AND $product->category != 'home') ? $product->category.'/' : '').(int)$product->id.'-'.$product->link_rewrite.($product->ean13 ? '-'.$product->ean13 : '').'.html?deletePicture='.$id_picture) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$product->id).'&deletePicture='.$id_picture;
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=product&id_product='.(int)$product->id).'&deletePicture='.$id_picture;
|
||||
else
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$product.'&deletePicture='.$id_picture;
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=product&id_product='.(int)$product.'&deletePicture='.$id_picture;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,73 +67,73 @@ class LinkCore
|
||||
{
|
||||
if (is_object($id_product))
|
||||
return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).((isset($id_product->category) AND !empty($id_product->category) AND $id_product->category != 'home') ? $id_product->category.'/' : '').(int)$id_product->id.'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product->id);
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=product&id_product='.(int)$id_product->id);
|
||||
elseif ($alias)
|
||||
return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)$id_lang).(($category AND $category != 'home') ? ($category.'/') : '').(int)$id_product.'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product);
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=product&id_product='.(int)$id_product);
|
||||
else
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'product.php?id_product='.(int)$id_product;
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=product&id_product='.(int)$id_product;
|
||||
}
|
||||
|
||||
public function getCategoryLink($id_category, $alias = NULL, $id_lang = NULL)
|
||||
{
|
||||
if (is_object($id_category))
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_category->id).'-'.$id_category->link_rewrite) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'category.php?id_category='.(int)($id_category->id));
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=category&id_category='.(int)($id_category->id));
|
||||
if ($alias)
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_category).'-'.$alias) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'category.php?id_category='.(int)($id_category));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'category.php?id_category='.(int)($id_category);
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=category&id_category='.(int)($id_category));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=category&id_category='.(int)($id_category);
|
||||
}
|
||||
|
||||
public function getCMSCategoryLink($id_category, $alias = NULL, $id_lang = NULL)
|
||||
{
|
||||
if (is_object($id_category))
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).'content/category/'.(int)($id_category->id).'-'.$id_category->link_rewrite) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'cms.php?id_cms_category='.(int)($id_category->id));
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=cms&id_cms_category='.(int)($id_category->id));
|
||||
if ($alias)
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).'content/category/'.(int)($id_category).'-'.$alias) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'cms.php?id_cms_category='.(int)($id_category));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'cms.php?id_cms_category='.(int)($id_category);
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=cms&id_cms_category='.(int)($id_category));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=cms&id_cms_category='.(int)($id_category);
|
||||
}
|
||||
|
||||
public function getCMSLink($cms, $alias = null, $ssl = false, $id_lang = NULL)
|
||||
{
|
||||
$base = (($ssl AND Configuration::get('PS_SSL_ENABLED')) ? Tools::getShopDomainSsl(true) : Tools::getShopDomain(true));
|
||||
|
||||
|
||||
if (is_object($cms))
|
||||
{
|
||||
return ($this->allow == 1) ?
|
||||
return ($this->allow == 1) ?
|
||||
($base.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).'content/'.(int)($cms->id).'-'.$cms->link_rewrite) :
|
||||
($base.__PS_BASE_URI__.'cms.php?id_cms='.(int)($cms->id));
|
||||
($base.__PS_BASE_URI__.'index.php?controller=cms&id_cms='.(int)($cms->id));
|
||||
}
|
||||
|
||||
|
||||
if ($alias)
|
||||
return ($this->allow == 1) ? ($base.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).'content/'.(int)($cms).'-'.$alias) :
|
||||
($base.__PS_BASE_URI__.'cms.php?id_cms='.(int)($cms));
|
||||
return $base.__PS_BASE_URI__.'cms.php?id_cms='.(int)($cms);
|
||||
($base.__PS_BASE_URI__.'index.php?controller=cms&id_cms='.(int)($cms));
|
||||
return $base.__PS_BASE_URI__.'index.php?controller=cms&id_cms='.(int)($cms);
|
||||
}
|
||||
|
||||
public function getSupplierLink($id_supplier, $alias = NULL, $id_lang = NULL)
|
||||
{
|
||||
if (is_object($id_supplier))
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_supplier->id).'__'.$id_supplier->link_rewrite) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'supplier.php?id_supplier='.(int)($id_supplier->id));
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=supplier&id_supplier='.(int)($id_supplier->id));
|
||||
if ($alias)
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_supplier).'__'.$alias) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'supplier.php?id_supplier='.(int)($id_supplier));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'supplier.php?id_supplier='.(int)($id_supplier);
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=supplier&id_supplier='.(int)($id_supplier));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=supplier&id_supplier='.(int)($id_supplier);
|
||||
}
|
||||
|
||||
public function getManufacturerLink($id_manufacturer, $alias = NULL, $id_lang = NULL)
|
||||
{
|
||||
if (is_object($id_manufacturer))
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_manufacturer->id).'_'.$id_manufacturer->link_rewrite) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer->id));
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=manufacturer&id_manufacturer='.(int)($id_manufacturer->id));
|
||||
if ($alias)
|
||||
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_manufacturer).'_'.$alias) :
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer);
|
||||
(_PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=manufacturer&id_manufacturer='.(int)($id_manufacturer));
|
||||
return _PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=manufacturer&id_manufacturer='.(int)($id_manufacturer);
|
||||
}
|
||||
|
||||
public function getImageLink($name, $ids, $type = NULL)
|
||||
@@ -145,7 +145,7 @@ class LinkCore
|
||||
$uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').'.jpg';
|
||||
return $protocol_content.Tools::getMediaServer($uri_path).$uri_path;
|
||||
}
|
||||
|
||||
|
||||
public function getMediaLink($filepath)
|
||||
{
|
||||
return Tools::getProtocol().Tools::getMediaServer($filepath).$filepath;
|
||||
@@ -165,7 +165,7 @@ class LinkCore
|
||||
foreach ($result as $row)
|
||||
self::$cache['page'][$row['page'].'.php_'.$cookie->id_lang] = $this->getLangLink((int)$cookie->id_lang).$row['url_rewrite'];
|
||||
}
|
||||
|
||||
|
||||
public function getPageLink($filename, $ssl = false, $id_lang = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
@@ -196,7 +196,7 @@ class LinkCore
|
||||
{
|
||||
$uri_path = '';
|
||||
if ($filename != 'index.php')
|
||||
$uri_path = $filename;
|
||||
$uri_path = 'index.php?controller='.$filename;
|
||||
}
|
||||
self::$cache['page'][$filename.'_'.$id_lang] = $uri_path;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ class LinkCore
|
||||
parse_str($_SERVER['QUERY_STRING'], $queryTab);
|
||||
unset($queryTab['isolang']);
|
||||
$query = http_build_query($queryTab);
|
||||
|
||||
|
||||
if (!empty($query) OR !$this->allow)
|
||||
$query = '?'.$query;
|
||||
|
||||
@@ -292,16 +292,17 @@ class LinkCore
|
||||
{
|
||||
return $url.(!strstr($url, '?') ? '?' : '&').'orderby='.urlencode($orderby).'&orderway='.urlencode($orderway);
|
||||
}
|
||||
|
||||
|
||||
protected function getLangLink($id_lang = NULL)
|
||||
{
|
||||
if (!$this->allow OR Language::countActiveLanguages() <= 1)
|
||||
return '';
|
||||
|
||||
|
||||
global $cookie;
|
||||
if (!$id_lang)
|
||||
$id_lang = (int)$cookie->id_lang;
|
||||
|
||||
|
||||
return Language::getIsoById((int)$id_lang).'/';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+48
-26
@@ -398,47 +398,68 @@ class OrderCore extends ObjectModel
|
||||
return $result['message'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add breakdown prices in an order detail row
|
||||
*
|
||||
* @param array &$row
|
||||
*/
|
||||
public function setProductPrices(&$row)
|
||||
{
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = Tools::ps_round($row['product_price'], 2);
|
||||
$row = $this->setProductPricesTaxExcl($row);
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price'] * (1 + $row['tax_rate'] / 100), 2);
|
||||
$row = $this->setProductPricesTaxIncl($row);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute tax excl prices for an order detail
|
||||
*
|
||||
* @param array $row
|
||||
*/
|
||||
protected function getProductsPricesTaxExcl($row)
|
||||
{
|
||||
$row['product_price'] = Tools::ps_round($row['product_price'], 2);
|
||||
|
||||
if ($row['reduction_percent'])
|
||||
{
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = $row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01);
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['product_price_wt'] * ($row['reduction_percent'] * 0.01), 2);
|
||||
}
|
||||
|
||||
if ($row['reduction_amount'])
|
||||
{
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = $row['product_price'] - $row['reduction_amount'] / (1 + $row['tax_rate'] / 100);
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['reduction_amount'], 2);
|
||||
}
|
||||
|
||||
if ($row['group_reduction'])
|
||||
{
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = $row['product_price'] - $row['product_price'] * ($row['group_reduction'] * 0.01);
|
||||
else
|
||||
|
||||
$row['product_price'] = Tools::ps_round($row['product_price'], 2); // rounding in case of reduction
|
||||
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price'] * (1 + ($row['tax_rate'] * 0.01)), 2) + Tools::ps_round($row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100), 2);
|
||||
|
||||
$row['total_wt'] = $row['product_quantity'] * $row['product_price_wt'];
|
||||
$row['total_price'] = $row['product_quantity'] * $row['product_price'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute tax incl prices for an order detail
|
||||
*
|
||||
* @param array $row
|
||||
*/
|
||||
protected function getProductsPricesTaxIncl($row)
|
||||
{
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price'] * (1 + $row['tax_rate'] / 100), 2);
|
||||
|
||||
if ($row['reduction_percent'])
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['product_price_wt'] * ($row['reduction_percent'] * 0.01), 2);
|
||||
|
||||
if ($row['reduction_amount'])
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['reduction_amount'], 2);
|
||||
|
||||
if ($row['group_reduction'])
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] - $row['product_price_wt'] * ($row['group_reduction'] * 0.01), 2);
|
||||
}
|
||||
|
||||
if (($row['reduction_percent'] OR $row['reduction_amount'] OR $row['group_reduction']) AND $this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price'] = Tools::ps_round($row['product_price'], 2);
|
||||
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price'] * (1 + ($row['tax_rate'] * 0.01)), 2) + Tools::ps_round($row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100), 2);
|
||||
else
|
||||
{
|
||||
$row['product_price_wt_but_ecotax'] = $row['product_price_wt'];
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] + $row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100), 2);
|
||||
}
|
||||
$row['product_price_wt_but_ecotax'] = $row['product_price_wt'];
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] + $row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100), 2);
|
||||
|
||||
$row['total_wt'] = $row['product_quantity'] * $row['product_price_wt'];
|
||||
$row['total_price'] = $row['product_quantity'] * $row['product_price'];
|
||||
@@ -980,3 +1001,4 @@ class OrderCore extends ObjectModel
|
||||
WHERE `id_order` = '.(int)($this->id)) !== false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -47,10 +47,11 @@ class SubDomainCore extends ObjectModel
|
||||
{
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `name` FROM `'._DB_PREFIX_.'subdomain`'))
|
||||
return false;
|
||||
$subDomains = array();
|
||||
|
||||
$sub_domains = array();
|
||||
foreach ($result AS $row)
|
||||
$subDomains[] = $row['name'];
|
||||
return $subDomains;
|
||||
$sub_domains[] = $row['name'];
|
||||
return $sub_domains;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+40
-23
@@ -58,6 +58,9 @@ class ToolsCore
|
||||
global $link;
|
||||
if (strpos($url, $baseUri) !== FALSE && strpos($url, $baseUri) == 0)
|
||||
$url = substr($url, strlen($baseUri));
|
||||
if (strpos($url, 'index.php/') !== FALSE && strpos($url, 'index.php/') == 0)
|
||||
$url = substr($url, strlen('index.php/'));
|
||||
|
||||
$explode = explode('?', $url);
|
||||
$url = $link->getPageLink($explode[0], true);
|
||||
if (isset($explode[1]))
|
||||
@@ -84,6 +87,8 @@ class ToolsCore
|
||||
global $link;
|
||||
if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0)
|
||||
$url = substr($url, strlen(__PS_BASE_URI__));
|
||||
if (strpos($url, 'index.php/') !== FALSE && strpos($url, 'index.php/') == 0)
|
||||
$url = substr($url, strlen('index.php/'));
|
||||
$explode = explode('?', $url);
|
||||
$url = $link->getPageLink($explode[0]);
|
||||
if (isset($explode[1]))
|
||||
@@ -1302,7 +1307,7 @@ class ToolsCore
|
||||
Tools::addCSS($file, $media_type);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//overriding of modules css files
|
||||
$different = 0;
|
||||
$override_path = str_replace(__PS_BASE_URI__.'modules/', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different);
|
||||
@@ -1411,7 +1416,7 @@ class ToolsCore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Combine Compress and Cache (ccc) JS calls
|
||||
*/
|
||||
@@ -1429,17 +1434,17 @@ class ToolsCore
|
||||
foreach ($js_files as $filename)
|
||||
{
|
||||
$expr = explode(':', $filename);
|
||||
|
||||
|
||||
if ($expr[0] == 'http')
|
||||
$js_external_files[] = $filename;
|
||||
else
|
||||
$js_external_files[] = $filename;
|
||||
else
|
||||
{
|
||||
$infos = array();
|
||||
$infos['uri'] = $filename;
|
||||
$url_data = parse_url($filename);
|
||||
$infos['path'] =_PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, '/', $url_data['path']);
|
||||
$js_files_infos[] = $infos;
|
||||
|
||||
|
||||
$js_files_date = max(
|
||||
file_exists($infos['path']) ? filemtime($infos['path']) : 0,
|
||||
$js_files_date
|
||||
@@ -1479,7 +1484,7 @@ class ToolsCore
|
||||
// rebuild the original js_files array
|
||||
$url = str_replace(_PS_ROOT_DIR_.'/', __PS_BASE_URI__, $compressed_js_path);
|
||||
$js_files = array_merge(array($protocol_link.Tools::getMediaServer($url).$url), $js_external_files);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function getMediaServer($filename)
|
||||
@@ -1711,31 +1716,43 @@ FileETag INode MTime Size
|
||||
*/
|
||||
public static function displayAsDeprecated()
|
||||
{
|
||||
if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
|
||||
{
|
||||
$backtrace = debug_backtrace();
|
||||
$callee = next($backtrace);
|
||||
trigger_error('Function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['line'].'</strong><br />', E_USER_WARNING);
|
||||
$backtrace = debug_backtrace();
|
||||
$callee = next($backtrace);
|
||||
$error = 'Function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['line'].'</strong><br />';
|
||||
$message = Tools::displayError('The function').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
|
||||
|
||||
$message = Tools::displayError('The function').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
|
||||
|
||||
Logger::addLog($message, 3, $callee['class']);
|
||||
}
|
||||
self::throwDeprecated($error, $message, $callee['class']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a warning message indicating that the parameter is deprecated
|
||||
*/
|
||||
public static function displayParameterAsDeprecated($parameter)
|
||||
{
|
||||
$backtrace = debug_backtrace();
|
||||
$callee = next($backtrace);
|
||||
$error = 'Parameter <strong>'.$parameter.'</strong> in function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['Line'].'</strong><br />';
|
||||
$message = Tools::displayError('The parameter').' '.$parameter.' '.Tools::displayError(' in function ').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['Line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
|
||||
|
||||
self::throwDeprecated($error, $message, $callee['class']);
|
||||
}
|
||||
|
||||
public static function displayFileAsDeprecated()
|
||||
{
|
||||
$backtrace = debug_backtrace();
|
||||
$callee = current($backtrace);
|
||||
$error = 'File <strong>'.$callee['file'].'</strong> is deprecated<br />';
|
||||
$message = Tools::displayError('The file').' '.$callee['file'].' '.Tools::displayError('is deprecated and will be removed in the next major version.');
|
||||
|
||||
self::throwDeprecated($error, $message, $callee['class']);
|
||||
}
|
||||
|
||||
protected static function throwDeprecated($error, $message, $class)
|
||||
{
|
||||
if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
|
||||
{
|
||||
$backtrace = debug_backtrace();
|
||||
$callee = next($backtrace);
|
||||
trigger_error('Parameter <strong>'.$parameter.'</strong> in function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['Line'].'</strong><br />', E_USER_WARNING);
|
||||
|
||||
$message = Tools::displayError('The parameter').' '.$parameter.' '.Tools::displayError(' in function ').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['Line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
|
||||
Logger::addLog($message, 3, $callee['class']);
|
||||
trigger_error($error, E_USER_WARNING);
|
||||
Logger::addLog($message, 3, $class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1776,7 +1793,7 @@ FileETag INode MTime Size
|
||||
$s = str_replace($char, '\\'.$char, $s);
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
public static function str_replace_once($needle , $replace , $haystack)
|
||||
{
|
||||
$pos = strpos($haystack, $needle);
|
||||
|
||||
Reference in New Issue
Block a user