diff --git a/libs/Autoloader.php b/libs/Autoloader.php index ad09ec29..0b794804 100644 --- a/libs/Autoloader.php +++ b/libs/Autoloader.php @@ -11,7 +11,7 @@ * @package Smarty * @author Uwe Tews * Usage: - * include '...path/Autoloader.php'; + * require_once '...path/Autoloader.php'; * Smarty_Autoloader::register(); * $smarty = new Smarty(); * Note: This autoloader is not needed if you use Composer. @@ -47,24 +47,38 @@ class Smarty_Autoloader ); private static $syspluginsClasses = array( - 'smarty_config_source' => true, - 'smarty_security' => true, - 'smarty_cacheresource' => true, - 'smarty_compiledresource' => true, - 'smarty_cacheresource_custom' => true, - 'smarty_cacheresource_keyvaluestore' => true, - 'smarty_resource' => true, - 'smarty_resource_custom' => true, - 'smarty_resource_uncompiled' => true, - 'smarty_resource_recompiled' => true, - 'smarty_template_source' => true, - 'smarty_template_compiled' => true, - 'smarty_template_cached' => true, - 'smarty_data' => true, - 'smarty_variable' => true, - 'smarty_undefined_variable' => true, - 'smartyexception' => true, - 'smartycompilerexception' => true, + 'smarty_config_source' => true, + 'smarty_security' => true, + 'smarty_cacheresource' => true, + 'smarty_compiledresource' => true, + 'smarty_cacheresource_custom' => true, + 'smarty_cacheresource_keyvaluestore' => true, + 'smarty_resource' => true, + 'smarty_resource_custom' => true, + 'smarty_resource_uncompiled' => true, + 'smarty_resource_recompiled' => true, + 'smarty_template_source' => true, + 'smarty_template_compiled' => true, + 'smarty_template_cached' => true, + 'smarty_data' => true, + 'smarty_variable' => true, + 'smarty_undefined_variable' => true, + 'smartyexception' => true, + 'smartycompilerexception' => true, + 'smarty_internal_data' => true, + 'smarty_internal_template' => true, + 'smarty_internal_templatebase' => true, + 'smarty_internal_resource_file' => true, + 'smarty_internal_resource_extends' => true, + 'smarty_internal_resource_eval' => true, + 'smarty_internal_resource_string' => true, + 'smarty_internal_resource_registered' => true, + 'smarty_internal_extension_codeframe' => true, + 'smarty_internal_extension_config' => true, + 'smarty_internal_filter_handler' => true, + 'smarty_internal_function_call_handler' => true, + 'smarty_internal_cacheresource_file' => true, + 'smarty_internal_write_file' => true, ); /** @@ -121,12 +135,12 @@ class Smarty_Autoloader if (isset(self::$syspluginsClasses[$_class])) { $_class = (self::$syspluginsClasses[$_class] === true) ? $_class : self::$syspluginsClasses[$_class]; $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php'; - require $file; + require_once $file; return; } elseif (0 !== strpos($_class, 'smarty_internal_')) { if (isset(self::$rootClasses[$class])) { $file = self::$SMARTY_DIR . self::$rootClasses[$class]; - require $file; + require_once $file; return; } self::$unknown[$class] = true; @@ -134,7 +148,7 @@ class Smarty_Autoloader } $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php'; if (is_file($file)) { - require $file; + require_once $file; return; } self::$unknown[$class] = true; diff --git a/libs/plugins/modifier.date_format.php b/libs/plugins/modifier.date_format.php index 5ad7540b..28d6ff02 100644 --- a/libs/plugins/modifier.date_format.php +++ b/libs/plugins/modifier.date_format.php @@ -33,7 +33,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' $format = Smarty::$_DATE_FORMAT; } /** - * Include the {@link shared.make_timestamp.php} plugin + * require_once the {@link shared.make_timestamp.php} plugin */ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') { diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php index 3366910b..07bc0899 100644 --- a/libs/sysplugins/smarty_internal_compile_function.php +++ b/libs/sysplugins/smarty_internal_compile_function.php @@ -141,7 +141,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase if (!empty($compiler->template->required_plugins['compiled'])) { foreach ($compiler->template->required_plugins['compiled'] as $tmp) { foreach ($tmp as $data) { - $output .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n"; + $output .= "if (!is_callable('{$data['function']}')) require_once '{$data['file']}';\n"; } } } @@ -149,7 +149,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output .= "echo '/*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/template->required_plugins['nocache'] as $tmp) { foreach ($tmp as $data) { - $output .= "if (!is_callable(\'{$data['function']}\')) include \'{$data['file']}\';\n"; + $output .= "if (!is_callable(\'{$data['function']}\')) require_once \'{$data['file']}\';\n"; } } $output .= "?>/*/%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/';\n"; @@ -185,7 +185,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase if (!empty($compiler->template->required_plugins['compiled'])) { foreach ($compiler->template->required_plugins['compiled'] as $tmp) { foreach ($tmp as $data) { - $output .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n"; + $output .= "if (!is_callable('{$data['function']}')) require_once '{$data['file']}';\n"; } } } diff --git a/libs/sysplugins/smarty_internal_extension_codeframe.php b/libs/sysplugins/smarty_internal_extension_codeframe.php index 793c2fce..cd58f37c 100644 --- a/libs/sysplugins/smarty_internal_extension_codeframe.php +++ b/libs/sysplugins/smarty_internal_extension_codeframe.php @@ -46,9 +46,9 @@ class Smarty_Internal_Extension_CodeFrame foreach ($tmp as $data) { $file = addslashes($data['file']); if (is_Array($data['function'])) { - $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) include '{$file}';\n"; + $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"; } else { - $output .= "if (!is_callable('{$data['function']}')) include '{$file}';\n"; + $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n"; } } } @@ -60,9 +60,9 @@ class Smarty_Internal_Extension_CodeFrame foreach ($tmp as $data) { $file = addslashes($data['file']); if (is_Array($data['function'])) { - $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) include '{$file}';\n"); + $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n"); } else { - $output .= addslashes("if (!is_callable('{$data['function']}')) include '{$file}';\n"); + $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n"); } } } diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 04e538e9..fdb32017 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -701,7 +701,7 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->template->required_plugins['compiled'][$tag][$plugin_type]['file'] = $script; $this->template->required_plugins['compiled'][$tag][$plugin_type]['function'] = $callback; } - include_once $script; + require_once $script; } else { $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found"); }