- improvement replaced most in_array() calls by more efficient isset() on array_flip()ed haystacks

- added notes on possible performance optimization/problem with Smarty_Security
This commit is contained in:
rodneyrehm
2011-10-01 18:10:48 +00:00
parent 41958a5790
commit aff7c6a0ab
13 changed files with 99 additions and 50 deletions
+2 -1
View File
@@ -180,6 +180,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
*/
private static function get_key($template)
{
static $_is_stringy = array('string' => true, 'eval' => true);
// calculate Uid if not already done
if ($template->source->uid == '') {
$template->source->filepath;
@@ -188,7 +189,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
if (isset(self::$template_data[$key])) {
return $key;
} else {
if (in_array($template->source->type, array('string','eval'))) {
if (isset($_is_stringy[$template->source->type])) {
self::$template_data[$key]['name'] = '\''.substr($template->source->name,0,25).'...\'';
} else {
self::$template_data[$key]['name'] = $template->source->filepath;