Merge pull request #3914 from MrPetovan/issue/#3878-move-itemplateengine-to-src
Move ITemplateEngine to src
This commit is contained in:
commit
27af65918e
5 changed files with 23 additions and 22 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file object/TemplateEngine.php
|
||||
*/
|
||||
|
||||
require_once 'boot.php';
|
||||
|
||||
/**
|
||||
* Interface for template engines
|
||||
*/
|
||||
interface ITemplateEngine
|
||||
{
|
||||
public function replace_macros($s, $v);
|
||||
public function get_template_file($file, $root = '');
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
15
src/Render/ITemplateEngine.php
Normal file
15
src/Render/ITemplateEngine.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* @file src/Render/ITemplateEngine.php
|
||||
*/
|
||||
|
||||
namespace Friendica\Render;
|
||||
|
||||
/**
|
||||
* Interface for template engines
|
||||
*/
|
||||
interface ITemplateEngine
|
||||
{
|
||||
public function replaceMacros($s, $v);
|
||||
public function getTemplateFile($file, $root = '');
|
||||
}
|
Loading…
Reference in a new issue