Commit Graph

1312 Commits

Author SHA1 Message Date
Fabien Potencier c5ef990807 merged branch andrerom/patch-1 (PR #658)
Commits
-------

be07174 Added @return doc on Twig_LoaderInterface->isFresh()
8315992 Added missing @throws in Twig_LoaderInterface

Discussion
----------

Added missing @throws in Twig_LoaderInterface

Based on Twig_Loader_Chain implementation, this seems to be the possible exception that can be thrown by loaders.
2012-03-10 19:52:41 +01:00
andrerom be0717431c Added @return doc on Twig_LoaderInterface->isFresh() 2012-03-10 16:58:52 +01:00
andrerom 8315992979 Added missing @throws in Twig_LoaderInterface
Based on Twig_Loader_Chain implementation, this seems to be the possible exceptions that can be thrown by loaders.
2012-03-10 16:39:02 +01:00
Fabien Potencier 9f322ab2fd fixed typo 2012-03-01 15:11:11 +01:00
Fabien Potencier e765183c62 fixed previous commit 2012-02-29 22:20:34 +01:00
Fabien Potencier a64a98431f merged branch robo47/docs-install-via-composer (PR #648)
Commits
-------

7153ff6 Installing twig via composer

Discussion
----------

Installing twig via composer

Installing twig via composer
2012-02-29 22:18:38 +01:00
Fabien Potencier c18a0e60fe bumped Twig version 2012-02-29 22:10:49 +01:00
Fabien Potencier 75b954c183 fixed typo in the doc 2012-02-29 22:02:48 +01:00
Fabien Potencier e9cfd2ec85 fixed typos in the doc 2012-02-29 22:00:20 +01:00
Fabien Potencier 30929fde86 prepared the 1.6.1 release v1.6.1 2012-02-29 21:46:35 +01:00
Fabien Potencier 741b11c618 fixed Twig C extension 2012-02-28 23:19:54 +01:00
Fabien Potencier 8274e84d4e fixed CS 2012-02-28 23:19:54 +01:00
Fabien Potencier 9573f2213c added some unit tests 2012-02-28 23:19:50 +01:00
Benjamin Steininger 7153ff6c32 Installing twig via composer 2012-02-27 11:10:31 +01:00
Fabien Potencier 01f733f4b5 added some more information on the spaceless tag documentation 2012-02-21 11:44:24 +01:00
Fabien Potencier 2fb20cdf77 added some information about Twig_Template::getContext() and made it final 2012-02-19 11:09:47 +01:00
Fabien Potencier 229239a0b0 Revert "merged branch m0ppers/master (PR #611)"
This reverts commit 5f4e6d7a0e, reversing
changes made to a61d42084c.
2012-02-19 11:03:22 +01:00
Fabien Potencier 5e11c672de updated CHANGELOG 2012-02-18 10:35:52 +01:00
Fabien Potencier 5f4e6d7a0e merged branch m0ppers/master (PR #611)
Commits
-------

71449e8 Remove optimization (covered by Optimization VAR_ACCESS anyway)

Discussion
----------

Remove optimization (covered by Optimization VAR_ACCESS anyway)

I have an own template class implementing getContext() and this one drove me completely mad after a twig upgrade.

After compilation the resulting templates have:

isset($context['bla'])

vs.

$this->getContext('bla')

Changing the Name Node however didn't have any effect and i saw that due to the optimizations by the SetTemp class twig doesn't even reach the Name Node. In fact SetTemp has the isset optimization hardcoded (which is ok).

I could simply fix my issue by setting optimizations to -9 (all optimizations except VAR_ACCESS). However the issue will reappear immediately when using PHP 5.4. Please remove the isset stuff from the non optimized node and let the optimization handler handle it (which i would disable in my case)

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

by m0ppers at 2012-01-24T17:42:07Z

some hackish script to test what i mean

<?php
require 'lib/Twig/Autoloader.php';
Twig_Autoloader::register();

abstract class Harxtemplate extends Twig_Template
{
    public function getContext($context, $item, $ignoreStrictCheck = false)
    {
        if ($item == "hans") {
            return "hund";
        } else {
            return parent::getContext($context, $item, $ignorStrictCheck);
        }
    }
}

$template = <<<EOT
Der {{ hans }} hat hund
{% if hans %}
hund
{% endif %}
EOT;

$loader = new Twig_Loader_String();
$options = array('base_template_class' => 'Harxtemplate',
//                 'strict_variables' => true, // doesn't work
                 'debug' => true,
                 'optimizations' => -1, // 0 => works
                );
$twig = new Twig_Environment($loader, $options);

echo $twig->render($template);
2012-02-18 10:18:43 +01:00
Fabien Potencier a61d42084c clarified documentation (closes #602) 2012-02-18 10:05:10 +01:00
Fabien Potencier 9e590e910d merged branch mvrhov/patch-1 (PR #603)
Commits
-------

95f8af7 cast $name to a string as $name can in fact be an object implementing __toString function as true in my case.

Discussion
----------

cast $name to a string ...

... because $name can be an object implementing __toString. I have Enum type implementation which implements __toString. Without the cast I'm getting the following exception:
"An exception has been thrown during the rendering of a template ("Warning: Illegal offset type in isset or empty in... "

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

by fabpot at 2012-01-18T08:43:23Z

From where do you call these methods? from your code? from a template?

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

by mvrhov at 2012-01-18T11:17:55Z

I put the enum object as variable into the template and then based on the enum value I display a block.
2012-02-18 10:00:52 +01:00
Fabien Potencier 07385f6a2c updated CHANGELOG 2012-02-18 09:55:38 +01:00
Fabien Potencier c75d5952e3 merged branch Seldaek/markup (PR #638)
Commits
-------

e4590d0 Avoid creating unnecessary Twig_Markup instances, allows testing for falsiness of empty output

Discussion
----------

Avoid creating unnecessary Twig_Markup instances

This allows testing for falsiness of an empty output:

```jinja
{% set foo %}{% block lala %}{% endblock %}{% endset %}

{% if foo %}
   some output with {{ foo }}
{% endif %}
```

Currently this requires `{% if foo|length %}` since the set tag will always return a Twig_Markup.
2012-02-18 09:54:30 +01:00
Jordi Boggiano e4590d0cd8 Avoid creating unnecessary Twig_Markup instances, allows testing for falsiness of empty output 2012-02-17 15:56:34 +01:00
Fabien Potencier 4b1a8e2798 added phpdoc (closes #627) 2012-02-17 14:16:13 +01:00
Fabien Potencier 4dee4e5841 updated the CHANGELOG and documentation for previous merge 2012-02-15 17:29:31 +01:00
Fabien Potencier f907eb4ac5 fixed previous merge 2012-02-15 17:24:22 +01:00
Fabien Potencier 7d30dc6f04 merged branch mlehner/default_timezone (PR #635)
Commits
-------

5699753 added setTimezone to allow globally overriding the timezone when formating dates

Discussion
----------

Allow setting global timezone for date formatting

My API returns dates in a string format of 2012-02-14T00:35:37+00:00. When parsed by the DateTime constructor, the timezone for that new object is UTC. Without specifying every time I use the date filter there was no way to globally influence the timezone used.

I added setTimezone() to the core extension that functions similar to setDateFormat() except that there is no timezone set by default to allow for backwards compatibility.
2012-02-15 17:21:29 +01:00
Matt Lehner 56997536b9 added setTimezone to allow globally overriding the timezone when formating dates 2012-02-14 14:52:51 -05:00
Fabien Potencier 1bfeed24c2 merged branch webwizard/patch-1 (PR #628)
Commits
-------

904dfef fixed typo

Discussion
----------

fixed typo
2012-02-12 20:28:11 +01:00
Victor Zamfir 904dfefb0b fixed typo 2012-02-12 21:10:01 +02:00
Fabien Potencier 4478816e41 removed usage of assertInstanceOf as if is not available when using PHPUnit on PHP 5.2.* 2012-02-06 18:16:12 +01:00
Fabien Potencier 5dd0aaec16 added more safeguards in unit tests to support different configuraitons 2012-02-06 16:21:45 +01:00
Fabien Potencier 2bcd60c9a8 updated CHANGELOG 2012-02-06 10:05:54 +01:00
Fabien Potencier 3561a45c85 added some unit tests for previous merge 2012-02-06 10:03:50 +01:00
Fabien Potencier 0150fdf8db fixes CS 2012-02-06 10:01:07 +01:00
Fabien Potencier 41927410d9 merged branch sv1l/master (PR #623)
Commits
-------

b6007f1 Fixed slice filter w/ null length for string values

Discussion
----------

Fixed issue #622: strings slice filter w/ no length

Fixed issue [#622](https://github.com/fabpot/Twig/issues/622)
2012-02-06 09:58:24 +01:00
Sylvain Dethier b6007f1cd5 Fixed slice filter w/ null length for string values 2012-02-05 18:37:26 +01:00
Fabien Potencier 5b5de2c743 fixed the creation of the cache directory in case of a race condition (closes #620) 2012-02-04 09:40:09 +01:00
Fabien Potencier 203945602b bumped version to 1.7.0-DEV 2012-02-04 08:38:29 +01:00
Fabien Potencier 9154d27622 prepared the 1.6.0 release v1.6.0 2012-02-04 08:34:52 +01:00
Fabien Potencier 8256bfa05c added missing entry in the doc 2012-01-31 11:57:59 +01:00
Fabien Potencier 310020ac98 fixed raw blocks when used with the whitespace trim option (closes #617) 2012-01-28 17:45:54 +01:00
Fabien Potencier 0eadacf6ba added some unit tests for the reverse filter when charset is not UTF-8 2012-01-28 17:12:21 +01:00
Fabien Potencier 12042e0880 added some unit tests for random() when charset is not UTF-8 2012-01-28 17:09:25 +01:00
Fabien Potencier 36d392b0de fixed previous commit 2012-01-28 16:58:52 +01:00
Fabien Potencier bc80f48f6a fixed the random() function on strings when the charset is not UTF-8
(refs #614)
2012-01-27 08:25:05 +01:00
Fabien Potencier bf61cc5344 fixed CS 2012-01-26 15:06:15 +01:00
Fabien Potencier 3bec772bea merged branch Tobion/test-coverage (PR #615)
Commits
-------

814cefd improve test coverage and support negative int for random function

Discussion
----------

improve test coverage and support negative int for random function
2012-01-26 15:06:02 +01:00
Tobias Schultze 814cefdad7 improve test coverage and support negative int for random function 2012-01-26 14:52:41 +01:00