- remove redundant code

This commit is contained in:
Uwe Tews
2015-06-28 15:45:50 +02:00
parent 8d30442450
commit 99fe8120c8
3 changed files with 4 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
- optimize autoloader
- optimize file path normalization
- bugfix PATH_SEPARATOR was replaced by mistake in autoloader
- remove redundant code
27.06.2015
- bugfix resolve naming conflict between custom Smarty delimiter '<%' and PHP ASP tags https://github.com/smarty-php/smarty/issues/64

View File

@@ -49,8 +49,6 @@ class Smarty_Internal_Extension_LoadPlugin
// plugin filename is expected to be: [type].[name].php
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
$_stream_resolve_include_path = function_exists('stream_resolve_include_path');
// loop through plugin dirs and find the plugin
foreach ($smarty->getPluginsDir() as $_plugin_dir) {
$names = array($_plugin_dir . $_plugin_filename, $_plugin_dir . strtolower($_plugin_filename),);
@@ -61,15 +59,9 @@ class Smarty_Internal_Extension_LoadPlugin
}
if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
// try PHP include_path
if ($_stream_resolve_include_path) {
$file = stream_resolve_include_path($file);
} else {
$file = Smarty_Internal_Get_Include_Path::getIncludePath($file);
}
$file = Smarty_Internal_Get_Include_Path::getIncludePath($file);
if ($file !== false) {
require_once($file);
return $file;
}
}

View File

@@ -30,7 +30,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
{
$file = $source->name;
// absolute file ?
if ($file[0] == '/' || $file[1] == ':' ) {
if ($file[0] == '/' || $file[1] == ':') {
$file = $source->smarty->_realpath($file);
return is_file($file) ? $file : false;
}
@@ -90,11 +90,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
}
if ($source->smarty->use_include_path && !preg_match('/^([\\\/]|[a-zA-Z]:[\\\/])/', $_directory)) {
// try PHP include_path
if (function_exists('stream_resolve_include_path')) {
$_filepath = stream_resolve_include_path($_filepath);
} else {
$_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath);
}
$_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath);
if ($_filepath !== false) {
$path = $source->smarty->_realpath($_filepath);
if (is_file($path)) {
@@ -108,7 +104,6 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
return is_file($path) ? $path : false;
}
/**
* test is file exists and save timestamp
*