Commit Graph

623 Commits

Author SHA1 Message Date
Nils Langner 389f2c2603 Changed mode from 0755 to 0644 2011-10-25 16:49:17 +02:00
Nils Langner c48bd2f809 Fixed wrong used PHPDoc tags 2011-10-25 14:32:16 +02:00
Fabien Potencier d10966132b added Twig_Environment::display() 2011-10-17 13:01:40 +02:00
Fabien Potencier f6961d558d simplified some code 2011-10-17 02:48:36 +02:00
Fabien Potencier e7347160cb added an optimization when the same temporary variable would have been created twice 2011-10-16 22:18:02 +02:00
Fabien Potencier 344043e891 made the escape filter smarter when the encoding is not supported by PHP 2011-10-16 11:12:08 +02:00
Fabien Potencier c015e8184a added a convert_encoding filter 2011-10-16 11:12:06 +02:00
Fabien Potencier 846a2c134d added a Twig_Node_Expression_DefaultFilter to replace the current way of dealing with default filters 2011-10-16 05:46:09 +02:00
Fabien Potencier ac3bb814d5 added public getters on the environment to be able to get various stuff 2011-10-15 10:57:18 +02:00
Fabien Potencier df47659e9d fixed exception 2011-10-15 01:10:30 +02:00
Fabien Potencier dd0546eaa9 refactored Twig_Node_Expression_GetAttr for better readability of compiled templates 2011-10-08 14:27:18 +02:00
Fabien Potencier a68425118d optimized variable access when possible 2011-10-08 14:27:18 +02:00
Fabien Potencier 4a91f4ff34 refactored 'defined' test and 'default' filter
Node manipulations have been moved outside the compile() method.
That's needed if we want to be able to visit all nodes that will be
compiled.
2011-10-08 14:27:18 +02:00
Fabien Potencier e76fc0cb55 optimized lexer by pre-computing regexes 2011-10-08 14:27:18 +02:00
Fabien Potencier bd5687ee10 made an optimization by removing array_merge usage 2011-10-08 14:27:18 +02:00
Fabien Potencier 4c2ecdb61d bumped version to 1.4.0-DEV 2011-10-08 14:05:18 +02:00
Fabien Potencier 4b929992df prepared the 1.3.0-RC1 release 2011-10-08 14:04:10 +02:00
Fabien Potencier 5c1277eb8a prepared the 1.3.0-RC1 release 2011-10-04 09:58:29 +02:00
Fabien Potencier 6c6a44fa84 fixed optimizer 2011-09-30 22:49:47 +02:00
Fabien Potencier d340339ae0 fixed wrong node type for the for tag 2011-09-30 17:11:02 +02:00
Fabien Potencier 3e66e3e9c0 added an optimization for simple variables output 2011-09-30 17:11:02 +02:00
Fabien Potencier e0cd76614f fixed hardcoded name escaping 2011-09-30 17:10:56 +02:00
Fabien Potencier 6d5a070fac merged branch phiamo/master (PR #454)
Commits
-------

5fa0094 Added Capability to format DateInterval via twig date filter

Discussion
----------

Added Capability to format DateInterval via twig date filter

hi,
i was wondering why twig couldn't format my DateInterval and added it.

Either this is ok for you or we should add something similar for DateInterval because it uses a little bit different syntax to format its string (e.g. prepend with "%")

Cheers Phil
2011-09-29 16:46:39 +02:00
Oleg Efimov 68ec644936 FloorDiv (//) should return integer value according to documentation 2011-09-29 13:24:03 +04:00
phiamo 5fa00942dd Added Capability to format DateInterval via twig date filter 2011-09-29 02:44:55 +02:00
Fabien Potencier f96d8d8219 added an optimization for the parent() function 2011-09-27 14:17:34 +02:00
Fabien Potencier d9d38d6c1e added a note about the usage of Twig_Template methods 2011-09-27 14:06:47 +02:00
Fabien Potencier 5446d45f6e made a small optimization when a macro does not take any argument 2011-09-24 14:20:57 +02:00
Fabien Potencier d472d21515 added cache reloading when auto_reload is true and an extension has been modified 2011-09-24 08:05:14 +02:00
Fabien Potencier 46080c90ea added the possibility to force the escaping of a string already marked as safe 2011-09-22 21:57:09 +02:00
Fabien Potencier d101a05976 added traits support for the parent function 2011-09-22 14:06:20 +02:00
Fabien Potencier 56f82db1a1 allowed empty templates to be used as traits 2011-09-22 11:51:48 +02:00
Fabien Potencier a7fdec2383 bumped version to 1.3.0-DEV 2011-09-22 11:30:08 +02:00
Fabien Potencier 4a5057997d prepared 1.2.0 release 2011-09-13 17:01:30 +02:00
Fabien Potencier 8c086d7560 prepared 1.2.0-RC1 release 2011-09-10 08:57:30 +02:00
Fabien Potencier 4ea393adb0 added an exception for unclosed tags 2011-09-06 13:45:10 +02:00
Max Romanovsky 4b95621c0f Added: Countable interface support for empty test 2011-09-04 15:13:42 +03:00
Fabien Potencier 9c2065facc removed some loop variable when using an if statement in a for loop 2011-09-01 10:41:03 +02:00
Fabien Potencier 39774a1118 made a markup refactoring 2011-09-01 10:33:25 +02:00
Fabien Potencier f20450d13d fixed algorithm that determines if a template using inheritance is valid (no output between block definitions) 2011-09-01 08:13:26 +02:00
Fabien Potencier 2be5bc986a tweaked an error message 2011-09-01 08:06:05 +02:00
Fabien Potencier 6473f22fa6 fixed resolveTemplate() method (we only catch loader exceptions) 2011-08-30 22:58:17 +02:00
Fabien Potencier 453c3e8b00 added better support for encoding problems when escaping a string (available as of PHP 5.4)
From the PHP CHANGELOG:

The flag ENT_SUBSTITUTE makes invalid multibyte sequences be replaced by
U+FFFD (UTF-8) or &#FFFD; by htmlspecialchars and htmlentities. It is an
alternative to the default behavior, which just returns an empty string and to
ENT_IGNORE, which is a security risk. The behavior follows the recommendations
of Unicode Technical Report #36.
2011-08-30 07:38:41 +02:00
Fabien Potencier ca3d5a821d simplified previous merge 2011-08-29 18:47:24 +02:00
Fabien Potencier b1bfb14d46 fixed CS 2011-08-29 18:27:12 +02:00
Joel Wurtz 4dc490fbd5 Removing array_shift for optimisation.
For example we check if a template and use exception to redirect to a default template

Before : We checked ~1000 times => 100sec due to array_shift
After  : ~1sec
2011-08-30 06:02:31 +03:00
Fabien Potencier 4402ee2c1d added support for an array of templates to the "extends" tag 2011-08-27 20:34:02 +02:00
Fabien Potencier c56dd32f57 added a way to ignore a missing template when using the "include" tag 2011-08-27 14:02:05 +02:00
Fabien Potencier 35a8a0d155 added support for an array of templates to the include tag 2011-08-27 13:58:36 +02:00
Fabien Potencier b5b25334fe merged branch jturmel/master (PR #403)
Commits
-------

c2c01de Add bitwise operators to core

Discussion
----------

Added bitwise operators (and, xor, or) to core

* Added bitwise operators (and, xor, or) to core

---------------------------------------------------------------------------

by nikic at 2011/08/02 21:02:14 -0700

I'm not sure bitwise ops really belong into a templateing language...

---------------------------------------------------------------------------

by jturmel at 2011/08/02 21:06:02 -0700

That's a general statement to make without knowing why it was implemented at all... no one is forced to use them, however when you do need them, them not being available makes you have relegate something that should be in the view in the particular case I needed them, to be done in a controller instead, which would be quite a bit nastier in my case.

---------------------------------------------------------------------------

by nikic at 2011/08/02 23:23:30 -0700

@jturmel: I do not doubt that there are some cases where bitwise operations are useful. I can't think of one of the top of my head, though I imagine that it could be useful when using bitwise right management or something like that. What I was trying to say is, that I don't really believe that there are enough significant use cases for bitwise ops to justify adding them to the core (I know, "You Don't Have To Use It!", but it isn't good to clutter the core with features nearly no one uses). Maybe you could give an example of what you needed them for?

---------------------------------------------------------------------------

by jturmel at 2011/08/02 23:41:36 -0700

It would be one thing if I was implementing some operator that didn't normally exist in PHP itself, but it seems a bit odd to even say that it's cluttering it up, it's 3 lines of code that add 3 missing standard operators from PHP.

Simply put, I have an object that gets passed to the template that has many properties, these properties are bit values, I need to do checks on them to select/deselect various checkboxes in a grid... this is the cleanest way to do it without mudding up controller code with view logic.

---------------------------------------------------------------------------

by jalliot at 2011/08/03 01:42:56 -0700

Why not adding ``<<`` and ``>>`` then @jturmel?
I don't have a particular use case but I think that if Twig includes those 3 operators, it should also support these 2 to be "complete". What do you think?

---------------------------------------------------------------------------

by jturmel at 2011/08/03 06:07:46 -0700

Of course, if you guys think we need the shifting operators as well, we can... but modifying data in the view seems much less practical than the one's I added, although I did miss NOT.

---------------------------------------------------------------------------

by jalliot at 2011/08/03 06:16:38 -0700

I forgot about ``~`` but sure it should be included as well.
As for ``<<`` and ``>>``, they could also be used for verifying grant access for example in some implementations.
``{% if some_var << some_other_var & 1 %}``
2011-08-27 11:10:29 +02:00