From 0b5da4185efb35df8d1097bc530cb1eba5025705 Mon Sep 17 00:00:00 2001 From: mohrt Date: Sat, 10 Feb 2001 23:58:51 +0000 Subject: [PATCH] remove unneeded preg_match --- Smarty.class.php | 6 ++---- libs/Smarty.class.php | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Smarty.class.php b/Smarty.class.php index 7c3c1b4c..dd255649 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -510,8 +510,6 @@ class Smarty /* Split content by template tags to obtain non-template content. */ $text_blocks = preg_split("!{$ldq}.*?{$rdq}!s", $template_contents); - $special_tags = preg_match_all('!(<\?[^?]*?\?>)!i',$text_blocks,$sp_match); - /* TODO: speed up the following with preg_replace and /F once we require that version of PHP */ /* loop through text blocks */ @@ -521,11 +519,11 @@ class Smarty /* found at least one match, loop through each one */ foreach($sp_match[0] as $curr_sp) { if(!$this->allow_php) { - /* we don't allow php, so echo anything in */ + /* we don't allow php, so echo everything */ $text_blocks[$curr_tb] = str_replace($curr_sp,'',$text_blocks[$curr_tb]); } elseif(!preg_match("!^(<\?(php | )|)!i",$curr_sp)) - /* we allow php, so echo only non-php such as */ + /* we allow php, so echo only non-php tags */ $text_blocks[$curr_tb] = str_replace($curr_sp,'',$text_blocks[$curr_tb]); } } diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 7c3c1b4c..dd255649 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -510,8 +510,6 @@ class Smarty /* Split content by template tags to obtain non-template content. */ $text_blocks = preg_split("!{$ldq}.*?{$rdq}!s", $template_contents); - $special_tags = preg_match_all('!(<\?[^?]*?\?>)!i',$text_blocks,$sp_match); - /* TODO: speed up the following with preg_replace and /F once we require that version of PHP */ /* loop through text blocks */ @@ -521,11 +519,11 @@ class Smarty /* found at least one match, loop through each one */ foreach($sp_match[0] as $curr_sp) { if(!$this->allow_php) { - /* we don't allow php, so echo anything in */ + /* we don't allow php, so echo everything */ $text_blocks[$curr_tb] = str_replace($curr_sp,'',$text_blocks[$curr_tb]); } elseif(!preg_match("!^(<\?(php | )|)!i",$curr_sp)) - /* we allow php, so echo only non-php such as */ + /* we allow php, so echo only non-php tags */ $text_blocks[$curr_tb] = str_replace($curr_sp,'',$text_blocks[$curr_tb]); } }