aboutsummaryrefslogtreecommitdiff
path: root/lib/PhpTemplate.php
diff options
context:
space:
mode:
authorMaZderMind2014-10-01 10:33:00 +0200
committerMaZderMind2014-10-01 10:33:00 +0200
commitbf4c140f5438101d87dcb0395c7c778585b7fe09 (patch)
tree6ebaf53ec3205222ca00796f9d880f719b2bb54a /lib/PhpTemplate.php
31c3 php player site
Diffstat (limited to 'lib/PhpTemplate.php')
-rw-r--r--lib/PhpTemplate.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/PhpTemplate.php b/lib/PhpTemplate.php
new file mode 100644
index 0000000..8dd6f72
--- /dev/null
+++ b/lib/PhpTemplate.php
@@ -0,0 +1,34 @@
+<?php
+
+// Version 1.2
+
+if(!function_exists('h'))
+{
+ function h($s)
+ {
+ return htmlspecialchars($s);
+ }
+}
+
+class PhpTemplate
+{
+ public function __construct($file)
+ {
+ $this -> file = $file;
+ }
+
+ public function render($___data = array())
+ {
+ extract((array)$___data);
+ unset($___data);
+
+ ob_start();
+ include($this->file);
+ return ob_get_clean();
+ }
+
+ public function __tostring()
+ {
+ return $this->render();
+ }
+}