summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-03-03 23:29:56 +0000
committerxue <>2007-03-03 23:29:56 +0000
commit902639d85f9ca13e54e04f9d2a59c691d4610195 (patch)
tree5229c2a062c57c0adbad547dca043cf7828adefe
parente6191197dbebab3ebee0a53ca2757c22e5b684c3 (diff)
Fixed #503.
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/TTemplateManager.php9
2 files changed, 8 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 044456ef..e252289e 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6,6 +6,7 @@ BUG: Ticket#521 - comment tag on TActiveButton stop callback (Wei)
BUG: Ticket#553 - I18N quickstart sample does not work (Qiang)
BUG: TXmlElement did not encode attribute and text values when being saved as a string (Qiang)
BUG: SelectedIndices not return expected result for ActiveListBox (Wei)
+ENH: Ticket#503 - Localization and parameter tags can now appear as a substring in a property initial value (Qiang)
ENH: Ticket#513 - Display last modified / revision in quickstart (Wei)
ENH: Ticket#519 - Update TActiveRecord implementation (Wei)
ENH: Added PRADO_CHMOD constant so that users can specify the permission of PRADO-created directories (Qiang)
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);