// FO : more optimizations with unnecessary instantiations

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14160 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2012-03-14 14:51:49 +00:00
parent 014193f2c2
commit 0e7c1835e0
2 changed files with 11 additions and 10 deletions
+8 -5
View File
@@ -376,12 +376,15 @@ class ToolsCore
{
if (!$context)
$context = Context::getContext();
if (($id_lang = (int)Tools::getValue('id_lang')) && Validate::isUnsignedId($id_lang))
$context->cookie->id_lang = $id_lang;
$language = new Language($id_lang);
if (Validate::isLoadedObject($language))
$context->language = $language;
// update language only if new id is different from old id
if (($id_lang = (int)Tools::getValue('id_lang')) && Validate::isUnsignedId($id_lang) && $context->cookie->id_lang != (int)$id_lang)
{
$context->cookie->id_lang = $id_lang;
$language = new Language($id_lang);
if (Validate::isLoadedObject($language))
$context->language = $language;
}
}
/**