示例#1
0
 /**
  * Constructor
  *
  * @param KObjectConfig $config   An optional ObjectConfig object with configuration options
  */
 public function __construct(KObjectConfig $config)
 {
     parent::__construct($config);
     //Reset the stack
     $this->_stack = array();
     //Intercept template exception
     $this->getObject('exception.handler')->addHandler(array($this, 'handleException'), true);
 }
示例#2
0
 /**
  * Constructor
  *
  * @param KObjectConfig $config   An optional ObjectConfig object with configuration options
  */
 public function __construct(KObjectConfig $config)
 {
     parent::__construct($config);
     //Set the markdown compiler
     if ($config->compiler) {
         $this->setCompiler($config->compiler);
     }
 }
示例#3
0
 /**
  * Constructor
  *
  * @param KObjectConfig $config   An optional ObjectConfig object with configuration options
  */
 public function __construct(KObjectConfig $config)
 {
     parent::__construct($config);
     //Reset the stack
     $this->_stack = array();
     $self = $this;
     $this->_mustache = new Mustache_Engine(array('loader' => $this, 'cache' => $this->_cache ? $this->_cache_path : null, 'escape' => function ($value) use($self) {
         return $self->getTemplate()->escape($value);
     }, 'strict_callables' => $this->getConfig()->strict_callables, 'pragmas' => $this->getConfig()->pragmas, 'helpers' => $this->_functions));
 }
示例#4
0
 /**
  * Constructor
  *
  * @param KObjectConfig $config   An optional ObjectConfig object with configuration options
  */
 public function __construct(KObjectConfig $config)
 {
     parent::__construct($config);
     //Reset the stack
     $this->_stack = array();
     $this->_twig = new Twig_Environment($this, array('cache' => $this->_cache ? $this->_cache_path : false, 'auto_reload' => $this->_cache_reload, 'debug' => $config->debug, 'autoescape' => $config->autoescape, 'strict_variables' => $config->strict_variables, 'optimizations' => $config->optimizations));
     //Register functions in twig
     foreach ($this->_functions as $name => $callable) {
         $function = new Twig_SimpleFunction($name, $callable);
         $this->_twig->addFunction($function);
     }
 }