Commit Graph

282 Commits

Author SHA1 Message Date
Fabien Potencier ab2a9ac459 added more information to an exception to ease debugging 2010-11-26 21:13:26 +01:00
Fabien Potencier dc71bf1a82 made operators configurable 2010-11-26 20:57:53 +01:00
Jordi Boggiano 3c94b3c033 Allow is defined test on complex variables 2010-11-26 19:06:50 +01:00
Fabien Potencier a511b9bd64 fixed several bugs in SimpleTokenParser (nested optional grammar, and support for , as a separator) 2010-11-26 18:58:54 +01:00
Fabien Potencier 9d8583efcc rewrote expression parser with a new algorithm to limit the depth of nested calls
This change has no impact for the end user, but many internal benefits:

* less nested calls (was the primary reason for the change as xdebug limits the depth of nested calls);
* less code;
* code is much cleaner (I have removed all the parsing "hacks");
* faster;
* more flexible (we will now be able to expose an API to add new operators);
* easier to maintain.
2010-11-26 16:35:59 +01:00
stloyd 515741a8e0 replace all is_null($value) with null === $value 2010-11-25 17:12:39 +01:00
Fabien Potencier 5b4c074223 added a defined test (strict_variables is now useable) 2010-11-24 09:47:51 +01:00
Fabien Potencier 4778822863 added _charset as a special variable that references the current charset 2010-11-20 14:44:00 +01:00
Arnaud Le Blanc 34373eeb01 handle spl_object_hash collisions 2010-11-20 10:22:12 +01:00
Fabien Potencier 1d2afa097f added the spaceless tag 2010-11-19 13:26:23 +01:00
Fabien Potencier 38acf6f134 removed trim_blocks option
The trim_blocks option has been removed as the rendered output depends on the value of this option.
This is not a problem for HTML output, but it's a big one if you want to output
plain text for instance.

The behavior now is the same as if the trim_blocks option is set to true. It mimicks
the behavior of PHP tags.
2010-11-19 13:21:24 +01:00
Arnaud Le Blanc 15e46e598d Changed Twig_Node_Expression_Filter to accept only one filter
Chained filters are now represented by nested
Twig_Node_Expression_Filter nodes internally.

This makes it easier to analyse the tree
2010-11-19 08:06:32 +01:00
Fabien Potencier 92b890bf25 removed usage of SplObjectStorage as PHP < 5.3 does not support ArrayAccess 2010-11-17 11:35:26 +01:00
Fabien Potencier 001685ba13 added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar()) 2010-11-16 10:51:23 +01:00
Arnaud Le Blanc 62551da95e fix storage of object properties in analysis 2010-11-08 07:48:13 +01:00
Fabien Potencier 7ea98b6c90 moved all exceptions to Twig_Error_* 2010-11-07 22:18:31 +01:00
Fabien Potencier 7d78ab416d fixed unary expressions 2010-11-07 21:44:05 +01:00
Jordi Boggiano 469814f223 Remove is_escaper flag from urlencode
urlencode is an url escaper but not an html escaper so I don't think it should be exempt from auto-escaping
2010-11-07 20:46:32 +01:00
Fabien Potencier 057380694c fixed child templates (with an extend tag) that uses one or more imports 2010-11-07 14:31:47 +01:00
Fabien Potencier 011e727b22 fixed documentation and added infix notation for in (already supported for is) 2010-11-07 14:21:10 +01:00
Fabien Potencier 2d1b78e849 removed @version phpdoc attribute 2010-11-07 09:26:25 +01:00
Fabien Potencier 36489263d5 fixed CS 2010-11-07 09:21:01 +01:00
Arnaud Le Blanc 4087d087a1 deeply mark expressions as safe (e.g. a conditonal expression is safe if both operands are literals) 2010-11-07 08:52:12 +01:00
Arnaud Le Blanc 123caccc80 support for specifying the escaping type of a filter 2010-11-07 08:52:06 +01:00
Arnaud Le Blanc 510e96275c Changed escaping rules (switched to post-escaping)
Expression in Print nodes are always escaped before being printed,
except in two conditions :
  * if the expression is an Expression_Constant node
  * if the last filter in the chain is an escaper
2010-11-07 08:52:03 +01:00
Fabien Potencier 10cab46129 made the include tag more flexible 2010-11-01 04:24:32 +01:00
Fabien Potencier 03c286667c fixed typo 2010-10-23 10:38:18 +02:00
Jordi Boggiano eba8805f4a Optimize/uniformalize the multibyte filters 2010-10-22 08:43:47 +02:00
Jordi Boggiano abdee6a8cd Removed unnecessary twig_constant_filter function 2010-10-22 08:35:44 +02:00
Fabien Potencier 12fd54f1d4 renamed urlencode to url_encode 2010-10-06 15:10:20 +02:00
Jordi Boggiano 6714d9ac3f Added json_encode filter 2010-10-06 15:09:08 +02:00
Matt Agar 711f92fcc8 Fixed PHP 5.3 namespace dependency (Issues a warning in PHP 5.2). 2010-10-05 07:55:46 +02:00
Fabien Potencier 29b020eb2f changed the way to access nodes and attributes from a node
Before:
  Nodes were accessed via node properties ($node->body)
  Attributes were accessed via node array access ($node['name'])

After:
  Nodes are accessed via getNode(), setNode(), ... ($node->getNode('body'))
  Attributes are accessed via getAttribute(), setAttribute(), ... ($node->getAttribute('name'))

The change was necessary because of side-effects. This is one more time the
demonstration that being explicit is always better than magic ;)
2010-10-02 08:29:25 +02:00
Fabien Potencier b034e6545d fixed typo 2010-10-01 20:34:31 +02:00
Fabien Potencier 057a64c425 added a note to get an extension reference 2010-10-01 20:28:02 +02:00
Fabien Potencier 8e5443dfd5 fixed typo 2010-10-01 20:13:25 +02:00
henrikbjorn 56caee0937 renamed |safe to |raw to avoid unnecesarry confusion about what the tags does.
Discussion can be viewed here http://groups.google.com/group/symfony-devs/browse_thread/thread/b927063310c74411. All tests pass.
2010-10-01 19:17:22 +02:00
Fabien Potencier 15f3276676 changed the implementation of template inheritance 2010-10-01 14:17:16 +02:00
Fabien Potencier 5198d20bb1 removed obsolete code 2010-10-01 14:16:04 +02:00
Fabien Potencier e4d3f43664 added a replace filter 2010-10-01 14:16:02 +02:00
Fabien Potencier 3d622e472e added the environment as an argument to initRuntime 2010-09-30 10:10:34 +02:00
Fabien Potencier 05578c8860 added Twig_Template::hasBlock() method 2010-09-30 10:10:16 +02:00
Angelo Vargas 1230c210dc fixed error handling for if tag when a syntax error occurs within a subparse process (closes #131) 2010-09-23 09:11:45 +02:00
Arnaud Le Blanc f7febc0c2c added token parser broker (closes #104)
Twig_Extension::getTokenParsers() can now return an array of
TokenParsers, or a Twig_TokenParserBrokerInterface. This allows
extensions to implement custom logics for resolving token parsers.
2010-09-20 11:17:03 +02:00
Arnaud Le Blanc 4541e88e51 fixed js escaper to be stricter, whilelist-based js escaper (closes #114) 2010-09-14 09:39:10 +02:00
Fabien Potencier 1cf01ce927 added a constant filter (refs #120) 2010-09-12 08:00:21 +02:00
Mark Story 1e9493df29 added the constant() test (closes #120) 2010-09-12 07:50:05 +02:00
Mark Story 2ff6cedbf8 fixed objects with __toString() not being autoescaped (fixes #111) 2010-09-12 07:44:26 +02:00
Fabien Potencier 34b57fac5b fixed filesystem loader should not view directory as a valid template (closes #116) 2010-09-06 08:56:03 +02:00
fivestar a115a0667d fixed SimpleTokenParser accepts comma(",") in grammar 2010-08-31 07:40:36 +02:00