Merge pull request #611 from 202-ecommerce/fix_translation
[-] BO : Fix while of translation, to find in folder if translation exists
This commit is contained in:
commit
a23a576d47
1 file changed
+19
-6
@@ -2353,9 +2353,12 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
$files_by_directiories = $this->getFileToParseByTypeTranslation();
|
$files_by_directiories = $this->getFileToParseByTypeTranslation();
|
||||||
|
|
||||||
foreach ($files_by_directiories['php'] as $dir => $files)
|
foreach ($files_by_directiories['php'] as $dir => $files)
|
||||||
foreach ($files as $file)
|
foreach ($files as $file) {
|
||||||
if (Tools::file_exists_cache($dir.$file) && is_file($dir.$file) && !in_array($file, self::$ignore_folder) && preg_match('/\.php$/', $file))
|
// If file exist and is not in ignore_folder, in the next step we check if a folder or mail
|
||||||
|
if (Tools::file_exists_cache($dir.$file) && !in_array($file, self::$ignore_folder) ) {
|
||||||
$subject_mail = $this->getSubjectMail($dir, $file, $subject_mail);
|
$subject_mail = $this->getSubjectMail($dir, $file, $subject_mail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get path of directory for find a good path of translation file
|
// Get path of directory for find a good path of translation file
|
||||||
if ($this->theme_selected && @filemtime($this->translations_informations[$this->type_selected]['override']['dir']))
|
if ($this->theme_selected && @filemtime($this->translations_informations[$this->type_selected]['override']['dir']))
|
||||||
@@ -2409,12 +2412,15 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
* @return array : list of subjects of mails
|
* @return array : list of subjects of mails
|
||||||
*/
|
*/
|
||||||
protected function getSubjectMail($dir, $file, $subject_mail)
|
protected function getSubjectMail($dir, $file, $subject_mail)
|
||||||
|
{
|
||||||
|
// If is file and is not in ignore_folder
|
||||||
|
if (is_file($dir.'/'.$file) && !in_array($file, self::$ignore_folder) && preg_match('/\.php$/', $file))
|
||||||
{
|
{
|
||||||
$content = file_get_contents($dir.'/'.$file);
|
$content = file_get_contents($dir.'/'.$file);
|
||||||
$content = str_replace("\n", ' ', $content);
|
$content = str_replace("\n", ' ', $content);
|
||||||
|
|
||||||
// Subject must match with a template, therefor we first grep the Mail::Send() function then the Mail::l() inside.
|
// Subject must match with a template, therefor we first grep the Mail::Send() function then the Mail::l() inside.
|
||||||
if (preg_match_all('/Mail::Send([^;]*);/si', $content, $tab))
|
if (preg_match_all('/Mail::Send([^;]*);/si', $content, $tab)) {
|
||||||
for ($i = 0; isset($tab[1][$i]); $i++)
|
for ($i = 0; isset($tab[1][$i]); $i++)
|
||||||
{
|
{
|
||||||
$tab2 = explode(',', $tab[1][$i]);
|
$tab2 = explode(',', $tab[1][$i]);
|
||||||
@@ -2431,9 +2437,16 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!in_array($file, self::$ignore_folder) && is_dir($dir.'/'.$file))
|
}
|
||||||
$subject_mail = $this->getSubjectMail($dir, $file, $subject_mail);
|
// Of if is colder, we scan colder for check if find in folder and subfolder
|
||||||
|
else if (!in_array($file, self::$ignore_folder) && is_dir($dir.'/'.$file))
|
||||||
|
{
|
||||||
|
foreach( scandir($dir.'/'.$file ) as $temp )
|
||||||
|
{
|
||||||
|
$subject_mail = $this->getSubjectMail($dir.'/'.$file, $temp, $subject_mail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $subject_mail;
|
return $subject_mail;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user