]> git.mxchange.org Git - friendica.git/commitdiff
Move ITemplateEngine to src
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 19 Nov 2017 15:22:18 +0000 (10:22 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 19 Nov 2017 15:22:18 +0000 (10:22 -0500)
- Fix method name format

include/friendica_smarty.php
include/text.php
object/TemplateEngine.php [deleted file]
src/App.php
src/Render/ITemplateEngine.php [new file with mode: 0644]

index f497fbee017c94b9bb35db66b457dd2191ebe813..5dd324bf75b47ee1018ff254c7c8deef5b253876 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-require_once "object/TemplateEngine.php";
+use Friendica\Render\ITemplateEngine;
+
 require_once("library/Smarty/libs/Smarty.class.php");
 require_once "include/plugin.php";
 
@@ -54,13 +55,13 @@ class FriendicaSmartyEngine implements ITemplateEngine {
        }
 
        // 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
@@ -80,7 +81,7 @@ class FriendicaSmartyEngine implements ITemplateEngine {
                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();
index cf802513c45629ebb2cfe4f3d5aacffd3ebe563e..616c4adb86b7c35b0363f0592f80e4661a2a9f6a 100644 (file)
@@ -30,7 +30,7 @@ function replace_macros($s, $r) {
 
        $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();
@@ -591,7 +591,7 @@ function get_markup_template($s, $root = '') {
        $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();
diff --git a/object/TemplateEngine.php b/object/TemplateEngine.php
deleted file mode 100644 (file)
index 61ccb01..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?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
index 4d06ba630d51e55cbac06a5c9377f01f5ecb9522..1bb35e1dc2d1c773a998c3f9bb85f811f1877e6a 100644 (file)
@@ -295,7 +295,7 @@ class App {
                // 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);
                        }
                }
diff --git a/src/Render/ITemplateEngine.php b/src/Render/ITemplateEngine.php
new file mode 100644 (file)
index 0000000..d592481
--- /dev/null
@@ -0,0 +1,15 @@
+<?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