]> git.mxchange.org Git - friendica.git/commitdiff
added missing constant
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 3 Feb 2018 10:11:00 +0000 (11:11 +0100)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 3 Feb 2018 10:11:00 +0000 (11:11 +0100)
src/Render/FriendicaSmartyEngine.php

index 2cfce760adc2cba53c6e62950638f61097e5208c..6fd51cf5d1a9e307920e980dc3b9cc11c1b11d19 100644 (file)
@@ -1,59 +1,61 @@
-<?php\r
-/**\r
- * @file src/Render/FriendicaSmartyEngine.php\r
- */\r
-namespace Friendica\Render;\r
-\r
-use Friendica\Core\Addon;\r
-\r
-class FriendicaSmartyEngine implements ITemplateEngine\r
-{\r
-       static $name = "smarty3";\r
-\r
-       public function __construct()\r
-       {\r
-               if (!is_writable('view/smarty3/')) {\r
-                       echo "<b>ERROR:</b> folder <tt>view/smarty3/</tt> must be writable by webserver.";\r
-                       killme();\r
-               }\r
-       }\r
-\r
-       // ITemplateEngine interface\r
-       public function replaceMacros($s, $r)\r
-       {\r
-               $template = '';\r
-               if (gettype($s) === 'string') {\r
-                       $template = $s;\r
-                       $s = new FriendicaSmarty();\r
-               }\r
-\r
-               $r['$APP'] = get_app();\r
-\r
-               // "middleware": inject variables into templates\r
-               $arr = [\r
-                       "template" => basename($s->filename),\r
-                       "vars" => $r\r
-               ];\r
-               Addon::callHooks("template_vars", $arr);\r
-               $r = $arr['vars'];\r
-\r
-               foreach ($r as $key => $value) {\r
-                       if ($key[0] === '$') {\r
-                               $key = substr($key, 1);\r
-                       }\r
-\r
-                       $s->assign($key, $value);\r
-               }\r
-               return $s->parsed($template);\r
-       }\r
-\r
-       public function getTemplateFile($file, $root = '')\r
-       {\r
-               $a = get_app();\r
-               $template_file = get_template_file($a, SMARTY3_TEMPLATE_FOLDER . '/' . $file, $root);\r
-               $template = new FriendicaSmarty();\r
-               $template->filename = $template_file;\r
-\r
-               return $template;\r
-       }\r
-}\r
+<?php
+/**
+ * @file src/Render/FriendicaSmartyEngine.php
+ */
+namespace Friendica\Render;
+
+use Friendica\Core\Addon;
+
+define('SMARTY3_TEMPLATE_FOLDER', 'templates');
+
+class FriendicaSmartyEngine implements ITemplateEngine
+{
+       static $name = "smarty3";
+
+       public function __construct()
+       {
+               if (!is_writable('view/smarty3/')) {
+                       echo "<b>ERROR:</b> folder <tt>view/smarty3/</tt> must be writable by webserver.";
+                       killme();
+               }
+       }
+
+       // ITemplateEngine interface
+       public function replaceMacros($s, $r)
+       {
+               $template = '';
+               if (gettype($s) === 'string') {
+                       $template = $s;
+                       $s = new FriendicaSmarty();
+               }
+
+               $r['$APP'] = get_app();
+
+               // "middleware": inject variables into templates
+               $arr = [
+                       "template" => basename($s->filename),
+                       "vars" => $r
+               ];
+               Addon::callHooks("template_vars", $arr);
+               $r = $arr['vars'];
+
+               foreach ($r as $key => $value) {
+                       if ($key[0] === '$') {
+                               $key = substr($key, 1);
+                       }
+
+                       $s->assign($key, $value);
+               }
+               return $s->parsed($template);
+       }
+
+       public function getTemplateFile($file, $root = '')
+       {
+               $a = get_app();
+               $template_file = get_template_file($a, SMARTY3_TEMPLATE_FOLDER . '/' . $file, $root);
+               $template = new FriendicaSmarty();
+               $template->filename = $template_file;
+
+               return $template;
+       }
+}