aboutsummaryrefslogtreecommitdiffstats
path: root/include/template_processor.php
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2014-06-24 19:34:36 +0200
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2014-06-24 19:34:36 +0200
commitb8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70 (patch)
tree718df6305bcb82c8dcb4b287a7132422e748cdfb /include/template_processor.php
parentc2d520f1be115fb3cb5da2a35eb10146cecee8aa (diff)
parenta92fb0b04c3e6474ec48faf8e4cc65c382e89d66 (diff)
downloadvolse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.tar.gz
volse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.tar.bz2
volse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.zip
Merge remote-tracking branch 'upstream/master'
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;