diff --git a/classes/AdminController.php b/classes/AdminController.php
index f116d6748..ea633297a 100644
--- a/classes/AdminController.php
+++ b/classes/AdminController.php
@@ -79,6 +79,8 @@ class AdminControllerCore extends Controller
public $tpl_option_vars = array();
public $tpl_view_vars = array();
+ public $base_tpl_view = null;
+
/** @var bool if you want more fieldsets in the form */
public $multiple_fieldsets = false;
@@ -1376,6 +1378,7 @@ class AdminControllerCore extends Controller
$helper = new HelperView($this);
$this->setHelperDisplay($helper);
$helper->tpl_vars = $this->tpl_view_vars;
+ !is_null($this->base_tpl_view) ? $helper->base_tpl = $this->base_tpl_view : '';
$view = $helper->generateView();
$this->toolbar_fix = false;
diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php
index 5af06bbaa..6e0e968c4 100644
--- a/controllers/admin/AdminTranslationsController.php
+++ b/controllers/admin/AdminTranslationsController.php
@@ -113,7 +113,8 @@ class AdminTranslationsControllerCore extends AdminController
);
$this->toolbar_fix = false;
- return parent::initView('main.tpl');
+ $this->base_tpl_view = 'main.tpl';
+ return parent::initView();
}
/**
@@ -402,7 +403,7 @@ class AdminTranslationsControllerCore extends AdminController
}
}
}
- if (isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) AND $str_write != " $file)
{
- if ($file{0} === '.' || in_array(substr($file, 0, strrpos($file,'.')), $this->all_iso_lang))
+ if ($file{0} === '.' || in_array(substr($file, 0, strrpos($file, '.')), $this->all_iso_lang))
unset($files[$key]);
- else if ($type_clear === 'file' && !in_array(substr($file, strrpos($file,'.')), $arr_good_ext))
+ else if ($type_clear === 'file' && !in_array(substr($file, strrpos($file, '.')), $arr_good_ext))
unset($files[$key]);
else if ($type_clear === 'directory' && (!is_dir($path.$file) || in_array($file, $arr_exclude)))
unset($files[$key]);
@@ -465,7 +466,8 @@ class AdminTranslationsControllerCore extends AdminController
foreach ($matches[1] as $key)
{
- $module_key = ($is_default ? self::DEFAULT_THEME_NAME : '').'<{'.Tools::strtolower($module_name).'}'.strtolower($is_default ? 'prestashop' : $theme_name).'>'.Tools::strtolower($template_name).'_'.md5($key);
+ $module_key = ($is_default ? self::DEFAULT_THEME_NAME : '').'<{'.Tools::strtolower($module_name).'}'.
+ strtolower($is_default ? 'prestashop' : $theme_name).'>'.Tools::strtolower($template_name).'_'.md5($key);
// to avoid duplicate entry
if (!in_array($module_key, $array_check_duplicate))
{
@@ -576,9 +578,7 @@ class AdminTranslationsControllerCore extends AdminController
else if (Tools::isSubmit('submitTranslationsMails') || Tools::isSubmit('submitTranslationsMailsAndStay'))
{
if ($this->tabAccess['edit'] === '1' && ($id_lang = Language::getIdByIso(Tools::getValue('lang'))) > 0)
- {
$this->submitTranslationsMails($id_lang);
- }
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
@@ -608,7 +608,7 @@ class AdminTranslationsControllerCore extends AdminController
$arr_find_and_write = array_merge($arr_find_and_write, $arr_files);
}
- foreach ($arr_find_and_write as $key=>$value)
+ foreach ($arr_find_and_write as $key => $value)
$this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir']);
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
@@ -640,36 +640,40 @@ class AdminTranslationsControllerCore extends AdminController
*
* @param int $id_lang
*/
- protected function submitTranslationsMails ($id_lang)
+ protected function submitTranslationsMails($id_lang)
{
$obj_lang = new Language($id_lang);
$params_redirect = (Tools::isSubmit('submitTranslationsMailsAndStay') ? '&lang='.Tools::getValue('lang').'&type='.Tools::getValue('type') : '');
$arr_mail_content = array();
$arr_mail_path = array();
- if (Tools::getValue('core_mail')) {
+ if (Tools::getValue('core_mail'))
+ {
$arr_mail_content['core_mail'] = Tools::getValue('core_mail');
$arr_mail_path['core_mail'] = _PS_MAIL_DIR_.$obj_lang->iso_code.'/';
}
- if (Tools::getValue('module_mail')) {
+ if (Tools::getValue('module_mail'))
+ {
$arr_mail_content['module_mail'] = Tools::getValue('module_mail');
$arr_mail_path['module_mail'] = _PS_MODULE_DIR_.'{module}'.'/mails/'.$obj_lang->iso_code.'/';
}
- if (Tools::getValue('theme_mail')) {
+ if (Tools::getValue('theme_mail'))
+ {
$arr_mail_content['theme_mail'] = Tools::getValue('theme_mail');
$arr_mail_path['theme_mail'] = _PS_THEME_DIR_.'mails/'.$obj_lang->iso_code.'/';
}
- if (Tools::getValue('theme_module_mail')) {
+ if (Tools::getValue('theme_module_mail'))
+ {
$arr_mail_content['theme_module_mail'] = Tools::getValue('theme_module_mail');
$arr_mail_path['theme_module_mail'] = _PS_THEME_DIR_.'modules/{module}'.'/mails/'.$obj_lang->iso_code.'/';
}
// Save each mail content
- foreach ($arr_mail_content as $group_name=>$all_content)
+ foreach ($arr_mail_content as $group_name => $all_content)
{
- foreach ($all_content as $type_content=>$mails)
+ foreach ($all_content as $type_content => $mails)
{
- foreach ($mails as $mail_name=>$content)
+ foreach ($mails as $mail_name => $content)
{
$module_name = false;
@@ -677,7 +681,7 @@ class AdminTranslationsControllerCore extends AdminController
if ($module_name_pipe_pos)
{
$module_name = substr($mail_name, 0, $module_name_pipe_pos);
- $mail_name = substr($mail_name, $module_name_pipe_pos+1);
+ $mail_name = substr($mail_name, $module_name_pipe_pos + 1);
}
if ($type_content == 'html')
@@ -689,9 +693,7 @@ class AdminTranslationsControllerCore extends AdminController
$title = '';
if (Tools::getValue('title_'.$group_name.'_'.$mail_name))
- {
$title = Tools::getValue('title_'.$group_name.'_'.$mail_name);
- }
$string_mail = $this->getMailPattern();
$content = str_replace(array('#title', '#content'), array($title, $content), $string_mail);
@@ -708,16 +710,14 @@ class AdminTranslationsControllerCore extends AdminController
chmod($path.$mail_name.'.'.$type_content, 0777);
}
else
- {
$this->_errors[] = Tools::displayError('HTML e-mail templates cannot contain JavaScript code.');
- }
}
}
}
// Update subjects
$array_subjects = array();
- if ($subjects = Tools::getValue('subject') AND is_array($subjects))
+ if ($subjects = Tools::getValue('subject') && is_array($subjects))
{
$array_subjects['core_and_modules'] = array('translations'=>array(), 'path'=>$arr_mail_path['core_mail'].'lang.php');
if (isset($arr_mail_path['theme_mail']))
@@ -725,23 +725,21 @@ class AdminTranslationsControllerCore extends AdminController
foreach ($subjects as $group => $subject_translation)
{
- if ($group == 'core_mail' || $group == 'module_mail') {
+ if ($group == 'core_mail' || $group == 'module_mail')
$array_subjects['core_and_modules']['translations'] = array_merge($array_subjects['core_and_modules']['translations'], $subject_translation);
- }
else if ( isset($array_subjects['themes_and_modules']) && ($group == 'theme_mail' || $group == 'theme_module_mail')) {
$array_subjects['themes_and_modules']['translations'] = array_merge($array_subjects['themes_and_modules']['translations'], $subject_translation);
}
}
}
- if (!empty($array_subjects)) {
- foreach ($array_subjects as $type=>$infos) {
+ if (!empty($array_subjects))
+ foreach ($array_subjects as $type => $infos)
$this->writeSubjectTranslationFile($infos['translations'], $infos['path']);
- }
- }
+
if (count($this->_errors) == 0)
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token.$params_redirect);
}
-
+
/** include file $dir/$file and return the var $var declared in it.
* This create the file if not exists
* @param string $dir
@@ -790,13 +788,13 @@ class AdminTranslationsControllerCore extends AdminController
public function displayAutoTranslate()
{
- $languageCode = Tools::htmlentitiesUTF8(Language::getLanguageCodeByIso(Tools::getValue('lang')));
+ $language_code = Tools::htmlentitiesUTF8(Language::getLanguageCodeByIso(Tools::getValue('lang')));
return '