replace macros

implement new replaceMacros function
This commit is contained in:
Adam Magness 2018-10-31 10:35:50 -04:00
parent f6c86649c2
commit 91facd2d0a
91 changed files with 335 additions and 249 deletions

View file

@ -8,6 +8,7 @@ namespace Friendica\Content;
use Friendica\Core\Protocol;
use Friendica\Content\Feature;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -124,7 +125,7 @@ class ForumManager
$tpl = get_markup_template('widget_forumlist.tpl');
$o .= replace_macros(
$o .= Renderer::replaceMacros(
$tpl,
[
'$title' => L10n::t('Forums'),

View file

@ -9,6 +9,7 @@ use Friendica\Content\Feature;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -63,7 +64,7 @@ class Nav
$tpl = get_markup_template('nav.tpl');
$nav .= replace_macros($tpl, [
$nav .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(),
'$sitelocation' => $nav_info['sitelocation'],
'$nav' => $nav_info['nav'],

View file

@ -14,6 +14,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
@ -179,7 +180,7 @@ class OEmbed
$th = 120;
$tw = $th * $tr;
$tpl = get_markup_template('oembed_video.tpl');
$ret .= replace_macros($tpl, [
$ret .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(),
'$embedurl' => $oembed->embed_url,
'$escapedhtml' => base64_encode($oembed->html),

View file

@ -3,6 +3,7 @@
namespace Friendica\Content;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
/**
* The Pager has two very different output, Minimal and Full, see renderMinimal() and renderFull() for more details.
@ -173,7 +174,7 @@ class Pager
];
$tpl = get_markup_template('paginate.tpl');
return replace_macros($tpl, ['pager' => $data]);
return Renderer::replaceMacros($tpl, ['pager' => $data]);
}
/**
@ -277,6 +278,6 @@ class Pager
}
$tpl = get_markup_template('paginate.tpl');
return replace_macros($tpl, ['pager' => $data]);
return Renderer::replaceMacros($tpl, ['pager' => $data]);
}
}

View file

@ -17,6 +17,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Model\Event;
@ -987,7 +988,7 @@ class BBCode extends BaseObject
$text = ($is_quote_share? "\n" : '');
$tpl = get_markup_template('shared_content.tpl');
$text .= replace_macros($tpl, [
$text .= Renderer::replaceMacros($tpl, [
'$profile' => $attributes['profile'],
'$avatar' => $attributes['avatar'],
'$author' => $attributes['author'],

View file

@ -11,6 +11,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -30,7 +31,7 @@ class Widget
*/
public static function follow($value = "")
{
return replace_macros(get_markup_template('follow.tpl'), array(
return Renderer::replaceMacros(get_markup_template('follow.tpl'), array(
'$connect' => L10n::t('Add New Contact'),
'$desc' => L10n::t('Enter address or web location'),
'$hint' => L10n::t('Example: bob@example.com, http://example.com/barbara'),
@ -73,7 +74,7 @@ class Widget
$aside = [];
$aside['$nv'] = $nv;
return replace_macros(get_markup_template('peoplefind.tpl'), $aside);
return Renderer::replaceMacros(get_markup_template('peoplefind.tpl'), $aside);
}
/**
@ -151,7 +152,7 @@ class Widget
return '';
}
return replace_macros(get_markup_template('nets.tpl'), array(
return Renderer::replaceMacros(get_markup_template('nets.tpl'), array(
'$title' => L10n::t('Networks'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
@ -193,7 +194,7 @@ class Widget
}
}
return replace_macros(get_markup_template('fileas_widget.tpl'), array(
return Renderer::replaceMacros(get_markup_template('fileas_widget.tpl'), array(
'$title' => L10n::t('Saved Folders'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
@ -233,7 +234,7 @@ class Widget
}
}
return replace_macros(get_markup_template('categories_widget.tpl'), array(
return Renderer::replaceMacros(get_markup_template('categories_widget.tpl'), array(
'$title' => L10n::t('Categories'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
@ -300,7 +301,7 @@ class Widget
$r = GContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true);
}
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
return Renderer::replaceMacros(get_markup_template('remote_friends_common.tpl'), array(
'$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t),
'$base' => System::baseUrl(),
'$uid' => $profile_uid,

View file

@ -8,6 +8,7 @@ namespace Friendica\Content\Widget;
use Friendica\Content\Feature;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
require_once 'boot.php';
require_once 'include/text.php';
@ -61,7 +62,7 @@ class CalendarExport
$user = defaults($a->data['user'], 'nickname', $a->user['nickname']);
$tpl = get_markup_template("events_aside.tpl");
$return = replace_macros($tpl, [
$return = Renderer::replaceMacros($tpl, [
'$etitle' => L10n::t("Export"),
'$export_ical' => L10n::t("Export calendar as ical"),
'$export_csv' => L10n::t("Export calendar as csv"),

View file

@ -7,6 +7,7 @@
namespace Friendica\Content\Widget;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Item;
@ -50,7 +51,7 @@ class TagCloud
}
$tpl = get_markup_template('tagblock_widget.tpl');
$o = replace_macros($tpl, [
$o = Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Tags'),
'$tags' => $tags
]);