Arnaud Le Blanc
43ec3036f7
removed Template::callFunction
2010-12-30 09:31:09 +01:00
Arnaud Le Blanc
9528bac1e4
updated doc for functions
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc
7794463706
Added sandbox support for functions
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc
3615e9a386
Added auto-escaper support for functions
...
Functions' output is escaped by default and functions can declare
themselves "safe" using the "is_safe" option.
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc
c225a5bed9
Handle functions like filters
...
Functions are not global variables anymore. They are resolved at
compile time, and Twig_Function objects are instanciated only when
compiling.
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc
b247452ec5
Resolve imported functions at compile time
...
{% from %} is compiled as {% import %}, the imported module is placed in
a local variable, and calls to imported functions are compiled as calls
to module functions.
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc
ad6374434d
Added nodes representing local variables
...
Allows to use local PHP variables as temporary variables in compiled
templates
2010-12-30 09:31:08 +01:00
Fabien Potencier
d9e2c42e41
renamed Template::getParentBlock() and getBlock() to diplayParentBlock() and displayBlock(), which is semantically more correct
2010-12-30 09:31:08 +01:00
nikic
522f35ed6b
update Core Extension doc
2010-12-23 12:31:14 +01:00
nikic
9dcf64e386
fix Exception documentation, remove use of Twig_SyntaxError
2010-12-23 12:31:10 +01:00
nikic
6d030c266a
disallow {% set %}{% endset %}
2010-12-22 18:04:45 +01:00
nikic
4ebbc5e43e
rename $parser to $stream in parseArguments
2010-12-22 18:04:34 +01:00
Fabien Potencier
8b74ea04ce
added the possibility to look at more than just the very next token
2010-12-22 11:58:10 +01:00
Fabien Potencier
d72b6ad136
readded TokenStream::look()
2010-12-22 11:51:29 +01:00
nikic
648c843523
TokenStream changes:
...
* remove unused look() and rewind()
* do not shift tokens, but increase a pointer
2010-12-22 11:51:22 +01:00
nikic
d1ae5dbf4c
improve lexer (causes changes in token stream, token and parser)
2010-12-22 11:36:59 +01:00
Fabien Potencier
592834f7f6
fixed typo
2010-12-22 11:34:23 +01:00
nikic
d88a3c805f
remove $is_multitarget return in parseMultitargetExpression
...
Furthermore slightly reordered code thus removing redundant expect()
2010-12-20 19:06:42 +01:00
Fabien Potencier
1467586430
added some unit tests for previous commit
2010-12-20 19:05:45 +01:00
nikic
ad8375ac4b
One should only be able to assign to variables
2010-12-20 19:03:15 +01:00
nikic
06753220b9
remove unused $lineno variable
2010-12-20 19:01:33 +01:00
nikic
f1583ce353
change while(1) to while(true)
2010-12-20 19:01:23 +01:00
nikic
59f45ba11d
remove "(,)" hint from syntax error messages (the expect function will do that already)
2010-12-20 19:01:11 +01:00
nikic
f14e0a37ca
use the passed $token in isUnary and isBinary of ExpressionParser
2010-12-20 19:00:22 +01:00
nikic
c0e1c49b2d
Grammer/Hash: array -> hash
2010-12-20 18:01:48 +01:00
Fabien Potencier
6de8f8bd43
tweaked error message
2010-12-20 15:05:29 +01:00
Fabien Potencier
8e96487ada
changed error messages to be more friendly
2010-12-20 14:48:07 +01:00
Fabien Potencier
b1b173f167
converted the cycle filter to a function
2010-12-20 08:46:29 +01:00
Fabien Potencier
47a73476e0
converted the constant filter to a function
2010-12-20 08:43:27 +01:00
Fabien Potencier
8fe302bb3e
converted the range filter to a function
2010-12-20 08:36:03 +01:00
Fabien Potencier
508a241179
forced functions to have fn_ as a prefix to avoid name clashes between functions and variables
2010-12-19 22:24:10 +01:00
Fabien Potencier
739bfb2891
fixed doc index
2010-12-19 21:53:00 +01:00
Fabien Potencier
3a6d9e8526
fixed typo
2010-12-19 21:52:54 +01:00
Fabien Potencier
dc884c3888
rewrote the advanced chapter and documented globals and functions
2010-12-19 20:11:00 +01:00
Fabien Potencier
afa47bd9a4
added global variables
2010-12-19 19:50:03 +01:00
Fabien Potencier
7fc5927721
made macro return their value instead of echoing directly
2010-12-19 19:50:03 +01:00
Fabien Potencier
9d77cf2254
added from tag
2010-12-19 19:50:00 +01:00
Fabien Potencier
1621435b89
added support for functions
2010-12-19 19:48:02 +01:00
Fabien Potencier
5c5e33ee12
fixed typo
2010-12-19 11:43:24 +01:00
Fabien Potencier
c66cfa1d6e
made macros callable when sandbox mode is enabled
2010-12-18 14:31:15 +01:00
Fabien Potencier
f9507d8883
fixed markup
2010-12-18 14:20:48 +01:00
Fabien Potencier
fc4fe73f57
added a new recipe
2010-12-18 14:19:40 +01:00
Fabien Potencier
e782d41963
fixed if tag documentation
2010-12-18 13:44:51 +01:00
Fabien Potencier
eedce6617e
added an exception when a macro uses a reserved name
2010-12-18 13:15:34 +01:00
Fabien Potencier
583718ee1a
changed default filter to use the empty test
2010-12-18 12:56:44 +01:00
Fabien Potencier
4fbbad44f1
fixed markup in doc
2010-12-18 11:53:59 +01:00
Fabien Potencier
0d424bff0d
added the empty test
2010-12-18 11:53:55 +01:00
Fabien Potencier
14341443dd
removed the 'items' filter, which has been deprecated a long time ago
2010-12-18 11:21:46 +01:00
nikic
dfa0cb91dd
some improvements to for tag compiler
2010-12-18 09:04:23 +01:00
Fabien Potencier
3f8fb73083
made a small performance optimization
2010-12-18 08:04:21 +01:00