// Language class 1.5

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11958 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-12-30 16:07:44 +00:00
parent deec59c659
commit c698ae5210
+22 -16
View File
@@ -144,33 +144,39 @@ class LanguageCore extends ObjectModel
rename(_PS_MODULE_DIR_.$moduleDir.'/'.$this->iso_code.'.php', _PS_MODULE_DIR_.$moduleDir.'/'.$newIso.'.php'); rename(_PS_MODULE_DIR_.$moduleDir.'/'.$this->iso_code.'.php', _PS_MODULE_DIR_.$moduleDir.'/'.$newIso.'.php');
} }
foreach ($this->_getThemesList() as $theme => $data) foreach (Theme::getThemes() as $theme)
{ {
if (file_exists(_PS_ALL_THEMES_DIR_.$theme.'/lang/'.$this->iso_code.'.php')) $theme_dir = $theme->directory;
rename(_PS_ALL_THEMES_DIR_.$theme.'/lang/'.$this->iso_code.'.php', _PS_ALL_THEMES_DIR_.$theme.'/lang/'.$newIso.'.php'); if (file_exists(_PS_ALL_THEMES_DIR_.$theme_dir.'/lang/'.$this->iso_code.'.php'))
rename(_PS_ALL_THEMES_DIR_.$theme_dir.'/lang/'.$this->iso_code.'.php', _PS_ALL_THEMES_DIR_.$theme_dir.'/lang/'.$newIso.'.php');
if (file_exists(_PS_ALL_THEMES_DIR_.$theme.'/mails/'.$this->iso_code)) if (file_exists(_PS_ALL_THEMES_DIR_.$theme_dir.'/mails/'.$this->iso_code))
rename(_PS_ALL_THEMES_DIR_.$theme.'/mails/'.$this->iso_code, _PS_ALL_THEMES_DIR_.$theme.'/mails/'.$newIso); rename(_PS_ALL_THEMES_DIR_.$theme_dir.'/mails/'.$this->iso_code, _PS_ALL_THEMES_DIR_.$theme_dir.'/mails/'.$newIso);
foreach ($modulesList as $module) foreach ($modulesList as $module)
if (file_exists(_PS_ALL_THEMES_DIR_.$theme.'/modules/'.$module.'/'.$this->iso_code.'.php')) if (file_exists(_PS_ALL_THEMES_DIR_.$theme_dir.'/modules/'.$module.'/'.$this->iso_code.'.php'))
rename(_PS_ALL_THEMES_DIR_.$theme.'/modules/'.$module.'/'.$this->iso_code.'.php', _PS_ALL_THEMES_DIR_.$theme.'/modules/'.$module.'/'.$newIso.'.php'); rename(_PS_ALL_THEMES_DIR_.$theme_dir.'/modules/'.$module.'/'.$this->iso_code.'.php', _PS_ALL_THEMES_DIR_.$theme_dir.'/modules/'.$module.'/'.$newIso.'.php');
} }
} }
/** /**
* Return an array with themes and thumbnails * Return an array of theme
* *
* @return array * @return array([theme dir] => array('name' => [theme name]))
* @deprecated will be removed in 1.6
*/ */
private function _getThemesList() private function _getThemesList()
{ {
$dir = opendir(_PS_ALL_THEMES_DIR_); Tools::displayAsDeprecated();
while ($folder = readdir($dir)) static $themes = array();
if ($folder != '.' AND $folder != '..' AND file_exists(_PS_ALL_THEMES_DIR_.'/'.$folder.'/preview.jpg'))
$themes[$folder]['name'] = $folder; if (empty($themes))
closedir($dir); {
return isset($themes) ? $themes : array(); $installed_themes = Theme::getThemes();
foreach($installed_themes as $theme)
$themes[$theme->directory] = array('name' => $theme->name);
}
return $themes;
} }
public function add($autodate = true, $nullValues = false) public function add($autodate = true, $nullValues = false)