Browse code

partially reverted the previous commit

git-svn-id: http://svn.twig-project.org/trunk@227 93ef8e89-cb99-4229-a87c-7fa0fa45744b

fabien authored on 14/01/2010 12:36:32
Showing 3 changed files
... ...
@@ -16,7 +16,6 @@ class Twig_Environment
16 16
   protected $charset;
17 17
   protected $loader;
18 18
   protected $trimBlocks;
19
-  protected $strictMode;
20 19
   protected $debug;
21 20
   protected $autoReload;
22 21
   protected $cache;
... ...
@@ -57,11 +56,6 @@ class Twig_Environment
57 56
    *  * auto_reload: Whether to reload the template is the original source changed.
58 57
    *    If you don't provide the auto_reload option, it will be
59 58
    *    determined automatically base on the debug value.
60
-   *
61
-   *  * strict_mode: Whether to enable the strict mode or not. If enabled,
62
-   *    everything must be explicit. For instance, all variables must be
63
-   *    declared at the top of the template, you must pass explicitely the variables
64
-   *    when including another template, and so on. If not, a StrictError is thrown.
65 59
    */
66 60
   public function __construct(Twig_LoaderInterface $loader = null, $options = array())
67 61
   {
... ...
@@ -70,7 +64,6 @@ class Twig_Environment
70 64
       $this->setLoader($loader);
71 65
     }
72 66
 
73
-    $this->strictMode         = isset($options['strict_mode']) ? (bool) $options['strict_mode'] : false;
74 67
     $this->debug              = isset($options['debug']) ? (bool) $options['debug'] : false;
75 68
     $this->trimBlocks         = isset($options['trim_blocks']) ? (bool) $options['trim_blocks'] : false;
76 69
     $this->charset            = isset($options['charset']) ? $options['charset'] : 'UTF-8';
... ...
@@ -91,21 +84,6 @@ class Twig_Environment
91 84
     $this->baseTemplateClass = $class;
92 85
   }
93 86
 
94
-  public function enableStrictMode()
95
-  {
96
-    $this->strictMode = true;
97
-  }
98
-
99
-  public function disableStrictMode()
100
-  {
101
-    $this->strictMode = false;
102
-  }
103
-
104
-  public function isStrictMode()
105
-  {
106
-    return $this->strictMode;
107
-  }
108
-
109 87
   public function enableDebug()
110 88
   {
111 89
     $this->debug = true;
... ...
@@ -30,7 +30,6 @@ class Twig_Extension_Core extends Twig_Extension
30 30
       new Twig_TokenParser_Import(),
31 31
       new Twig_TokenParser_Set(),
32 32
       new Twig_TokenParser_Debug(),
33
-      new Twig_TokenParser_Use(),
34 33
     );
35 34
   }
36 35
 
... ...
@@ -41,10 +40,7 @@ class Twig_Extension_Core extends Twig_Extension
41 40
    */
42 41
   public function getNodeVisitors()
43 42
   {
44
-    return array(
45
-      new Twig_NodeVisitor_Filter(),
46
-      new Twig_NodeVisitor_StrictMode()
47
-    );
43
+    return array(new Twig_NodeVisitor_Filter());
48 44
   }
49 45
 
50 46
   /**
... ...
@@ -12,7 +12,6 @@
12 12
 class Twig_Node_Expression_Name extends Twig_Node_Expression
13 13
 {
14 14
   protected $name;
15
-  protected $declared = false;
16 15
 
17 16
   public function __construct($name, $lineno)
18 17
   {
... ...
@@ -27,23 +26,11 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression
27 26
 
28 27
   public function compile($compiler)
29 28
   {
30
-    if ($this->declared)
31
-    {
32
-      $compiler->raw(sprintf('$context[\'%s\']', $this->name));
33
-    }
34
-    else
35
-    {
36
-      $compiler->raw(sprintf('(isset($context[\'%s\']) ? $context[\'%s\'] : null)', $this->name, $this->name));
37
-    }
29
+    $compiler->raw(sprintf('(isset($context[\'%s\']) ? $context[\'%s\'] : null)', $this->name, $this->name));
38 30
   }
39 31
 
40 32
   public function getName()
41 33
   {
42 34
     return $this->name;
43 35
   }
44
-
45
-  public function setDeclared()
46
-  {
47
-    $this->declared = true;
48
-  }
49 36
 }