From 902639d85f9ca13e54e04f9d2a59c691d4610195 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 3 Mar 2007 23:29:56 +0000 Subject: Fixed #503. --- framework/Web/UI/TTemplateManager.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index a8caba24..1f2bca68 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -854,7 +854,7 @@ class TTemplate extends TApplicationComponent implements ITemplate */ protected function parseAttribute($value) { - if(($n=preg_match_all('/<%[#=].*?%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0) + if(($n=preg_match_all('/<%[#=\\$].*?%>|<%\\[.*?\\]%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0) { $isDataBind=false; $textStart=0; @@ -869,7 +869,12 @@ class TTemplate extends TApplicationComponent implements ITemplate $isDataBind=true; if($offset>$textStart) $expr.=".'".strtr(substr($value,$textStart,$offset-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'"; - $expr.='.('.substr($token,3,$length-5).')'; + if($token[2]==='[') // localize + $expr.='.(Prado::localize(\''.strtr(trim(substr($token,3,$length-6)),array("'"=>"\\'","\\"=>"\\\\")).'\'))'; + else if($token[2]==='$') // parameter + $expr.='.(Prado::getApplication()->getParameters()->itemAt(\''.strtr(trim(substr($token,3,$length-5)),array("'"=>"\\'","\\"=>"\\\\")).'\'))'; + else // expression + $expr.='.('.substr($token,3,$length-5).')'; $textStart=$offset+$length; } $length=strlen($value); -- cgit v1.2.3