Merge remote-tracking branch 'upstream/develop' into write-tags
This commit is contained in:
commit
9fb035ee79
6 changed files with 24 additions and 9 deletions
|
@ -99,19 +99,18 @@ class Renderer
|
||||||
* Load a given template $s
|
* Load a given template $s
|
||||||
*
|
*
|
||||||
* @param string $s Template to load.
|
* @param string $s Template to load.
|
||||||
* @param string $root Optional.
|
* @param string $subDir Subdirectory (Optional)
|
||||||
*
|
*
|
||||||
* @return string template.
|
* @return string template.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function getMarkupTemplate($s, $root = '')
|
public static function getMarkupTemplate($s, $subDir = '')
|
||||||
{
|
{
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
$a = DI::app();
|
|
||||||
$t = self::getTemplateEngine();
|
$t = self::getTemplateEngine();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$template = $t->getTemplateFile($s, $root);
|
$template = $t->getTemplateFile($s, $subDir);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||||
exit();
|
exit();
|
||||||
|
|
|
@ -383,6 +383,14 @@ abstract class DI
|
||||||
return self::$dice->create(Util\ACLFormatter::class);
|
return self::$dice->create(Util\ACLFormatter::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function basePath()
|
||||||
|
{
|
||||||
|
return self::$dice->create('$basepath');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Util\DateTimeFormat
|
* @return Util\DateTimeFormat
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,7 +28,7 @@ use Friendica\DI;
|
||||||
class View
|
class View
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* view definition loaded from config/dbview.config.php
|
* view definition loaded from static/dbview.config.php
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -68,16 +68,18 @@ class FriendicaSmartyEngine implements ITemplateEngine
|
||||||
return $s->parsed($template);
|
return $s->parsed($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTemplateFile($file, $root = '')
|
public function getTemplateFile($file, $subDir = '')
|
||||||
{
|
{
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
$template = new FriendicaSmarty();
|
$template = new FriendicaSmarty();
|
||||||
|
|
||||||
// Make sure $root ends with a slash /
|
// Make sure $root ends with a slash /
|
||||||
if ($root !== '' && substr($root, -1, 1) !== '/') {
|
if ($subDir !== '' && substr($subDir, -1, 1) !== '/') {
|
||||||
$root = $root . '/';
|
$subDir = $subDir . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$root = DI::basePath() . '/' . $subDir;
|
||||||
|
|
||||||
$theme = $a->getCurrentTheme();
|
$theme = $a->getCurrentTheme();
|
||||||
$filename = $template::SMARTY3_TEMPLATE_FOLDER . '/' . $file;
|
$filename = $template::SMARTY3_TEMPLATE_FOLDER . '/' . $file;
|
||||||
|
|
||||||
|
|
|
@ -27,5 +27,5 @@ namespace Friendica\Render;
|
||||||
interface ITemplateEngine
|
interface ITemplateEngine
|
||||||
{
|
{
|
||||||
public function replaceMacros($s, $v);
|
public function replaceMacros($s, $v);
|
||||||
public function getTemplateFile($file, $root = '');
|
public function getTemplateFile($file, $subDir = '');
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,12 @@ return [
|
||||||
'wall' => 1,
|
'wall' => 1,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'profile' => [
|
||||||
|
[
|
||||||
|
'id' => 1,
|
||||||
|
'uid' => 42,
|
||||||
|
],
|
||||||
|
],
|
||||||
'group' => [
|
'group' => [
|
||||||
[
|
[
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
|
|
Loading…
Reference in a new issue