From 18933dfbb6740a3602668c959ace324a4ff2d3ba Mon Sep 17 00:00:00 2001 From: fabien Date: Thu, 14 Jan 2010 12:36:32 +0000 Subject: [PATCH] partially reverted the previous commit git-svn-id: http://svn.twig-project.org/trunk@227 93ef8e89-cb99-4229-a87c-7fa0fa45744b --- lib/Twig/Environment.php | 22 ---------------------- lib/Twig/Extension/Core.php | 6 +----- lib/Twig/Node/Expression/Name.php | 15 +-------------- 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 5576df8..c691d97 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -16,7 +16,6 @@ class Twig_Environment protected $charset; protected $loader; protected $trimBlocks; - protected $strictMode; protected $debug; protected $autoReload; protected $cache; @@ -57,11 +56,6 @@ class Twig_Environment * * auto_reload: Whether to reload the template is the original source changed. * If you don't provide the auto_reload option, it will be * determined automatically base on the debug value. - * - * * strict_mode: Whether to enable the strict mode or not. If enabled, - * everything must be explicit. For instance, all variables must be - * declared at the top of the template, you must pass explicitely the variables - * when including another template, and so on. If not, a StrictError is thrown. */ public function __construct(Twig_LoaderInterface $loader = null, $options = array()) { @@ -70,7 +64,6 @@ class Twig_Environment $this->setLoader($loader); } - $this->strictMode = isset($options['strict_mode']) ? (bool) $options['strict_mode'] : false; $this->debug = isset($options['debug']) ? (bool) $options['debug'] : false; $this->trimBlocks = isset($options['trim_blocks']) ? (bool) $options['trim_blocks'] : false; $this->charset = isset($options['charset']) ? $options['charset'] : 'UTF-8'; @@ -91,21 +84,6 @@ class Twig_Environment $this->baseTemplateClass = $class; } - public function enableStrictMode() - { - $this->strictMode = true; - } - - public function disableStrictMode() - { - $this->strictMode = false; - } - - public function isStrictMode() - { - return $this->strictMode; - } - public function enableDebug() { $this->debug = true; diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index d6dbd4c..3ae0905 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -30,7 +30,6 @@ class Twig_Extension_Core extends Twig_Extension new Twig_TokenParser_Import(), new Twig_TokenParser_Set(), new Twig_TokenParser_Debug(), - new Twig_TokenParser_Use(), ); } @@ -41,10 +40,7 @@ class Twig_Extension_Core extends Twig_Extension */ public function getNodeVisitors() { - return array( - new Twig_NodeVisitor_Filter(), - new Twig_NodeVisitor_StrictMode() - ); + return array(new Twig_NodeVisitor_Filter()); } /** diff --git a/lib/Twig/Node/Expression/Name.php b/lib/Twig/Node/Expression/Name.php index fae4c9b..439a4b3 100644 --- a/lib/Twig/Node/Expression/Name.php +++ b/lib/Twig/Node/Expression/Name.php @@ -12,7 +12,6 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression { protected $name; - protected $declared = false; public function __construct($name, $lineno) { @@ -27,23 +26,11 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression public function compile($compiler) { - if ($this->declared) - { - $compiler->raw(sprintf('$context[\'%s\']', $this->name)); - } - else - { - $compiler->raw(sprintf('(isset($context[\'%s\']) ? $context[\'%s\'] : null)', $this->name, $this->name)); - } + $compiler->raw(sprintf('(isset($context[\'%s\']) ? $context[\'%s\'] : null)', $this->name, $this->name)); } public function getName() { return $this->name; } - - public function setDeclared() - { - $this->declared = true; - } } -- 1.7.2.5