// Opti
This commit is contained in:
1 parent
56fe410f86
commit
b51a95f9dd
4 files changed
+20
-28
No files matched your search
+8
-17
@@ -93,32 +93,23 @@ class Autoload
|
|||||||
// If requested class does not exist, load associated core class
|
// If requested class does not exist, load associated core class
|
||||||
if (isset($this->index[$classname]) && !$this->index[$classname])
|
if (isset($this->index[$classname]) && !$this->index[$classname])
|
||||||
{
|
{
|
||||||
require_once($this->root_dir.$this->index[$classname.'Core']);
|
require($this->root_dir.$this->index[$classname.'Core']);
|
||||||
if (file_exists($this->root_dir.'override/'.$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
|
||||||
$this->generateIndex();
|
$class_infos = new ReflectionClass($classname.'Core');
|
||||||
require_once($this->root_dir.$this->index[$classname]);
|
eval(($class_infos->isAbstract() ? 'abstract ' : '').'class '.$classname.' extends '.$classname.'Core {}');
|
||||||
}
|
|
||||||
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 {}');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// request a non Core Class load the associated Core class if exists
|
// request a non Core Class load the associated Core class if exists
|
||||||
if (isset($this->index[$classname.'Core']))
|
if (isset($this->index[$classname.'Core']))
|
||||||
require_once($this->root_dir.$this->index[$classname.'Core']);
|
require($this->root_dir.$this->index[$classname.'Core']);
|
||||||
|
require($this->root_dir.$this->index[$classname]);
|
||||||
if (isset($this->index[$classname]))
|
|
||||||
require_once($this->root_dir.$this->index[$classname]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Call directly ProductCore, ShopCore class
|
// Call directly ProductCore, ShopCore class
|
||||||
else
|
else
|
||||||
require_once($this->root_dir.$this->index[$classname]);
|
require($this->root_dir.$this->index[$classname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -734,9 +734,9 @@ class DispatcherCore
|
|||||||
{
|
{
|
||||||
if ($controller_filename[0] != '.')
|
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);
|
$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));
|
$key = str_replace(array('controller.php', '.php'), '', strtolower($controller_filename));
|
||||||
$controllers[$key] = basename($controller_filename, '.php');
|
$controllers[$key] = basename($controller_filename, '.php');
|
||||||
|
|||||||
+8
-8
@@ -218,7 +218,7 @@ class MediaCore
|
|||||||
$file_uri = $js_uri;
|
$file_uri = $js_uri;
|
||||||
// check if js files exists
|
// 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;
|
return false;
|
||||||
|
|
||||||
// adding file to the big array...;
|
// adding file to the big array...;
|
||||||
@@ -240,7 +240,7 @@ class MediaCore
|
|||||||
$url_data = parse_url($css_uri);
|
$url_data = parse_url($css_uri);
|
||||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||||
// check if css files exists
|
// check if css files exists
|
||||||
if (!file_exists($file_uri))
|
if (!@filemtime($file_uri))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// adding file to the big array...
|
// 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
|
// check if js files exists, if not try to load query from ajax.googleapis.com
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
if (file_exists($file_uri))
|
if (@filemtime($file_uri))
|
||||||
$return[] = Media::getJSPath($file);
|
$return[] = Media::getJSPath($file);
|
||||||
else
|
else
|
||||||
$return[] = Media::getJSPath(Tools::getCurrentUrlProtocolPrefix().'ajax.googleapis.com/ajax/libs/jquery/'.$version.'/jquery'.($minifier ? '.min.js' : '.js'));
|
$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);
|
$ui_path['css'] = array_merge($ui_path['css'], $comp_css);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($file_uri))
|
if (@filemtime($file_uri))
|
||||||
{
|
{
|
||||||
if (!empty($ui_tmp))
|
if (!empty($ui_tmp))
|
||||||
{
|
{
|
||||||
@@ -351,9 +351,9 @@ class MediaCore
|
|||||||
$file = 'jquery.'.$name.'.js';
|
$file = 'jquery.'.$name.'.js';
|
||||||
$url_data = parse_url($folder);
|
$url_data = parse_url($folder);
|
||||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
$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);
|
$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);
|
$plugin_path['js'] = Media::getJSPath($folder.$name.'/'.$file);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@@ -373,9 +373,9 @@ class MediaCore
|
|||||||
$file = 'jquery.'.$name.'.css';
|
$file = 'jquery.'.$name.'.css';
|
||||||
$url_data = parse_url($folder);
|
$url_data = parse_url($folder);
|
||||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
$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);
|
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);
|
return Media::getCSSPath($folder.$name.'/'.$file);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ class TranslateCore
|
|||||||
else
|
else
|
||||||
$str = Translate::getGenericAdminTranslation($string, $key, $_LANGADM);
|
$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);
|
$str = str_replace('"', '"', $str);
|
||||||
|
|
||||||
if ($sprintf !== null)
|
if ($sprintf !== null)
|
||||||
|
|||||||
Reference in new issue
Block a user