Merge pull request #768 from zeroadam/CoreRenderer

Core Renderer Class
This commit is contained in:
Hypolite Petovan 2018-10-31 14:22:13 -04:00 committed by GitHub
commit cbb915d9ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 112 additions and 82 deletions

View file

@ -40,6 +40,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\Model\Item;
@ -207,8 +208,8 @@ function advancedcontentfilter_content(App $a)
return $html;
} else {
$t = get_markup_template('settings.tpl', 'addon/advancedcontentfilter/');
return replace_macros($t, [
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/advancedcontentfilter/');
return Renderer::replaceMacros($t, [
'$messages' => [
'backtosettings' => L10n::t('Back to Addon Settings'),
'title' => L10n::t('Advanced Content Filter'),

View file

@ -53,6 +53,7 @@ use Friendica\Core\Config;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
function blackout_install() {
Addon::registerHook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
@ -97,9 +98,9 @@ function blackout_addon_admin(&$a, &$o) {
if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; }
$myurl = Config::get('blackout','url');
if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
$t = get_markup_template( "admin.tpl", "addon/blackout/" );
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/blackout/" );
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$rurl' => ["rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"],
'$startdate' => ["startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"],

View file

@ -15,6 +15,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Model\ItemContent;
use Friendica\Util\Proxy as ProxyUtils;
@ -70,9 +71,9 @@ function buffer_content(App $a)
function buffer_addon_admin(App $a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/buffer/");
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/buffer/");
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values]
'$client_id' => ['client_id', L10n::t('Client ID'), Config::get('buffer', 'client_id'), ''],

View file

@ -12,6 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -53,8 +54,8 @@ function catavatar_addon_settings(App $a, &$s)
return;
}
$t = get_markup_template('settings.tpl', 'addon/catavatar/');
$s .= replace_macros ($t, [
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/');
$s .= Renderer::replaceMacros($t, [
'$postpost' => !empty($_POST['catavatar-morecat']) || !empty($_POST['catavatar-emailcat']),
'$uncache' => time(),
'$uid' => local_user(),

View file

@ -17,6 +17,7 @@ use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils;
@ -135,8 +136,8 @@ function curweather_network_mod_init(App $a, &$b)
}
if ($ok) {
$t = get_markup_template("widget.tpl", "addon/curweather/" );
$curweather = replace_macros ($t, [
$t = Renderer::getMarkupTemplate("widget.tpl", "addon/curweather/" );
$curweather = Renderer::replaceMacros($t, [
'$title' => L10n::t("Current Weather"),
'$icon' => ProxyUtils::proxifyUrl('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
'$city' => $res['city'],
@ -152,8 +153,8 @@ function curweather_network_mod_init(App $a, &$b)
'$showonmap' => L10n::t('Show on map')
]);
} else {
$t = get_markup_template('widget-error.tpl', 'addon/curweather/');
$curweather = replace_macros( $t, [
$t = Renderer::getMarkupTemplate('widget-error.tpl', 'addon/curweather/');
$curweather = Renderer::replaceMacros( $t, [
'$problem' => L10n::t('There was a problem accessing the weather data. But have a look'),
'$rpt' => $rpt,
'$atOWM' => L10n::t('at OpenWeatherMap')
@ -197,9 +198,9 @@ function curweather_addon_settings(App $a, &$s)
$enable_checked = (($enable) ? ' checked="checked" ' : '');
// load template and replace the macros
$t = get_markup_template("settings.tpl", "addon/curweather/" );
$t = Renderer::getMarkupTemplate("settings.tpl", "addon/curweather/" );
$s = replace_macros ($t, [
$s = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$header' => L10n::t('Current Weather').' '.L10n::t('Settings'),
'$noappidtext' => $noappidtext,
@ -237,9 +238,9 @@ function curweather_addon_admin(App $a, &$o)
$appid = Config::get('curweather', 'appid');
$cachetime = Config::get('curweather', 'cachetime');
$t = get_markup_template("admin.tpl", "addon/curweather/" );
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/curweather/" );
$o = replace_macros ($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$cachetime' => [
'cachetime',

View file

@ -13,6 +13,7 @@ use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
@ -76,7 +77,7 @@ function forumdirectory_content(App $a)
$search = ((!empty($_GET['search'])) ? notags(trim(rawurldecode($_GET['search']))) : '');
}
$tpl = get_markup_template('directory_header.tpl');
$tpl = Renderer::getMarkupTemplate('directory_header.tpl');
$globaldir = '';
$gdirpath = Config::get('system', 'directory');
@ -87,7 +88,7 @@ function forumdirectory_content(App $a)
$admin = '';
$o .= replace_macros($tpl, [
$o .= Renderer::replaceMacros($tpl, [
'$search' => $search,
'$globaldir' => $globaldir,
'$desc' => L10n::t('Find on this site'),
@ -187,9 +188,9 @@ function forumdirectory_content(App $a)
$homepage = !empty($profile['homepage']) ? L10n::t('Homepage:') : false;
$about = !empty($profile['about']) ? L10n::t('About:') : false;
$tpl = get_markup_template('forumdirectory_item.tpl', 'addon/forumdirectory/');
$tpl = Renderer::getMarkupTemplate('forumdirectory_item.tpl', 'addon/forumdirectory/');
$entry = replace_macros($tpl, [
$entry = Renderer::replaceMacros($tpl, [
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $rr[$photo],

View file

@ -15,6 +15,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Object\Image;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@ -102,9 +103,9 @@ function fromgplus_addon_settings_post(&$a,&$b) {
function fromgplus_addon_admin(&$a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/fromgplus/");
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/fromgplus/");
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$key' => ['key', L10n::t('Key'), trim(Config::get('fromgplus', 'key')), ''],
]);

View file

@ -10,6 +10,7 @@ use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Util\Network;
function geocoordinates_install()
@ -87,9 +88,9 @@ function geocoordinates_post_hook($a, &$item)
function geocoordinates_addon_admin(&$a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/geocoordinates/");
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/geocoordinates/");
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$api_key' => ['api_key', L10n::t('API Key'), Config::get('geocoordinates', 'api_key'), ''],
'$language' => ['language', L10n::t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''],

View file

@ -12,6 +12,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Util\Security;
@ -71,7 +72,7 @@ function gravatar_lookup($a, &$b) {
* Display admin settings for this addon
*/
function gravatar_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/gravatar/" );
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" );
$default_avatar = Config::get('gravatar', 'default_avatar');
$rating = Config::get('gravatar', 'rating');
@ -107,7 +108,7 @@ function gravatar_addon_admin (&$a, &$o) {
// output Gravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' . BaseModule::getFormSecurityToken("gravatarsave") .'">';
$o .= replace_macros( $t, [
$o .= Renderer::replaceMacros( $t, [
'$submit' => L10n::t('Save Settings'),
'$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars],
'$rating' => ['rating', L10n::t('Rating of images'), $rating, L10n::t('Select the appropriate avatar rating for your site. See README'), $ratings],

View file

@ -12,6 +12,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Util\Proxy as ProxyUtils;
function impressum_install() {
@ -100,8 +101,8 @@ function impressum_addon_admin_post (&$a) {
info(L10n::t('Settings updated.'). EOL );
}
function impressum_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/impressum/" );
$o = replace_macros($t, [
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/impressum/" );
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$owner' => ['owner', L10n::t('Site Owner'), Config::get('impressum','owner'), L10n::t('The page operators name.')],
'$ownerprofile' => ['ownerprofile', L10n::t('Site Owners Profile'), Config::get('impressum','ownerprofile'), L10n::t('Profile address of the operator.')],

View file

@ -10,6 +10,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
function irc_install() {
Addon::registerHook('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
@ -36,8 +37,8 @@ function irc_addon_settings(&$a,&$s) {
$sitechats = PConfig::get( local_user(), 'irc','sitechats'); /* popular channels */
$autochans = PConfig::get( local_user(), 'irc','autochans'); /* auto connect chans */
$t = get_markup_template( "settings.tpl", "addon/irc/" );
$s .= replace_macros($t, [
$t = Renderer::getMarkupTemplate( "settings.tpl", "addon/irc/" );
$s .= Renderer::replaceMacros($t, [
'$header' => L10n::t('IRC Settings'),
'$info' => L10n::t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'),
'$submit' => L10n::t('Save Settings'),
@ -135,8 +136,8 @@ function irc_addon_admin_post (&$a) {
function irc_addon_admin (&$a, &$o) {
$sitechats = Config::get('irc','sitechats'); /* popular channels */
$autochans = Config::get('irc','autochans'); /* auto connect chans */
$t = get_markup_template( "admin.tpl", "addon/irc/" );
$o = replace_macros($t, [
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/irc/" );
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$autochans' => [ 'autochans', L10n::t('Channel(s) to auto connect (comma separated)'), $autochans, L10n::t('List of channels that shall automatically connected to when the app is launched.')],
'$sitechats' => [ 'sitechats', L10n::t('Popular Channels (comma separated)'), $sitechats, L10n::t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]

View file

@ -12,6 +12,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
/* Define the hooks we want to use
* that is, we have settings, we need to save the settings and we want
@ -50,8 +51,8 @@ function langfilter_addon_settings(App $a, &$s)
$minconfidence = PConfig::get(local_user(), 'langfilter', 'minconfidence') * 100;
$minlength = PConfig::get(local_user(), 'langfilter', 'minlength');
$t = get_markup_template("settings.tpl", "addon/langfilter/");
$s .= replace_macros($t, [
$t = Renderer::getMarkupTemplate("settings.tpl", "addon/langfilter/");
$s .= Renderer::replaceMacros($t, [
'$title' => L10n::t("Language Filter"),
'$intro' => L10n::t('This addon tries to identify the language posts are writen in. If it does not match any language specifed below, posts will be hidden by collapsing them.'),
'$enabled' => ['langfilter_enable', L10n::t('Use the language filter'), $enable_checked, ''],

View file

@ -12,6 +12,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Util\Security;
@ -74,7 +75,7 @@ function libravatar_lookup($a, &$b)
*/
function libravatar_addon_admin(&$a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/libravatar");
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/libravatar");
$default_avatar = Config::get('libravatar', 'default_avatar');
@ -110,7 +111,7 @@ function libravatar_addon_admin(&$a, &$o)
// output Libravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' . BaseModule::getFormSecurityToken("libravatarsave") .'">';
$o .= replace_macros( $t, [
$o .= Renderer::replaceMacros( $t, [
'$submit' => L10n::t('Save Settings'),
'$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found. See README'), $default_avatars],
]);

View file

@ -12,6 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Util\Network;
use Friendica\Model\Item;
@ -74,12 +75,12 @@ function mailstream_module() {}
function mailstream_addon_admin(&$a,&$o) {
$frommail = Config::get('mailstream', 'frommail');
$template = get_markup_template('admin.tpl', 'addon/mailstream/');
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
$config = ['frommail',
L10n::t('From Address'),
$frommail,
L10n::t('Email address that stream items will appear to be from.')];
$o .= replace_macros($template, [
$o .= Renderer::replaceMacros($template, [
'$frommail' => $config,
'$submit' => L10n::t('Save Settings')]);
}
@ -288,10 +289,10 @@ function mailstream_send($a, $message_id, $item, $user) {
}
$mail->IsHTML(true);
$mail->CharSet = 'utf-8';
$template = get_markup_template('mail.tpl', 'addon/mailstream/');
$template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/');
$item['body'] = BBCode::convert($item['body']);
$item['url'] = $a->getBaseURL() . '/display/' . $user['nickname'] . '/' . $item['id'];
$mail->Body = replace_macros($template, [
$mail->Body = Renderer::replaceMacros($template, [
'$upstream' => L10n::t('Upstream'),
'$local' => L10n::t('Local'),
'$item' => $item]);
@ -356,8 +357,8 @@ function mailstream_addon_settings(&$a,&$s) {
$address = PConfig::get(local_user(), 'mailstream', 'address');
$nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes');
$attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg');
$template = get_markup_template('settings.tpl', 'addon/mailstream/');
$s .= replace_macros($template, [
$template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/');
$s .= Renderer::replaceMacros($template, [
'$enabled' => [
'mailstream_enabled',
L10n::t('Enabled'),

View file

@ -12,6 +12,7 @@ use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
function mathjax_install()
{
@ -49,8 +50,8 @@ function mathjax_settings(App $a, &$s)
$use = PConfig::get(local_user(), 'mathjax', 'use', false);
$tpl = get_markup_template('settings.tpl', __DIR__);
$s .= replace_macros($tpl, [
$tpl = Renderer::getMarkupTemplate('settings.tpl', __DIR__);
$s .= Renderer::replaceMacros($tpl, [
'$title' => 'MathJax',
'$description' => L10n::t('The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail.'),
'$mathjax_use' => ['mathjax_use', L10n::t('Use the MathJax renderer'), $use, ''],

View file

@ -11,6 +11,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
function newmemberwidget_install()
{
@ -64,8 +65,8 @@ function newmemberwidget_addon_admin_post(&$a)
function newmemberwidget_addon_admin(&$a, &$o)
{
$t = get_markup_template('admin.tpl', 'addon/newmemberwidget');
$o = replace_macros($t, [
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget');
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$freetext' => [ "freetext", L10n::t("Message"), Config::get("newmemberwidget", "freetext"), L10n::t("Your message for new members. You can use bbcode here.")],
'$linkglobalsupport' => [ "linkglobalsupport", L10n::t('Add a link to global support forum'), Config::get('newmemberwidget', 'linkglobalsupport'), L10n::t('Should a link to the global support forum be displayed?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"],

View file

@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Util\Emailer;
function notifyall_install()
@ -105,7 +106,7 @@ function notifyall_content(&$a)
$title = L10n::t('Send email to all members of this Friendica instance.');
$o = replace_macros(get_markup_template('notifyall_form.tpl', 'addon/notifyall/'), [
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('notifyall_form.tpl', 'addon/notifyall/'), [
'$title' => $title,
'$text' => htmlspecialchars(defaults($_REQUEST, 'text', '')),
'$subject' => ['subject', L10n::t('Message subject'), defaults($_REQUEST, 'subject', ''),''],

View file

@ -13,6 +13,7 @@ use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Util\Network;
@ -190,7 +191,7 @@ function openstreetmap_generate_map(&$a, &$b)
function openstreetmap_addon_admin(&$a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/openstreetmap/");
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/openstreetmap/");
$tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS);
$nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM);
$zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM);
@ -201,7 +202,7 @@ function openstreetmap_addon_admin(&$a, &$o)
$nomserver = OSM_NOM;
}
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Submit'),
'$tmsserver' => ['tmsserver', L10n::t('Tile Server URL'), $tmsserver, L10n::t('A list of <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')],
'$nomserver' => ['nomserver', L10n::t('Nominatim (reverse geocoding) Server URL'), $nomserver, L10n::t('A list of <a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim servers</a>')],

View file

@ -10,6 +10,7 @@
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
function pageheader_install() {
Addon::registerHook('page_content_top', 'addon/pageheader/pageheader.php', 'pageheader_fetch');
@ -48,8 +49,8 @@ function pageheader_addon_settings(&$a,&$s) {
if(! $words)
$words = '';
$t = get_markup_template("settings.tpl", "addon/pageheader/");
$s .= replace_macros($t, [
$t = Renderer::getMarkupTemplate("settings.tpl", "addon/pageheader/");
$s .= Renderer::replaceMacros($t, [
'$title' => L10n::t('"pageheader" Settings'),
'$phwords' => ['pageheader-words', L10n::t('Message'), $words, L10n::t('Message to display on every page on this server (or put a pageheader.html file in your docroot)')],
'$submit' => L10n::t('Save Settings')

View file

@ -34,6 +34,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
function piwik_install() {
Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
@ -96,8 +97,8 @@ function piwik_analytics($a,&$b) {
}
}
function piwik_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/piwik/" );
$o = replace_macros( $t, [
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" );
$o = Renderer::replaceMacros( $t, [
'$submit' => L10n::t('Save Settings'),
'$piwikbaseurl' => ['baseurl', L10n::t('Piwik Base URL'), Config::get('piwik','baseurl' ), L10n::t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')],
'$siteid' => ['siteid', L10n::t('Site ID'), Config::get('piwik','siteid' ), ''],

View file

@ -12,6 +12,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
@ -164,8 +165,8 @@ function public_server_addon_admin_post(&$a)
function public_server_addon_admin(&$a, &$o)
{
$token = BaseModule::getFormSecurityToken("publicserver");
$t = get_markup_template("admin.tpl", "addon/public_server");
$o = replace_macros($t, [
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/public_server");
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$form_security_token' => $token,
'$infotext' => L10n::t('Set any of these options to 0 to deactivate it.'),

View file

@ -11,6 +11,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
function remote_permissions_install() {
@ -45,8 +46,8 @@ function remote_permissions_settings(&$a,&$o) {
/* Add some HTML to the existing form */
// $t = file_get_contents("addon/remote_permissions/settings.tpl" );
$t = get_markup_template("settings.tpl", "addon/remote_permissions/" );
$o .= replace_macros($t, [
$t = Renderer::getMarkupTemplate("settings.tpl", "addon/remote_permissions/" );
$o .= Renderer::replaceMacros($t, [
'$remote_perms_title' => L10n::t('Remote Permissions Settings'),
'$remote_perms_label' => L10n::t('Allow recipients of your private posts to see the other recipients of the posts'),
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
@ -196,8 +197,8 @@ function remote_permissions_content($a, $item_copy) {
}
function remote_permissions_addon_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
$o = replace_macros($t, [
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" );
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$global' => ['remotepermschoice', L10n::t('Global'), 1, L10n::t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
'$individual' => ['remotepermschoice', L10n::t('Individual'), 2, L10n::t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]

View file

@ -12,6 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Util\Emailer;
/* because the fraking openpgp-php is in composer, require libs in composer
@ -62,9 +63,9 @@ function securemail_settings(App &$a, &$s){
$enable = intval(PConfig::get(local_user(), 'securemail', 'enable'));
$publickey = PConfig::get(local_user(), 'securemail', 'pkey');
$t = get_markup_template('admin.tpl', 'addon/securemail/');
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/securemail/');
$s .= replace_macros($t, [
$s .= Renderer::replaceMacros($t, [
'$title' => L10n::t('"Secure Mail" Settings'),
'$submit' => L10n::t('Save Settings'),
'$test' => L10n::t('Save and send test'), //NOTE: update also in 'post'

View file

@ -49,6 +49,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -668,8 +669,8 @@ function statusnet_addon_admin(App $a, &$o)
//'applicationname' => Array("applicationname[$id]", L10n::t("Application name"), "", ""),
];
$t = get_markup_template("admin.tpl", "addon/statusnet/");
$o = replace_macros($t, [
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/statusnet/");
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$sites' => $sitesform,
]);

View file

@ -16,6 +16,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
function tumblr_install()
@ -70,9 +71,9 @@ function tumblr_content(App $a)
function tumblr_addon_admin(App $a, &$o)
{
$t = get_markup_template( "admin.tpl", "addon/tumblr/" );
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/tumblr/" );
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values]
'$consumer_key' => ['consumer_key', L10n::t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''],

View file

@ -72,6 +72,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -347,7 +348,7 @@ function twitter_settings(App $a, &$s)
try {
$details = $connection->get('account/verify_credentials');
$field_checkbox = get_markup_template('field_checkbox.tpl');
$field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl');
$s .= '<div id="twitter-info" >
<p>' . L10n::t('Currently connected to: ') . '<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter">' . $details->screen_name . '</a>
@ -360,22 +361,22 @@ function twitter_settings(App $a, &$s)
</div>';
$s .= '<div class="clear"></div>';
$s .= replace_macros($field_checkbox, [
$s .= Renderer::replaceMacros($field_checkbox, [
'$field' => ['twitter-enable', L10n::t('Allow posting to Twitter'), $enabled, L10n::t('If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')]
]);
if ($a->user['hidewall']) {
$s .= '<p>' . L10n::t('<strong>Note</strong>: Due to your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>';
}
$s .= replace_macros($field_checkbox, [
$s .= Renderer::replaceMacros($field_checkbox, [
'$field' => ['twitter-default', L10n::t('Send public postings to Twitter by default'), $defenabled, '']
]);
$s .= replace_macros($field_checkbox, [
$s .= Renderer::replaceMacros($field_checkbox, [
'$field' => ['twitter-mirror', L10n::t('Mirror all posts from twitter that are no replies'), $mirrorenabled, '']
]);
$s .= replace_macros($field_checkbox, [
$s .= Renderer::replaceMacros($field_checkbox, [
'$field' => ['twitter-import', L10n::t('Import the remote timeline'), $importenabled, '']
]);
$s .= replace_macros($field_checkbox, [
$s .= Renderer::replaceMacros($field_checkbox, [
'$field' => ['twitter-create_user', L10n::t('Automatically create contacts'), $create_userenabled, L10n::t('This will automatically create a contact in Friendica as soon as you receive a message from an existing contact via the Twitter network. If you do not enable this, you need to manually add those Twitter contacts in Friendica from whom you would like to see posts here. However if enabled, you cannot merely remove a twitter contact from the Friendica contact list, as it will recreate this contact when they post again.')]
]);
$s .= '<div class="clear"></div>';
@ -665,9 +666,9 @@ function twitter_addon_admin_post(App $a)
function twitter_addon_admin(App $a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/twitter/");
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/twitter/");
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values]
'$consumerkey' => ['consumerkey', L10n::t('Consumer key'), Config::get('twitter', 'consumerkey'), ''],

View file

@ -9,6 +9,7 @@
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
function webrtc_install() {
Addon::registerHook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu');
@ -24,8 +25,8 @@ function webrtc_app_menu($a,&$b) {
}
function webrtc_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/webrtc/" );
$o = replace_macros( $t, [
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/webrtc/" );
$o = Renderer::replaceMacros( $t, [
'$submit' => L10n::t('Save Settings'),
'$webrtcurl' => ['webrtcurl', L10n::t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), L10n::t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')],
]);

View file

@ -1,6 +1,7 @@
<?php
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
function like_widget_name() {
@ -56,8 +57,8 @@ function like_widget_content(&$a, $conf){
$o = "";
# $t = file_get_contents( dirname(__file__). "/widget_like.tpl" );
$t = get_markup_template("widget_like.tpl", "addon/widgets/");
$o .= replace_macros($t, [
$t = Renderer::getMarkupTemplate("widget_like.tpl", "addon/widgets/");
$o .= Renderer::replaceMacros($t, [
'$like' => $likes,
'$strlike' => L10n::tt("%d person likes this", "%d people like this", $likes),

View file

@ -11,6 +11,7 @@ use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
function widgets_install() {
@ -58,8 +59,8 @@ function widgets_settings(&$a,&$o) {
# $t = file_get_contents( dirname(__file__). "/settings.tpl" );
$t = get_markup_template("settings.tpl", "addon/widgets/");
$o .= replace_macros($t, [
$t = Renderer::getMarkupTemplate("settings.tpl", "addon/widgets/");
$o .= Renderer::replaceMacros($t, [
'$submit' => L10n::t('Generate new key'),
'$baseurl' => $a->getBaseURL(),
'$title' => "Widgets",
@ -142,7 +143,7 @@ function widgets_content(&$a) {
$widget_size = call_user_func($a->argv[1].'_widget_size');
$script = file_get_contents(dirname(__file__)."/widgets.js");
$o .= replace_macros($script, [
$o .= Renderer::replaceMacros($script, [
'$entrypoint' => $a->getBaseURL()."/widgets/".$a->argv[1]."/cb/",
'$key' => $conf['key'],
'$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6),

View file

@ -11,6 +11,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
function xmpp_install()
{
@ -104,9 +105,9 @@ function xmpp_login()
function xmpp_addon_admin(App $a, &$o)
{
$t = get_markup_template('admin.tpl', 'addon/xmpp/');
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/xmpp/');
$o = replace_macros($t, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$bosh_proxy' => ['bosh_proxy', L10n::t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''],
'$central_userbase' => ['central_userbase', L10n::t('Use central userbase'), Config::get('xmpp', 'central_userbase'), L10n::t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')],