optimized autoloader

This commit is contained in:
rodneyrehm
2011-09-21 22:10:52 +00:00
parent e499fb11f0
commit 38a3554fa0
2 changed files with 16 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
21.09.2011
- bugfix look for mixed case plugin file names as in 3.0 if not found try all lowercase
- added $error_muting to suppress error messages even for badly implemented error_handlers
- optimized autoloader
20.09.2011
- bugfix removed debug echo output while compiling template inheritance

View File

@@ -1209,7 +1209,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
// loop through plugin dirs and find the plugin
foreach($this->getPluginsDir() as $_plugin_dir) {
$names = array(
$_plugin_dir . $_plugin_filename,
//$_plugin_dir . $_plugin_filename,
$_plugin_dir . strtolower($_plugin_filename),
);
foreach ($names as $file) {
@@ -1352,19 +1352,20 @@ class SmartyCompilerException extends SmartyException {
function smartyAutoload($class)
{
$_class = strtolower($class);
if (substr($_class, 0, 16) == 'smarty_internal_'
|| in_array( $_class, array(
'smarty_config_source',
'smarty_config_compiled',
'smarty_security',
'smarty_cacheresource',
'smarty_cacheresource_custom',
'smarty_cacheresource_keyvaluestore',
'smarty_resource',
'smarty_resource_custom',
'smarty_resource_uncompiled',
'smarty_resource_recompiled',
))) {
$_classes = array(
'smarty_config_source' => true,
'smarty_config_compiled' => true,
'smarty_security' => true,
'smarty_cacheresource' => true,
'smarty_cacheresource_custom' => true,
'smarty_cacheresource_keyvaluestore' => true,
'smarty_resource' => true,
'smarty_resource_custom' => true,
'smarty_resource_uncompiled' => true,
'smarty_resource_recompiled' => true,
);
if (!strncmp($_class, 'smarty_internal_', 16) || isset($_classes[$_class])) {
include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
}
}