From 9079480d4a531fa0d44376a8c8e9a5c7a20833b1 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 10:55:15 -0400 Subject: [PATCH] move to Renderer class update functions calls for new Renderer class. --- advancedcontentfilter/advancedcontentfilter.php | 5 +++-- blackout/blackout.php | 5 +++-- buffer/buffer.php | 5 +++-- catavatar/catavatar.php | 3 ++- curweather/curweather.php | 11 ++++++----- forumdirectory/forumdirectory.php | 9 +++++---- fromgplus/fromgplus.php | 5 +++-- geocoordinates/geocoordinates.php | 5 +++-- gravatar/gravatar.php | 5 +++-- impressum/impressum.php | 5 +++-- irc/irc.php | 9 +++++---- langfilter/langfilter.php | 5 +++-- libravatar/libravatar.php | 5 +++-- mailstream/mailstream.php | 13 +++++++------ mathjax/mathjax.php | 5 +++-- newmemberwidget/newmemberwidget.php | 5 +++-- notifyall/notifyall.php | 3 ++- openstreetmap/openstreetmap.php | 5 +++-- pageheader/pageheader.php | 5 +++-- piwik/piwik.php | 5 +++-- public_server/public_server.php | 5 +++-- remote_permissions/remote_permissions.php | 9 +++++---- securemail/securemail.php | 5 +++-- statusnet/statusnet.php | 5 +++-- tumblr/tumblr.php | 5 +++-- twitter/twitter.php | 17 +++++++++-------- webrtc/webrtc.php | 5 +++-- widgets/widget_like.php | 5 +++-- widgets/widgets.php | 7 ++++--- xmpp/xmpp.php | 5 +++-- 30 files changed, 108 insertions(+), 78 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 549698d3..a00f2f07 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -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'), diff --git a/blackout/blackout.php b/blackout/blackout.php index dc19edda..c0e0dc59 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -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
(YYYY-MM-DD hh:mm)", $mystart, "format is YYYY year, MM month, DD day, hh hour and mm minute"], diff --git a/buffer/buffer.php b/buffer/buffer.php index 93e9432e..bb9af8ab 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -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'), ''], diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index 07f21527..66780e1f 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -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,7 +54,7 @@ function catavatar_addon_settings(App $a, &$s) return; } - $t = get_markup_template('settings.tpl', 'addon/catavatar/'); + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/'); $s .= replace_macros ($t, [ '$postpost' => !empty($_POST['catavatar-morecat']) || !empty($_POST['catavatar-emailcat']), '$uncache' => time(), diff --git a/curweather/curweather.php b/curweather/curweather.php index db244c7d..3382e731 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -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,7 +136,7 @@ function curweather_network_mod_init(App $a, &$b) } if ($ok) { - $t = get_markup_template("widget.tpl", "addon/curweather/" ); + $t = Renderer::getMarkupTemplate("widget.tpl", "addon/curweather/" ); $curweather = replace_macros ($t, [ '$title' => L10n::t("Current Weather"), '$icon' => ProxyUtils::proxifyUrl('http://openweathermap.org/img/w/'.$res['icon'].'.png'), @@ -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,7 +198,7 @@ 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, [ '$submit' => L10n::t('Save Settings'), @@ -237,7 +238,7 @@ 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, [ '$submit' => L10n::t('Save Settings'), diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 54818cdb..1c88dfaf 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -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], diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index a964954a..860438d8 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -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')), ''], ]); diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 6a3f535c..1a0b9daa 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -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'), ''], diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index e5a59b26..d0d54689 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -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 .= ''; - $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], diff --git a/impressum/impressum.php b/impressum/impressum.php index 2cac33fa..0efe5c3c 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -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.')], diff --git a/irc/irc.php b/irc/irc.php index 38ce5f24..4804fb6f 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -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.') ] diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 6922ac82..8cc8f697 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -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, ''], diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 80c9e4c5..39f77a56 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -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 .= ''; - $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], ]); diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index c7842b78..1d2a4917 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -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'), diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 9aa07027..ca073e53 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -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, ''], diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index f71f01b2..73ae176c 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -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?')." (@helpers)"], diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index a2eb2a87..ea6712f1 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -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', ''),''], diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 61838b38..68edf8bf 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -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 public tile servers')], '$nomserver' => ['nomserver', L10n::t('Nominatim (reverse geocoding) Server URL'), $nomserver, L10n::t('A list of Nominatim servers')], diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index ce0d6e2b..5b59064a 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -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') diff --git a/piwik/piwik.php b/piwik/piwik.php index 638c1339..77755236 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -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' ), ''], diff --git a/public_server/public_server.php b/public_server/public_server.php index 31502d77..3421dcc1 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -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.'), diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php index c883c5b8..91c2b4ce 100644 --- a/remote_permissions/remote_permissions.php +++ b/remote_permissions/remote_permissions.php @@ -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] diff --git a/securemail/securemail.php b/securemail/securemail.php index e39b88ef..90251788 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -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' diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 0d64ccee..e07a6e73 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -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, ]); diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 7d232a6a..bac11634 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -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' ), ''], diff --git a/twitter/twitter.php b/twitter/twitter.php index 77a3a265..e556e402 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -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 .= '

' . L10n::t('Currently connected to: ') . '' . $details->screen_name . ' @@ -360,22 +361,22 @@ function twitter_settings(App $a, &$s)

'; $s .= '
'; - $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 public 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 .= '

' . L10n::t('Note: Due to your privacy settings (Hide your profile details from unknown viewers?) 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.') . '

'; } - $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 .= '
'; @@ -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'), ''], diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php index 47cd734c..d8c7d8a2 100644 --- a/webrtc/webrtc.php +++ b/webrtc/webrtc.php @@ -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 .')], ]); diff --git a/widgets/widget_like.php b/widgets/widget_like.php index 238d15ad..9693d254 100644 --- a/widgets/widget_like.php +++ b/widgets/widget_like.php @@ -1,6 +1,7 @@ $likes, '$strlike' => L10n::tt("%d person likes this", "%d people like this", $likes), diff --git a/widgets/widgets.php b/widgets/widgets.php index 8d7cf3ae..927d6746 100644 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -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), diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index e45bd72e..d80abb64 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -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.')], -- 2.39.5