aboutsummaryrefslogtreecommitdiffstats
path: root/include/template_processor.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/template_processor.php')
-rwxr-xr-x[-rw-r--r--]include/template_processor.php28
1 files changed, 20 insertions, 8 deletions
diff --git a/include/template_processor.php b/include/template_processor.php
index 61526e570..74acc9c67 100644..100755
--- a/include/template_processor.php
+++ b/include/template_processor.php
@@ -1,7 +1,11 @@
<?php
+ require_once 'include/ITemplateEngine.php';
+
define ("KEY_NOT_EXISTS", '^R_key_not_Exists^');
- class Template {
+ class Template implements ITemplateEngine {
+ static $name ="internal";
+
var $r;
var $search;
var $replace;
@@ -244,9 +248,13 @@
return $s;
}
-
- public function replace($s, $r) {
- $t1 = dba_timer();
+
+ private function replace($s,$r) {
+ $this->replace_macros($s, $r);
+ }
+
+ // TemplateEngine interface
+ public function replace_macros($s, $r) {
$this->r = $r;
$s = $this->_build_nodes($s);
@@ -265,14 +273,18 @@
$os=$s; $count++;
$s = $this->var_replace($s);
}
- $t3 = dba_timer();
-// logger('macro timer: ' . sprintf('%01.4f %01.4f',$t3 - $t2, $t2 - $t1));
-
return $s;
}
+
+ public function get_markup_template($file, $root='') {
+ $template_file = theme_include($file, $root);
+ if ($template_file) {
+ $content = file_get_contents($template_file);
+ }
+ return $content;
+ }
}
- $t = new Template;