From f6c86649c2f35ed41e374281756596d95bc384eb Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 10:03:42 -0400 Subject: [PATCH 1/6] Create Core\Renderer Class create new class and redirect old functions --- include/text.php | 58 +++++++++-------------------------- src/Core/Renderer.php | 71 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 43 deletions(-) create mode 100644 src/Core/Renderer.php diff --git a/include/text.php b/include/text.php index aa4b2c8db..0c2ea61de 100644 --- a/include/text.php +++ b/include/text.php @@ -24,6 +24,7 @@ use Friendica\Util\Map; use Friendica\Util\Proxy as ProxyUtils; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Model\FileTag; require_once "include/conversation.php"; @@ -36,26 +37,21 @@ require_once "include/conversation.php"; * @param array $r key value pairs (search => replace) * @return string substituted string */ -function replace_macros($s, $r) { +function replace_macros($s, $r) +{ + return Renderer::replaceMacros($s, $r); +} - $stamp1 = microtime(true); - - $a = get_app(); - - // pass $baseurl to all templates - $r['$baseurl'] = System::baseUrl(); - - $t = $a->getTemplateEngine(); - try { - $output = $t->replaceMacros($s, $r); - } catch (Exception $e) { - echo "
" . __FUNCTION__ . ": " . $e->getMessage() . "
"; - killme(); - } - - $a->saveTimestamp($stamp1, "rendering"); - - return $output; +/** + * load template $s + * + * @param string $s + * @param string $root + * @return string + */ +function get_markup_template($s, $root = '') +{ + return Renderer::getMarkupTemplate($s, $root); } /** @@ -339,30 +335,6 @@ function perms2str($p) { return $ret; } -/** - * load template $s - * - * @param string $s - * @param string $root - * @return string - */ -function get_markup_template($s, $root = '') { - $stamp1 = microtime(true); - - $a = get_app(); - $t = $a->getTemplateEngine(); - try { - $template = $t->getTemplateFile($s, $root); - } catch (Exception $e) { - echo "
" . __FUNCTION__ . ": " . $e->getMessage() . "
"; - killme(); - } - - $a->saveTimestamp($stamp1, "file"); - - return $template; -} - /** * for html,xml parsing - let's say you've got * an attribute foobar="class1 class2 class3" diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php new file mode 100644 index 000000000..2c0cb5517 --- /dev/null +++ b/src/Core/Renderer.php @@ -0,0 +1,71 @@ + replace) + * + * @return string substituted string + */ + public static function replaceMacros($s, $r) + { + $stamp1 = microtime(true); + $a = self::getApp(); + + // pass $baseurl to all templates + $r['$baseurl'] = System::baseUrl(); + $t = $a->getTemplateEngine(); + + try { + $output = $t->replaceMacros($s, $r); + } catch (Exception $e) { + echo "
" . __FUNCTION__ . ": " . $e->getMessage() . "
"; + killme(); + } + + $a->saveTimestamp($stamp1, "rendering"); + + return $output; + } + + /** + * @brief Load a given template $s + * + * @param string $s Template to load. + * @param string $root Optional. + * + * @return string template. + */ + public static function getMarkupTemplate($s, $root = '') + { + $stamp1 = microtime(true); + $a = self::getApp(); + $t = $a->getTemplateEngine(); + + try { + $template = $t->getTemplateFile($s, $root); + } catch (Exception $e) { + echo "
" . __FUNCTION__ . ": " . $e->getMessage() . "
"; + killme(); + } + + $a->saveTimestamp($stamp1, "file"); + + return $template; + } +} From 91facd2d0a2869e2c26a5943d8afe1849d3891f8 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 10:35:50 -0400 Subject: [PATCH 2/6] replace macros implement new replaceMacros function --- doc/Addons.md | 2 +- doc/smarty3-templates.md | 4 +-- include/conversation.php | 13 ++++---- include/enotify.php | 7 +++-- include/items.php | 5 ++-- include/text.php | 14 ++++----- mod/admin.php | 43 ++++++++++++++------------- mod/allfriends.php | 3 +- mod/api.php | 5 ++-- mod/apps.php | 3 +- mod/babel.php | 3 +- mod/cal.php | 7 +++-- mod/common.php | 5 ++-- mod/community.php | 5 ++-- mod/credits.php | 3 +- mod/crepair.php | 3 +- mod/delegate.php | 3 +- mod/dfrn_request.php | 5 ++-- mod/directory.php | 3 +- mod/dirfind.php | 3 +- mod/display.php | 3 +- mod/editpost.php | 7 +++-- mod/events.php | 7 +++-- mod/fbrowser.php | 5 ++-- mod/feedtest.php | 3 +- mod/filer.php | 3 +- mod/follow.php | 5 ++-- mod/group.php | 9 +++--- mod/help.php | 3 +- mod/home.php | 3 +- mod/hostxrd.php | 3 +- mod/hovercard.php | 3 +- mod/invite.php | 3 +- mod/lostpass.php | 5 ++-- mod/maintenance.php | 3 +- mod/manage.php | 3 +- mod/manifest.php | 3 +- mod/match.php | 3 +- mod/message.php | 19 ++++++------ mod/network.php | 11 +++---- mod/notifications.php | 11 +++---- mod/notify.php | 5 ++-- mod/oexchange.php | 3 +- mod/opensearch.php | 3 +- mod/photos.php | 39 ++++++++++++------------ mod/poco.php | 3 +- mod/poke.php | 5 ++-- mod/profile_photo.php | 7 +++-- mod/profiles.php | 11 +++---- mod/register.php | 5 ++-- mod/removeme.php | 3 +- mod/search.php | 7 +++-- mod/settings.php | 41 ++++++++++++------------- mod/suggest.php | 5 ++-- mod/uexport.php | 3 +- mod/uimport.php | 3 +- mod/unfollow.php | 5 ++-- mod/videos.php | 9 +++--- mod/viewcontacts.php | 3 +- mod/wallmessage.php | 5 ++-- mod/xrd.php | 3 +- src/App.php | 10 +++---- src/Content/ForumManager.php | 3 +- src/Content/Nav.php | 3 +- src/Content/OEmbed.php | 3 +- src/Content/Pager.php | 5 ++-- src/Content/Text/BBCode.php | 3 +- src/Content/Widget.php | 13 ++++---- src/Content/Widget/CalendarExport.php | 3 +- src/Content/Widget/TagCloud.php | 3 +- src/Core/ACL.php | 3 +- src/Core/Installer.php | 5 ++-- src/Core/Renderer.php | 1 + src/Core/System.php | 3 +- src/Model/Event.php | 3 +- src/Model/Group.php | 5 ++-- src/Model/Profile.php | 15 +++++----- src/Module/Contact.php | 19 ++++++------ src/Module/Install.php | 9 +++--- src/Module/Itemsource.php | 3 +- src/Module/Login.php | 5 ++-- src/Module/Tos.php | 3 +- src/Object/Post.php | 3 +- src/Util/Temporal.php | 7 +++-- util/README | 2 +- view/theme/duepuntozero/config.php | 3 +- view/theme/frio/config.php | 3 +- view/theme/quattro/config.php | 3 +- view/theme/smoothly/theme.php | 3 +- view/theme/vier/config.php | 5 ++-- view/theme/vier/theme.php | 13 ++++---- 91 files changed, 335 insertions(+), 249 deletions(-) diff --git a/doc/Addons.md b/doc/Addons.md index f7dfcc870..cc5ea8d73 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -164,7 +164,7 @@ $tpl = get_markup_template('mytemplate.tpl', 'addon/addon_name/'); # apply template. first argument is the loaded template, # second an array of 'name' => 'values' to pass to template -$output = replace_macros($tpl, array( +$output = Renderer::replaceMacros($tpl, array( 'title' => 'My beautiful addon', )); ``` diff --git a/doc/smarty3-templates.md b/doc/smarty3-templates.md index d44f26325..6d53199f8 100644 --- a/doc/smarty3-templates.md +++ b/doc/smarty3-templates.md @@ -20,10 +20,10 @@ Templates that are only used by addons shall be placed in the directory. -To render a template use the function *get_markup_template* to load the template and *replace_macros* to replace the macros/variables in the just loaded template file. +To render a template use the function *getMarkupTemplate* to load the template and *replaceMacros* to replace the macros/variables in the just loaded template file. $tpl = get_markup_template('install_settings.tpl'); - $o .= replace_macros($tpl, array( ... )); + $o .= Renderer::replaceMacros($tpl, array( ... )); the array consists of an association of an identifier and the value for that identifier, i.e. diff --git a/include/conversation.php b/include/conversation.php index 8317746dd..45f5607bd 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -14,6 +14,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -758,7 +759,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ } } - $o = replace_macros($page_template, [ + $o = Renderer::replaceMacros($page_template, [ '$baseurl' => System::baseUrl($ssl_state), '$return_path' => $a->query_string, '$live_update' => $live_update_div, @@ -1062,7 +1063,7 @@ function format_like($cnt, array $arr, $type, $id) { } $phrase .= EOL ; - $o .= replace_macros(get_markup_template('voting_fakelink.tpl'), [ + $o .= Renderer::replaceMacros(get_markup_template('voting_fakelink.tpl'), [ '$phrase' => $phrase, '$type' => $type, '$id' => $id @@ -1076,10 +1077,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) { $o = ''; - $geotag = x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), []) : ''; + $geotag = x($x, 'allow_location') ? Renderer::replaceMacros(get_markup_template('jot_geotag.tpl'), []) : ''; $tpl = get_markup_template('jot-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$newpost' => 'true', '$baseurl' => System::baseUrl(true), '$geotag' => $geotag, @@ -1117,10 +1118,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) $public_post_link = '&public=1'; } - // $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); + // $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins)); $tpl = get_markup_template("jot.tpl"); - $o .= replace_macros($tpl,[ + $o .= Renderer::replaceMacros($tpl,[ '$new_post' => L10n::t('New Post'), '$return_path' => $query_str, '$action' => 'item', diff --git a/include/enotify.php b/include/enotify.php index bc9a7b9b0..cf8b195de 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -8,6 +8,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -517,7 +518,7 @@ function notification($params) } $itemlink = System::baseUrl().'/notify/view/'.$notify_id; - $msg = replace_macros($epreamble, ['$itemlink' => $itemlink]); + $msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $itemlink]); $msg_cache = format_notification_message($datarray['name_cache'], strip_tags(BBCode::convert($msg))); $fields = ['msg' => $msg, 'msg_cache' => $msg_cache]; @@ -590,7 +591,7 @@ function notification($params) // load the template for private message notifications $tpl = get_markup_template('email_notify_html.tpl'); - $email_html_body = replace_macros($tpl, [ + $email_html_body = Renderer::replaceMacros($tpl, [ '$banner' => $datarray['banner'], '$product' => $datarray['product'], '$preamble' => str_replace("\n", "
\n", $datarray['preamble']), @@ -611,7 +612,7 @@ function notification($params) // load the template for private message notifications $tpl = get_markup_template('email_notify_text.tpl'); - $email_text_body = replace_macros($tpl, [ + $email_text_body = Renderer::replaceMacros($tpl, [ '$banner' => $datarray['banner'], '$product' => $datarray['product'], '$preamble' => $datarray['preamble'], diff --git a/include/items.php b/include/items.php index 104547ab8..ff9559b28 100644 --- a/include/items.php +++ b/include/items.php @@ -11,6 +11,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Item; @@ -390,7 +391,7 @@ function drop_item($id) } } - return replace_macros(get_markup_template('confirm.tpl'), [ + return Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ '$method' => 'get', '$message' => L10n::t('Do you really want to delete this item?'), '$extra_inputs' => $inputs, @@ -481,7 +482,7 @@ function posted_date_widget($url, $uid, $wall) $cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years; $cutoff = ((array_key_exists($cutoff_year, $ret))? true : false); - $o = replace_macros(get_markup_template('posted_date_widget.tpl'),[ + $o = Renderer::replaceMacros(get_markup_template('posted_date_widget.tpl'),[ '$title' => L10n::t('Archives'), '$size' => $visible_years, '$cutoff_year' => $cutoff_year, diff --git a/include/text.php b/include/text.php index 0c2ea61de..d5c2ee961 100644 --- a/include/text.php +++ b/include/text.php @@ -267,7 +267,7 @@ function unxmlify($s) { */ function scroll_loader() { $tpl = get_markup_template("scroll_loader.tpl"); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ 'wait' => L10n::t('Loading more entries...'), 'end' => L10n::t('The end') ]); @@ -514,7 +514,7 @@ function contact_block() { } $tpl = get_markup_template('contact_block.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$contacts' => $contacts, '$nickname' => $a->profile['nickname'], '$viewcontacts' => L10n::t('View Contacts'), @@ -571,7 +571,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { $url = ''; } - return replace_macros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[ + return Renderer::replaceMacros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[ '$click' => defaults($contact, 'click', ''), '$class' => $class, '$url' => $url, @@ -626,7 +626,7 @@ function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = } } - return replace_macros(get_markup_template('searchbox.tpl'), $values); + return Renderer::replaceMacros(get_markup_template('searchbox.tpl'), $values); } /** @@ -904,14 +904,14 @@ function prepare_body(array &$item, $attach = false, $is_preview = false) if (strpos($mime, 'video') !== false) { if (!$vhead) { $vhead = true; - $a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), [ + $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('videos_head.tpl'), [ '$baseurl' => System::baseUrl(), ]); } $url_parts = explode('/', $the_url); $id = end($url_parts); - $as .= replace_macros(get_markup_template('video_top.tpl'), [ + $as .= Renderer::replaceMacros(get_markup_template('video_top.tpl'), [ '$video' => [ 'id' => $id, 'title' => L10n::t('View Video'), @@ -1007,7 +1007,7 @@ function apply_content_filter($html, array $reasons) { if (count($reasons)) { $tpl = get_markup_template('wall/content_filter.tpl'); - $html = replace_macros($tpl, [ + $html = Renderer::replaceMacros($tpl, [ '$reasons' => $reasons, '$rnd' => random_string(8), '$openclose' => L10n::t('Click to open/close'), diff --git a/mod/admin.php b/mod/admin.php index d4cbafe54..dce65c2fc 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -14,6 +14,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Core\Worker; @@ -174,7 +175,7 @@ function admin_content(App $a) // apc_delete($toDelete); //} // Header stuff - $a->page['htmlhead'] .= replace_macros(get_markup_template('admin/settings_head.tpl'), []); + $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('admin/settings_head.tpl'), []); /* * Side bar links @@ -226,7 +227,7 @@ function admin_content(App $a) } $t = get_markup_template('admin/aside.tpl'); - $a->page['aside'] .= replace_macros($t, [ + $a->page['aside'] .= Renderer::replaceMacros($t, [ '$admin' => $aside_tools, '$subpages' => $aside_sub, '$admtxt' => L10n::t('Admin'), @@ -314,7 +315,7 @@ function admin_page_tos(App $a) { $tos = new Tos(); $t = get_markup_template('admin/tos.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Terms of Service'), '$displaytos' => ['displaytos', L10n::t('Display Terms of Service'), Config::get('system', 'tosdisplay'), L10n::t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')], @@ -376,7 +377,7 @@ function admin_page_blocklist(App $a) } } $t = get_markup_template('admin/blocklist.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Server Blocklist'), '$intro' => L10n::t('This page can be used to define a black list of servers from the federated network that are not allowed to interact with your node. For all entered domains you should also give a reason why you have blocked the remote server.'), @@ -491,7 +492,7 @@ function admin_page_contactblock(App $a) $contacts = DBA::toArray($statement); $t = get_markup_template('admin/contactblock.tpl'); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ // strings // '$title' => L10n::t('Administration'), '$page' => L10n::t('Remote Contact Blocklist'), @@ -534,7 +535,7 @@ function admin_page_deleteitem(App $a) { $t = get_markup_template('admin/deleteitem.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Delete Item'), '$submit' => L10n::t('Delete this Item'), @@ -726,7 +727,7 @@ function admin_page_federation(App $a) // load the template, replace the macros and return the page content $t = get_markup_template('admin/federation.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Federation Statistics'), '$intro' => $intro, @@ -769,7 +770,7 @@ function admin_page_queue(App $a) DBA::close($entries); $t = get_markup_template('admin/queue.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Inspect Queue'), '$count' => count($r), @@ -820,7 +821,7 @@ function admin_page_workerqueue(App $a, $deferred) DBA::close($entries); $t = get_markup_template('admin/workerqueue.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => $sub_title, '$count' => count($r), @@ -938,7 +939,7 @@ function admin_page_summary(App $a) 'mysql' => ['max_allowed_packet' => $max_allowed_packet]]; $t = get_markup_template('admin/summary.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Summary'), '$queues' => $queues, @@ -1449,7 +1450,7 @@ function admin_page_site(App $a) } $t = get_markup_template('admin/site.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Site'), '$submit' => L10n::t('Save Settings'), @@ -1642,13 +1643,13 @@ function admin_page_dbsync(App $a) } if (!count($failed)) { - $o = replace_macros(get_markup_template('structure_check.tpl'), [ + $o = Renderer::replaceMacros(get_markup_template('structure_check.tpl'), [ '$base' => System::baseUrl(true), '$banner' => L10n::t('No failed updates.'), '$check' => L10n::t('Check database structure'), ]); } else { - $o = replace_macros(get_markup_template('failed_updates.tpl'), [ + $o = Renderer::replaceMacros(get_markup_template('failed_updates.tpl'), [ '$base' => System::baseUrl(true), '$banner' => L10n::t('Failed Updates'), '$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'), @@ -1910,7 +1911,7 @@ function admin_page_users(App $a) $th_users = array_map(null, [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Type')], $valid_orders); $t = get_markup_template('admin/users.tpl'); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ // strings // '$title' => L10n::t('Administration'), '$page' => L10n::t('Users'), @@ -2027,7 +2028,7 @@ function admin_page_addons(App $a, array $addons_admin) $t = get_markup_template('admin/addon_details.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Addons'), '$toggle' => L10n::t('Toggle'), @@ -2087,7 +2088,7 @@ function admin_page_addons(App $a, array $addons_admin) } $t = get_markup_template('admin/addons.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Addons'), '$submit' => L10n::t('Save Settings'), @@ -2297,7 +2298,7 @@ function admin_page_themes(App $a) } $t = get_markup_template('admin/addon_details.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Themes'), '$toggle' => L10n::t('Toggle'), @@ -2341,7 +2342,7 @@ function admin_page_themes(App $a) } $t = get_markup_template('admin/addons.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Themes'), '$submit' => L10n::t('Save Settings'), @@ -2416,7 +2417,7 @@ function admin_page_logs(App $a) $t = get_markup_template('admin/logs.tpl'); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Logs'), '$submit' => L10n::t('Save Settings'), @@ -2483,7 +2484,7 @@ function admin_page_viewlogs(App $a) fclose($fp); } } - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('View Logs'), '$data' => $data, @@ -2562,7 +2563,7 @@ function admin_page_features(App $a) } $tpl = get_markup_template('admin/settings_features.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("admin_manage_features"), '$title' => L10n::t('Manage Additional Features'), '$features' => $arr, diff --git a/mod/allfriends.php b/mod/allfriends.php index 83ea73af6..5f368220b 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Content\ContactSelector; use Friendica\Content\Pager; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model; @@ -100,7 +101,7 @@ function allfriends_content(App $a) $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])), '$tab_str' => $tab_str, '$contacts' => $entries, diff --git a/mod/api.php b/mod/api.php index 716b48446..e81633531 100644 --- a/mod/api.php +++ b/mod/api.php @@ -5,6 +5,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Module\Login; @@ -82,7 +83,7 @@ function api_content(App $a) } $tpl = get_markup_template("oauth_authorize_done.tpl"); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Authorize application connection'), '$info' => L10n::t('Return to your app and insert this Securty Code:'), '$code' => $verifier, @@ -104,7 +105,7 @@ function api_content(App $a) } $tpl = get_markup_template('oauth_authorize.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Authorize application connection'), '$app' => $app, '$authorize' => L10n::t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'), diff --git a/mod/apps.php b/mod/apps.php index 80138f78d..5fd00462e 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -5,6 +5,7 @@ use Friendica\Content\Nav; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; function apps_content() { @@ -25,7 +26,7 @@ function apps_content() } $tpl = get_markup_template('apps.tpl'); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$title' => $title, '$apps' => $apps, ]); diff --git a/mod/babel.php b/mod/babel.php index 65287b9f2..6a6e084a0 100644 --- a/mod/babel.php +++ b/mod/babel.php @@ -5,6 +5,7 @@ use Friendica\Content\Text; use Friendica\Core\L10n; +use Friendica\Core\Renderer; function visible_whitespace($s) { @@ -140,7 +141,7 @@ function babel_content() } $tpl = get_markup_template('babel.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$text' => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''], '$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'], '$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'], diff --git a/mod/cal.php b/mod/cal.php index 6f483acc1..f9e4b3fdf 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -12,6 +12,7 @@ use Friendica\Content\Nav; use Friendica\Content\Widget; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -61,7 +62,7 @@ function cal_init(App $a) $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget = replace_macros($tpl, [ + $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""), @@ -89,7 +90,7 @@ function cal_content(App $a) $i18n = Event::getStrings(); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [ '$baseurl' => System::baseUrl(), '$module_url' => '/cal/' . $a->data['user']['nickname'], '$modparams' => 2, @@ -267,7 +268,7 @@ function cal_content(App $a) $events[$key]['item'] = $event_item; } - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$tabs' => $tabs, '$title' => L10n::t('Events'), diff --git a/mod/common.php b/mod/common.php index 8fb19b57c..0a84dc56c 100644 --- a/mod/common.php +++ b/mod/common.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Content\ContactSelector; use Friendica\Content\Pager; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model; use Friendica\Module; @@ -48,7 +49,7 @@ function common_content(App $a) $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]); if (DBA::isResult($contact)) { - $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [ + $vcard_widget = Renderer::replaceMacros(get_markup_template("vcard-widget.tpl"), [ '$name' => htmlentities($contact['name']), '$photo' => $contact['photo'], 'url' => 'contact/' . $cid @@ -144,7 +145,7 @@ function common_content(App $a) $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$title' => $title, '$tab_str' => $tab_str, '$contacts' => $entries, diff --git a/mod/community.php b/mod/community.php index 1017698ea..a85a79c05 100644 --- a/mod/community.php +++ b/mod/community.php @@ -10,6 +10,7 @@ use Friendica\Core\ACL; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Item; @@ -120,7 +121,7 @@ function community_content(App $a, $update = 0) } $tab_tpl = get_markup_template('common_tabs.tpl'); - $o .= replace_macros($tab_tpl, ['$tabs' => $tabs]); + $o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); Nav::setSelected('community'); @@ -199,7 +200,7 @@ function community_content(App $a, $update = 0) } $t = get_markup_template("community.tpl"); - return replace_macros($t, [ + return Renderer::replaceMacros($t, [ '$content' => $o, '$header' => '', '$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'), diff --git a/mod/credits.php b/mod/credits.php index 880b4b34c..42894484a 100644 --- a/mod/credits.php +++ b/mod/credits.php @@ -7,6 +7,7 @@ */ use Friendica\App; use Friendica\Core\L10n; +use Friendica\Core\Renderer; function credits_content() { @@ -14,7 +15,7 @@ function credits_content() $credits_string = file_get_contents('util/credits.txt'); $names = explode("\n", htmlspecialchars($credits_string)); $tpl = get_markup_template('credits.tpl'); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Credits'), '$thanks' => L10n::t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'), '$names' => $names, diff --git a/mod/crepair.php b/mod/crepair.php index 1ca04af50..7c8761a54 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -8,6 +8,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model; use Friendica\Module; @@ -137,7 +138,7 @@ function crepair_content(App $a) $tab_str = Module\Contact::getTabsHTML($a, $contact, 5); $tpl = get_markup_template('crepair.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$tab_str' => $tab_str, '$warning' => $warning, '$info' => $info, diff --git a/mod/delegate.php b/mod/delegate.php index e38ce058e..bd21bb2ee 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\BaseModule; use Friendica\Core\L10n; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\User; @@ -163,7 +164,7 @@ function delegate_content(App $a) $parent_password = ['parent_password', L10n::t('Parent Password:'), '', L10n::t('Please enter the password of the parent account to legitimize your request.')]; } - $o = replace_macros(get_markup_template('delegate.tpl'), [ + $o = Renderer::replaceMacros(get_markup_template('delegate.tpl'), [ '$form_security_token' => BaseModule::getFormSecurityToken('delegate'), '$parent_header' => L10n::t('Parent User'), '$parent_user' => $parent_user, diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 674248be2..65b0b2ed3 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -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\Database\DBA; use Friendica\Model\Contact; @@ -515,7 +516,7 @@ function dfrn_request_content(App $a) } $tpl = get_markup_template("dfrn_req_confirm.tpl"); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$dfrn_url' => $dfrn_url, '$aes_allow' => (($aes_allow) ? '' : "" ), '$hidethem' => L10n::t('Hide this contact'), @@ -639,7 +640,7 @@ function dfrn_request_content(App $a) get_server() . '/servers' ); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$header' => L10n::t('Friend/Connection Request'), '$desc' => L10n::t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'), '$pls_answer' => L10n::t('Please answer the following:'), diff --git a/mod/directory.php b/mod/directory.php index 6c8be7c3c..6f6348103 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -10,6 +10,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; @@ -203,7 +204,7 @@ function directory_content(App $a) $tpl = get_markup_template('directory_header.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$search' => $search, '$globaldir' => L10n::t('Global Directory'), '$gdirpath' => $gdirpath, diff --git a/mod/dirfind.php b/mod/dirfind.php index 5d7815bd8..4c38a2dbd 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -10,6 +10,7 @@ use Friendica\Content\Widget; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -250,7 +251,7 @@ function dirfind_content(App $a, $prefix = "") { } $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl,[ + $o .= Renderer::replaceMacros($tpl,[ 'title' => $header, '$contacts' => $entries, '$paginate' => $pager->renderFull($j->total), diff --git a/mod/display.php b/mod/display.php index d95404a5b..b6577b008 100644 --- a/mod/display.php +++ b/mod/display.php @@ -12,6 +12,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\Database\DBA; use Friendica\Model\Contact; @@ -263,7 +264,7 @@ function display_content(App $a, $update = false, $update_uid = 0) $conversation = ''; } - $a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), + $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('display-head.tpl'), ['$alternate' => $alternate, '$conversation' => $conversation]); diff --git a/mod/editpost.php b/mod/editpost.php index 83fcdca56..fe1e5842e 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -7,6 +7,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 Friendcia\Model\FileTag; use Friendica\Model\Item; @@ -40,12 +41,12 @@ function editpost_content(App $a) $geotag = ''; - $o .= replace_macros(get_markup_template("section_title.tpl"), [ + $o .= Renderer::replaceMacros(get_markup_template("section_title.tpl"), [ '$title' => L10n::t('Edit post') ]); $tpl = get_markup_template('jot-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$ispublic' => ' ', // L10n::t('Visible to everybody'), '$geotag' => $geotag, @@ -85,7 +86,7 @@ function editpost_content(App $a) Addon::callHooks('jot_tool', $jotplugins); //Addon::callHooks('jot_networks', $jotnets); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$is_edit' => true, '$return_path' => '/display/' . $item['guid'], '$action' => 'item', diff --git a/mod/events.php b/mod/events.php index a13080a8e..932f9acfa 100644 --- a/mod/events.php +++ b/mod/events.php @@ -10,6 +10,7 @@ use Friendica\Content\Widget\CalendarExport; use Friendica\Core\ACL; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -226,7 +227,7 @@ function events_content(App $a) $i18n = Event::getStrings(); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [ '$baseurl' => System::baseUrl(), '$module_url' => '/events', '$modparams' => 1, @@ -382,7 +383,7 @@ function events_content(App $a) $events[$key]['item'] = $event_item; } - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$tabs' => $tabs, '$title' => L10n::t('Events'), @@ -499,7 +500,7 @@ function events_content(App $a) $tpl = get_markup_template('event_form.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$post' => System::baseUrl() . '/events', '$eid' => $eid, '$cid' => $cid, diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 3839bcc1c..e1e4dc572 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Object\Image; @@ -95,7 +96,7 @@ function fbrowser_content(App $a) $tpl = get_markup_template($template_file); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$type' => 'image', '$baseurl' => System::baseUrl(), '$path' => $path, @@ -126,7 +127,7 @@ function fbrowser_content(App $a) $tpl = get_markup_template($template_file); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$type' => 'file', '$baseurl' => System::baseUrl(), '$path' => [ [ "", L10n::t("Files")] ], diff --git a/mod/feedtest.php b/mod/feedtest.php index e75e7a1b8..a284c4115 100644 --- a/mod/feedtest.php +++ b/mod/feedtest.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Protocol\Feed; @@ -44,7 +45,7 @@ function feedtest_content(App $a) } $tpl = get_markup_template('feedtest.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''], '$result' => $result ]); diff --git a/mod/filer.php b/mod/filer.php index 050fa7063..f4e90d603 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Model\FileTag; require_once 'include/items.php'; @@ -31,7 +32,7 @@ function filer_content(App $a) $filetags = explode(",", $filetags); $tpl = get_markup_template("filer_dialog.tpl"); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$field' => ['term', L10n::t("Save to Folder:"), '', '', $filetags, L10n::t('- select -')], '$submit' => L10n::t('Save'), ]); diff --git a/mod/follow.php b/mod/follow.php index adc3fcc3b..2a069e72a 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -144,7 +145,7 @@ function follow_content(App $a) $header = L10n::t('Connect/Follow'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$header' => htmlentities($header), //'$photo' => ProxyUtils::proxifyUrl($ret['photo'], false, ProxyUtils::SIZE_SMALL), '$desc' => '', @@ -187,7 +188,7 @@ function follow_content(App $a) } if ($gcontact_id <> 0) { - $o .= replace_macros(get_markup_template('section_title.tpl'), + $o .= Renderer::replaceMacros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')] ); diff --git a/mod/group.php b/mod/group.php index 404448ebb..1791fce3e 100644 --- a/mod/group.php +++ b/mod/group.php @@ -10,6 +10,7 @@ use Friendica\BaseModule; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model; @@ -105,7 +106,7 @@ function group_content(App $a) { ]; if (($a->argc == 2) && ($a->argv[1] === 'new')) { - return replace_macros($tpl, $context + [ + return Renderer::replaceMacros($tpl, $context + [ '$title' => L10n::t('Create a group of contacts/friends.'), '$gname' => ['groupname', L10n::t('Group Name: '), '', ''], '$gid' => 'new', @@ -215,7 +216,7 @@ function group_content(App $a) { } $drop_tpl = get_markup_template('group_drop.tpl'); - $drop_txt = replace_macros($drop_tpl, [ + $drop_txt = Renderer::replaceMacros($drop_tpl, [ '$id' => $group['id'], '$delete' => L10n::t('Delete Group'), '$form_security_token' => BaseModule::getFormSecurityToken("group_drop"), @@ -307,10 +308,10 @@ function group_content(App $a) { if ($change) { $tpl = get_markup_template('groupeditor.tpl'); - echo replace_macros($tpl, $context); + echo Renderer::replaceMacros($tpl, $context); killme(); } - return replace_macros($tpl, $context); + return Renderer::replaceMacros($tpl, $context); } diff --git a/mod/help.php b/mod/help.php index 53118544f..553f1ae8f 100644 --- a/mod/help.php +++ b/mod/help.php @@ -8,6 +8,7 @@ use Friendica\Content\Nav; use Friendica\Content\Text\Markdown; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; function load_doc_file($s) @@ -61,7 +62,7 @@ function help_content(App $a) if (!strlen($text)) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found')); $tpl = get_markup_template("404.tpl"); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$message' => L10n::t('Page not found.') ]); } diff --git a/mod/home.php b/mod/home.php index bf5b5d27f..4c7a1a8a4 100644 --- a/mod/home.php +++ b/mod/home.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Module\Login; @@ -54,7 +55,7 @@ function home_content(App $a) { $tpl = get_markup_template('home.tpl'); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$defaultheader' => $defaultheader, '$customhome' => $customhome, '$login' => $login, diff --git a/mod/hostxrd.php b/mod/hostxrd.php index 30343381c..ec8b2cb35 100644 --- a/mod/hostxrd.php +++ b/mod/hostxrd.php @@ -4,6 +4,7 @@ */ use Friendica\App; use Friendica\Core\Config; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Protocol\Salmon; use Friendica\Util\Crypto; @@ -22,7 +23,7 @@ function hostxrd_init(App $a) } $tpl = get_markup_template('xrd_host.tpl'); - echo replace_macros($tpl, [ + echo Renderer::replaceMacros($tpl, [ '$zhost' => $a->getHostName(), '$zroot' => System::baseUrl(), '$domain' => System::baseUrl(), diff --git a/mod/hovercard.php b/mod/hovercard.php index 8b51eb00a..1c9766d49 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -10,6 +10,7 @@ use Friendica\App; use Friendica\Core\Config; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -111,7 +112,7 @@ function hovercard_content() ]; if ($datatype == 'html') { $tpl = get_markup_template('hovercard.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$profile' => $profile, ]); diff --git a/mod/invite.php b/mod/invite.php index 7f479157f..374628f55 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -11,6 +11,7 @@ use Friendica\BaseModule; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Protocol\Email; @@ -140,7 +141,7 @@ function invite_content(App $a) { } } - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("send_invite"), '$title' => L10n::t('Send invitations'), '$recipients' => ['recipients', L10n::t('Enter email addresses, one per line:')], diff --git a/mod/lostpass.php b/mod/lostpass.php index 9cde1c9ff..954788aa4 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\User; @@ -116,7 +117,7 @@ function lostpass_content(App $a) function lostpass_form() { $tpl = get_markup_template('lostpass.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Forgot your Password?'), '$desc' => L10n::t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), '$name' => L10n::t('Nickname or Email: '), @@ -135,7 +136,7 @@ function lostpass_generate_password($user) $result = User::updatePassword($user['uid'], $new_password); if (DBA::isResult($result)) { $tpl = get_markup_template('pwdreset.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$lbl1' => L10n::t('Password Reset'), '$lbl2' => L10n::t('Your password has been reset as requested.'), '$lbl3' => L10n::t('Your new password is'), diff --git a/mod/maintenance.php b/mod/maintenance.php index 8727e4afb..ccff935b8 100644 --- a/mod/maintenance.php +++ b/mod/maintenance.php @@ -5,6 +5,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; function maintenance_content(App $a) { @@ -20,7 +21,7 @@ function maintenance_content(App $a) header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 600'); - return replace_macros(get_markup_template('maintenance.tpl'), [ + return Renderer::replaceMacros(get_markup_template('maintenance.tpl'), [ '$sysdown' => L10n::t('System down for maintenance'), '$reason' => $reason ]); diff --git a/mod/manage.php b/mod/manage.php index b98fcac6f..20ed7e294 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\Authentication; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; @@ -176,7 +177,7 @@ function manage_content(App $a) { $identities[$key]['notifications'] = $notifications; } - $o = replace_macros(get_markup_template('manage.tpl'), [ + $o = Renderer::replaceMacros(get_markup_template('manage.tpl'), [ '$title' => L10n::t('Manage Identities and/or Pages'), '$desc' => L10n::t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'), '$choose' => L10n::t('Select an identity to manage: '), diff --git a/mod/manifest.php b/mod/manifest.php index a651f5166..98325c336 100644 --- a/mod/manifest.php +++ b/mod/manifest.php @@ -3,6 +3,7 @@ use Friendica\App; use Friendica\Core\System; use Friendica\Core\Config; +use Friendica\Core\Renderer; function manifest_content(App $a) { @@ -15,7 +16,7 @@ function manifest_content(App $a) { $touch_icon = 'images/friendica-128.png'; } - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$touch_icon' => $touch_icon, '$title' => Config::get('config', 'sitename', 'Friendica'), diff --git a/mod/match.php b/mod/match.php index 43a391650..1856dd981 100644 --- a/mod/match.php +++ b/mod/match.php @@ -8,6 +8,7 @@ use Friendica\Content\Pager; use Friendica\Content\Widget; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -114,7 +115,7 @@ function match_content(App $a) $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Profile Match'), '$contacts' => $entries, '$paginate' => $pager->renderFull($j->total) diff --git a/mod/message.php b/mod/message.php index 5f7ffb2b7..3e2cccb76 100644 --- a/mod/message.php +++ b/mod/message.php @@ -10,6 +10,7 @@ use Friendica\Content\Smilies; use Friendica\Content\Text\BBCode; use Friendica\Core\ACL; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -37,14 +38,14 @@ function message_init(App $a) ]; $tpl = get_markup_template('message_side.tpl'); - $a->page['aside'] = replace_macros($tpl, [ + $a->page['aside'] = Renderer::replaceMacros($tpl, [ '$tabs' => $tabs, '$new' => $new, ]); $base = System::baseUrl(); $head_tpl = get_markup_template('message-head.tpl'); - $a->page['htmlhead'] .= replace_macros($head_tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base ]); @@ -119,7 +120,7 @@ function message_content(App $a) 'accesskey' => 'm', ]; } - $header = replace_macros($tpl, [ + $header = Renderer::replaceMacros($tpl, [ '$messages' => L10n::t('Messages'), '$button' => $button, ]); @@ -143,7 +144,7 @@ function message_content(App $a) } //$a->page['aside'] = ''; - return replace_macros(get_markup_template('confirm.tpl'), [ + return Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ '$method' => 'get', '$message' => L10n::t('Do you really want to delete this message?'), '$extra_inputs' => $inputs, @@ -199,7 +200,7 @@ function message_content(App $a) $o .= $header; $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => L10n::t('Please enter a link URL:') @@ -244,7 +245,7 @@ function message_content(App $a) $select = ACL::getMessageContactSelectHTML('messageto', 'message-to-select', $preselect, 4, 10); $tpl = get_markup_template('prv_message.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$header' => L10n::t('Send Private Message'), '$to' => L10n::t('To:'), '$showinputs' => 'true', @@ -339,7 +340,7 @@ function message_content(App $a) ); $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => L10n::t('Please enter a link URL:') @@ -399,7 +400,7 @@ function message_content(App $a) $parent = ''; $tpl = get_markup_template('mail_display.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$thread_id' => $a->argv[1], '$thread_subject' => $message['title'], '$thread_seen' => $seen, @@ -478,7 +479,7 @@ function render_messages(array $msg, $t) $from_photo = (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']); } - $rslt .= replace_macros($tpl, [ + $rslt .= Renderer::replaceMacros($tpl, [ '$id' => $rr['id'], '$from_name' => $participants, '$from_url' => Contact::magicLink($rr['url']), diff --git a/mod/network.php b/mod/network.php index 6ba353d7e..5913f804b 100644 --- a/mod/network.php +++ b/mod/network.php @@ -18,6 +18,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\Group; @@ -201,7 +202,7 @@ function saved_searches($search) } $tpl = get_markup_template('saved_searches_aside.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Saved Searches'), '$add' => L10n::t('add'), '$searchbox' => search($search, 'netsearch-box', $srchurl, true), @@ -653,7 +654,7 @@ function networkThreadedView(App $a, $update, $parent) info(L10n::t('Group is empty')); } - $o = replace_macros(get_markup_template('section_title.tpl'), [ + $o = Renderer::replaceMacros(get_markup_template('section_title.tpl'), [ '$title' => L10n::t('Group: %s', $group['name']) ]) . $o; } elseif ($cid) { @@ -674,7 +675,7 @@ function networkThreadedView(App $a, $update, $parent) $entries[0]['account_type'] = Contact::getAccountType($contact); - $o = replace_macros(get_markup_template('viewcontact_template.tpl'), [ + $o = Renderer::replaceMacros(get_markup_template('viewcontact_template.tpl'), [ 'contacts' => $entries, 'id' => 'network', ]) . $o; @@ -1034,7 +1035,7 @@ function network_tabs(App $a) $tpl = get_markup_template('common_tabs.tpl'); - return replace_macros($tpl, ['$tabs' => $arr['tabs']]); + return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]); // --- end item filter tabs } @@ -1059,7 +1060,7 @@ function network_infinite_scroll_head(App $a, &$htmlhead) && defaults($_GET, 'mode', '') != 'minimal' ) { $tpl = get_markup_template('infinite_scroll_head.tpl'); - $htmlhead .= replace_macros($tpl, [ + $htmlhead .= Renderer::replaceMacros($tpl, [ '$pageno' => $pager->getPage(), '$reload_uri' => $pager->getBaseQueryString() ]); diff --git a/mod/notifications.php b/mod/notifications.php index 81084c1bc..c2dc1cd4c 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -11,6 +11,7 @@ use Friendica\Content\Pager; use Friendica\Core\L10n; use Friendica\Core\NotificationsManager; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Module\Login; @@ -158,7 +159,7 @@ function notifications_content(App $a) // We have to distinguish between these two because they use different data. switch ($notif['label']) { case 'friend_suggestion': - $notif_content[] = replace_macros($sugg, [ + $notif_content[] = Renderer::replaceMacros($sugg, [ '$type' => $notif['label'], '$str_notifytype' => L10n::t('Notification type:'), '$notify_type'=> $notif['notify_type'], @@ -209,7 +210,7 @@ function notifications_content(App $a) } $dfrn_tpl = get_markup_template('netfriend.tpl'); - $dfrn_text = replace_macros($dfrn_tpl, [ + $dfrn_text = Renderer::replaceMacros($dfrn_tpl, [ '$intro_id' => $notif['intro_id'], '$friend_selected' => $friend_selected, '$fan_selected'=> $fan_selected, @@ -234,7 +235,7 @@ function notifications_content(App $a) $discard = ''; } - $notif_content[] = replace_macros($tpl, [ + $notif_content[] = Renderer::replaceMacros($tpl, [ '$type' => $notif['label'], '$header' => htmlentities($header), '$str_notifytype' => L10n::t('Notification type:'), @@ -295,7 +296,7 @@ function notifications_content(App $a) $tpl_notif = get_markup_template($notification_templates[$notif['label']]); - $notif_content[] = replace_macros($tpl_notif, [ + $notif_content[] = Renderer::replaceMacros($tpl_notif, [ '$item_label' => $notif['label'], '$item_link' => $notif['link'], '$item_image' => $notif['image'], @@ -310,7 +311,7 @@ function notifications_content(App $a) $notif_nocontent = L10n::t('No more %s notifications.', $notifs['ident']); } - $o .= replace_macros($notif_tpl, [ + $o .= Renderer::replaceMacros($notif_tpl, [ '$notif_header' => $notif_header, '$tabs' => $tabs, '$notif_content' => $notif_content, diff --git a/mod/notify.php b/mod/notify.php index 6ec36d8f9..b7e2faf1c 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\L10n; use Friendica\Core\NotificationsManager; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Item; @@ -66,7 +67,7 @@ function notify_content(App $a) $r = $nm->getAll(['seen'=>0]); if (DBA::isResult($r) > 0) { foreach ($r as $it) { - $notif_content .= replace_macros($not_tpl, [ + $notif_content .= Renderer::replaceMacros($not_tpl, [ '$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(BBCode::convert($it['msg'])), @@ -77,7 +78,7 @@ function notify_content(App $a) $notif_content .= L10n::t('No more system notifications.'); } - $o = replace_macros($notif_tpl, [ + $o = Renderer::replaceMacros($notif_tpl, [ '$notif_header' => L10n::t('System Notifications'), '$tabs' => false, // $tabs, '$notif_content' => $notif_content, diff --git a/mod/oexchange.php b/mod/oexchange.php index 72577ab4e..df5f391d4 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -4,6 +4,7 @@ */ use Friendica\App; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Module\Login; use Friendica\Util\Network; @@ -13,7 +14,7 @@ function oexchange_init(App $a) { if (($a->argc > 1) && ($a->argv[1] === 'xrd')) { $tpl = get_markup_template('oexchange_xrd.tpl'); - $o = replace_macros($tpl, ['$base' => System::baseUrl()]); + $o = Renderer::replaceMacros($tpl, ['$base' => System::baseUrl()]); echo $o; killme(); } diff --git a/mod/opensearch.php b/mod/opensearch.php index 541002410..b7c5ce280 100644 --- a/mod/opensearch.php +++ b/mod/opensearch.php @@ -1,6 +1,7 @@ System::baseUrl(), '$nodename' => $a->getHostName(), ]); diff --git a/mod/photos.php b/mod/photos.php index 8ddb0010d..92f79d7c9 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -13,6 +13,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -64,7 +65,7 @@ function photos_init(App $a) { $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget = replace_macros($tpl, [ + $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => defaults($profile, 'addr', ''), @@ -109,7 +110,7 @@ function photos_init(App $a) { } if ($ret['success']) { - $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'), [ + $photo_albums_widget = Renderer::replaceMacros(get_markup_template('photo_albums.tpl'), [ '$nick' => $a->data['user']['nickname'], '$title' => L10n::t('Photo Albums'), '$recent' => L10n::t('Recent Photos'), @@ -132,7 +133,7 @@ function photos_init(App $a) { $tpl = get_markup_template("photos_head.tpl"); - $a->page['htmlhead'] .= replace_macros($tpl,[ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$ispublic' => L10n::t('everybody') ]); } @@ -246,7 +247,7 @@ function photos_post(App $a) ['name' => 'albumname', 'value' => $_POST['albumname']], ]; - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ '$method' => 'post', '$message' => L10n::t('Do you really want to delete this photo album and all its photos?'), '$extra_inputs' => $extra_inputs, @@ -318,7 +319,7 @@ function photos_post(App $a) if (!empty($_REQUEST['confirm'])) { $drop_url = $a->query_string; - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ '$method' => 'post', '$message' => L10n::t('Do you really want to delete this photo?'), '$extra_inputs' => [], @@ -1084,8 +1085,8 @@ function photos_content(App $a) Addon::callHooks('photo_upload_form',$ret); - $default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), []); - $default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), [ + $default_upload_box = Renderer::replaceMacros(get_markup_template('photos_default_uploader_box.tpl'), []); + $default_upload_submit = Renderer::replaceMacros(get_markup_template('photos_default_uploader_submit.tpl'), [ '$submit' => L10n::t('Submit'), ]); @@ -1095,7 +1096,7 @@ function photos_content(App $a) $aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML($a->user)); - $o .= replace_macros($tpl,[ + $o .= Renderer::replaceMacros($tpl,[ '$pagename' => L10n::t('Upload Photos'), '$sessid' => session_id(), '$usage' => $usage_message, @@ -1169,7 +1170,7 @@ function photos_content(App $a) $album_e = $album; - $o .= replace_macros($edit_tpl,[ + $o .= Renderer::replaceMacros($edit_tpl,[ '$nametext' => L10n::t('New album name: '), '$nickname' => $a->data['user']['nickname'], '$album' => $album_e, @@ -1220,7 +1221,7 @@ function photos_content(App $a) } $tpl = get_markup_template('photo_album.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$photos' => $photos, '$album' => $album, '$can_post' => $can_post, @@ -1342,7 +1343,7 @@ function photos_content(App $a) if ($cmd === 'edit') { $tpl = get_markup_template('photo_edit_head.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl,[ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$prevlink' => $prevlink, '$nextlink' => $nextlink ]); @@ -1434,7 +1435,7 @@ function photos_content(App $a) $caption_e = $ph[0]['desc']; $aclselect_e = ACL::getFullSelectorHTML($a->user, false, $ph[0]); - $edit = replace_macros($edit_tpl, [ + $edit = Renderer::replaceMacros($edit_tpl, [ '$id' => $ph[0]['id'], '$album' => ['albname', L10n::t('New album name'), $album_e,''], '$caption' => ['desc', L10n::t('Caption'), $caption_e, ''], @@ -1473,7 +1474,7 @@ function photos_content(App $a) if ($can_post || Security::canWriteToUserWall($owner_uid)) { $like_tpl = get_markup_template('like_noshare.tpl'); - $likebuttons = replace_macros($like_tpl, [ + $likebuttons = Renderer::replaceMacros($like_tpl, [ '$id' => $link_item['id'], '$likethis' => L10n::t("I like this \x28toggle\x29"), '$nolike' => (Feature::isEnabled(local_user(), 'dislike') ? L10n::t("I don't like this \x28toggle\x29") : ''), @@ -1484,7 +1485,7 @@ function photos_content(App $a) if (!DBA::isResult($items)) { if (($can_post || Security::canWriteToUserWall($owner_uid))) { - $comments .= replace_macros($cmnt_tpl, [ + $comments .= Renderer::replaceMacros($cmnt_tpl, [ '$return_path' => '', '$jsreload' => $return_path, '$id' => $link_item['id'], @@ -1523,7 +1524,7 @@ function photos_content(App $a) } if (($can_post || Security::canWriteToUserWall($owner_uid))) { - $comments .= replace_macros($cmnt_tpl,[ + $comments .= Renderer::replaceMacros($cmnt_tpl,[ '$return_path' => '', '$jsreload' => $return_path, '$id' => $link_item['id'], @@ -1568,7 +1569,7 @@ function photos_content(App $a) $title_e = $item['title']; $body_e = BBCode::convert($item['body']); - $comments .= replace_macros($template,[ + $comments .= Renderer::replaceMacros($template,[ '$id' => $item['id'], '$profile_url' => $profile_url, '$name' => $item['author-name'], @@ -1583,7 +1584,7 @@ function photos_content(App $a) ]); if (($can_post || Security::canWriteToUserWall($owner_uid))) { - $comments .= replace_macros($cmnt_tpl, [ + $comments .= Renderer::replaceMacros($cmnt_tpl, [ '$return_path' => '', '$jsreload' => $return_path, '$id' => $item['item_id'], @@ -1612,7 +1613,7 @@ function photos_content(App $a) } $photo_tpl = get_markup_template('photo_view.tpl'); - $o .= replace_macros($photo_tpl, [ + $o .= Renderer::replaceMacros($photo_tpl, [ '$id' => $ph[0]['id'], '$album' => [$album_link, $ph[0]['album']], '$tools' => $tools, @@ -1704,7 +1705,7 @@ function photos_content(App $a) } $tpl = get_markup_template('photos_recent.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Recent Photos'), '$can_post' => $can_post, '$upload' => [L10n::t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'], diff --git a/mod/poco.php b/mod/poco.php index 7a33a69d0..9eac87679 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -10,6 +10,7 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\Logger; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Protocol\PortableContact; @@ -374,7 +375,7 @@ function poco_init(App $a) { if ($format === 'xml') { header('Content-type: text/xml'); - echo replace_macros(get_markup_template('poco_xml.tpl'), array_xmlify(['$response' => $ret])); + echo Renderer::replaceMacros(get_markup_template('poco_xml.tpl'), array_xmlify(['$response' => $ret])); killme(); } if ($format === 'json') { diff --git a/mod/poke.php b/mod/poke.php index 3eefeb9ab..37714eb4a 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -17,6 +17,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -160,7 +161,7 @@ function poke_content(App $a) $base = System::baseUrl(); $head_tpl = get_markup_template('poke_head.tpl'); - $a->page['htmlhead'] .= replace_macros($head_tpl,[ + $a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl,[ '$baseurl' => System::baseUrl(true), '$base' => $base ]); @@ -180,7 +181,7 @@ function poke_content(App $a) $tpl = get_markup_template('poke_content.tpl'); - $o = replace_macros($tpl,[ + $o = Renderer::replaceMacros($tpl,[ '$title' => L10n::t('Poke/Prod'), '$desc' => L10n::t('poke, prod or do other things to somebody'), '$clabel' => L10n::t('Recipient'), diff --git a/mod/profile_photo.php b/mod/profile_photo.php index da45226fe..ad9f5ab66 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -240,7 +241,7 @@ function profile_photo_content(App $a) if (empty($imagecrop)) { $tpl = get_markup_template('profile_photo.tpl'); - $o = replace_macros($tpl, + $o = Renderer::replaceMacros($tpl, [ '$user' => $a->user['nickname'], '$lbl_upfile' => L10n::t('Upload File:'), @@ -257,7 +258,7 @@ function profile_photo_content(App $a) } else { $filename = $imagecrop['hash'] . '-' . $imagecrop['resolution'] . '.' . $imagecrop['ext']; $tpl = get_markup_template("cropbody.tpl"); - $o = replace_macros($tpl, + $o = Renderer::replaceMacros($tpl, [ '$filename' => $filename, '$profile' => (isset($_REQUEST['profile']) ? intval($_REQUEST['profile']) : 0), @@ -318,7 +319,7 @@ function profile_photo_crop_ui_head(App $a, Image $image) } } - $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []); + $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template("crophead.tpl"), []); $imagecrop = [ 'hash' => $hash, diff --git a/mod/profiles.php b/mod/profiles.php index a4a49ec78..216edacb5 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -12,6 +12,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -526,12 +527,12 @@ function profiles_content(App $a) { return; } - $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), [ + $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('profed_head.tpl'), [ '$baseurl' => System::baseUrl(true), ]); $opt_tpl = get_markup_template("profile-hide-friends.tpl"); - $hide_friends = replace_macros($opt_tpl,[ + $hide_friends = Renderer::replaceMacros($opt_tpl,[ '$yesno' => [ 'hide-friends', //Name L10n::t('Hide contacts and friends:'), //Label @@ -553,7 +554,7 @@ function profiles_content(App $a) { $is_default = (($r[0]['is-default']) ? 1 : 0); $tpl = get_markup_template("profile_edit.tpl"); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$personal_account' => $personal_account, '$detailled_profile' => $detailled_profile, @@ -667,7 +668,7 @@ function profiles_content(App $a) { $profiles = ''; foreach ($r as $rr) { - $profiles .= replace_macros($tpl, [ + $profiles .= Renderer::replaceMacros($tpl, [ '$photo' => $a->removeBaseURL($rr['thumb']), '$id' => $rr['id'], '$alt' => L10n::t('Profile Image'), @@ -678,7 +679,7 @@ function profiles_content(App $a) { } $tpl_header = get_markup_template('profile_listing_header.tpl'); - $o .= replace_macros($tpl_header,[ + $o .= Renderer::replaceMacros($tpl_header,[ '$header' => L10n::t('Edit/Manage Profiles'), '$chg_photo' => L10n::t('Change profile photo'), '$cr_new' => L10n::t('Create New Profile'), diff --git a/mod/register.php b/mod/register.php index 73b57124a..0948098d7 100644 --- a/mod/register.php +++ b/mod/register.php @@ -11,6 +11,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Model; @@ -229,7 +230,7 @@ function register_content(App $a) $profile_publish = ''; } else { $publish_tpl = get_markup_template("profile_publish.tpl"); - $profile_publish = replace_macros($publish_tpl, [ + $profile_publish = Renderer::replaceMacros($publish_tpl, [ '$instance' => 'reg', '$pubdesc' => L10n::t('Include your profile in member directory?'), '$yes_selected' => '', @@ -254,7 +255,7 @@ function register_content(App $a) $tos = new Tos(); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$oidhtml' => $oidhtml, '$invitations' => Config::get('system', 'invitation_only'), '$permonly' => intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE, diff --git a/mod/removeme.php b/mod/removeme.php index 86d46a177..c49940648 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\User; @@ -75,7 +76,7 @@ function removeme_content(App $a) $_SESSION['remove_account_verify'] = $hash; $tpl = get_markup_template('removeme.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$basedir' => $a->getBaseURL(), '$hash' => $hash, '$title' => L10n::t('Remove My Account'), diff --git a/mod/search.php b/mod/search.php index 4be378ba9..320bf1b3b 100644 --- a/mod/search.php +++ b/mod/search.php @@ -11,6 +11,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\Database\DBA; use Friendica\Model\Item; @@ -45,7 +46,7 @@ function search_saved_searches() { $tpl = get_markup_template("saved_searches_aside.tpl"); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Saved Searches'), '$add' => '', '$searchbox' => '', @@ -158,7 +159,7 @@ function search_content(App $a) { } // contruct a wrapper for the search header - $o = replace_macros(get_markup_template("content_wrapper.tpl"),[ + $o = Renderer::replaceMacros(get_markup_template("content_wrapper.tpl"),[ 'name' => "search-header", '$title' => L10n::t("Search"), '$title_size' => 3, @@ -251,7 +252,7 @@ function search_content(App $a) { $title = L10n::t('Results for: %s', $search); } - $o .= replace_macros(get_markup_template("section_title.tpl"),[ + $o .= Renderer::replaceMacros(get_markup_template("section_title.tpl"),[ '$title' => $title ]); diff --git a/mod/settings.php b/mod/settings.php index 2973a7f72..5a1ab5ba6 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -13,6 +13,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Core\Worker; @@ -50,7 +51,7 @@ function settings_init(App $a) // These lines provide the javascript needed by the acl selector $tpl = get_markup_template('settings/head.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$ispublic' => L10n::t('everybody') ]); @@ -130,7 +131,7 @@ function settings_init(App $a) $tabtpl = get_markup_template("generic_links_widget.tpl"); - $a->page['aside'] = replace_macros($tabtpl, [ + $a->page['aside'] = Renderer::replaceMacros($tabtpl, [ '$title' => L10n::t('Settings'), '$class' => 'settings-widget', '$items' => $tabs, @@ -672,7 +673,7 @@ function settings_content(App $a) if (($a->argc > 1) && ($a->argv[1] === 'oauth')) { if (($a->argc > 2) && ($a->argv[2] === 'add')) { $tpl = get_markup_template('settings/oauth_edit.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"), '$title' => L10n::t('Add application'), '$submit' => L10n::t('Save Settings'), @@ -698,7 +699,7 @@ function settings_content(App $a) $app = $r[0]; $tpl = get_markup_template('settings/oauth_edit.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"), '$title' => L10n::t('Add application'), '$submit' => L10n::t('Update'), @@ -730,7 +731,7 @@ function settings_content(App $a) $tpl = get_markup_template('settings/oauth.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"), '$baseurl' => $a->getBaseURL(true), '$title' => L10n::t('Connected Apps'), @@ -757,7 +758,7 @@ function settings_content(App $a) $tpl = get_markup_template('settings/addons.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_addon"), '$title' => L10n::t('Addon Settings'), '$settings_addons' => $settings_addons @@ -778,7 +779,7 @@ function settings_content(App $a) } $tpl = get_markup_template('settings/features.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_features"), '$title' => L10n::t('Additional Features'), '$features' => $arr, @@ -837,7 +838,7 @@ function settings_content(App $a) $mail_disabled_message = (($mail_disabled) ? L10n::t('Email access is disabled on this site.') : ''); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_connectors"), '$title' => L10n::t('Social Networks'), @@ -956,7 +957,7 @@ function settings_content(App $a) } $tpl = get_markup_template('settings/display.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$ptitle' => L10n::t('Display Settings'), '$form_security_token' => BaseModule::getFormSecurityToken("settings_display"), '$submit' => L10n::t('Save Settings'), @@ -1033,7 +1034,7 @@ function settings_content(App $a) $pageset_tpl = get_markup_template('settings/pagetypes.tpl'); - $pagetype = replace_macros($pageset_tpl, [ + $pagetype = Renderer::replaceMacros($pageset_tpl, [ '$account_types' => L10n::t("Account Types"), '$user' => L10n::t("Personal Page Subtypes"), '$community' => L10n::t("Community Forum Subtypes"), @@ -1094,40 +1095,40 @@ function settings_content(App $a) if (Config::get('system', 'publish_all')) { $profile_in_dir = ''; } else { - $profile_in_dir = replace_macros($opt_tpl, [ + $profile_in_dir = Renderer::replaceMacros($opt_tpl, [ '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s local directory. Your profile details may be publicly visible depending on the system settings.', System::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]] ]); } if (strlen(Config::get('system', 'directory'))) { - $profile_in_net_dir = replace_macros($opt_tpl, [ + $profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [ '$field' => ['profile_in_netdirectory', L10n::t('Publish your default profile in the global social directory?'), $profile['net-publish'], L10n::t('Your profile will be published in the global friendica directories (e.g. %s). Your profile will be visible in public.', Config::get('system', 'directory'), Config::get('system', 'directory')), [L10n::t('No'), L10n::t('Yes')]] ]); } else { $profile_in_net_dir = ''; } - $hide_friends = replace_macros($opt_tpl, [ + $hide_friends = Renderer::replaceMacros($opt_tpl, [ '$field' => ['hide-friends', L10n::t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], L10n::t('Your contact list won\'t be shown in your default profile page. You can decide to show your contact list separately for each additional profile you create'), [L10n::t('No'), L10n::t('Yes')]], ]); - $hide_wall = replace_macros($opt_tpl, [ + $hide_wall = Renderer::replaceMacros($opt_tpl, [ '$field' => ['hidewall', L10n::t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], L10n::t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.'), [L10n::t('No'), L10n::t('Yes')]], ]); - $blockwall = replace_macros($opt_tpl, [ + $blockwall = Renderer::replaceMacros($opt_tpl, [ '$field' => ['blockwall', L10n::t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), L10n::t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts'), [L10n::t('No'), L10n::t('Yes')]], ]); - $blocktags = replace_macros($opt_tpl, [ + $blocktags = Renderer::replaceMacros($opt_tpl, [ '$field' => ['blocktags', L10n::t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), L10n::t('Your contacts can add additional tags to your posts.'), [L10n::t('No'), L10n::t('Yes')]], ]); - $suggestme = replace_macros($opt_tpl, [ + $suggestme = Renderer::replaceMacros($opt_tpl, [ '$field' => ['suggestme', L10n::t('Allow us to suggest you as a potential friend to new members?'), $suggestme, L10n::t('If you like, Friendica may suggest new members to add you as a contact.'), [L10n::t('No'), L10n::t('Yes')]], ]); - $unkmail = replace_macros($opt_tpl, [ + $unkmail = Renderer::replaceMacros($opt_tpl, [ '$field' => ['unkmail', L10n::t('Permit unknown people to send you private mail?'), $unkmail, L10n::t('Friendica network users may send you private messages even if they are not in your contact list.'), [L10n::t('No'), L10n::t('Yes')]], ]); @@ -1137,7 +1138,7 @@ function settings_content(App $a) $tpl_addr = get_markup_template('settings/nick_set.tpl'); - $prof_addr = replace_macros($tpl_addr,[ + $prof_addr = Renderer::replaceMacros($tpl_addr,[ '$desc' => L10n::t("Your Identity Address is '%s' or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname), '$basepath' => $a->getHostName() ]); @@ -1181,7 +1182,7 @@ function settings_content(App $a) $lang_choices = L10n::getAvailableLanguages(); /// @TODO Fix indending (or so) - $o .= replace_macros($stpl, [ + $o .= Renderer::replaceMacros($stpl, [ '$ptitle' => L10n::t('Account Settings'), '$submit' => L10n::t('Save Settings'), diff --git a/mod/suggest.php b/mod/suggest.php index 1e33cb660..baa3d184e 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Content\ContactSelector; use Friendica\Content\Widget; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -33,7 +34,7 @@ function suggest_init(App $a) } } - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ '$method' => 'get', '$message' => L10n::t('Do you really want to delete this suggestion?'), '$extra_inputs' => $inputs, @@ -113,7 +114,7 @@ function suggest_content(App $a) $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl,[ + $o .= Renderer::replaceMacros($tpl,[ '$title' => L10n::t('Friend Suggestions'), '$contacts' => $entries, ]); diff --git a/mod/uexport.php b/mod/uexport.php index 993e39802..27c36a40c 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -5,6 +5,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; @@ -47,7 +48,7 @@ function uexport_content(App $a) { Addon::callHooks('uexport_options', $options); $tpl = get_markup_template("uexport.tpl"); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$title' => L10n::t('Export personal data'), '$options' => $options diff --git a/mod/uimport.php b/mod/uimport.php index 3c80b671b..2061d4552 100644 --- a/mod/uimport.php +++ b/mod/uimport.php @@ -9,6 +9,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\UserImport; +use Friendica\Core\Renderer; function uimport_post(App $a) { @@ -49,7 +50,7 @@ function uimport_content(App $a) } $tpl = get_markup_template("uimport.tpl"); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$regbutt' => L10n::t('Import'), '$import' => [ 'title' => L10n::t("Move account"), diff --git a/mod/unfollow.php b/mod/unfollow.php index 2a60322f0..0e083c227 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -114,7 +115,7 @@ function unfollow_content(App $a) $header = L10n::t('Disconnect/Unfollow'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$header' => htmlentities($header), '$desc' => '', '$pls_answer' => '', @@ -144,7 +145,7 @@ function unfollow_content(App $a) $a->page['aside'] = ''; Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url'])); - $o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]); + $o .= Renderer::replaceMacros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]); // Show last public posts $o .= Contact::getPostsFromUrl($contact['url']); diff --git a/mod/videos.php b/mod/videos.php index 51f15a47a..c05132b8f 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -8,6 +8,7 @@ use Friendica\Content\Nav; use Friendica\Content\Pager; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -52,7 +53,7 @@ function videos_init(App $a) $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget = replace_macros($tpl, [ + $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => defaults($profile, 'addr', ''), @@ -103,7 +104,7 @@ function videos_init(App $a) $a->page['aside'] .= $vcard_widget; $tpl = get_markup_template("videos_head.tpl"); - $a->page['htmlhead'] .= replace_macros($tpl,[ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$baseurl' => System::baseUrl(), ]); } @@ -128,7 +129,7 @@ function videos_post(App $a) $drop_url = $a->query_string; - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ '$method' => 'post', '$message' => L10n::t('Do you really want to delete this video?'), '$extra_inputs' => [ @@ -382,7 +383,7 @@ function videos_content(App $a) } $tpl = get_markup_template('videos_recent.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Recent Videos'), '$can_post' => $can_post, '$upload' => [L10n::t('Upload New Videos'), System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/upload'], diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 9a2513a6c..4b4ea46a5 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -10,6 +10,7 @@ use Friendica\Content\Pager; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -125,7 +126,7 @@ function viewcontacts_content(App $a) $tpl = get_markup_template("viewcontact_template.tpl"); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Contacts'), '$contacts' => $contacts, '$paginate' => $pager->renderFull($total), diff --git a/mod/wallmessage.php b/mod/wallmessage.php index af1de6c06..371b82bee 100644 --- a/mod/wallmessage.php +++ b/mod/wallmessage.php @@ -5,6 +5,7 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Mail; @@ -115,14 +116,14 @@ function wallmessage_content(App $a) { } $tpl = get_markup_template('wallmsg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $user['nickname'], '$linkurl' => L10n::t('Please enter a link URL:') ]); $tpl = get_markup_template('wallmessage.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$header' => L10n::t('Send Private Message'), '$subheader' => L10n::t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']), '$to' => L10n::t('To:'), diff --git a/mod/xrd.php b/mod/xrd.php index 1d29d7904..a1ae7350b 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -5,6 +5,7 @@ use Friendica\App; use Friendica\Core\Addon; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Protocol\Salmon; @@ -107,7 +108,7 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r) $tpl = get_markup_template('xrd_person.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$nick' => $r['nickname'], '$accturi' => $uri, '$alias' => $alias, diff --git a/src/App.php b/src/App.php index 781faf1a5..b2ab78171 100644 --- a/src/App.php +++ b/src/App.php @@ -777,7 +777,7 @@ class App * since the code added by the modules frequently depends on it * being first */ - $this->page['htmlhead'] = replace_macros($tpl, [ + $this->page['htmlhead'] = Core\Renderer::replaceMacros($tpl, [ '$baseurl' => $this->getBaseURL(), '$local_user' => local_user(), '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION, @@ -823,7 +823,7 @@ class App } else { $link = 'toggle_mobile?off=1&address=' . curPageURL(); } - $this->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), [ + $this->page['footer'] .= Core\Renderer::replaceMacros(get_markup_template("toggle_mobile_footer.tpl"), [ '$toggle_link' => $link, '$toggle_text' => Core\L10n::t('toggle mobile') ]); @@ -832,7 +832,7 @@ class App Core\Addon::callHooks('footer', $this->page['footer']); $tpl = get_markup_template('footer.tpl'); - $this->page['footer'] = replace_macros($tpl, [ + $this->page['footer'] = Core\Renderer::replaceMacros($tpl, [ '$baseurl' => $this->getBaseURL(), '$footerScripts' => $this->footerScripts, ]) . $this->page['footer']; @@ -1793,7 +1793,7 @@ class App header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . Core\L10n::t('Not Found')); $tpl = get_markup_template("404.tpl"); - $this->page['content'] = replace_macros($tpl, [ + $this->page['content'] = Core\Renderer::replaceMacros($tpl, [ '$message' => Core\L10n::t('Page not found.') ]); } @@ -1881,7 +1881,7 @@ class App // Add the navigation (menu) template if ($this->module != 'install' && $this->module != 'maintenance') { - $this->page['htmlhead'] .= replace_macros(get_markup_template('nav_head.tpl'), []); + $this->page['htmlhead'] .= Core\Renderer::replaceMacros(get_markup_template('nav_head.tpl'), []); $this->page['nav'] = Content\Nav::build($this); } diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php index 35df0aee9..0b06a04c7 100644 --- a/src/Content/ForumManager.php +++ b/src/Content/ForumManager.php @@ -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'), diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 8289825ea..5c347c2a7 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -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'], diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index cfe9468ad..acc7f02cf 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -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), diff --git a/src/Content/Pager.php b/src/Content/Pager.php index a95fc7cf6..5794f589a 100644 --- a/src/Content/Pager.php +++ b/src/Content/Pager.php @@ -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]); } } diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 22ce4ea3a..188044945 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -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'], diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 8dd71b8bf..8f1279b4e 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -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, diff --git a/src/Content/Widget/CalendarExport.php b/src/Content/Widget/CalendarExport.php index 2c21b2f0d..2b42d35b2 100644 --- a/src/Content/Widget/CalendarExport.php +++ b/src/Content/Widget/CalendarExport.php @@ -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"), diff --git a/src/Content/Widget/TagCloud.php b/src/Content/Widget/TagCloud.php index 309f9a5bd..1fbb076a0 100644 --- a/src/Content/Widget/TagCloud.php +++ b/src/Content/Widget/TagCloud.php @@ -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 ]); diff --git a/src/Core/ACL.php b/src/Core/ACL.php index bbe24545c..14430fd5e 100644 --- a/src/Core/ACL.php +++ b/src/Core/ACL.php @@ -9,6 +9,7 @@ namespace Friendica\Core; use Friendica\BaseObject; use Friendica\Content\Feature; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\GContact; @@ -292,7 +293,7 @@ class ACL extends BaseObject } $tpl = get_markup_template('acl_selector.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$showall' => L10n::t('Visible to everybody'), '$show' => L10n::t('show'), '$hide' => L10n::t('don\'t show'), diff --git a/src/Core/Installer.php b/src/Core/Installer.php index cb871e2df..f0cf0cd0f 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -6,6 +6,7 @@ namespace Friendica\Core; use DOMDocument; use Exception; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\Object\Image; @@ -140,7 +141,7 @@ class Installer public function createConfig($phppath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $basepath) { $tpl = get_markup_template('local.ini.tpl'); - $txt = replace_macros($tpl, [ + $txt = Renderer::replaceMacros($tpl, [ '$phpath' => $phppath, '$dbhost' => $dbhost, '$dbuser' => $dbuser, @@ -238,7 +239,7 @@ class Installer $help .= L10n::t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See 'Setup the worker'") . EOL; $help .= EOL . EOL; $tpl = get_markup_template('field_input.tpl'); - $help .= replace_macros($tpl, [ + $help .= Renderer::replaceMacros($tpl, [ '$field' => ['phpath', L10n::t('PHP executable path'), $phppath, L10n::t('Enter full path to php executable. You can leave this blank to continue the installation.')], ]); $phppath = ""; diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 2c0cb5517..70f98059b 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -5,6 +5,7 @@ namespace Friendica\Core; +use Exception; use Friendica\BaseObject; use Friendica\Core\System; use Friendica\Render\FriendicaSmarty; diff --git a/src/Core/System.php b/src/Core/System.php index 07f0b6b17..42c68e4e8 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -6,6 +6,7 @@ namespace Friendica\Core; use Friendica\BaseObject; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Util\XML; @@ -140,7 +141,7 @@ class System extends BaseObject if (isset($description["title"])) { $tpl = get_markup_template('http_status.tpl'); - echo replace_macros($tpl, ['$title' => $description["title"], + echo Renderer::replaceMacros($tpl, ['$title' => $description["title"], '$description' => defaults($description, 'description', '')]); } diff --git a/src/Model/Event.php b/src/Model/Event.php index e6ed20f72..932322e35 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.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\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -899,7 +900,7 @@ class Event extends BaseObject $profile_link = Contact::magicLinkById($item['author-id']); $tpl = get_markup_template('event_stream_item.tpl'); - $return = replace_macros($tpl, [ + $return = Renderer::replaceMacros($tpl, [ '$id' => $item['event-id'], '$title' => prepare_text($item['event-summary']), '$dtstart_label' => L10n::t('Starts:'), diff --git a/src/Model/Group.php b/src/Model/Group.php index 0bc8794f8..a0806af38 100644 --- a/src/Model/Group.php +++ b/src/Model/Group.php @@ -8,6 +8,7 @@ use Friendica\BaseModule; use Friendica\BaseObject; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Util\Security; @@ -332,7 +333,7 @@ class Group extends BaseObject $label = L10n::t('Default privacy group for new contacts'); } - $o = replace_macros(get_markup_template('group_selection.tpl'), [ + $o = Renderer::replaceMacros(get_markup_template('group_selection.tpl'), [ '$label' => $label, '$groups' => $display_groups ]); @@ -400,7 +401,7 @@ class Group extends BaseObject } $tpl = get_markup_template('group_side.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$add' => L10n::t('add'), '$title' => L10n::t('Groups'), '$groups' => $display_groups, diff --git a/src/Model/Profile.php b/src/Model/Profile.php index fba675945..c8a229f23 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.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\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -171,7 +172,7 @@ class Profile } if (local_user() && local_user() == $a->profile['uid'] && $profiledata) { - $a->page['aside'] .= replace_macros( + $a->page['aside'] .= Renderer::replaceMacros( get_markup_template('profile_edlink.tpl'), [ '$editprofile' => L10n::t('Edit profile'), @@ -517,7 +518,7 @@ class Profile $p['url'] = Contact::magicLink(defaults($p, 'url', $profile_url)); $tpl = get_markup_template('profile_vcard.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$profile' => $p, '$xmpp' => $xmpp, '$connect' => $connect, @@ -622,7 +623,7 @@ class Profile } } $tpl = get_markup_template('birthdays_reminder.tpl'); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, '$count' => $total, @@ -711,7 +712,7 @@ class Profile $classtoday = (($istoday) ? 'event-today' : ''); } $tpl = get_markup_template('events_reminder.tpl'); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, '$count' => count($r), @@ -726,7 +727,7 @@ class Profile $o = ''; $uid = $a->profile['uid']; - $o .= replace_macros( + $o .= Renderer::replaceMacros( get_markup_template('section_title.tpl'), ['$title' => L10n::t('Profile')] ); @@ -860,7 +861,7 @@ class Profile $profile['edit'] = [System::baseUrl() . '/profiles/' . $a->profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')]; } - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Profile'), '$basic' => L10n::t('Basic'), '$advanced' => L10n::t('Advanced'), @@ -979,7 +980,7 @@ class Profile $tpl = get_markup_template('common_tabs.tpl'); - return replace_macros($tpl, ['$tabs' => $arr['tabs']]); + return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]); } /** diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 817c70e85..a50bcb14d 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -13,6 +13,7 @@ use Friendica\Core\ACL; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -82,7 +83,7 @@ class Contact extends BaseModule } /// @TODO Add nice spaces - $vcard_widget = replace_macros(get_markup_template('vcard-widget.tpl'), [ + $vcard_widget = Renderer::replaceMacros(get_markup_template('vcard-widget.tpl'), [ '$name' => htmlentities($contact['name']), '$photo' => $contact['photo'], '$url' => Model\Contact::MagicLink($contact['url']), @@ -113,7 +114,7 @@ class Contact extends BaseModule $groups_widget = null; } - $a->page['aside'] .= replace_macros(get_markup_template('contacts-widget-sidebar.tpl'), [ + $a->page['aside'] .= Renderer::replaceMacros(get_markup_template('contacts-widget-sidebar.tpl'), [ '$vcard_widget' => $vcard_widget, '$findpeople_widget' => $findpeople_widget, '$follow_widget' => $follow_widget, @@ -123,7 +124,7 @@ class Contact extends BaseModule $base = $a->getBaseURL(); $tpl = get_markup_template('contacts-head.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, [ + $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base ]); @@ -438,7 +439,7 @@ class Contact extends BaseModule $a->page['aside'] = ''; - return replace_macros(get_markup_template('contact_drop_confirm.tpl'), [ + return Renderer::replaceMacros(get_markup_template('contact_drop_confirm.tpl'), [ '$header' => L10n::t('Drop contact'), '$contact' => self::getContactTemplateVars($orig_record), '$method' => 'get', @@ -475,7 +476,7 @@ class Contact extends BaseModule $contact_id = $a->data['contact']['id']; $contact = $a->data['contact']; - $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), [ + $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('contact_head.tpl'), [ '$baseurl' => $a->getBaseURL(true), ]); @@ -592,7 +593,7 @@ class Contact extends BaseModule } $tpl = get_markup_template('contact_edit.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$header' => L10n::t('Contact'), '$tab_str' => $tab_str, '$submit' => L10n::t('Submit'), @@ -756,7 +757,7 @@ class Contact extends BaseModule ]; $tab_tpl = get_markup_template('common_tabs.tpl'); - $t = replace_macros($tab_tpl, ['$tabs' => $tabs]); + $t = Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); $total = 0; $searching = false; @@ -801,7 +802,7 @@ class Contact extends BaseModule } $tpl = get_markup_template('contacts-template.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$header' => L10n::t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''), '$tabs' => $t, @@ -904,7 +905,7 @@ class Contact extends BaseModule } $tab_tpl = get_markup_template('common_tabs.tpl'); - $tab_str = replace_macros($tab_tpl, ['$tabs' => $tabs]); + $tab_str = Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); return $tab_str; } diff --git a/src/Module/Install.php b/src/Module/Install.php index 2ef2c3229..1662e71f2 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -8,6 +8,7 @@ use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\Core; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Util\Temporal; class Install extends BaseModule @@ -124,7 +125,7 @@ class Install extends BaseModule $status = self::$installer->checkEnvironment($a->getBaseURL(), $phppath); $tpl = get_markup_template('install_checks.tpl'); - $output .= replace_macros($tpl, [ + $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => L10n::t('System check'), '$checks' => self::$installer->getChecks(), @@ -146,7 +147,7 @@ class Install extends BaseModule $adminmail = notags(trim(defaults($_POST, 'adminmail', '' ))); $tpl = get_markup_template('install_db.tpl'); - $output .= replace_macros($tpl, [ + $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => L10n::t('Database connection'), '$info_01' => L10n::t('In order to install Friendica we need to know how to connect to your database.'), @@ -202,7 +203,7 @@ class Install extends BaseModule $lang_choices = L10n::getAvailableLanguages(); $tpl = get_markup_template('install_settings.tpl'); - $output .= replace_macros($tpl, [ + $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$checks' => self::$installer->getChecks(), '$pass' => L10n::t('Site settings'), @@ -233,7 +234,7 @@ class Install extends BaseModule } $tpl = get_markup_template('install_finished.tpl'); - $output .= replace_macros($tpl, [ + $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$checks' => self::$installer->getChecks(), '$pass' => L10n::t('Installation finished'), diff --git a/src/Module/Itemsource.php b/src/Module/Itemsource.php index bcbd55718..e0d3bd016 100644 --- a/src/Module/Itemsource.php +++ b/src/Module/Itemsource.php @@ -3,6 +3,7 @@ namespace Friendica\Module; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Model; /** @@ -28,7 +29,7 @@ class Itemsource extends \Friendica\BaseModule } $tpl = get_markup_template('debug/itemsource.tpl'); - $o = replace_macros($tpl, [ + $o = Renderer::replaceMacros($tpl, [ '$guid' => ['guid', L10n::t('Item Guid'), htmlentities(defaults($_REQUEST, 'guid', '')), ''], '$source' => $source, '$item_uri' => $item_uri diff --git a/src/Module/Login.php b/src/Module/Login.php index a91c17b73..541b79885 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -11,6 +11,7 @@ use Friendica\Core\Authentication; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\User; @@ -301,7 +302,7 @@ class Login extends BaseModule if (local_user()) { $tpl = get_markup_template('logout.tpl'); } else { - $a->page['htmlhead'] .= replace_macros( + $a->page['htmlhead'] .= Renderer::replaceMacros( get_markup_template('login_head.tpl'), [ '$baseurl' => $a->getBaseURL(true) @@ -312,7 +313,7 @@ class Login extends BaseModule $_SESSION['return_path'] = $return_path; } - $o .= replace_macros( + $o .= Renderer::replaceMacros( $tpl, [ '$dest_url' => self::getApp()->getBaseURL(true) . '/login', diff --git a/src/Module/Tos.php b/src/Module/Tos.php index db8b55885..5553fb686 100644 --- a/src/Module/Tos.php +++ b/src/Module/Tos.php @@ -11,6 +11,7 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Content\Text\BBCode; @@ -66,7 +67,7 @@ class Tos extends BaseModule public static function content() { $tpl = get_markup_template('tos.tpl'); if (Config::get('system', 'tosdisplay')) { - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Terms of Service'), '$tostext' => BBCode::convert(Config::get('system', 'tostext')), '$displayprivstatement' => Config::get('system', 'tosprivstatement'), diff --git a/src/Object/Post.php b/src/Object/Post.php index bb1b81c2c..5303cc58a 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -13,6 +13,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\Item; @@ -786,7 +787,7 @@ class Post extends BaseObject } $template = get_markup_template($this->getCommentBoxTemplate()); - $comment_box = replace_macros($template, [ + $comment_box = Renderer::replaceMacros($template, [ '$return_path' => $a->query_string, '$threaded' => $this->isThreaded(), '$jsreload' => '', diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index bc7639b3b..3ac74f3ea 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -11,6 +11,7 @@ use DateTimeZone; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Database\DBA; require_once 'boot.php'; @@ -115,7 +116,7 @@ class Temporal $options = str_replace('', '', $options); $tpl = get_markup_template('field_select_raw.tpl'); - return replace_macros($tpl, [ + return Renderer::replaceMacros($tpl, [ '$field' => [$name, $label, $current, $help, $options], ]); } @@ -141,7 +142,7 @@ class Temporal $age = (intval($value) ? self::getAgeByTimezone($value, $a->user["timezone"], $a->user["timezone"]) : ""); $tpl = get_markup_template("field_input.tpl"); - $o = replace_macros($tpl, + $o = Renderer::replaceMacros($tpl, [ '$field' => [ 'dob', @@ -247,7 +248,7 @@ class Temporal $readable_format = str_replace(['Y', 'm', 'd', 'H', 'i'], ['yyyy', 'mm', 'dd', 'HH', 'MM'], $dateformat); $tpl = get_markup_template('field_datetime.tpl'); - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$field' => [ $id, $label, diff --git a/util/README b/util/README index d7774bc51..18e8fb882 100644 --- a/util/README +++ b/util/README @@ -39,7 +39,7 @@ text which you don't care for. Note: The view/lang/en directory contains many HTML template files, some of which only have a few words of English text amongst the HTML. Over time we will move -the translation to the replace_macros() function which calls these files and +the translation to the Renderer::replaceMacros() function which calls these files and then relocate the files to the view directory. The files in the top-level view directory are template files which do not require translation. diff --git a/view/theme/duepuntozero/config.php b/view/theme/duepuntozero/config.php index d8323225d..dedf418a2 100644 --- a/view/theme/duepuntozero/config.php +++ b/view/theme/duepuntozero/config.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; function theme_content(App $a) @@ -67,7 +68,7 @@ function clean_form(App $a, &$colorset, $user) } $t = get_markup_template("theme_settings.tpl"); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Submit'), '$baseurl' => System::baseUrl(), '$title' => L10n::t("Theme settings"), diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index 8bab362ff..328961828 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -4,6 +4,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; require_once 'view/theme/frio/php/Image.php'; @@ -137,7 +138,7 @@ function frio_form($arr) $ctx['$login_bg_color'] = ['frio_login_bg_color', L10n::t('Login page background color'), $arr['login_bg_color'], L10n::t('Leave background image and color empty for theme defaults'), false]; } - $o = replace_macros($t, $ctx); + $o = Renderer::replaceMacros($t, $ctx); return $o; } diff --git a/view/theme/quattro/config.php b/view/theme/quattro/config.php index 562a9ff5f..cc9f0488e 100644 --- a/view/theme/quattro/config.php +++ b/view/theme/quattro/config.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; function theme_content(App $a) { @@ -69,7 +70,7 @@ function quattro_form(App $a, $align, $color, $tfs, $pfs) { } $t = get_markup_template("theme_settings.tpl" ); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Submit'), '$baseurl' => System::baseUrl(), '$title' => L10n::t("Theme settings"), diff --git a/view/theme/smoothly/theme.php b/view/theme/smoothly/theme.php index e961146f6..98175e89b 100644 --- a/view/theme/smoothly/theme.php +++ b/view/theme/smoothly/theme.php @@ -11,6 +11,7 @@ */ use Friendica\App; +use Friendica\Core\Renderer; use Friendica\Core\System; function smoothly_init(App $a) { @@ -112,6 +113,6 @@ if (! function_exists('_js_in_foot')) { $bottom['$baseurl'] = $baseurl; $tpl = get_markup_template('bottom.tpl'); - return $a->page['bottom'] = replace_macros($tpl, $bottom); + return $a->page['bottom'] = Renderer::replaceMacros($tpl, $bottom); } } diff --git a/view/theme/vier/config.php b/view/theme/vier/config.php index 80225eb08..c6628ad06 100644 --- a/view/theme/vier/config.php +++ b/view/theme/vier/config.php @@ -7,6 +7,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; function theme_content(App $a) @@ -71,7 +72,7 @@ function theme_admin(App $a) { $helperlist = "https://forum.friendi.ca/profile/helpers"; $t = get_markup_template("theme_admin_settings.tpl"); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$helperlist' => ['vier_helperlist', L10n::t('Comma separated list of helper forums'), $helperlist, '', ''], ]); @@ -115,7 +116,7 @@ function vier_form(App $a, $style, $show_pages, $show_profiles, $show_helpers, $ $show_or_not = ['0' => L10n::t("don't show"), '1' => L10n::t("show"),]; $t = get_markup_template("theme_settings.tpl"); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Submit'), '$baseurl' => System::baseUrl(), '$title' => L10n::t("Theme settings"), diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 887ef1c12..7d0c4bdb8 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -15,6 +15,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -150,7 +151,7 @@ function vier_community_info() $aside['$comunity_profiles_items'] = []; foreach ($r as $rr) { - $entry = replace_macros($tpl, [ + $entry = Renderer::replaceMacros($tpl, [ '$id' => $rr['id'], '$profile_link' => 'follow/?url='.urlencode($rr['url']), '$photo' => ProxyUtils::proxifyUrl($rr['photo'], false, ProxyUtils::SIZE_MICRO), @@ -181,7 +182,7 @@ function vier_community_info() foreach ($r as $rr) { $profile_link = 'profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); - $entry = replace_macros($tpl, [ + $entry = Renderer::replaceMacros($tpl, [ '$id' => $rr['id'], '$profile_link' => $profile_link, '$photo' => $a->removeBaseURL($rr['thumb']), @@ -245,7 +246,7 @@ function vier_community_info() $tpl = get_markup_template('widget_forumlist_right.tpl'); - $page = replace_macros( + $page = Renderer::replaceMacros( $tpl, [ '$title' => L10n::t('Forums'), @@ -297,7 +298,7 @@ function vier_community_info() $aside['$helpers_items'] = []; foreach ($r as $rr) { - $entry = replace_macros($tpl, [ + $entry = Renderer::replaceMacros($tpl, [ '$url' => $rr['url'], '$title' => $rr['name'], ]); @@ -387,7 +388,7 @@ function vier_community_info() $aside['$con_services'] = $con_services; foreach ($r as $rr) { - $entry = replace_macros($tpl, [ + $entry = Renderer::replaceMacros($tpl, [ '$url' => $url, '$photo' => $rr['photo'], '$alt_text' => $rr['name'], @@ -400,5 +401,5 @@ function vier_community_info() //print right_aside $tpl = get_markup_template('communityhome.tpl'); - $a->page['right_aside'] = replace_macros($tpl, $aside); + $a->page['right_aside'] = Renderer::replaceMacros($tpl, $aside); } From 35abc4bb64bbb461e6448beed10484c028b74340 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 10:44:06 -0400 Subject: [PATCH 3/6] get markup template implement getMarkupTemplate function --- doc/Addons.md | 2 +- doc/smarty3-templates.md | 2 +- include/conversation.php | 12 ++++---- include/enotify.php | 4 +-- include/items.php | 4 +-- include/text.php | 14 ++++----- mod/admin.php | 42 +++++++++++++-------------- mod/allfriends.php | 2 +- mod/api.php | 4 +-- mod/apps.php | 2 +- mod/babel.php | 2 +- mod/cal.php | 10 +++---- mod/common.php | 4 +-- mod/community.php | 4 +-- mod/credits.php | 2 +- mod/crepair.php | 2 +- mod/delegate.php | 2 +- mod/dfrn_request.php | 6 ++-- mod/directory.php | 2 +- mod/dirfind.php | 2 +- mod/display.php | 2 +- mod/editpost.php | 6 ++-- mod/events.php | 8 ++--- mod/fbrowser.php | 4 +-- mod/feedtest.php | 2 +- mod/filer.php | 2 +- mod/follow.php | 6 ++-- mod/group.php | 6 ++-- mod/help.php | 2 +- mod/home.php | 2 +- mod/hostxrd.php | 2 +- mod/hovercard.php | 4 +-- mod/invite.php | 2 +- mod/lostpass.php | 4 +-- mod/maintenance.php | 2 +- mod/manage.php | 2 +- mod/manifest.php | 2 +- mod/match.php | 2 +- mod/message.php | 18 ++++++------ mod/network.php | 10 +++---- mod/notifications.php | 10 +++---- mod/notify.php | 4 +-- mod/oexchange.php | 2 +- mod/opensearch.php | 2 +- mod/photos.php | 34 +++++++++++----------- mod/poco.php | 2 +- mod/poke.php | 4 +-- mod/profile_photo.php | 6 ++-- mod/profiles.php | 10 +++---- mod/register.php | 4 +-- mod/removeme.php | 2 +- mod/search.php | 6 ++-- mod/settings.php | 26 ++++++++--------- mod/suggest.php | 4 +-- mod/uexport.php | 2 +- mod/uimport.php | 2 +- mod/unfollow.php | 4 +-- mod/videos.php | 8 ++--- mod/viewcontacts.php | 2 +- mod/wallmessage.php | 4 +-- mod/xrd.php | 2 +- src/App.php | 10 +++---- src/Content/ForumManager.php | 2 +- src/Content/Nav.php | 2 +- src/Content/OEmbed.php | 2 +- src/Content/Pager.php | 4 +-- src/Content/Text/BBCode.php | 2 +- src/Content/Widget.php | 12 ++++---- src/Content/Widget/CalendarExport.php | 2 +- src/Content/Widget/TagCloud.php | 2 +- src/Core/ACL.php | 2 +- src/Core/Installer.php | 4 +-- src/Core/System.php | 2 +- src/Model/Event.php | 2 +- src/Model/Group.php | 4 +-- src/Model/Profile.php | 14 ++++----- src/Module/Contact.php | 18 ++++++------ src/Module/Install.php | 8 ++--- src/Module/Itemsource.php | 2 +- src/Module/Login.php | 6 ++-- src/Module/Tos.php | 2 +- src/Object/Post.php | 2 +- src/Util/Temporal.php | 6 ++-- view/theme/duepuntozero/config.php | 2 +- view/theme/frio/config.php | 2 +- view/theme/quattro/config.php | 2 +- view/theme/smoothly/theme.php | 2 +- view/theme/vier/config.php | 4 +-- view/theme/vier/theme.php | 12 ++++---- 89 files changed, 243 insertions(+), 243 deletions(-) diff --git a/doc/Addons.md b/doc/Addons.md index cc5ea8d73..50febf721 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -160,7 +160,7 @@ In your code, like in the function addon_name_content(), load the template file ```php # load template file. first argument is the template name, # second is the addon path relative to friendica top folder -$tpl = get_markup_template('mytemplate.tpl', 'addon/addon_name/'); +$tpl = Renderer::getMarkupTemplate('mytemplate.tpl', 'addon/addon_name/'); # apply template. first argument is the loaded template, # second an array of 'name' => 'values' to pass to template diff --git a/doc/smarty3-templates.md b/doc/smarty3-templates.md index 6d53199f8..599e3597e 100644 --- a/doc/smarty3-templates.md +++ b/doc/smarty3-templates.md @@ -22,7 +22,7 @@ directory. To render a template use the function *getMarkupTemplate* to load the template and *replaceMacros* to replace the macros/variables in the just loaded template file. - $tpl = get_markup_template('install_settings.tpl'); + $tpl = Renderer::getMarkupTemplate('install_settings.tpl'); $o .= Renderer::replaceMacros($tpl, array( ... )); the array consists of an association of an identifier and the value for that identifier, i.e. diff --git a/include/conversation.php b/include/conversation.php index 45f5607bd..c1d428f24 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -554,7 +554,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ $threads = []; $threadsid = -1; - $page_template = get_markup_template("conversation.tpl"); + $page_template = Renderer::getMarkupTemplate("conversation.tpl"); if (!empty($items)) { if (in_array($mode, ['community', 'contacts'])) { @@ -713,7 +713,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ } } else { // Normal View - $page_template = get_markup_template("threaded_conversation.tpl"); + $page_template = Renderer::getMarkupTemplate("threaded_conversation.tpl"); $conv = new Thread($mode, $preview, $writable); @@ -1063,7 +1063,7 @@ function format_like($cnt, array $arr, $type, $id) { } $phrase .= EOL ; - $o .= Renderer::replaceMacros(get_markup_template('voting_fakelink.tpl'), [ + $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [ '$phrase' => $phrase, '$type' => $type, '$id' => $id @@ -1077,9 +1077,9 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) { $o = ''; - $geotag = x($x, 'allow_location') ? Renderer::replaceMacros(get_markup_template('jot_geotag.tpl'), []) : ''; + $geotag = x($x, 'allow_location') ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : ''; - $tpl = get_markup_template('jot-header.tpl'); + $tpl = Renderer::getMarkupTemplate('jot-header.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$newpost' => 'true', '$baseurl' => System::baseUrl(true), @@ -1119,7 +1119,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) } // $tpl = Renderer::replaceMacros($tpl,array('$jotplugins' => $jotplugins)); - $tpl = get_markup_template("jot.tpl"); + $tpl = Renderer::getMarkupTemplate("jot.tpl"); $o .= Renderer::replaceMacros($tpl,[ '$new_post' => L10n::t('New Post'), diff --git a/include/enotify.php b/include/enotify.php index cf8b195de..339e31a3c 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -590,7 +590,7 @@ function notification($params) $content_allowed = ((!Config::get('system', 'enotify_no_content')) || ($params['type'] == SYSTEM_EMAIL)); // load the template for private message notifications - $tpl = get_markup_template('email_notify_html.tpl'); + $tpl = Renderer::getMarkupTemplate('email_notify_html.tpl'); $email_html_body = Renderer::replaceMacros($tpl, [ '$banner' => $datarray['banner'], '$product' => $datarray['product'], @@ -611,7 +611,7 @@ function notification($params) ]); // load the template for private message notifications - $tpl = get_markup_template('email_notify_text.tpl'); + $tpl = Renderer::getMarkupTemplate('email_notify_text.tpl'); $email_text_body = Renderer::replaceMacros($tpl, [ '$banner' => $datarray['banner'], '$product' => $datarray['product'], diff --git a/include/items.php b/include/items.php index ff9559b28..887bbb5b6 100644 --- a/include/items.php +++ b/include/items.php @@ -391,7 +391,7 @@ function drop_item($id) } } - return Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ + return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'get', '$message' => L10n::t('Do you really want to delete this item?'), '$extra_inputs' => $inputs, @@ -482,7 +482,7 @@ function posted_date_widget($url, $uid, $wall) $cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years; $cutoff = ((array_key_exists($cutoff_year, $ret))? true : false); - $o = Renderer::replaceMacros(get_markup_template('posted_date_widget.tpl'),[ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('posted_date_widget.tpl'),[ '$title' => L10n::t('Archives'), '$size' => $visible_years, '$cutoff_year' => $cutoff_year, diff --git a/include/text.php b/include/text.php index d5c2ee961..2099f88c1 100644 --- a/include/text.php +++ b/include/text.php @@ -266,7 +266,7 @@ function unxmlify($s) { * @return string html for loader */ function scroll_loader() { - $tpl = get_markup_template("scroll_loader.tpl"); + $tpl = Renderer::getMarkupTemplate("scroll_loader.tpl"); return Renderer::replaceMacros($tpl, [ 'wait' => L10n::t('Loading more entries...'), 'end' => L10n::t('The end') @@ -513,7 +513,7 @@ function contact_block() { } } - $tpl = get_markup_template('contact_block.tpl'); + $tpl = Renderer::getMarkupTemplate('contact_block.tpl'); $o = Renderer::replaceMacros($tpl, [ '$contacts' => $contacts, '$nickname' => $a->profile['nickname'], @@ -571,7 +571,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { $url = ''; } - return Renderer::replaceMacros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[ + return Renderer::replaceMacros(Renderer::getMarkupTemplate(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),[ '$click' => defaults($contact, 'click', ''), '$class' => $class, '$url' => $url, @@ -626,7 +626,7 @@ function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = } } - return Renderer::replaceMacros(get_markup_template('searchbox.tpl'), $values); + return Renderer::replaceMacros(Renderer::getMarkupTemplate('searchbox.tpl'), $values); } /** @@ -904,14 +904,14 @@ function prepare_body(array &$item, $attach = false, $is_preview = false) if (strpos($mime, 'video') !== false) { if (!$vhead) { $vhead = true; - $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('videos_head.tpl'), [ + $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('videos_head.tpl'), [ '$baseurl' => System::baseUrl(), ]); } $url_parts = explode('/', $the_url); $id = end($url_parts); - $as .= Renderer::replaceMacros(get_markup_template('video_top.tpl'), [ + $as .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [ '$video' => [ 'id' => $id, 'title' => L10n::t('View Video'), @@ -1006,7 +1006,7 @@ function prepare_body(array &$item, $attach = false, $is_preview = false) function apply_content_filter($html, array $reasons) { if (count($reasons)) { - $tpl = get_markup_template('wall/content_filter.tpl'); + $tpl = Renderer::getMarkupTemplate('wall/content_filter.tpl'); $html = Renderer::replaceMacros($tpl, [ '$reasons' => $reasons, '$rnd' => random_string(8), diff --git a/mod/admin.php b/mod/admin.php index dce65c2fc..ff37c8b61 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -175,7 +175,7 @@ function admin_content(App $a) // apc_delete($toDelete); //} // Header stuff - $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('admin/settings_head.tpl'), []); + $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []); /* * Side bar links @@ -226,7 +226,7 @@ function admin_content(App $a) $addons_admin[] = $addon; } - $t = get_markup_template('admin/aside.tpl'); + $t = Renderer::getMarkupTemplate('admin/aside.tpl'); $a->page['aside'] .= Renderer::replaceMacros($t, [ '$admin' => $aside_tools, '$subpages' => $aside_sub, @@ -314,7 +314,7 @@ function admin_content(App $a) function admin_page_tos(App $a) { $tos = new Tos(); - $t = get_markup_template('admin/tos.tpl'); + $t = Renderer::getMarkupTemplate('admin/tos.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Terms of Service'), @@ -376,7 +376,7 @@ function admin_page_blocklist(App $a) ]; } } - $t = get_markup_template('admin/blocklist.tpl'); + $t = Renderer::getMarkupTemplate('admin/blocklist.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Server Blocklist'), @@ -491,7 +491,7 @@ function admin_page_contactblock(App $a) $contacts = DBA::toArray($statement); - $t = get_markup_template('admin/contactblock.tpl'); + $t = Renderer::getMarkupTemplate('admin/contactblock.tpl'); $o = Renderer::replaceMacros($t, [ // strings // '$title' => L10n::t('Administration'), @@ -533,7 +533,7 @@ function admin_page_contactblock(App $a) */ function admin_page_deleteitem(App $a) { - $t = get_markup_template('admin/deleteitem.tpl'); + $t = Renderer::getMarkupTemplate('admin/deleteitem.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), @@ -726,7 +726,7 @@ function admin_page_federation(App $a) $hint = L10n::t('The Auto Discovered Contact Directory feature is not enabled, it will improve the data displayed here.'); // load the template, replace the macros and return the page content - $t = get_markup_template('admin/federation.tpl'); + $t = Renderer::getMarkupTemplate('admin/federation.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Federation Statistics'), @@ -769,7 +769,7 @@ function admin_page_queue(App $a) } DBA::close($entries); - $t = get_markup_template('admin/queue.tpl'); + $t = Renderer::getMarkupTemplate('admin/queue.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Inspect Queue'), @@ -820,7 +820,7 @@ function admin_page_workerqueue(App $a, $deferred) } DBA::close($entries); - $t = get_markup_template('admin/workerqueue.tpl'); + $t = Renderer::getMarkupTemplate('admin/workerqueue.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => $sub_title, @@ -938,7 +938,7 @@ function admin_page_summary(App $a) 'memory_limit' => ini_get('memory_limit')], 'mysql' => ['max_allowed_packet' => $max_allowed_packet]]; - $t = get_markup_template('admin/summary.tpl'); + $t = Renderer::getMarkupTemplate('admin/summary.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Summary'), @@ -1449,7 +1449,7 @@ function admin_page_site(App $a) $optimize_max_tablesize = -1; } - $t = get_markup_template('admin/site.tpl'); + $t = Renderer::getMarkupTemplate('admin/site.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Site'), @@ -1643,13 +1643,13 @@ function admin_page_dbsync(App $a) } if (!count($failed)) { - $o = Renderer::replaceMacros(get_markup_template('structure_check.tpl'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('structure_check.tpl'), [ '$base' => System::baseUrl(true), '$banner' => L10n::t('No failed updates.'), '$check' => L10n::t('Check database structure'), ]); } else { - $o = Renderer::replaceMacros(get_markup_template('failed_updates.tpl'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('failed_updates.tpl'), [ '$base' => System::baseUrl(true), '$banner' => L10n::t('Failed Updates'), '$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'), @@ -1910,7 +1910,7 @@ function admin_page_users(App $a) $th_users = array_map(null, [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Type')], $valid_orders); - $t = get_markup_template('admin/users.tpl'); + $t = Renderer::getMarkupTemplate('admin/users.tpl'); $o = Renderer::replaceMacros($t, [ // strings // '$title' => L10n::t('Administration'), @@ -2026,7 +2026,7 @@ function admin_page_addons(App $a, array $addons_admin) $func($a, $admin_form); } - $t = get_markup_template('admin/addon_details.tpl'); + $t = Renderer::getMarkupTemplate('admin/addon_details.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), @@ -2087,7 +2087,7 @@ function admin_page_addons(App $a, array $addons_admin) } } - $t = get_markup_template('admin/addons.tpl'); + $t = Renderer::getMarkupTemplate('admin/addons.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Addons'), @@ -2297,7 +2297,7 @@ function admin_page_themes(App $a) $screenshot = null; } - $t = get_markup_template('admin/addon_details.tpl'); + $t = Renderer::getMarkupTemplate('admin/addon_details.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Themes'), @@ -2341,7 +2341,7 @@ function admin_page_themes(App $a) $addons[] = [$th['name'], (($th['allowed']) ? "on" : "off"), Theme::getInfo($th['name'])]; } - $t = get_markup_template('admin/addons.tpl'); + $t = Renderer::getMarkupTemplate('admin/addons.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), '$page' => L10n::t('Themes'), @@ -2415,7 +2415,7 @@ function admin_page_logs(App $a) $phplogenabled = L10n::t('PHP log currently disabled.'); } - $t = get_markup_template('admin/logs.tpl'); + $t = Renderer::getMarkupTemplate('admin/logs.tpl'); return Renderer::replaceMacros($t, [ '$title' => L10n::t('Administration'), @@ -2456,7 +2456,7 @@ function admin_page_logs(App $a) */ function admin_page_viewlogs(App $a) { - $t = get_markup_template('admin/viewlogs.tpl'); + $t = Renderer::getMarkupTemplate('admin/viewlogs.tpl'); $f = Config::get('system', 'logfile'); $data = ''; @@ -2562,7 +2562,7 @@ function admin_page_features(App $a) } } - $tpl = get_markup_template('admin/settings_features.tpl'); + $tpl = Renderer::getMarkupTemplate('admin/settings_features.tpl'); $o = Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("admin_manage_features"), '$title' => L10n::t('Manage Additional Features'), diff --git a/mod/allfriends.php b/mod/allfriends.php index 5f368220b..b233a4618 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -99,7 +99,7 @@ function allfriends_content(App $a) $tab_str = Module\Contact::getTabsHTML($a, $contact, 4); - $tpl = get_markup_template('viewcontact_template.tpl'); + $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl'); $o .= Renderer::replaceMacros($tpl, [ //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])), diff --git a/mod/api.php b/mod/api.php index e81633531..52ddf37be 100644 --- a/mod/api.php +++ b/mod/api.php @@ -82,7 +82,7 @@ function api_content(App $a) killme(); } - $tpl = get_markup_template("oauth_authorize_done.tpl"); + $tpl = Renderer::getMarkupTemplate("oauth_authorize_done.tpl"); $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Authorize application connection'), '$info' => L10n::t('Return to your app and insert this Securty Code:'), @@ -104,7 +104,7 @@ function api_content(App $a) return "Invalid request. Unknown token."; } - $tpl = get_markup_template('oauth_authorize.tpl'); + $tpl = Renderer::getMarkupTemplate('oauth_authorize.tpl'); $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Authorize application connection'), '$app' => $app, diff --git a/mod/apps.php b/mod/apps.php index 5fd00462e..d497ce93a 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -25,7 +25,7 @@ function apps_content() notice(L10n::t('No installed applications.') . EOL); } - $tpl = get_markup_template('apps.tpl'); + $tpl = Renderer::getMarkupTemplate('apps.tpl'); return Renderer::replaceMacros($tpl, [ '$title' => $title, '$apps' => $apps, diff --git a/mod/babel.php b/mod/babel.php index 6a6e084a0..b9846e4fb 100644 --- a/mod/babel.php +++ b/mod/babel.php @@ -140,7 +140,7 @@ function babel_content() } } - $tpl = get_markup_template('babel.tpl'); + $tpl = Renderer::getMarkupTemplate('babel.tpl'); $o = Renderer::replaceMacros($tpl, [ '$text' => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''], '$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'], diff --git a/mod/cal.php b/mod/cal.php index f9e4b3fdf..29095082d 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -60,7 +60,7 @@ function cal_init(App $a) $account_type = Contact::getAccountType($profile); - $tpl = get_markup_template("vcard-widget.tpl"); + $tpl = Renderer::getMarkupTemplate("vcard-widget.tpl"); $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], @@ -89,7 +89,7 @@ function cal_content(App $a) // get the translation strings for the callendar $i18n = Event::getStrings(); - $htpl = get_markup_template('event_head.tpl'); + $htpl = Renderer::getMarkupTemplate('event_head.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [ '$baseurl' => System::baseUrl(), '$module_url' => '/cal/' . $a->data['user']['nickname'], @@ -249,12 +249,12 @@ function cal_content(App $a) // links: array('href', 'text', 'extra css classes', 'title') if (x($_GET, 'id')) { - $tpl = get_markup_template("event.tpl"); + $tpl = Renderer::getMarkupTemplate("event.tpl"); } else { // if (Config::get('experimentals','new_calendar')==1){ - $tpl = get_markup_template("events_js.tpl"); + $tpl = Renderer::getMarkupTemplate("events_js.tpl"); // } else { -// $tpl = get_markup_template("events.tpl"); +// $tpl = Renderer::getMarkupTemplate("events.tpl"); // } } diff --git a/mod/common.php b/mod/common.php index 0a84dc56c..0f9bc096a 100644 --- a/mod/common.php +++ b/mod/common.php @@ -49,7 +49,7 @@ function common_content(App $a) $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]); if (DBA::isResult($contact)) { - $vcard_widget = Renderer::replaceMacros(get_markup_template("vcard-widget.tpl"), [ + $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("vcard-widget.tpl"), [ '$name' => htmlentities($contact['name']), '$photo' => $contact['photo'], 'url' => 'contact/' . $cid @@ -143,7 +143,7 @@ function common_content(App $a) $title = L10n::t('Common Friends'); } - $tpl = get_markup_template('viewcontact_template.tpl'); + $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$title' => $title, diff --git a/mod/community.php b/mod/community.php index a85a79c05..366688173 100644 --- a/mod/community.php +++ b/mod/community.php @@ -120,7 +120,7 @@ function community_content(App $a, $update = 0) ]; } - $tab_tpl = get_markup_template('common_tabs.tpl'); + $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); $o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); Nav::setSelected('community'); @@ -199,7 +199,7 @@ function community_content(App $a, $update = 0) $o .= $pager->renderMinimal(count($r)); } - $t = get_markup_template("community.tpl"); + $t = Renderer::getMarkupTemplate("community.tpl"); return Renderer::replaceMacros($t, [ '$content' => $o, '$header' => '', diff --git a/mod/credits.php b/mod/credits.php index 42894484a..c53c86b8b 100644 --- a/mod/credits.php +++ b/mod/credits.php @@ -14,7 +14,7 @@ function credits_content() /* fill the page with credits */ $credits_string = file_get_contents('util/credits.txt'); $names = explode("\n", htmlspecialchars($credits_string)); - $tpl = get_markup_template('credits.tpl'); + $tpl = Renderer::getMarkupTemplate('credits.tpl'); return Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Credits'), '$thanks' => L10n::t('Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!'), diff --git a/mod/crepair.php b/mod/crepair.php index 7c8761a54..330831559 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -137,7 +137,7 @@ function crepair_content(App $a) $tab_str = Module\Contact::getTabsHTML($a, $contact, 5); - $tpl = get_markup_template('crepair.tpl'); + $tpl = Renderer::getMarkupTemplate('crepair.tpl'); $o = Renderer::replaceMacros($tpl, [ '$tab_str' => $tab_str, '$warning' => $warning, diff --git a/mod/delegate.php b/mod/delegate.php index bd21bb2ee..116245812 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -164,7 +164,7 @@ function delegate_content(App $a) $parent_password = ['parent_password', L10n::t('Parent Password:'), '', L10n::t('Please enter the password of the parent account to legitimize your request.')]; } - $o = Renderer::replaceMacros(get_markup_template('delegate.tpl'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('delegate.tpl'), [ '$form_security_token' => BaseModule::getFormSecurityToken('delegate'), '$parent_header' => L10n::t('Parent User'), '$parent_user' => $parent_user, diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 65b0b2ed3..fdb1a42ee 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -515,7 +515,7 @@ function dfrn_request_content(App $a) return; // NOTREACHED } - $tpl = get_markup_template("dfrn_req_confirm.tpl"); + $tpl = Renderer::getMarkupTemplate("dfrn_req_confirm.tpl"); $o = Renderer::replaceMacros($tpl, [ '$dfrn_url' => $dfrn_url, '$aes_allow' => (($aes_allow) ? '' : "" ), @@ -628,9 +628,9 @@ function dfrn_request_content(App $a) * it doesn't matter if they know you or not. */ if ($a->profile['page-flags'] == Contact::PAGE_NORMAL) { - $tpl = get_markup_template('dfrn_request.tpl'); + $tpl = Renderer::getMarkupTemplate('dfrn_request.tpl'); } else { - $tpl = get_markup_template('auto_request.tpl'); + $tpl = Renderer::getMarkupTemplate('auto_request.tpl'); } $page_desc = L10n::t("Please enter your 'Identity Address' from one of the following supported communications networks:"); diff --git a/mod/directory.php b/mod/directory.php index 6f6348103..10eaa4492 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -202,7 +202,7 @@ function directory_content(App $a) } DBA::close($r); - $tpl = get_markup_template('directory_header.tpl'); + $tpl = Renderer::getMarkupTemplate('directory_header.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$search' => $search, diff --git a/mod/dirfind.php b/mod/dirfind.php index 4c38a2dbd..2451beb18 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -250,7 +250,7 @@ function dirfind_content(App $a, $prefix = "") { $entries[] = $entry; } - $tpl = get_markup_template('viewcontact_template.tpl'); + $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl'); $o .= Renderer::replaceMacros($tpl,[ 'title' => $header, '$contacts' => $entries, diff --git a/mod/display.php b/mod/display.php index b6577b008..ac345d541 100644 --- a/mod/display.php +++ b/mod/display.php @@ -264,7 +264,7 @@ function display_content(App $a, $update = false, $update_uid = 0) $conversation = ''; } - $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('display-head.tpl'), + $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), ['$alternate' => $alternate, '$conversation' => $conversation]); diff --git a/mod/editpost.php b/mod/editpost.php index fe1e5842e..329e0c9a0 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -41,11 +41,11 @@ function editpost_content(App $a) $geotag = ''; - $o .= Renderer::replaceMacros(get_markup_template("section_title.tpl"), [ + $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"), [ '$title' => L10n::t('Edit post') ]); - $tpl = get_markup_template('jot-header.tpl'); + $tpl = Renderer::getMarkupTemplate('jot-header.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$ispublic' => ' ', // L10n::t('Visible to everybody'), @@ -53,7 +53,7 @@ function editpost_content(App $a) '$nickname' => $a->user['nickname'] ]); - $tpl = get_markup_template("jot.tpl"); + $tpl = Renderer::getMarkupTemplate("jot.tpl"); if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) { $lockstate = 'lock'; diff --git a/mod/events.php b/mod/events.php index 932f9acfa..c9461a48e 100644 --- a/mod/events.php +++ b/mod/events.php @@ -226,7 +226,7 @@ function events_content(App $a) // get the translation strings for the callendar $i18n = Event::getStrings(); - $htpl = get_markup_template('event_head.tpl'); + $htpl = Renderer::getMarkupTemplate('event_head.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [ '$baseurl' => System::baseUrl(), '$module_url' => '/events', @@ -368,9 +368,9 @@ function events_content(App $a) } if (!empty($_GET['id'])) { - $tpl = get_markup_template("event.tpl"); + $tpl = Renderer::getMarkupTemplate("event.tpl"); } else { - $tpl = get_markup_template("events_js.tpl"); + $tpl = Renderer::getMarkupTemplate("events_js.tpl"); } // Get rid of dashes in key names, Smarty3 can't handle them @@ -498,7 +498,7 @@ function events_content(App $a) $uri = ''; } - $tpl = get_markup_template('event_form.tpl'); + $tpl = Renderer::getMarkupTemplate('event_form.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$post' => System::baseUrl() . '/events', diff --git a/mod/fbrowser.php b/mod/fbrowser.php index e1e4dc572..cc51d4199 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -94,7 +94,7 @@ function fbrowser_content(App $a) } $files = array_map("_map_files1", $r); - $tpl = get_markup_template($template_file); + $tpl = Renderer::getMarkupTemplate($template_file); $o = Renderer::replaceMacros($tpl, [ '$type' => 'image', @@ -126,7 +126,7 @@ function fbrowser_content(App $a) $files = array_map("_map_files2", $files); - $tpl = get_markup_template($template_file); + $tpl = Renderer::getMarkupTemplate($template_file); $o = Renderer::replaceMacros($tpl, [ '$type' => 'file', '$baseurl' => System::baseUrl(), diff --git a/mod/feedtest.php b/mod/feedtest.php index a284c4115..edb75aefc 100644 --- a/mod/feedtest.php +++ b/mod/feedtest.php @@ -44,7 +44,7 @@ function feedtest_content(App $a) ]; } - $tpl = get_markup_template('feedtest.tpl'); + $tpl = Renderer::getMarkupTemplate('feedtest.tpl'); $o = Renderer::replaceMacros($tpl, [ '$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''], '$result' => $result diff --git a/mod/filer.php b/mod/filer.php index f4e90d603..11a5dd057 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -31,7 +31,7 @@ function filer_content(App $a) $filetags = FileTag::fileToList($filetags, 'file'); $filetags = explode(",", $filetags); - $tpl = get_markup_template("filer_dialog.tpl"); + $tpl = Renderer::getMarkupTemplate("filer_dialog.tpl"); $o = Renderer::replaceMacros($tpl, [ '$field' => ['term', L10n::t("Save to Folder:"), '', '', $filetags, L10n::t('- select -')], '$submit' => L10n::t('Save'), diff --git a/mod/follow.php b/mod/follow.php index 2a069e72a..5c6c6d9d3 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -109,10 +109,10 @@ function follow_content(App $a) if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($r)) { $request = $ret['request']; - $tpl = get_markup_template('dfrn_request.tpl'); + $tpl = Renderer::getMarkupTemplate('dfrn_request.tpl'); } else { $request = System::baseUrl() . '/follow'; - $tpl = get_markup_template('auto_request.tpl'); + $tpl = Renderer::getMarkupTemplate('auto_request.tpl'); } $r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid)); @@ -188,7 +188,7 @@ function follow_content(App $a) } if ($gcontact_id <> 0) { - $o .= Renderer::replaceMacros(get_markup_template('section_title.tpl'), + $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')] ); diff --git a/mod/group.php b/mod/group.php index 1791fce3e..8b2ce9ca1 100644 --- a/mod/group.php +++ b/mod/group.php @@ -98,7 +98,7 @@ function group_content(App $a) { $switchtotext = Config::get('system', 'groupedit_image_limit', 400); } - $tpl = get_markup_template('group_edit.tpl'); + $tpl = Renderer::getMarkupTemplate('group_edit.tpl'); $context = [ '$submit' => L10n::t('Save Group'), @@ -215,7 +215,7 @@ function group_content(App $a) { } } - $drop_tpl = get_markup_template('group_drop.tpl'); + $drop_tpl = Renderer::getMarkupTemplate('group_drop.tpl'); $drop_txt = Renderer::replaceMacros($drop_tpl, [ '$id' => $group['id'], '$delete' => L10n::t('Delete Group'), @@ -307,7 +307,7 @@ function group_content(App $a) { $context['$shortmode'] = (($switchtotext && ($total > $switchtotext)) ? true : false); if ($change) { - $tpl = get_markup_template('groupeditor.tpl'); + $tpl = Renderer::getMarkupTemplate('groupeditor.tpl'); echo Renderer::replaceMacros($tpl, $context); killme(); } diff --git a/mod/help.php b/mod/help.php index 553f1ae8f..2c8f68ff3 100644 --- a/mod/help.php +++ b/mod/help.php @@ -61,7 +61,7 @@ function help_content(App $a) if (!strlen($text)) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found')); - $tpl = get_markup_template("404.tpl"); + $tpl = Renderer::getMarkupTemplate("404.tpl"); return Renderer::replaceMacros($tpl, [ '$message' => L10n::t('Page not found.') ]); diff --git a/mod/home.php b/mod/home.php index 4c7a1a8a4..b37570740 100644 --- a/mod/home.php +++ b/mod/home.php @@ -54,7 +54,7 @@ function home_content(App $a) { Addon::callHooks("home_content",$content); - $tpl = get_markup_template('home.tpl'); + $tpl = Renderer::getMarkupTemplate('home.tpl'); return Renderer::replaceMacros($tpl, [ '$defaultheader' => $defaultheader, '$customhome' => $customhome, diff --git a/mod/hostxrd.php b/mod/hostxrd.php index ec8b2cb35..93a9d833c 100644 --- a/mod/hostxrd.php +++ b/mod/hostxrd.php @@ -22,7 +22,7 @@ function hostxrd_init(App $a) Config::set('system','site_pubkey', $res['pubkey']); } - $tpl = get_markup_template('xrd_host.tpl'); + $tpl = Renderer::getMarkupTemplate('xrd_host.tpl'); echo Renderer::replaceMacros($tpl, [ '$zhost' => $a->getHostName(), '$zroot' => System::baseUrl(), diff --git a/mod/hovercard.php b/mod/hovercard.php index 1c9766d49..1e2e14afb 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -111,7 +111,7 @@ function hovercard_content() 'actions' => $actions, ]; if ($datatype == 'html') { - $tpl = get_markup_template('hovercard.tpl'); + $tpl = Renderer::getMarkupTemplate('hovercard.tpl'); $o = Renderer::replaceMacros($tpl, [ '$profile' => $profile, ]); @@ -134,7 +134,7 @@ function get_template_content($template, $root = '') { // We load the whole template system to get the filename. // Maybe we can do it a little bit smarter if I get time. - $t = get_markup_template($template, $root); + $t = Renderer::getMarkupTemplate($template, $root); $filename = $t->filename; // Get the content of the template file diff --git a/mod/invite.php b/mod/invite.php index 374628f55..1e02ae9ca 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -111,7 +111,7 @@ function invite_content(App $a) { return; } - $tpl = get_markup_template('invite.tpl'); + $tpl = Renderer::getMarkupTemplate('invite.tpl'); $invonly = false; if (Config::get('system', 'invitation_only')) { diff --git a/mod/lostpass.php b/mod/lostpass.php index 954788aa4..ae94fbbbe 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -116,7 +116,7 @@ function lostpass_content(App $a) function lostpass_form() { - $tpl = get_markup_template('lostpass.tpl'); + $tpl = Renderer::getMarkupTemplate('lostpass.tpl'); $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Forgot your Password?'), '$desc' => L10n::t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), @@ -135,7 +135,7 @@ function lostpass_generate_password($user) $new_password = User::generateNewPassword(); $result = User::updatePassword($user['uid'], $new_password); if (DBA::isResult($result)) { - $tpl = get_markup_template('pwdreset.tpl'); + $tpl = Renderer::getMarkupTemplate('pwdreset.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$lbl1' => L10n::t('Password Reset'), '$lbl2' => L10n::t('Your password has been reset as requested.'), diff --git a/mod/maintenance.php b/mod/maintenance.php index ccff935b8..a1b032a61 100644 --- a/mod/maintenance.php +++ b/mod/maintenance.php @@ -21,7 +21,7 @@ function maintenance_content(App $a) header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 600'); - return Renderer::replaceMacros(get_markup_template('maintenance.tpl'), [ + return Renderer::replaceMacros(Renderer::getMarkupTemplate('maintenance.tpl'), [ '$sysdown' => L10n::t('System down for maintenance'), '$reason' => $reason ]); diff --git a/mod/manage.php b/mod/manage.php index 20ed7e294..f92a94549 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -177,7 +177,7 @@ function manage_content(App $a) { $identities[$key]['notifications'] = $notifications; } - $o = Renderer::replaceMacros(get_markup_template('manage.tpl'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('manage.tpl'), [ '$title' => L10n::t('Manage Identities and/or Pages'), '$desc' => L10n::t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'), '$choose' => L10n::t('Select an identity to manage: '), diff --git a/mod/manifest.php b/mod/manifest.php index 98325c336..9fbfde448 100644 --- a/mod/manifest.php +++ b/mod/manifest.php @@ -7,7 +7,7 @@ use Friendica\Core\Renderer; function manifest_content(App $a) { - $tpl = get_markup_template('manifest.tpl'); + $tpl = Renderer::getMarkupTemplate('manifest.tpl'); header('Content-type: application/manifest+json'); diff --git a/mod/match.php b/mod/match.php index 1856dd981..e924722aa 100644 --- a/mod/match.php +++ b/mod/match.php @@ -113,7 +113,7 @@ function match_content(App $a) } } - $tpl = get_markup_template('viewcontact_template.tpl'); + $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Profile Match'), diff --git a/mod/message.php b/mod/message.php index 3e2cccb76..23c08f5a3 100644 --- a/mod/message.php +++ b/mod/message.php @@ -37,14 +37,14 @@ function message_init(App $a) 'accesskey' => 'm', ]; - $tpl = get_markup_template('message_side.tpl'); + $tpl = Renderer::getMarkupTemplate('message_side.tpl'); $a->page['aside'] = Renderer::replaceMacros($tpl, [ '$tabs' => $tabs, '$new' => $new, ]); $base = System::baseUrl(); - $head_tpl = get_markup_template('message-head.tpl'); + $head_tpl = Renderer::getMarkupTemplate('message-head.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base @@ -105,7 +105,7 @@ function message_content(App $a) $myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; - $tpl = get_markup_template('mail_head.tpl'); + $tpl = Renderer::getMarkupTemplate('mail_head.tpl'); if ($a->argc > 1 && $a->argv[1] == 'new') { $button = [ 'label' => L10n::t('Discard'), @@ -144,7 +144,7 @@ function message_content(App $a) } //$a->page['aside'] = ''; - return Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ + return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'get', '$message' => L10n::t('Do you really want to delete this message?'), '$extra_inputs' => $inputs, @@ -199,7 +199,7 @@ function message_content(App $a) if (($a->argc > 1) && ($a->argv[1] === 'new')) { $o .= $header; - $tpl = get_markup_template('msg-header.tpl'); + $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], @@ -244,7 +244,7 @@ function message_content(App $a) // the ugly select box $select = ACL::getMessageContactSelectHTML('messageto', 'message-to-select', $preselect, 4, 10); - $tpl = get_markup_template('prv_message.tpl'); + $tpl = Renderer::getMarkupTemplate('prv_message.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$header' => L10n::t('Send Private Message'), '$to' => L10n::t('To:'), @@ -339,7 +339,7 @@ function message_content(App $a) intval(local_user()) ); - $tpl = get_markup_template('msg-header.tpl'); + $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], @@ -399,7 +399,7 @@ function message_content(App $a) $select = $message['name'] . ''; $parent = ''; - $tpl = get_markup_template('mail_display.tpl'); + $tpl = Renderer::getMarkupTemplate('mail_display.tpl'); $o = Renderer::replaceMacros($tpl, [ '$thread_id' => $a->argv[1], '$thread_subject' => $message['title'], @@ -454,7 +454,7 @@ function render_messages(array $msg, $t) { $a = get_app(); - $tpl = get_markup_template($t); + $tpl = Renderer::getMarkupTemplate($t); $rslt = ''; $myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; diff --git a/mod/network.php b/mod/network.php index 5913f804b..11b297329 100644 --- a/mod/network.php +++ b/mod/network.php @@ -201,7 +201,7 @@ function saved_searches($search) ]; } - $tpl = get_markup_template('saved_searches_aside.tpl'); + $tpl = Renderer::getMarkupTemplate('saved_searches_aside.tpl'); $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Saved Searches'), '$add' => L10n::t('add'), @@ -654,7 +654,7 @@ function networkThreadedView(App $a, $update, $parent) info(L10n::t('Group is empty')); } - $o = Renderer::replaceMacros(get_markup_template('section_title.tpl'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [ '$title' => L10n::t('Group: %s', $group['name']) ]) . $o; } elseif ($cid) { @@ -675,7 +675,7 @@ function networkThreadedView(App $a, $update, $parent) $entries[0]['account_type'] = Contact::getAccountType($contact); - $o = Renderer::replaceMacros(get_markup_template('viewcontact_template.tpl'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('viewcontact_template.tpl'), [ 'contacts' => $entries, 'id' => 'network', ]) . $o; @@ -1033,7 +1033,7 @@ function network_tabs(App $a) $arr = ['tabs' => $tabs]; Addon::callHooks('network_tabs', $arr); - $tpl = get_markup_template('common_tabs.tpl'); + $tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]); @@ -1059,7 +1059,7 @@ function network_infinite_scroll_head(App $a, &$htmlhead) if (PConfig::get(local_user(), 'system', 'infinite_scroll') && defaults($_GET, 'mode', '') != 'minimal' ) { - $tpl = get_markup_template('infinite_scroll_head.tpl'); + $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl'); $htmlhead .= Renderer::replaceMacros($tpl, [ '$pageno' => $pager->getPage(), '$reload_uri' => $pager->getBaseQueryString() diff --git a/mod/notifications.php b/mod/notifications.php index c2dc1cd4c..54c54fa22 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -133,7 +133,7 @@ function notifications_content(App $a) System::jsonExit($notifs); } - $notif_tpl = get_markup_template('notifications.tpl'); + $notif_tpl = Renderer::getMarkupTemplate('notifications.tpl'); $notif_show_lnk = [ 'href' => ($show ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all' ), @@ -142,8 +142,8 @@ function notifications_content(App $a) // Process the data for template creation if (defaults($notifs, 'ident', '') === 'introductions') { - $sugg = get_markup_template('suggestions.tpl'); - $tpl = get_markup_template('intros.tpl'); + $sugg = Renderer::getMarkupTemplate('suggestions.tpl'); + $tpl = Renderer::getMarkupTemplate('intros.tpl'); // The link to switch between ignored and normal connection requests $notif_show_lnk = [ @@ -209,7 +209,7 @@ function notifications_content(App $a) $helptext3 = L10n::t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $notif['name']); } - $dfrn_tpl = get_markup_template('netfriend.tpl'); + $dfrn_tpl = Renderer::getMarkupTemplate('netfriend.tpl'); $dfrn_text = Renderer::replaceMacros($dfrn_tpl, [ '$intro_id' => $notif['intro_id'], '$friend_selected' => $friend_selected, @@ -294,7 +294,7 @@ function notifications_content(App $a) 'notify' => 'notify.tpl', ]; - $tpl_notif = get_markup_template($notification_templates[$notif['label']]); + $tpl_notif = Renderer::getMarkupTemplate($notification_templates[$notif['label']]); $notif_content[] = Renderer::replaceMacros($tpl_notif, [ '$item_label' => $notif['label'], diff --git a/mod/notify.php b/mod/notify.php index b7e2faf1c..959b581d5 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -60,9 +60,9 @@ function notify_content(App $a) $nm = new NotificationsManager(); - $notif_tpl = get_markup_template('notifications.tpl'); + $notif_tpl = Renderer::getMarkupTemplate('notifications.tpl'); - $not_tpl = get_markup_template('notify.tpl'); + $not_tpl = Renderer::getMarkupTemplate('notify.tpl'); $r = $nm->getAll(['seen'=>0]); if (DBA::isResult($r) > 0) { diff --git a/mod/oexchange.php b/mod/oexchange.php index df5f391d4..296869aac 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -12,7 +12,7 @@ use Friendica\Util\Network; function oexchange_init(App $a) { if (($a->argc > 1) && ($a->argv[1] === 'xrd')) { - $tpl = get_markup_template('oexchange_xrd.tpl'); + $tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl'); $o = Renderer::replaceMacros($tpl, ['$base' => System::baseUrl()]); echo $o; diff --git a/mod/opensearch.php b/mod/opensearch.php index b7c5ce280..f4765b062 100644 --- a/mod/opensearch.php +++ b/mod/opensearch.php @@ -6,7 +6,7 @@ use Friendica\Core\System; function opensearch_content(App $a) { - $tpl = get_markup_template('opensearch.tpl'); + $tpl = Renderer::getMarkupTemplate('opensearch.tpl'); header("Content-type: application/opensearchdescription+xml"); diff --git a/mod/photos.php b/mod/photos.php index 92f79d7c9..82a6ccca2 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -63,7 +63,7 @@ function photos_init(App $a) { $account_type = Contact::getAccountType($profile); - $tpl = get_markup_template("vcard-widget.tpl"); + $tpl = Renderer::getMarkupTemplate("vcard-widget.tpl"); $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], @@ -110,7 +110,7 @@ function photos_init(App $a) { } if ($ret['success']) { - $photo_albums_widget = Renderer::replaceMacros(get_markup_template('photo_albums.tpl'), [ + $photo_albums_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('photo_albums.tpl'), [ '$nick' => $a->data['user']['nickname'], '$title' => L10n::t('Photo Albums'), '$recent' => L10n::t('Recent Photos'), @@ -131,7 +131,7 @@ function photos_init(App $a) { $a->page['aside'] .= $photo_albums_widget; } - $tpl = get_markup_template("photos_head.tpl"); + $tpl = Renderer::getMarkupTemplate("photos_head.tpl"); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$ispublic' => L10n::t('everybody') @@ -247,7 +247,7 @@ function photos_post(App $a) ['name' => 'albumname', 'value' => $_POST['albumname']], ]; - $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'post', '$message' => L10n::t('Do you really want to delete this photo album and all its photos?'), '$extra_inputs' => $extra_inputs, @@ -319,7 +319,7 @@ function photos_post(App $a) if (!empty($_REQUEST['confirm'])) { $drop_url = $a->query_string; - $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'post', '$message' => L10n::t('Do you really want to delete this photo?'), '$extra_inputs' => [], @@ -1085,14 +1085,14 @@ function photos_content(App $a) Addon::callHooks('photo_upload_form',$ret); - $default_upload_box = Renderer::replaceMacros(get_markup_template('photos_default_uploader_box.tpl'), []); - $default_upload_submit = Renderer::replaceMacros(get_markup_template('photos_default_uploader_submit.tpl'), [ + $default_upload_box = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_box.tpl'), []); + $default_upload_submit = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_submit.tpl'), [ '$submit' => L10n::t('Submit'), ]); $usage_message = ''; - $tpl = get_markup_template('photos_upload.tpl'); + $tpl = Renderer::getMarkupTemplate('photos_upload.tpl'); $aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML($a->user)); @@ -1166,7 +1166,7 @@ function photos_content(App $a) if ($cmd === 'edit') { if (($album !== L10n::t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== L10n::t('Contact Photos'))) { if ($can_post) { - $edit_tpl = get_markup_template('album_edit.tpl'); + $edit_tpl = Renderer::getMarkupTemplate('album_edit.tpl'); $album_e = $album; @@ -1220,7 +1220,7 @@ function photos_content(App $a) } } - $tpl = get_markup_template('photo_album.tpl'); + $tpl = Renderer::getMarkupTemplate('photo_album.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$photos' => $photos, '$album' => $album, @@ -1342,7 +1342,7 @@ function photos_content(App $a) } if ($cmd === 'edit') { - $tpl = get_markup_template('photo_edit_head.tpl'); + $tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$prevlink' => $prevlink, '$nextlink' => $nextlink @@ -1429,7 +1429,7 @@ function photos_content(App $a) $edit = Null; if ($cmd === 'edit' && $can_post) { - $edit_tpl = get_markup_template('photo_edit.tpl'); + $edit_tpl = Renderer::getMarkupTemplate('photo_edit.tpl'); $album_e = $ph[0]['album']; $caption_e = $ph[0]['desc']; @@ -1468,12 +1468,12 @@ function photos_content(App $a) $responses = ''; if (count($linked_items)) { - $cmnt_tpl = get_markup_template('comment_item.tpl'); - $tpl = get_markup_template('photo_item.tpl'); + $cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl'); + $tpl = Renderer::getMarkupTemplate('photo_item.tpl'); $return_path = $a->cmd; if ($can_post || Security::canWriteToUserWall($owner_uid)) { - $like_tpl = get_markup_template('like_noshare.tpl'); + $like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl'); $likebuttons = Renderer::replaceMacros($like_tpl, [ '$id' => $link_item['id'], '$likethis' => L10n::t("I like this \x28toggle\x29"), @@ -1612,7 +1612,7 @@ function photos_content(App $a) $paginate = $pager->renderFull($total); } - $photo_tpl = get_markup_template('photo_view.tpl'); + $photo_tpl = Renderer::getMarkupTemplate('photo_view.tpl'); $o .= Renderer::replaceMacros($photo_tpl, [ '$id' => $ph[0]['id'], '$album' => [$album_link, $ph[0]['album']], @@ -1704,7 +1704,7 @@ function photos_content(App $a) } } - $tpl = get_markup_template('photos_recent.tpl'); + $tpl = Renderer::getMarkupTemplate('photos_recent.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Recent Photos'), '$can_post' => $can_post, diff --git a/mod/poco.php b/mod/poco.php index 9eac87679..41fabff4e 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -375,7 +375,7 @@ function poco_init(App $a) { if ($format === 'xml') { header('Content-type: text/xml'); - echo Renderer::replaceMacros(get_markup_template('poco_xml.tpl'), array_xmlify(['$response' => $ret])); + echo Renderer::replaceMacros(Renderer::getMarkupTemplate('poco_xml.tpl'), array_xmlify(['$response' => $ret])); killme(); } if ($format === 'json') { diff --git a/mod/poke.php b/mod/poke.php index 37714eb4a..be2625438 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -160,7 +160,7 @@ function poke_content(App $a) $base = System::baseUrl(); - $head_tpl = get_markup_template('poke_head.tpl'); + $head_tpl = Renderer::getMarkupTemplate('poke_head.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl,[ '$baseurl' => System::baseUrl(true), '$base' => $base @@ -179,7 +179,7 @@ function poke_content(App $a) } } - $tpl = get_markup_template('poke_content.tpl'); + $tpl = Renderer::getMarkupTemplate('poke_content.tpl'); $o = Renderer::replaceMacros($tpl,[ '$title' => L10n::t('Poke/Prod'), diff --git a/mod/profile_photo.php b/mod/profile_photo.php index ad9f5ab66..3304e3cab 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -239,7 +239,7 @@ function profile_photo_content(App $a) ); if (empty($imagecrop)) { - $tpl = get_markup_template('profile_photo.tpl'); + $tpl = Renderer::getMarkupTemplate('profile_photo.tpl'); $o = Renderer::replaceMacros($tpl, [ @@ -257,7 +257,7 @@ function profile_photo_content(App $a) return $o; } else { $filename = $imagecrop['hash'] . '-' . $imagecrop['resolution'] . '.' . $imagecrop['ext']; - $tpl = get_markup_template("cropbody.tpl"); + $tpl = Renderer::getMarkupTemplate("cropbody.tpl"); $o = Renderer::replaceMacros($tpl, [ '$filename' => $filename, @@ -319,7 +319,7 @@ function profile_photo_crop_ui_head(App $a, Image $image) } } - $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template("crophead.tpl"), []); + $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate("crophead.tpl"), []); $imagecrop = [ 'hash' => $hash, diff --git a/mod/profiles.php b/mod/profiles.php index 216edacb5..a535f2fc2 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -527,11 +527,11 @@ function profiles_content(App $a) { return; } - $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('profed_head.tpl'), [ + $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [ '$baseurl' => System::baseUrl(true), ]); - $opt_tpl = get_markup_template("profile-hide-friends.tpl"); + $opt_tpl = Renderer::getMarkupTemplate("profile-hide-friends.tpl"); $hide_friends = Renderer::replaceMacros($opt_tpl,[ '$yesno' => [ 'hide-friends', //Name @@ -553,7 +553,7 @@ function profiles_content(App $a) { $detailled_profile = (PConfig::get(local_user(), 'system', 'detailled_profile') AND $personal_account); $is_default = (($r[0]['is-default']) ? 1 : 0); - $tpl = get_markup_template("profile_edit.tpl"); + $tpl = Renderer::getMarkupTemplate("profile_edit.tpl"); $o .= Renderer::replaceMacros($tpl, [ '$personal_account' => $personal_account, '$detailled_profile' => $detailled_profile, @@ -664,7 +664,7 @@ function profiles_content(App $a) { if (DBA::isResult($r)) { - $tpl = get_markup_template('profile_entry.tpl'); + $tpl = Renderer::getMarkupTemplate('profile_entry.tpl'); $profiles = ''; foreach ($r as $rr) { @@ -678,7 +678,7 @@ function profiles_content(App $a) { ]); } - $tpl_header = get_markup_template('profile_listing_header.tpl'); + $tpl_header = Renderer::getMarkupTemplate('profile_listing_header.tpl'); $o .= Renderer::replaceMacros($tpl_header,[ '$header' => L10n::t('Edit/Manage Profiles'), '$chg_photo' => L10n::t('Change profile photo'), diff --git a/mod/register.php b/mod/register.php index 0948098d7..d8231bd21 100644 --- a/mod/register.php +++ b/mod/register.php @@ -229,7 +229,7 @@ function register_content(App $a) if (Config::get('system', 'publish_all')) { $profile_publish = ''; } else { - $publish_tpl = get_markup_template("profile_publish.tpl"); + $publish_tpl = Renderer::getMarkupTemplate("profile_publish.tpl"); $profile_publish = Renderer::replaceMacros($publish_tpl, [ '$instance' => 'reg', '$pubdesc' => L10n::t('Include your profile in member directory?'), @@ -245,7 +245,7 @@ function register_content(App $a) $license = ''; - $tpl = get_markup_template("register.tpl"); + $tpl = Renderer::getMarkupTemplate("register.tpl"); $arr = ['template' => $tpl]; diff --git a/mod/removeme.php b/mod/removeme.php index c49940648..c2ceb7d4c 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -75,7 +75,7 @@ function removeme_content(App $a) $_SESSION['remove_account_verify'] = $hash; - $tpl = get_markup_template('removeme.tpl'); + $tpl = Renderer::getMarkupTemplate('removeme.tpl'); $o = Renderer::replaceMacros($tpl, [ '$basedir' => $a->getBaseURL(), '$hash' => $hash, diff --git a/mod/search.php b/mod/search.php index 320bf1b3b..37dacaddd 100644 --- a/mod/search.php +++ b/mod/search.php @@ -44,7 +44,7 @@ function search_saved_searches() { } - $tpl = get_markup_template("saved_searches_aside.tpl"); + $tpl = Renderer::getMarkupTemplate("saved_searches_aside.tpl"); $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Saved Searches'), @@ -159,7 +159,7 @@ function search_content(App $a) { } // contruct a wrapper for the search header - $o = Renderer::replaceMacros(get_markup_template("content_wrapper.tpl"),[ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate("content_wrapper.tpl"),[ 'name' => "search-header", '$title' => L10n::t("Search"), '$title_size' => 3, @@ -252,7 +252,7 @@ function search_content(App $a) { $title = L10n::t('Results for: %s', $search); } - $o .= Renderer::replaceMacros(get_markup_template("section_title.tpl"),[ + $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"),[ '$title' => $title ]); diff --git a/mod/settings.php b/mod/settings.php index 5a1ab5ba6..d88628840 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -50,7 +50,7 @@ function settings_init(App $a) // These lines provide the javascript needed by the acl selector - $tpl = get_markup_template('settings/head.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/head.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$ispublic' => L10n::t('everybody') ]); @@ -130,7 +130,7 @@ function settings_init(App $a) ]; - $tabtpl = get_markup_template("generic_links_widget.tpl"); + $tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl"); $a->page['aside'] = Renderer::replaceMacros($tabtpl, [ '$title' => L10n::t('Settings'), '$class' => 'settings-widget', @@ -672,7 +672,7 @@ function settings_content(App $a) if (($a->argc > 1) && ($a->argv[1] === 'oauth')) { if (($a->argc > 2) && ($a->argv[2] === 'add')) { - $tpl = get_markup_template('settings/oauth_edit.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/oauth_edit.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"), '$title' => L10n::t('Add application'), @@ -698,7 +698,7 @@ function settings_content(App $a) } $app = $r[0]; - $tpl = get_markup_template('settings/oauth_edit.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/oauth_edit.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"), '$title' => L10n::t('Add application'), @@ -730,7 +730,7 @@ function settings_content(App $a) local_user()); - $tpl = get_markup_template('settings/oauth.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/oauth.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"), '$baseurl' => $a->getBaseURL(true), @@ -757,7 +757,7 @@ function settings_content(App $a) Addon::callHooks('addon_settings', $settings_addons); - $tpl = get_markup_template('settings/addons.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/addons.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_addon"), '$title' => L10n::t('Addon Settings'), @@ -778,7 +778,7 @@ function settings_content(App $a) } } - $tpl = get_markup_template('settings/features.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/features.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("settings_features"), '$title' => L10n::t('Additional Features'), @@ -834,7 +834,7 @@ function settings_content(App $a) $mail_chk = ((DBA::isResult($r)) ? $r[0]['last_check'] : DBA::NULL_DATETIME); - $tpl = get_markup_template('settings/connectors.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/connectors.tpl'); $mail_disabled_message = (($mail_disabled) ? L10n::t('Email access is disabled on this site.') : ''); @@ -956,7 +956,7 @@ function settings_content(App $a) $theme_config = theme_content($a); } - $tpl = get_markup_template('settings/display.tpl'); + $tpl = Renderer::getMarkupTemplate('settings/display.tpl'); $o = Renderer::replaceMacros($tpl, [ '$ptitle' => L10n::t('Display Settings'), '$form_security_token' => BaseModule::getFormSecurityToken("settings_display"), @@ -1032,7 +1032,7 @@ function settings_content(App $a) ($a->user['account-type'] != Contact::ACCOUNT_TYPE_COMMUNITY)) $a->user['account-type'] = Contact::ACCOUNT_TYPE_COMMUNITY; - $pageset_tpl = get_markup_template('settings/pagetypes.tpl'); + $pageset_tpl = Renderer::getMarkupTemplate('settings/pagetypes.tpl'); $pagetype = Renderer::replaceMacros($pageset_tpl, [ '$account_types' => L10n::t("Account Types"), @@ -1091,7 +1091,7 @@ function settings_content(App $a) $openid_field = ['openid_url', L10n::t('OpenID:'), $openid, L10n::t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "", "url"]; } - $opt_tpl = get_markup_template("field_yesno.tpl"); + $opt_tpl = Renderer::getMarkupTemplate("field_yesno.tpl"); if (Config::get('system', 'publish_all')) { $profile_in_dir = ''; } else { @@ -1136,14 +1136,14 @@ function settings_content(App $a) info(L10n::t('Profile is not published.') . EOL); } - $tpl_addr = get_markup_template('settings/nick_set.tpl'); + $tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl'); $prof_addr = Renderer::replaceMacros($tpl_addr,[ '$desc' => L10n::t("Your Identity Address is '%s' or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname), '$basepath' => $a->getHostName() ]); - $stpl = get_markup_template('settings/settings.tpl'); + $stpl = Renderer::getMarkupTemplate('settings/settings.tpl'); $expire_arr = [ 'days' => ['expire', L10n::t("Automatically expire posts after this many days:"), $expire, L10n::t('If empty, posts will not expire. Expired posts will be deleted')], diff --git a/mod/suggest.php b/mod/suggest.php index baa3d184e..ed9f6e0f2 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -34,7 +34,7 @@ function suggest_init(App $a) } } - $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'get', '$message' => L10n::t('Do you really want to delete this suggestion?'), '$extra_inputs' => $inputs, @@ -112,7 +112,7 @@ function suggest_content(App $a) $entries[] = $entry; } - $tpl = get_markup_template('viewcontact_template.tpl'); + $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl'); $o .= Renderer::replaceMacros($tpl,[ '$title' => L10n::t('Friend Suggestions'), diff --git a/mod/uexport.php b/mod/uexport.php index 27c36a40c..f0d91eeab 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -47,7 +47,7 @@ function uexport_content(App $a) { ]; Addon::callHooks('uexport_options', $options); - $tpl = get_markup_template("uexport.tpl"); + $tpl = Renderer::getMarkupTemplate("uexport.tpl"); return Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$title' => L10n::t('Export personal data'), diff --git a/mod/uimport.php b/mod/uimport.php index 2061d4552..5df919d7d 100644 --- a/mod/uimport.php +++ b/mod/uimport.php @@ -49,7 +49,7 @@ function uimport_content(App $a) unset($_SESSION['mobile-theme']); } - $tpl = get_markup_template("uimport.tpl"); + $tpl = Renderer::getMarkupTemplate("uimport.tpl"); return Renderer::replaceMacros($tpl, [ '$regbutt' => L10n::t('Import'), '$import' => [ diff --git a/mod/unfollow.php b/mod/unfollow.php index 0e083c227..372364810 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -100,7 +100,7 @@ function unfollow_content(App $a) } $request = System::baseUrl() . '/unfollow'; - $tpl = get_markup_template('auto_request.tpl'); + $tpl = Renderer::getMarkupTemplate('auto_request.tpl'); $self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]); @@ -145,7 +145,7 @@ function unfollow_content(App $a) $a->page['aside'] = ''; Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url'])); - $o .= Renderer::replaceMacros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]); + $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]); // Show last public posts $o .= Contact::getPostsFromUrl($contact['url']); diff --git a/mod/videos.php b/mod/videos.php index c05132b8f..9e64321f3 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -51,7 +51,7 @@ function videos_init(App $a) $account_type = Contact::getAccountType($profile); - $tpl = get_markup_template("vcard-widget.tpl"); + $tpl = Renderer::getMarkupTemplate("vcard-widget.tpl"); $vcard_widget = Renderer::replaceMacros($tpl, [ '$name' => $profile['name'], @@ -103,7 +103,7 @@ function videos_init(App $a) $a->page['aside'] .= $vcard_widget; - $tpl = get_markup_template("videos_head.tpl"); + $tpl = Renderer::getMarkupTemplate("videos_head.tpl"); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$baseurl' => System::baseUrl(), ]); @@ -129,7 +129,7 @@ function videos_post(App $a) $drop_url = $a->query_string; - $a->page['content'] = Renderer::replaceMacros(get_markup_template('confirm.tpl'), [ + $a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [ '$method' => 'post', '$message' => L10n::t('Do you really want to delete this video?'), '$extra_inputs' => [ @@ -382,7 +382,7 @@ function videos_content(App $a) } } - $tpl = get_markup_template('videos_recent.tpl'); + $tpl = Renderer::getMarkupTemplate('videos_recent.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Recent Videos'), '$can_post' => $can_post, diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 4b4ea46a5..f3d457e29 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -125,7 +125,7 @@ function viewcontacts_content(App $a) } - $tpl = get_markup_template("viewcontact_template.tpl"); + $tpl = Renderer::getMarkupTemplate("viewcontact_template.tpl"); $o .= Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Contacts'), '$contacts' => $contacts, diff --git a/mod/wallmessage.php b/mod/wallmessage.php index 371b82bee..78cdd5a55 100644 --- a/mod/wallmessage.php +++ b/mod/wallmessage.php @@ -115,14 +115,14 @@ function wallmessage_content(App $a) { return; } - $tpl = get_markup_template('wallmsg-header.tpl'); + $tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $user['nickname'], '$linkurl' => L10n::t('Please enter a link URL:') ]); - $tpl = get_markup_template('wallmessage.tpl'); + $tpl = Renderer::getMarkupTemplate('wallmessage.tpl'); $o = Renderer::replaceMacros($tpl, [ '$header' => L10n::t('Send Private Message'), '$subheader' => L10n::t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']), diff --git a/mod/xrd.php b/mod/xrd.php index a1ae7350b..83f069d14 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -106,7 +106,7 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r) header('Access-Control-Allow-Origin: *'); header("Content-type: text/xml"); - $tpl = get_markup_template('xrd_person.tpl'); + $tpl = Renderer::getMarkupTemplate('xrd_person.tpl'); $o = Renderer::replaceMacros($tpl, [ '$nick' => $r['nickname'], diff --git a/src/App.php b/src/App.php index b2ab78171..a301fa0b2 100644 --- a/src/App.php +++ b/src/App.php @@ -772,7 +772,7 @@ class App Core\Addon::callHooks('head', $this->page['htmlhead']); - $tpl = get_markup_template('head.tpl'); + $tpl = Core\Renderer::getMarkupTemplate('head.tpl'); /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it * being first @@ -823,7 +823,7 @@ class App } else { $link = 'toggle_mobile?off=1&address=' . curPageURL(); } - $this->page['footer'] .= Core\Renderer::replaceMacros(get_markup_template("toggle_mobile_footer.tpl"), [ + $this->page['footer'] .= Core\Renderer::replaceMacros(Core\Renderer::getMarkupTemplate("toggle_mobile_footer.tpl"), [ '$toggle_link' => $link, '$toggle_text' => Core\L10n::t('toggle mobile') ]); @@ -831,7 +831,7 @@ class App Core\Addon::callHooks('footer', $this->page['footer']); - $tpl = get_markup_template('footer.tpl'); + $tpl = Core\Renderer::getMarkupTemplate('footer.tpl'); $this->page['footer'] = Core\Renderer::replaceMacros($tpl, [ '$baseurl' => $this->getBaseURL(), '$footerScripts' => $this->footerScripts, @@ -1792,7 +1792,7 @@ class App Core\Logger::log('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], Core\Logger::DEBUG); header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . Core\L10n::t('Not Found')); - $tpl = get_markup_template("404.tpl"); + $tpl = Core\Renderer::getMarkupTemplate("404.tpl"); $this->page['content'] = Core\Renderer::replaceMacros($tpl, [ '$message' => Core\L10n::t('Page not found.') ]); @@ -1881,7 +1881,7 @@ class App // Add the navigation (menu) template if ($this->module != 'install' && $this->module != 'maintenance') { - $this->page['htmlhead'] .= Core\Renderer::replaceMacros(get_markup_template('nav_head.tpl'), []); + $this->page['htmlhead'] .= Core\Renderer::replaceMacros(Core\Renderer::getMarkupTemplate('nav_head.tpl'), []); $this->page['nav'] = Content\Nav::build($this); } diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php index 0b06a04c7..a47d70ab3 100644 --- a/src/Content/ForumManager.php +++ b/src/Content/ForumManager.php @@ -123,7 +123,7 @@ class ForumManager $entries[] = $entry; } - $tpl = get_markup_template('widget_forumlist.tpl'); + $tpl = Renderer::getMarkupTemplate('widget_forumlist.tpl'); $o .= Renderer::replaceMacros( $tpl, diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 5c347c2a7..b8691e934 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -62,7 +62,7 @@ class Nav $nav_info = self::getInfo($a); - $tpl = get_markup_template('nav.tpl'); + $tpl = Renderer::getMarkupTemplate('nav.tpl'); $nav .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index acc7f02cf..943b91e1f 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -179,7 +179,7 @@ class OEmbed $th = 120; $tw = $th * $tr; - $tpl = get_markup_template('oembed_video.tpl'); + $tpl = Renderer::getMarkupTemplate('oembed_video.tpl'); $ret .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$embedurl' => $oembed->embed_url, diff --git a/src/Content/Pager.php b/src/Content/Pager.php index 5794f589a..098d8e879 100644 --- a/src/Content/Pager.php +++ b/src/Content/Pager.php @@ -173,7 +173,7 @@ class Pager ] ]; - $tpl = get_markup_template('paginate.tpl'); + $tpl = Renderer::getMarkupTemplate('paginate.tpl'); return Renderer::replaceMacros($tpl, ['pager' => $data]); } @@ -277,7 +277,7 @@ class Pager ]; } - $tpl = get_markup_template('paginate.tpl'); + $tpl = Renderer::getMarkupTemplate('paginate.tpl'); return Renderer::replaceMacros($tpl, ['pager' => $data]); } } diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 188044945..3592059d0 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -987,7 +987,7 @@ class BBCode extends BaseObject } else { $text = ($is_quote_share? "\n" : ''); - $tpl = get_markup_template('shared_content.tpl'); + $tpl = Renderer::getMarkupTemplate('shared_content.tpl'); $text .= Renderer::replaceMacros($tpl, [ '$profile' => $attributes['profile'], '$avatar' => $attributes['avatar'], diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 8f1279b4e..2f78d0fd3 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -31,7 +31,7 @@ class Widget */ public static function follow($value = "") { - return Renderer::replaceMacros(get_markup_template('follow.tpl'), array( + return Renderer::replaceMacros(Renderer::getMarkupTemplate('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'), @@ -74,7 +74,7 @@ class Widget $aside = []; $aside['$nv'] = $nv; - return Renderer::replaceMacros(get_markup_template('peoplefind.tpl'), $aside); + return Renderer::replaceMacros(Renderer::getMarkupTemplate('peoplefind.tpl'), $aside); } /** @@ -152,7 +152,7 @@ class Widget return ''; } - return Renderer::replaceMacros(get_markup_template('nets.tpl'), array( + return Renderer::replaceMacros(Renderer::getMarkupTemplate('nets.tpl'), array( '$title' => L10n::t('Networks'), '$desc' => '', '$sel_all' => (($selected == '') ? 'selected' : ''), @@ -194,7 +194,7 @@ class Widget } } - return Renderer::replaceMacros(get_markup_template('fileas_widget.tpl'), array( + return Renderer::replaceMacros(Renderer::getMarkupTemplate('fileas_widget.tpl'), array( '$title' => L10n::t('Saved Folders'), '$desc' => '', '$sel_all' => (($selected == '') ? 'selected' : ''), @@ -234,7 +234,7 @@ class Widget } } - return Renderer::replaceMacros(get_markup_template('categories_widget.tpl'), array( + return Renderer::replaceMacros(Renderer::getMarkupTemplate('categories_widget.tpl'), array( '$title' => L10n::t('Categories'), '$desc' => '', '$sel_all' => (($selected == '') ? 'selected' : ''), @@ -301,7 +301,7 @@ class Widget $r = GContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true); } - return Renderer::replaceMacros(get_markup_template('remote_friends_common.tpl'), array( + return Renderer::replaceMacros(Renderer::getMarkupTemplate('remote_friends_common.tpl'), array( '$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t), '$base' => System::baseUrl(), '$uid' => $profile_uid, diff --git a/src/Content/Widget/CalendarExport.php b/src/Content/Widget/CalendarExport.php index 2b42d35b2..e8bec0b95 100644 --- a/src/Content/Widget/CalendarExport.php +++ b/src/Content/Widget/CalendarExport.php @@ -61,7 +61,7 @@ class CalendarExport // of the profile page it should be the personal /events page. So we can use $a->user. $user = defaults($a->data['user'], 'nickname', $a->user['nickname']); - $tpl = get_markup_template("events_aside.tpl"); + $tpl = Renderer::getMarkupTemplate("events_aside.tpl"); $return = Renderer::replaceMacros($tpl, [ '$etitle' => L10n::t("Export"), '$export_ical' => L10n::t("Export calendar as ical"), diff --git a/src/Content/Widget/TagCloud.php b/src/Content/Widget/TagCloud.php index 1fbb076a0..23aac19eb 100644 --- a/src/Content/Widget/TagCloud.php +++ b/src/Content/Widget/TagCloud.php @@ -50,7 +50,7 @@ class TagCloud $tags[] = $tag; } - $tpl = get_markup_template('tagblock_widget.tpl'); + $tpl = Renderer::getMarkupTemplate('tagblock_widget.tpl'); $o = Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Tags'), '$tags' => $tags diff --git a/src/Core/ACL.php b/src/Core/ACL.php index 14430fd5e..9abd259ac 100644 --- a/src/Core/ACL.php +++ b/src/Core/ACL.php @@ -292,7 +292,7 @@ class ACL extends BaseObject } } - $tpl = get_markup_template('acl_selector.tpl'); + $tpl = Renderer::getMarkupTemplate('acl_selector.tpl'); $o = Renderer::replaceMacros($tpl, [ '$showall' => L10n::t('Visible to everybody'), '$show' => L10n::t('show'), diff --git a/src/Core/Installer.php b/src/Core/Installer.php index f0cf0cd0f..d2b5c4f05 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -140,7 +140,7 @@ class Installer */ public function createConfig($phppath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $basepath) { - $tpl = get_markup_template('local.ini.tpl'); + $tpl = Renderer::getMarkupTemplate('local.ini.tpl'); $txt = Renderer::replaceMacros($tpl, [ '$phpath' => $phppath, '$dbhost' => $dbhost, @@ -238,7 +238,7 @@ class Installer $help .= L10n::t('Could not find a command line version of PHP in the web server PATH.') . EOL; $help .= L10n::t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See 'Setup the worker'") . EOL; $help .= EOL . EOL; - $tpl = get_markup_template('field_input.tpl'); + $tpl = Renderer::getMarkupTemplate('field_input.tpl'); $help .= Renderer::replaceMacros($tpl, [ '$field' => ['phpath', L10n::t('PHP executable path'), $phppath, L10n::t('Enter full path to php executable. You can leave this blank to continue the installation.')], ]); diff --git a/src/Core/System.php b/src/Core/System.php index 42c68e4e8..0f9a611ab 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -140,7 +140,7 @@ class System extends BaseObject header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err); if (isset($description["title"])) { - $tpl = get_markup_template('http_status.tpl'); + $tpl = Renderer::getMarkupTemplate('http_status.tpl'); echo Renderer::replaceMacros($tpl, ['$title' => $description["title"], '$description' => defaults($description, 'description', '')]); } diff --git a/src/Model/Event.php b/src/Model/Event.php index 932322e35..ee61149de 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -899,7 +899,7 @@ class Event extends BaseObject // Construct the profile link (magic-auth). $profile_link = Contact::magicLinkById($item['author-id']); - $tpl = get_markup_template('event_stream_item.tpl'); + $tpl = Renderer::getMarkupTemplate('event_stream_item.tpl'); $return = Renderer::replaceMacros($tpl, [ '$id' => $item['event-id'], '$title' => prepare_text($item['event-summary']), diff --git a/src/Model/Group.php b/src/Model/Group.php index a0806af38..b32b61e10 100644 --- a/src/Model/Group.php +++ b/src/Model/Group.php @@ -333,7 +333,7 @@ class Group extends BaseObject $label = L10n::t('Default privacy group for new contacts'); } - $o = Renderer::replaceMacros(get_markup_template('group_selection.tpl'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('group_selection.tpl'), [ '$label' => $label, '$groups' => $display_groups ]); @@ -400,7 +400,7 @@ class Group extends BaseObject ]; } - $tpl = get_markup_template('group_side.tpl'); + $tpl = Renderer::getMarkupTemplate('group_side.tpl'); $o = Renderer::replaceMacros($tpl, [ '$add' => L10n::t('add'), '$title' => L10n::t('Groups'), diff --git a/src/Model/Profile.php b/src/Model/Profile.php index c8a229f23..a98cb30d8 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -173,7 +173,7 @@ class Profile if (local_user() && local_user() == $a->profile['uid'] && $profiledata) { $a->page['aside'] .= Renderer::replaceMacros( - get_markup_template('profile_edlink.tpl'), + Renderer::getMarkupTemplate('profile_edlink.tpl'), [ '$editprofile' => L10n::t('Edit profile'), '$profid' => $a->profile['id'] @@ -517,7 +517,7 @@ class Profile $p['url'] = Contact::magicLink(defaults($p, 'url', $profile_url)); - $tpl = get_markup_template('profile_vcard.tpl'); + $tpl = Renderer::getMarkupTemplate('profile_vcard.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$profile' => $p, '$xmpp' => $xmpp, @@ -622,7 +622,7 @@ class Profile } } } - $tpl = get_markup_template('birthdays_reminder.tpl'); + $tpl = Renderer::getMarkupTemplate('birthdays_reminder.tpl'); return Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, @@ -711,7 +711,7 @@ class Profile DBA::close($s); $classtoday = (($istoday) ? 'event-today' : ''); } - $tpl = get_markup_template('events_reminder.tpl'); + $tpl = Renderer::getMarkupTemplate('events_reminder.tpl'); return Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, @@ -728,12 +728,12 @@ class Profile $uid = $a->profile['uid']; $o .= Renderer::replaceMacros( - get_markup_template('section_title.tpl'), + Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => L10n::t('Profile')] ); if ($a->profile['name']) { - $tpl = get_markup_template('profile_advanced.tpl'); + $tpl = Renderer::getMarkupTemplate('profile_advanced.tpl'); $profile = []; @@ -978,7 +978,7 @@ class Profile $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $tab, 'tabs' => $tabs]; Addon::callHooks('profile_tabs', $arr); - $tpl = get_markup_template('common_tabs.tpl'); + $tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]); } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index a50bcb14d..89a989191 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -83,7 +83,7 @@ class Contact extends BaseModule } /// @TODO Add nice spaces - $vcard_widget = Renderer::replaceMacros(get_markup_template('vcard-widget.tpl'), [ + $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [ '$name' => htmlentities($contact['name']), '$photo' => $contact['photo'], '$url' => Model\Contact::MagicLink($contact['url']), @@ -114,7 +114,7 @@ class Contact extends BaseModule $groups_widget = null; } - $a->page['aside'] .= Renderer::replaceMacros(get_markup_template('contacts-widget-sidebar.tpl'), [ + $a->page['aside'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contacts-widget-sidebar.tpl'), [ '$vcard_widget' => $vcard_widget, '$findpeople_widget' => $findpeople_widget, '$follow_widget' => $follow_widget, @@ -123,7 +123,7 @@ class Contact extends BaseModule ]); $base = $a->getBaseURL(); - $tpl = get_markup_template('contacts-head.tpl'); + $tpl = Renderer::getMarkupTemplate('contacts-head.tpl'); $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base @@ -439,7 +439,7 @@ class Contact extends BaseModule $a->page['aside'] = ''; - return Renderer::replaceMacros(get_markup_template('contact_drop_confirm.tpl'), [ + return Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_drop_confirm.tpl'), [ '$header' => L10n::t('Drop contact'), '$contact' => self::getContactTemplateVars($orig_record), '$method' => 'get', @@ -476,7 +476,7 @@ class Contact extends BaseModule $contact_id = $a->data['contact']['id']; $contact = $a->data['contact']; - $a->page['htmlhead'] .= Renderer::replaceMacros(get_markup_template('contact_head.tpl'), [ + $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [ '$baseurl' => $a->getBaseURL(true), ]); @@ -592,7 +592,7 @@ class Contact extends BaseModule $contact_settings_label = null; } - $tpl = get_markup_template('contact_edit.tpl'); + $tpl = Renderer::getMarkupTemplate('contact_edit.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$header' => L10n::t('Contact'), '$tab_str' => $tab_str, @@ -756,7 +756,7 @@ class Contact extends BaseModule ], ]; - $tab_tpl = get_markup_template('common_tabs.tpl'); + $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); $t = Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); $total = 0; @@ -801,7 +801,7 @@ class Contact extends BaseModule } } - $tpl = get_markup_template('contacts-template.tpl'); + $tpl = Renderer::getMarkupTemplate('contacts-template.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(), '$header' => L10n::t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''), @@ -904,7 +904,7 @@ class Contact extends BaseModule ]; } - $tab_tpl = get_markup_template('common_tabs.tpl'); + $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); $tab_str = Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); return $tab_str; diff --git a/src/Module/Install.php b/src/Module/Install.php index 1662e71f2..b6b7027cb 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -124,7 +124,7 @@ class Install extends BaseModule $status = self::$installer->checkEnvironment($a->getBaseURL(), $phppath); - $tpl = get_markup_template('install_checks.tpl'); + $tpl = Renderer::getMarkupTemplate('install_checks.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => L10n::t('System check'), @@ -146,7 +146,7 @@ class Install extends BaseModule $phpath = notags(trim(defaults($_POST, 'phpath' , '' ))); $adminmail = notags(trim(defaults($_POST, 'adminmail', '' ))); - $tpl = get_markup_template('install_db.tpl'); + $tpl = Renderer::getMarkupTemplate('install_db.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$pass' => L10n::t('Database connection'), @@ -202,7 +202,7 @@ class Install extends BaseModule /* Installed langs */ $lang_choices = L10n::getAvailableLanguages(); - $tpl = get_markup_template('install_settings.tpl'); + $tpl = Renderer::getMarkupTemplate('install_settings.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$checks' => self::$installer->getChecks(), @@ -233,7 +233,7 @@ class Install extends BaseModule $db_return_text .= $txt; } - $tpl = get_markup_template('install_finished.tpl'); + $tpl = Renderer::getMarkupTemplate('install_finished.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, '$checks' => self::$installer->getChecks(), diff --git a/src/Module/Itemsource.php b/src/Module/Itemsource.php index e0d3bd016..2da679eee 100644 --- a/src/Module/Itemsource.php +++ b/src/Module/Itemsource.php @@ -28,7 +28,7 @@ class Itemsource extends \Friendica\BaseModule $source = htmlspecialchars($conversation['source']); } - $tpl = get_markup_template('debug/itemsource.tpl'); + $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl'); $o = Renderer::replaceMacros($tpl, [ '$guid' => ['guid', L10n::t('Item Guid'), htmlentities(defaults($_REQUEST, 'guid', '')), ''], '$source' => $source, diff --git a/src/Module/Login.php b/src/Module/Login.php index 541b79885..751d4d4cc 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -300,16 +300,16 @@ class Login extends BaseModule } if (local_user()) { - $tpl = get_markup_template('logout.tpl'); + $tpl = Renderer::getMarkupTemplate('logout.tpl'); } else { $a->page['htmlhead'] .= Renderer::replaceMacros( - get_markup_template('login_head.tpl'), + Renderer::getMarkupTemplate('login_head.tpl'), [ '$baseurl' => $a->getBaseURL(true) ] ); - $tpl = get_markup_template('login.tpl'); + $tpl = Renderer::getMarkupTemplate('login.tpl'); $_SESSION['return_path'] = $return_path; } diff --git a/src/Module/Tos.php b/src/Module/Tos.php index 5553fb686..170371ad4 100644 --- a/src/Module/Tos.php +++ b/src/Module/Tos.php @@ -65,7 +65,7 @@ class Tos extends BaseModule * @return string **/ public static function content() { - $tpl = get_markup_template('tos.tpl'); + $tpl = Renderer::getMarkupTemplate('tos.tpl'); if (Config::get('system', 'tosdisplay')) { return Renderer::replaceMacros($tpl, [ '$title' => L10n::t('Terms of Service'), diff --git a/src/Object/Post.php b/src/Object/Post.php index 5303cc58a..086b78960 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -786,7 +786,7 @@ class Post extends BaseObject $uid = $parent_uid; } - $template = get_markup_template($this->getCommentBoxTemplate()); + $template = Renderer::getMarkupTemplate($this->getCommentBoxTemplate()); $comment_box = Renderer::replaceMacros($template, [ '$return_path' => $a->query_string, '$threaded' => $this->isThreaded(), diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index 3ac74f3ea..670c273c0 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -115,7 +115,7 @@ class Temporal $options = str_replace('', '', $options); - $tpl = get_markup_template('field_select_raw.tpl'); + $tpl = Renderer::getMarkupTemplate('field_select_raw.tpl'); return Renderer::replaceMacros($tpl, [ '$field' => [$name, $label, $current, $help, $options], ]); @@ -141,7 +141,7 @@ class Temporal $age = (intval($value) ? self::getAgeByTimezone($value, $a->user["timezone"], $a->user["timezone"]) : ""); - $tpl = get_markup_template("field_input.tpl"); + $tpl = Renderer::getMarkupTemplate("field_input.tpl"); $o = Renderer::replaceMacros($tpl, [ '$field' => [ @@ -247,7 +247,7 @@ class Temporal $readable_format = str_replace(['Y', 'm', 'd', 'H', 'i'], ['yyyy', 'mm', 'dd', 'HH', 'MM'], $dateformat); - $tpl = get_markup_template('field_datetime.tpl'); + $tpl = Renderer::getMarkupTemplate('field_datetime.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$field' => [ $id, diff --git a/view/theme/duepuntozero/config.php b/view/theme/duepuntozero/config.php index dedf418a2..430fa7f60 100644 --- a/view/theme/duepuntozero/config.php +++ b/view/theme/duepuntozero/config.php @@ -67,7 +67,7 @@ function clean_form(App $a, &$colorset, $user) $color = Config::get('duepuntozero', 'colorset'); } - $t = get_markup_template("theme_settings.tpl"); + $t = Renderer::getMarkupTemplate("theme_settings.tpl"); $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Submit'), '$baseurl' => System::baseUrl(), diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index 328961828..f73ef3ab0 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -114,7 +114,7 @@ function frio_form($arr) $background_image_help = '' . L10n::t('Note') . ': ' . L10n::t('Check image permissions if all users are allowed to see the image'); - $t = get_markup_template('theme_settings.tpl'); + $t = Renderer::getMarkupTemplate('theme_settings.tpl'); $ctx = [ '$submit' => L10n::t('Submit'), '$baseurl' => System::baseUrl(), diff --git a/view/theme/quattro/config.php b/view/theme/quattro/config.php index cc9f0488e..cdef0eeaa 100644 --- a/view/theme/quattro/config.php +++ b/view/theme/quattro/config.php @@ -69,7 +69,7 @@ function quattro_form(App $a, $align, $color, $tfs, $pfs) { $pfs = "12"; } - $t = get_markup_template("theme_settings.tpl" ); + $t = Renderer::getMarkupTemplate("theme_settings.tpl" ); $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Submit'), '$baseurl' => System::baseUrl(), diff --git a/view/theme/smoothly/theme.php b/view/theme/smoothly/theme.php index 98175e89b..727650ef2 100644 --- a/view/theme/smoothly/theme.php +++ b/view/theme/smoothly/theme.php @@ -111,7 +111,7 @@ if (! function_exists('_js_in_foot')) { $ssl_state = null; $baseurl = System::baseUrl($ssl_state); $bottom['$baseurl'] = $baseurl; - $tpl = get_markup_template('bottom.tpl'); + $tpl = Renderer::getMarkupTemplate('bottom.tpl'); return $a->page['bottom'] = Renderer::replaceMacros($tpl, $bottom); } diff --git a/view/theme/vier/config.php b/view/theme/vier/config.php index c6628ad06..f70935653 100644 --- a/view/theme/vier/config.php +++ b/view/theme/vier/config.php @@ -71,7 +71,7 @@ function theme_admin(App $a) { if ($helperlist == "") $helperlist = "https://forum.friendi.ca/profile/helpers"; - $t = get_markup_template("theme_admin_settings.tpl"); + $t = Renderer::getMarkupTemplate("theme_admin_settings.tpl"); $o = Renderer::replaceMacros($t, [ '$helperlist' => ['vier_helperlist', L10n::t('Comma separated list of helper forums'), $helperlist, '', ''], ]); @@ -115,7 +115,7 @@ function vier_form(App $a, $style, $show_pages, $show_profiles, $show_helpers, $ $show_or_not = ['0' => L10n::t("don't show"), '1' => L10n::t("show"),]; - $t = get_markup_template("theme_settings.tpl"); + $t = Renderer::getMarkupTemplate("theme_settings.tpl"); $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Submit'), '$baseurl' => System::baseUrl(), diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 7d0c4bdb8..457816b24 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -145,7 +145,7 @@ function vier_community_info() if ($show_profiles) { $r = GContact::suggestionQuery(local_user(), 0, 9); - $tpl = get_markup_template('ch_directory_item.tpl'); + $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl'); if (DBA::isResult($r)) { $aside['$comunity_profiles_title'] = L10n::t('Community Profiles'); $aside['$comunity_profiles_items'] = []; @@ -167,7 +167,7 @@ function vier_community_info() $publish = (Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 "); $order = " ORDER BY `register_date` DESC "; - $tpl = get_markup_template('ch_directory_item.tpl'); + $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl'); $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` @@ -244,7 +244,7 @@ function vier_community_info() } - $tpl = get_markup_template('widget_forumlist_right.tpl'); + $tpl = Renderer::getMarkupTemplate('widget_forumlist_right.tpl'); $page = Renderer::replaceMacros( $tpl, @@ -289,7 +289,7 @@ function vier_community_info() $r[] = ["url" => "help/Quick-Start-guide", "name" => L10n::t("Quick Start")]; - $tpl = get_markup_template('ch_helpers.tpl'); + $tpl = Renderer::getMarkupTemplate('ch_helpers.tpl'); if ($r) { $helpers = []; @@ -380,7 +380,7 @@ function vier_community_info() $r[] = ["photo" => "images/mail.png", "name" => "E-Mail"]; } - $tpl = get_markup_template('ch_connectors.tpl'); + $tpl = Renderer::getMarkupTemplate('ch_connectors.tpl'); if (DBA::isResult($r)) { $con_services = []; @@ -400,6 +400,6 @@ function vier_community_info() //end connectable services //print right_aside - $tpl = get_markup_template('communityhome.tpl'); + $tpl = Renderer::getMarkupTemplate('communityhome.tpl'); $a->page['right_aside'] = Renderer::replaceMacros($tpl, $aside); } From 93ccd7bcdb8520e91ba1cbb8a80b7baee9a7180c Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 11:02:30 -0400 Subject: [PATCH 4/6] Remove old functions remove old functions from file. --- include/text.php | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/include/text.php b/include/text.php index 2099f88c1..7f66268ad 100644 --- a/include/text.php +++ b/include/text.php @@ -29,31 +29,6 @@ use Friendica\Model\FileTag; require_once "include/conversation.php"; -/** - * This is our template processor - * - * @param string|FriendicaSmarty $s the string requiring macro substitution, - * or an instance of FriendicaSmarty - * @param array $r key value pairs (search => replace) - * @return string substituted string - */ -function replace_macros($s, $r) -{ - return Renderer::replaceMacros($s, $r); -} - -/** - * load template $s - * - * @param string $s - * @param string $root - * @return string - */ -function get_markup_template($s, $root = '') -{ - return Renderer::getMarkupTemplate($s, $root); -} - /** * @brief Generates a pseudo-random string of hexadecimal characters * From 3f74ba88c2b44189e6df07fee2f1e8014a9bb7f5 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 12:12:15 -0400 Subject: [PATCH 5/6] Move delimiter props and functions move left and right delimiter functions and properties to Render class. --- src/App.php | 40 --------------------------------- src/Core/Renderer.php | 41 ++++++++++++++++++++++++++++++++++ src/Render/FriendicaSmarty.php | 5 +++-- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/App.php b/src/App.php index a301fa0b2..deb15f702 100644 --- a/src/App.php +++ b/src/App.php @@ -162,14 +162,6 @@ class App public $template_engine_instance = []; public $process_id; public $queue; - private $ldelim = [ - 'internal' => '', - 'smarty3' => '{{' - ]; - private $rdelim = [ - 'internal' => '', - 'smarty3' => '}}' - ]; private $scheme; private $hostname; @@ -924,38 +916,6 @@ class App $this->theme['template_engine'] = $engine; } - /** - * Gets the right delimiter for a template engine - * - * Currently: - * Internal = '' - * Smarty3 = '{{' - * - * @param string $engine The template engine (default is Smarty3) - * - * @return string the right delimiter - */ - public function getTemplateLeftDelimiter($engine = 'smarty3') - { - return $this->ldelim[$engine]; - } - - /** - * Gets the left delimiter for a template engine - * - * Currently: - * Internal = '' - * Smarty3 = '}}' - * - * @param string $engine The template engine (default is Smarty3) - * - * @return string the left delimiter - */ - public function getTemplateRightDelimiter($engine = 'smarty3') - { - return $this->rdelim[$engine]; - } - /** * Saves a timestamp for a value - f.e. a call * Necessary for profiling Friendica diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 70f98059b..378652fe2 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -15,6 +15,15 @@ use Friendica\Render\FriendicaSmarty; */ class Renderer extends BaseObject { + private static $ldelim = [ + 'internal' => '', + 'smarty3' => '{{' + ]; + private static $rdelim = [ + 'internal' => '', + 'smarty3' => '}}' + ]; + /** * @brief This is our template processor * @@ -69,4 +78,36 @@ class Renderer extends BaseObject return $template; } + + /** + * Gets the right delimiter for a template engine + * + * Currently: + * Internal = '' + * Smarty3 = '{{' + * + * @param string $engine The template engine (default is Smarty3) + * + * @return string the right delimiter + */ + public static function getTemplateLeftDelimiter($engine = 'smarty3') + { + return self::$ldelim[$engine]; + } + + /** + * Gets the left delimiter for a template engine + * + * Currently: + * Internal = '' + * Smarty3 = '}}' + * + * @param string $engine The template engine (default is Smarty3) + * + * @return string the left delimiter + */ + public static function getTemplateRightDelimiter($engine = 'smarty3') + { + return self::$rdelim[$engine]; + } } diff --git a/src/Render/FriendicaSmarty.php b/src/Render/FriendicaSmarty.php index 2052aa9e8..e544a76d1 100644 --- a/src/Render/FriendicaSmarty.php +++ b/src/Render/FriendicaSmarty.php @@ -5,6 +5,7 @@ namespace Friendica\Render; use Smarty; +use Friendica\Core\Renderer; /** * Friendica extension of the Smarty3 template engine @@ -38,8 +39,8 @@ class FriendicaSmarty extends Smarty $this->setConfigDir('view/smarty3/config/'); $this->setCacheDir('view/smarty3/cache/'); - $this->left_delimiter = $a->getTemplateLeftDelimiter('smarty3'); - $this->right_delimiter = $a->getTemplateRightDelimiter('smarty3'); + $this->left_delimiter = Renderer::getTemplateLeftDelimiter('smarty3'); + $this->right_delimiter = Renderer::getTemplateRightDelimiter('smarty3'); // Don't report errors so verbosely $this->error_reporting = E_ALL & ~E_NOTICE; From 70f01d6c00a44979e024f0a8bdd41c70b48a2d20 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 13:25:38 -0400 Subject: [PATCH 6/6] Template Engine and props to Renderer move methods and props from App to Renderer --- mod/admin.php | 8 +-- src/App.php | 94 +----------------------------- src/Core/Renderer.php | 95 ++++++++++++++++++++++++++++++- src/Model/Profile.php | 2 +- src/Module/Install.php | 2 +- view/theme/duepuntozero/theme.php | 3 +- view/theme/frio/theme.php | 3 +- view/theme/smoothly/theme.php | 2 +- view/theme/vier/theme.php | 2 +- 9 files changed, 108 insertions(+), 103 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index ff37c8b61..5604cd5aa 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -91,7 +91,7 @@ function admin_post(App $a) $theme = $a->argv[2]; if (is_file("view/theme/$theme/config.php")) { - $orig_theme = $a->theme; + $orig_theme = Renderer::$theme; $orig_page = $a->page; $orig_session_theme = $_SESSION['theme']; require_once "view/theme/$theme/theme.php"; @@ -107,7 +107,7 @@ function admin_post(App $a) } $_SESSION['theme'] = $orig_session_theme; - $a->theme = $orig_theme; + Renderer::$theme = $orig_theme; $a->page = $orig_page; } @@ -2271,7 +2271,7 @@ function admin_page_themes(App $a) $admin_form = ''; if (is_file("view/theme/$theme/config.php")) { - $orig_theme = $a->theme; + $orig_theme = Renderer::$theme; $orig_page = $a->page; $orig_session_theme = $_SESSION['theme']; require_once "view/theme/$theme/theme.php"; @@ -2288,7 +2288,7 @@ function admin_page_themes(App $a) } $_SESSION['theme'] = $orig_session_theme; - $a->theme = $orig_theme; + Renderer::$theme = $orig_theme; $a->page = $orig_page; } diff --git a/src/App.php b/src/App.php index deb15f702..3cfcc6718 100644 --- a/src/App.php +++ b/src/App.php @@ -136,30 +136,6 @@ class App $this->footerScripts[] = trim($url, '/'); } - /** - * @brief An array for all theme-controllable parameters - * - * Mostly unimplemented yet. Only options 'template_engine' and - * beyond are used. - */ - public $theme = [ - 'sourcename' => '', - 'videowidth' => 425, - 'videoheight' => 350, - 'force_max_items' => 0, - 'stylesheet' => '', - 'template_engine' => 'smarty3', - ]; - - /** - * @brief An array of registered template engines ('name'=>'class name') - */ - public $template_engines = []; - - /** - * @brief An array of instanced template engines ('name'=>'instance') - */ - public $template_engine_instance = []; public $process_id; public $queue; private $scheme; @@ -301,7 +277,7 @@ class App $this->isAjax = strtolower(defaults($_SERVER, 'HTTP_X_REQUESTED_WITH', '')) == 'xmlhttprequest'; // Register template engines - $this->registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine'); + Core\Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine'); } /** @@ -744,8 +720,8 @@ class App $this->page['title'] = $this->config['sitename']; } - if (!empty($this->theme['stylesheet'])) { - $stylesheet = $this->theme['stylesheet']; + if (!empty(Core\Renderer::$theme['stylesheet'])) { + $stylesheet = Core\Renderer::$theme['stylesheet']; } else { $stylesheet = $this->getCurrentThemeStylesheetPath(); } @@ -852,70 +828,6 @@ class App } } - /** - * @brief Register template engine class - * - * @param string $class - */ - private function registerTemplateEngine($class) - { - $v = get_class_vars($class); - if (!empty($v['name'])) { - $name = $v['name']; - $this->template_engines[$name] = $class; - } else { - echo "template engine $class cannot be registered without a name.\n"; - die(); - } - } - - /** - * @brief Return template engine instance. - * - * If $name is not defined, return engine defined by theme, - * or default - * - * @return object Template Engine instance - */ - public function getTemplateEngine() - { - $template_engine = defaults($this->theme, 'template_engine', 'smarty3'); - - if (isset($this->template_engines[$template_engine])) { - if (isset($this->template_engine_instance[$template_engine])) { - return $this->template_engine_instance[$template_engine]; - } else { - $class = $this->template_engines[$template_engine]; - $obj = new $class; - $this->template_engine_instance[$template_engine] = $obj; - return $obj; - } - } - - echo "template engine $template_engine is not registered!\n"; - exit(); - } - - /** - * @brief Returns the active template engine. - * - * @return string the active template engine - */ - public function getActiveTemplateEngine() - { - return $this->theme['template_engine']; - } - - /** - * sets the active template engine - * - * @param string $engine the template engine (default is Smarty3) - */ - public function setActiveTemplateEngine($engine = 'smarty3') - { - $this->theme['template_engine'] = $engine; - } - /** * Saves a timestamp for a value - f.e. a call * Necessary for profiling Friendica diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 378652fe2..44b56fcba 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -15,6 +15,31 @@ use Friendica\Render\FriendicaSmarty; */ class Renderer extends BaseObject { + /** + * @brief An array of registered template engines ('name'=>'class name') + */ + public static $template_engines = []; + + /** + * @brief An array of instanced template engines ('name'=>'instance') + */ + public static $template_engine_instance = []; + + /** + * @brief An array for all theme-controllable parameters + * + * Mostly unimplemented yet. Only options 'template_engine' and + * beyond are used. + */ + public static $theme = [ + 'sourcename' => '', + 'videowidth' => 425, + 'videoheight' => 350, + 'force_max_items' => 0, + 'stylesheet' => '', + 'template_engine' => 'smarty3', + ]; + private static $ldelim = [ 'internal' => '', 'smarty3' => '{{' @@ -39,7 +64,7 @@ class Renderer extends BaseObject // pass $baseurl to all templates $r['$baseurl'] = System::baseUrl(); - $t = $a->getTemplateEngine(); + $t = self::getTemplateEngine(); try { $output = $t->replaceMacros($s, $r); @@ -65,7 +90,7 @@ class Renderer extends BaseObject { $stamp1 = microtime(true); $a = self::getApp(); - $t = $a->getTemplateEngine(); + $t = self::getTemplateEngine(); try { $template = $t->getTemplateFile($s, $root); @@ -79,6 +104,72 @@ class Renderer extends BaseObject return $template; } + /** + * @brief Register template engine class + * + * @param string $class + */ + public static function registerTemplateEngine($class) + { + $v = get_class_vars($class); + + if (!empty($v['name'])) + { + $name = $v['name']; + self::$template_engines[$name] = $class; + } else { + echo "template engine $class cannot be registered without a name.\n"; + die(); + } + } + + /** + * @brief Return template engine instance. + * + * If $name is not defined, return engine defined by theme, + * or default + * + * @return object Template Engine instance + */ + public static function getTemplateEngine() + { + $template_engine = defaults(self::$theme, 'template_engine', 'smarty3'); + + if (isset(self::$template_engines[$template_engine])) { + if (isset(self::$template_engine_instance[$template_engine])) { + return self::$template_engine_instance[$template_engine]; + } else { + $class = self::$template_engines[$template_engine]; + $obj = new $class; + self::$template_engine_instance[$template_engine] = $obj; + return $obj; + } + } + + echo "template engine $template_engine is not registered!\n"; + exit(); + } + + /** + * @brief Returns the active template engine. + * + * @return string the active template engine + */ + public static function getActiveTemplateEngine() + { + return self::$theme['template_engine']; + } + + /** + * sets the active template engine + * + * @param string $engine the template engine (default is Smarty3) + */ + public static function setActiveTemplateEngine($engine = 'smarty3') + { + self::$theme['template_engine'] = $engine; + } + /** * Gets the right delimiter for a template engine * diff --git a/src/Model/Profile.php b/src/Model/Profile.php index a98cb30d8..2cd3f7a86 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -164,7 +164,7 @@ class Profile * load/reload current theme info */ - $a->setActiveTemplateEngine(); // reset the template engine to the default in case the user's theme doesn't specify one + Renderer::setActiveTemplateEngine(); // reset the template engine to the default in case the user's theme doesn't specify one $theme_info_file = 'view/theme/' . $a->getCurrentTheme() . '/theme.php'; if (file_exists($theme_info_file)) { diff --git a/src/Module/Install.php b/src/Module/Install.php index b6b7027cb..09de23c08 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -53,7 +53,7 @@ class Install extends BaseModule // We overwrite current theme css, because during install we may not have a working mod_rewrite // so we may not have a css at all. Here we set a static css file for the install procedure pages - $a->theme['stylesheet'] = $a->getBaseURL() . '/view/install/style.css'; + Renderer::$theme['stylesheet'] = $a->getBaseURL() . '/view/install/style.css'; self::$installer = new Core\Installer(); self::$currentWizardStep = defaults($_POST, 'pass', self::SYSTEM_CHECK); diff --git a/view/theme/duepuntozero/theme.php b/view/theme/duepuntozero/theme.php index 588a6fa46..015e8090f 100644 --- a/view/theme/duepuntozero/theme.php +++ b/view/theme/duepuntozero/theme.php @@ -3,10 +3,11 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; function duepuntozero_init(App $a) { -$a->setActiveTemplateEngine('smarty3'); +Renderer::setActiveTemplateEngine('smarty3'); $colorset = PConfig::get( local_user(), 'duepuntozero','colorset'); if (!$colorset) diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index 8cb4c3429..c7d38baeb 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -15,6 +15,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model; @@ -30,7 +31,7 @@ function frio_init(App $a) $a->theme_events_in_profile = false; $a->videowidth = 622; - $a->setActiveTemplateEngine('smarty3'); + Renderer::setActiveTemplateEngine('smarty3'); $baseurl = System::baseUrl(); diff --git a/view/theme/smoothly/theme.php b/view/theme/smoothly/theme.php index 727650ef2..6168932e9 100644 --- a/view/theme/smoothly/theme.php +++ b/view/theme/smoothly/theme.php @@ -15,7 +15,7 @@ use Friendica\Core\Renderer; use Friendica\Core\System; function smoothly_init(App $a) { - $a->setActiveTemplateEngine('smarty3'); + Renderer::setActiveTemplateEngine('smarty3'); $cssFile = null; $ssl_state = null; diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 457816b24..fb4f66431 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -26,7 +26,7 @@ function vier_init(App $a) { $a->theme_events_in_profile = false; - $a->setActiveTemplateEngine('smarty3'); + Renderer::setActiveTemplateEngine('smarty3'); if (!empty($a->argv[0]) && $a->argv[0] . defaults($a->argv, 1, '') === "profile".$a->user['nickname'] || $a->argv[0] === "network" && local_user()) { vier_community_info();