- /**
- * @brief Register template engine class
- *
- * @param string $class
- */
- private function registerTemplateEngine($class)
- {
- $v = get_class_vars($class);
- if (!empty($v['name'])) {
- $name = $v['name'];
- $this->template_engines[$name] = $class;
- } else {
- echo "template engine <tt>$class</tt> cannot be registered without a name.\n";
- die();
- }
- }
-
- /**
- * @brief Return template engine instance.
- *
- * If $name is not defined, return engine defined by theme,
- * or default
- *
- * @return object Template Engine instance
- */
- public function getTemplateEngine()
- {
- $template_engine = defaults($this->theme, 'template_engine', 'smarty3');
-
- if (isset($this->template_engines[$template_engine])) {
- if (isset($this->template_engine_instance[$template_engine])) {
- return $this->template_engine_instance[$template_engine];
- } else {
- $class = $this->template_engines[$template_engine];
- $obj = new $class;
- $this->template_engine_instance[$template_engine] = $obj;
- return $obj;
- }
- }
-
- echo "template engine <tt>$template_engine</tt> is not registered!\n";
- exit();
- }
-
- /**
- * @brief Returns the active template engine.
- *
- * @return string the active template engine
- */
- public function getActiveTemplateEngine()
- {
- return $this->theme['template_engine'];
- }
-
- /**
- * sets the active template engine
- *
- * @param string $engine the template engine (default is Smarty3)
- */
- public function setActiveTemplateEngine($engine = 'smarty3')
- {
- $this->theme['template_engine'] = $engine;
- }
-
- /**
- * Gets the right delimiter for a template engine
- *
- * Currently:
- * Internal = ''
- * Smarty3 = '{{'
- *
- * @param string $engine The template engine (default is Smarty3)
- *
- * @return string the right delimiter
- */
- public function getTemplateLeftDelimiter($engine = 'smarty3')
- {
- return $this->ldelim[$engine];
- }
-
- /**
- * Gets the left delimiter for a template engine
- *
- * Currently:
- * Internal = ''
- * Smarty3 = '}}'
- *
- * @param string $engine The template engine (default is Smarty3)
- *
- * @return string the left delimiter
- */
- public function getTemplateRightDelimiter($engine = 'smarty3')
- {
- return $this->rdelim[$engine];
- }
-