summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodneyrehm <rodneyrehm@localhost>2011-09-21 22:10:52 +0000
committerrodneyrehm <rodneyrehm@localhost>2011-09-21 22:10:52 +0000
commit38a3554fa074c5c40f0e66020e85328a5a332200 (patch)
tree9c1d67f205b28a8cd95bbef00ce693f842cb5b9a
parente499fb11f0ceeed08b6dedd552ac3dd54be72f46 (diff)
downloadsmarty-38a3554fa074c5c40f0e66020e85328a5a332200.tar.gz
smarty-38a3554fa074c5c40f0e66020e85328a5a332200.tar.bz2
smarty-38a3554fa074c5c40f0e66020e85328a5a332200.zip
optimized autoloader
-rw-r--r--change_log.txt1
-rw-r--r--libs/Smarty.class.php29
2 files changed, 16 insertions, 14 deletions
diff --git a/change_log.txt b/change_log.txt
index dac8484d..120ab868 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -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
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index bf40e1e0..d3d6abd2 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -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';
}
}