mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 19:36:43 +00:00
partially reverted the previous commit
git-svn-id: http://svn.twig-project.org/trunk@227 93ef8e89-cb99-4229-a87c-7fa0fa45744b
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user