<?php
-require_once "object/TemplateEngine.php";
+use Friendica\Render\ITemplateEngine;
+
require_once("library/Smarty/libs/Smarty.class.php");
require_once "include/plugin.php";
}
// ITemplateEngine interface
- public function replace_macros($s, $r) {
+ public function replaceMacros($s, $r) {
$template = '';
if (gettype($s) === 'string') {
$template = $s;
$s = new FriendicaSmarty();
}
-
+
$r['$APP'] = get_app();
// "middleware": inject variables into templates
return $s->parsed($template);
}
- public function get_template_file($file, $root=''){
+ public function getTemplateFile($file, $root=''){
$a = get_app();
$template_file = get_template_file($a, SMARTY3_TEMPLATE_FOLDER.'/'.$file, $root);
$template = new FriendicaSmarty();
$t = $a->template_engine();
try {
- $output = $t->replace_macros($s, $r);
+ $output = $t->replaceMacros($s, $r);
} catch (Exception $e) {
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
killme();
$a = get_app();
$t = $a->template_engine();
try {
- $template = $t->get_template_file($s, $root);
+ $template = $t->getTemplateFile($s, $root);
} catch (Exception $e) {
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
killme();
+++ /dev/null
-<?php\r
-/**\r
- * @file object/TemplateEngine.php\r
- */\r
-\r
-require_once 'boot.php';\r
-\r
-/**\r
- * Interface for template engines\r
- */\r
-interface ITemplateEngine\r
-{\r
- public function replace_macros($s, $v);\r
- public function get_template_file($file, $root = '');\r
-}\r
// Register template engines
$dc = get_declared_classes();
foreach ($dc as $k) {
- if (in_array('ITemplateEngine', class_implements($k))) {
+ if (in_array('Friendica\Render\ITemplateEngine', class_implements($k))) {
$this->register_template_engine($k);
}
}
--- /dev/null
+<?php\r
+/**\r
+ * @file src/Render/ITemplateEngine.php\r
+ */\r
+\r
+namespace Friendica\Render;\r
+\r
+/**\r
+ * Interface for template engines\r
+ */\r
+interface ITemplateEngine\r
+{\r
+ public function replaceMacros($s, $v);\r
+ public function getTemplateFile($file, $root = '');\r
+}\r