Commit Graph

7732 Commits

Author SHA1 Message Date
Derick Rethans f42cd14d2d Fix efree(NULL) when no arguments are passed in. 2011-07-04 16:06:46 +01:00
nikic 5b91f12ab7 Update tests 2011-07-02 23:53:43 +02:00
nikic a5ef32663b Use Template->getContext in non-strict mode too 2011-07-02 23:44:47 +02:00
nikic e4b8371ab4 Improve performance of is defined in non strict mode 2011-07-02 11:21:49 +02:00
Matthieu Robin 681d2b8b7f fix nested buffers issue #374 2011-07-01 10:35:24 +02:00
Derick Rethans 577169c515 Added missing header and switch arguments for the return around as I got that wrong. 2011-06-30 17:03:00 +01:00
Derick Rethans 2b58fec35d Added support for NULL arguments to CALL_USER_FUNC_ARRAY and made CALL_BOOLEAN use that. 2011-06-30 17:02:27 +01:00
Derick Rethans f7fc1ffed6 Fold TWIG_GET_ARRAY_ELEMENT and TWIG_PROPERTY into one worker function. 2011-06-30 17:01:34 +01:00
Derick Rethans 6e1dd56172 Implement TWIG_GET_CLASS_NAME and make use of it. 2011-06-30 14:36:05 +01:00
Derick Rethans b891ad909a Initialise ret to NULL. 2011-06-30 14:25:00 +01:00
Derick Rethans 828c113fa2 Get rid of TWIG_RETURN_ARRAY_ELEMENT and use TWIG_GET_ARRAY_ELEMENT instead. 2011-06-30 14:24:27 +01:00
Derick Rethans 0cc719add3 Implemented TWIG_THROW_EXCEPTION. 2011-06-30 13:21:57 +01:00
Derick Rethans 701be8bb57 Implemented TWIG_IMPLODE_ARRAY_KEYS. 2011-06-30 13:21:26 +01:00
Derick Rethans 3da24d9fda Fixed logic and implemented normal array key return. 2011-06-30 11:26:25 +01:00
Derick Rethans b918f2ea7b Implemented TWIG_RETURN_ARRAY_ELEMENT. 2011-06-30 11:25:57 +01:00
Derick Rethans e1663e8d0b Re-scope variables. 2011-06-29 12:47:47 +01:00
Derick Rethans 8bc1f0268b Added the cache creating/fetching method in the code. 2011-06-29 12:46:46 +01:00
Derick Rethans 7367cf942b Added the cache fetching method for methods and properties. 2011-06-29 12:46:00 +01:00
Derick Rethans 9d40c9f8c8 Implemented TWIG_CALL_USER_FUNC_ARRAY, TWIG_GET_STATIC_PROPERTY, TWIG_GET_ARRAY_ELEMENT_ZVAL and TWIG_GET_ARRAY_ELEMENT. 2011-06-29 12:44:10 +01:00
Derick Rethans 2078e50de1 - Implemented the strtolower function. 2011-06-29 12:42:34 +01:00
Fabien Potencier 661e9c7ad2 updated CHANGELOG v1.1.0 2011-06-28 08:09:35 +02:00
Fabien Potencier 5e61517a94 merged branch markstory/fix-308 (PR #373)
Commits
-------

eaa8995 Grammatical fix.

Discussion
----------

Grammatical fix.

A small grammatical fix for #308 + PR #372
2011-06-28 08:06:52 +02:00
Mark Story eaa899576c Grammatical fix. 2011-06-27 07:28:17 -04:00
Fabien Potencier cdd8351cf5 merged branch markstory/fix-308 (PR #372)
Commits
-------

c178c28 Making docs more explict as to what kind of object can be used with Twig_Function_Method. Fixes #308

Discussion
----------

Fix for #308

Making docs more explict as to what kind of object can be used with Twig_Function_Method.
Fixes #308
2011-06-27 09:29:21 +02:00
Mark Story c178c2818e Making docs more explict as to what kind of object can be
used with Twig_Function_Method.
Fixes #308
2011-06-26 17:31:56 -04:00
Fabien Potencier 612fa7bc51 fixed json_encode filter (thanks to Koc for the fix) v1.1.0-RC3 2011-06-24 11:26:28 +02:00
Fabien Potencier 066d561e43 prepare 1.1 RC3 2011-06-24 11:07:17 +02:00
Fabien Potencier 83a0cbab91 fixed method case-sensitivity when using the sandbox mode 2011-06-24 11:04:41 +02:00
Fabien Potencier 0496956970 updated CHANGELOG 2011-06-24 10:42:46 +02:00
Fabien Potencier 8a5f6bf63b added doc and fixed CS for previous merge 2011-06-24 10:41:55 +02:00
Fabien Potencier bbf55fe391 merged branch jturmel/patch-1 (PR #367)
Commits
-------

6593761 Allow setting of timezone on twig_date_format_filter method

Discussion
----------

Allow setting of timezone on twig_date_format_filter method
2011-06-24 10:39:24 +02:00
Fabien Potencier d03edac8ae added Sublime Text support in the doc 2011-06-24 10:37:02 +02:00
Fabien Potencier 46a8d8d124 reworded the section on IDEs and added an Eclipse plugin 2011-06-24 10:24:14 +02:00
Andreas Runfalk eb5c9fbcc7 Recipe code formatting fix. New recipe for improved APC bytecode support 2011-06-22 11:03:56 +02:00
Josh Turmel 6593761950 Allow setting of timezone on twig_date_format_filter method 2011-06-21 20:14:00 -07:00
kotas f5b9df98be added if modifier support to for loop like {% for k in v if k is odd %} 2011-06-18 04:00:46 +09:00
Fabien Potencier 027f4890a7 fixed possible security problems with NUL bytes 2011-06-17 09:17:45 +02:00
Fabien Potencier 2c26e6776b releasing 1.1.0 RC2 v1.1.0-RC2 2011-06-17 07:03:39 +02:00
Fabien Potencier a12aec38c3 added Twig_Error::getRawMessage() 2011-06-16 10:04:13 +02:00
Fabien Potencier 47818dd2a1 added an exception when the template passed to "use" is not a string 2011-06-16 09:57:17 +02:00
Fabien Potencier 730f9314a7 merged branch henrikbjorn/issue-347 (PR #348)
Commits
-------

a8d29b1 Add testcase for issue #347

Discussion
----------

Add testcase for issue #347

Dismisses false issue.
2011-06-16 09:45:47 +02:00
Fabien Potencier 4d043d4706 updated CHANGELOG 2011-06-16 09:45:16 +02:00
Fabien Potencier cf50380b8c merged branch nikic/nestedDefinedTestWithStrictVars (PR #359)
Commits
-------

f2a1c2b Refactor and add additional default filter tests
e760483 Make `a.b is defined` not throw an exception if a is not defined (in strict mode)

Discussion
----------

Make `a.b is defined` not throw an exception if a is not defined (in strict mode)

This commit does two things: Firstly (that's the main part) it makes `a.b is defined` not throw an error in strict mode if `a` is undefined (applies for `a.b.c` aso too) [fixes #337]. Additionally it allows `a.b|default` just like it is allowed to do `a|default`.

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

by fabpot at 2011/06/09 22:21:11 -0700

This is quite a big change. Can you add some tests?

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

by nikic at 2011/06/10 08:19:49 -0700

I added some more tests for the default filter in the fixtures. But I wasn't sure how I should test the default test's behavior in strict mode. If you could point me in the right direction here I would add those tests, too ;)
2011-06-16 09:41:50 +02:00
Fabien Potencier 6c442bd9ba updated CHANGELOG 2011-06-16 09:41:31 +02:00
Fabien Potencier 403151ba48 merged branch arnaud-lb/line-numbers (PR #353)
Commits
-------

5ec1955 added {% line \d+ %} directive

Discussion
----------

added {% line \d+ %} directive

This directive allows to change the current line number in the tokenizer.

This allows to generate Twig code from some other Twig or partially-Twig script, and still get relevant line numbers in error messages, when the line numbers of the generated Twig script do not match those of the original script.

For example in the following script:

    foo
    {% line 10 %}
    bar
    {{ baz }}

`"foo"` is on line 1, `"bar"` is considered to be on line 10 and `{{ baz }}` is considered to be on line 11.

This is similar to `# line ...` directives in C.

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

by nikic at 2011/06/05 08:51:20 -0700

I don't quite yet understand it's use cases.

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

by arnaud-lb at 2011/06/05 09:17:57 -0700

The `{% line ... %}` directive is not meant to be used by humans, but rather by generators.

The use case is the same as [#line directives in C](http://gcc.gnu.org/onlinedocs/cpp/Line-Control.html): when you generate a C file from a template, you would prefer that the compiler refers to the line number of the template, instead of the line number of the generated file.

In my case, I built a [HAML compiler for php](https://github.com/arnaud-lb/MtHaml) which can target Twig as an output language. I use it as a Twig pre-processor so that it translates HAML scripts to Twig scripts on the fly in a custom Twig_Loader.

So I have scripts like that:

    %p
      test
    %div = foo.bar

which is compiled like that:

    <p>
      test
    </p>
    <div>
       {{ foo.bar }}
    </div>

If an error occurs in the execution of {{ foo.bar }}, Twig will throw an error refering to line 5 in the original script, which is wrong. A simple solution to this is the {% line %} directive:

    <p>
      test
    </p>
    <div>
    {% line 3 %}
       {{ foo.bar }}
    </div>

Now if an error occures in {{ foo.bar }}, the error will refer to line 3.

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

by nikic at 2011/06/05 09:33:26 -0700

Ah, okay, seems reasonable. Though I'm not sure whether it is appropriate to use the comment syntax to accomplish that.

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

by arnaud-lb at 2011/06/05 10:41:03 -0700

You are right, I changed the request to use the block syntax instead.
2011-06-16 09:31:53 +02:00
Fabien Potencier b340d98d98 added null as an alias for the none test 2011-06-14 08:19:32 +02:00
nikic f2a1c2b539 Refactor and add additional default filter tests 2011-06-10 16:50:20 +02:00
nikic e760483287 Make a.b is defined not throw an exception if a is not defined (in strict mode) 2011-06-09 20:50:48 +02:00
Derick Rethans e133074da1 - The extension now loads and the pseudo code is mostly ready. 2011-06-08 16:24:53 +01:00
Derick Rethans 1b96539ecb - The parse parameters line was wrong, it still had the extra one that was
removed in Twig itself already.
2011-06-08 13:28:48 +01:00