cvs: smarty / NEWS /libs Smarty_Compiler.class.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1105031825@cvsserver> |
messju Thu Jan 6 12:17:05 2005 EDT
Modified files:
/smarty NEWS
/smarty/libs Smarty_Compiler.class.php
Log:
slight optimization in the compilation of $smarty.const.FOO .
@FOO is less code and executed slightly faster than constant('FOO').
more complex consts like $smarty.const.$name still compile to
constant($this->_tpl_vars['name'])
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.483&r2=1.484&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.483 smarty/NEWS:1.484
--- smarty/NEWS:1.483 Wed Jan 5 05:40:11 2005
+++ smarty/NEWS Thu Jan 6 12:17:05 2005
@@ -1,3 +1,6 @@
+ - make $smarty.const.FOO compile to "FOO", and not to "constant('foo')".
+ this is less code and a little faster execution. note that undefined
+ constants are now displayed as the constant's name. (messju)
- make block functions and registered objects' block methods use a
local variable for block_content instead of a property of $smarty (messju)
- fix escaping in the generated code that calls smarty_core_load_plugins
http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.354&r2=1.355&ty=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.354 smarty/libs/Smarty_Compiler.class.php:1.355
--- smarty/libs/Smarty_Compiler.class.php:1.354 Wed Jan 5 05:40:11 2005
+++ smarty/libs/Smarty_Compiler.class.php Thu Jan 6 12:17:05 2005
@@ -26,7 +26,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.354 2005/01/05 10:40:11 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.355 2005/01/06 17:17:05 messju Exp $ */
/**
* Template compiling class
@@ -2031,8 +2031,12 @@
return;
}
array_shift($indexes);
- $_val = $this->_parse_var_props(substr($indexes[0],1));
- $compiled_ref = '@constant(' . $_val . ')';
+ if (preg_match('!^\.\w+$!', $indexes[0])) {
+ $compiled_ref = '@' . substr($indexes[0], 1);
+ } else {
+ $_val = $this->_parse_var_props(substr($indexes[0], 1));
+ $compiled_ref = '@constant(' . $_val . ')';
+ }
$_max_index = 1;
break;
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php