* 0.9.10
+ * made the Escaper and Optimizer extensions enabled by default
* fixed sandbox extension when used with auto output escaping
* fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved)
* added an Optimizer extension
escaped HTML.
>**NOTE**
->Escaping is only supported if the *escaper* extension has been enabled.
+>Escaping is only supported if the *escaper* extension has been enabled (which
+>is the default).
### Working with Manual Escaping
### Working with Automatic Escaping
-Automatic escaping is enabled when the `escaper` extension has been enabled.
-
Whether automatic escaping is enabled or not, you can mark a section of a
template to be escaped or not by using the `autoescape` tag:
* *Twig_Extension_Optimizer*: Optimizers the node tree before compilation (as
of Twig 0.9.10).
+The core, escaper, and optimizer extensions do not need to be added to the
+Twig environment, as they are registered by default. You can disable an
+already registered extension:
+
+ [php]
+ $twig->removeExtension('escaper');
+
Built-in Extensions
-------------------
* `escape`
* `e`
-The core extension does not need to be added to the Twig environment, as it is
-registered by default.
-
### Escaper Extension
The `escaper` extension adds automatic output escaping to Twig. It defines a
$this->charset = isset($options['charset']) ? $options['charset'] : 'UTF-8';
$this->baseTemplateClass = isset($options['base_template_class']) ? $options['base_template_class'] : 'Twig_Template';
$this->autoReload = isset($options['auto_reload']) ? (bool) $options['auto_reload'] : $this->debug;
- $this->extensions = array('core' => new Twig_Extension_Core());
+ $this->extensions = array(
+ 'core' => new Twig_Extension_Core(),
+ 'escaper' => new Twig_Extension_Escaper(),
+ 'optimizer' => new Twig_Extension_Optimizer(),
+ );
$this->strictVariables = isset($options['strict_variables']) ? (bool) $options['strict_variables'] : false;
$this->runtimeInitialized = false;
if (isset($options['cache']) && $options['cache']) {