diff --git a/classes/Autoload.php b/classes/Autoload.php index 6abda9465..179c6728b 100644 --- a/classes/Autoload.php +++ b/classes/Autoload.php @@ -93,32 +93,23 @@ class Autoload // If requested class does not exist, load associated core class if (isset($this->index[$classname]) && !$this->index[$classname]) { - require_once($this->root_dir.$this->index[$classname.'Core']); - if (file_exists($this->root_dir.'override/'.$this->index[$classname.'Core'])) - { - $this->generateIndex(); - require_once($this->root_dir.$this->index[$classname]); - } - else - { - // Since the classname does not exists (we only have a classCore class), we have to emulate the declaration of this class - $class_infos = new ReflectionClass($classname.'Core'); - eval(($class_infos->isAbstract() ? 'abstract ' : '').'class '.$classname.' extends '.$classname.'Core {}'); - } + require($this->root_dir.$this->index[$classname.'Core']); + + // Since the classname does not exists (we only have a classCore class), we have to emulate the declaration of this class + $class_infos = new ReflectionClass($classname.'Core'); + eval(($class_infos->isAbstract() ? 'abstract ' : '').'class '.$classname.' extends '.$classname.'Core {}'); } else { // request a non Core Class load the associated Core class if exists if (isset($this->index[$classname.'Core'])) - require_once($this->root_dir.$this->index[$classname.'Core']); - - if (isset($this->index[$classname])) - require_once($this->root_dir.$this->index[$classname]); + require($this->root_dir.$this->index[$classname.'Core']); + require($this->root_dir.$this->index[$classname]); } } // Call directly ProductCore, ShopCore class else - require_once($this->root_dir.$this->index[$classname]); + require($this->root_dir.$this->index[$classname]); } /** diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php index 2f849cc22..85ba09eee 100644 --- a/classes/Dispatcher.php +++ b/classes/Dispatcher.php @@ -734,9 +734,9 @@ class DispatcherCore { if ($controller_filename[0] != '.') { - if (is_dir($dir.$controller_filename)) + if (!strpos($controller_filename, '.php') && is_dir($dir.$controller_filename)) $controllers += Dispatcher::getControllersInDirectory($dir.$controller_filename.DIRECTORY_SEPARATOR); - else if ($controller_filename != 'index.php') + elseif ($controller_filename != 'index.php') { $key = str_replace(array('controller.php', '.php'), '', strtolower($controller_filename)); $controllers[$key] = basename($controller_filename, '.php'); diff --git a/classes/Media.php b/classes/Media.php index c6477450e..f340b79f4 100755 --- a/classes/Media.php +++ b/classes/Media.php @@ -218,7 +218,7 @@ class MediaCore $file_uri = $js_uri; // check if js files exists - if (!preg_match('/^http(s?):\/\//i', $file_uri) && !file_exists($file_uri)) + if (!preg_match('/^http(s?):\/\//i', $file_uri) && !@filemtime($file_uri)) return false; // adding file to the big array...; @@ -240,7 +240,7 @@ class MediaCore $url_data = parse_url($css_uri); $file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']); // check if css files exists - if (!file_exists($file_uri)) + if (!@filemtime($file_uri)) return false; // adding file to the big array... @@ -275,7 +275,7 @@ class MediaCore // check if js files exists, if not try to load query from ajax.googleapis.com $return = array(); - if (file_exists($file_uri)) + if (@filemtime($file_uri)) $return[] = Media::getJSPath($file); else $return[] = Media::getJSPath(Tools::getCurrentUrlProtocolPrefix().'ajax.googleapis.com/ajax/libs/jquery/'.$version.'/jquery'.($minifier ? '.min.js' : '.js')); @@ -314,7 +314,7 @@ class MediaCore $ui_path['css'] = array_merge($ui_path['css'], $comp_css); } - if (file_exists($file_uri)) + if (@filemtime($file_uri)) { if (!empty($ui_tmp)) { @@ -351,9 +351,9 @@ class MediaCore $file = 'jquery.'.$name.'.js'; $url_data = parse_url($folder); $file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']); - if (file_exists($file_uri.$file)) + if (@filemtime($file_uri.$file)) $plugin_path['js'] = Media::getJSPath($folder.$file); - else if (file_exists($file_uri.$name.'/'.$file)) + elseif (@filemtime($file_uri.$name.'/'.$file)) $plugin_path['js'] = Media::getJSPath($folder.$name.'/'.$file); else return false; @@ -373,9 +373,9 @@ class MediaCore $file = 'jquery.'.$name.'.css'; $url_data = parse_url($folder); $file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']); - if (file_exists($file_uri.$file)) + if (@filemtime($file_uri.$file)) return Media::getCSSPath($folder.$file); - else if (file_exists($file_uri.$name.'/'.$file)) + elseif (@filemtime($file_uri.$name.'/'.$file)) return Media::getCSSPath($folder.$name.'/'.$file); else return false; diff --git a/classes/Translate.php b/classes/Translate.php index 497bbcc2c..7ab4569c7 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -72,7 +72,8 @@ class TranslateCore else $str = Translate::getGenericAdminTranslation($string, $key, $_LANGADM); - $str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str; + if ($htmlentities) + $str = htmlentities($str, ENT_QUOTES, 'utf-8'); $str = str_replace('"', '"', $str); if ($sprintf !== null)