protected $charset;
protected $loader;
protected $trimBlocks;
- protected $strictMode;
protected $debug;
protected $autoReload;
protected $cache;
* * 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())
{
$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';
$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;
new Twig_TokenParser_Import(),
new Twig_TokenParser_Set(),
new Twig_TokenParser_Debug(),
- new Twig_TokenParser_Use(),
);
}
*/
public function getNodeVisitors()
{
- return array(
- new Twig_NodeVisitor_Filter(),
- new Twig_NodeVisitor_StrictMode()
- );
+ return array(new Twig_NodeVisitor_Filter());
}
/**
class Twig_Node_Expression_Name extends Twig_Node_Expression
{
protected $name;
- protected $declared = false;
public function __construct($name, $lineno)
{
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;
- }
}