added caching of requested paths to smarty_core_assemble_plugin_filepath()

This commit is contained in:
messju
2004-01-08 13:13:04 +00:00
parent 73995af1e9
commit 6950893505
2 changed files with 6 additions and 1 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- add caching of requested paths to _assemble_plugin_filepath() (messju)
- fix handling of comments inside {php}- and {literal}-blocks (messju) - fix handling of comments inside {php}- and {literal}-blocks (messju)
- fix bug handling triple-quotes in config-files (BRDude, messju) - fix bug handling triple-quotes in config-files (BRDude, messju)
- change default of request_use_auto_globals to true - $_SERVER is - change default of request_use_auto_globals to true - $_SERVER is

View File

@@ -14,8 +14,12 @@
*/ */
function smarty_core_assemble_plugin_filepath($params, &$smarty) function smarty_core_assemble_plugin_filepath($params, &$smarty)
{ {
static $_filepaths_cache = array();
$_plugin_filename = $params['type'] . '.' . $params['name'] . '.php'; $_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
if (isset($_filepaths_cache[$_plugin_filename])) {
return $_filepaths_cache[$_plugin_filename];
}
$_return = false; $_return = false;
foreach ((array)$smarty->plugins_dir as $_plugin_dir) { foreach ((array)$smarty->plugins_dir as $_plugin_dir) {
@@ -53,7 +57,7 @@ function smarty_core_assemble_plugin_filepath($params, &$smarty)
} }
} }
} }
$_filepaths_cache[$_plugin_filename] = $_return;
return $_return; return $_return;
} }