From e293de04f57f419cc4581dd4b31970ef4d36e1f2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 24 Mar 2024 09:20:58 -0400 Subject: [PATCH] Add '$VERSION' template variable to make Friendica version available in templates - constant() Smarty function is deprecated - Remove unused site-wide template variable '$APP' - Address https://github.com/friendica/friendica/issues/14027#issuecomment-2016469408 --- src/Core/Renderer.php | 7 +- src/Module/Admin/Federation.php | 1 - src/Module/Admin/Summary.php | 2 +- view/templates/admin/federation.tpl | 4 +- view/templates/admin/summary.tpl | 8 +- view/templates/calendar/calendar_head.tpl | 8 +- view/templates/head.tpl | 46 ++++---- view/templates/jot-header.tpl | 2 +- view/templates/media/browser.tpl | 4 +- view/templates/msg-header.tpl | 2 +- .../templates/settings/profile/index_head.tpl | 2 +- .../settings/profile/photo/crop_head.tpl | 4 +- view/theme/frio/templates/admin/site.tpl | 2 +- view/theme/frio/templates/admin/storage.tpl | 2 +- view/theme/frio/templates/admin/summary.tpl | 4 +- .../frio/templates/calendar/calendar_head.tpl | 2 +- view/theme/frio/templates/circle_edit.tpl | 2 +- view/theme/frio/templates/contacts-head.tpl | 2 +- view/theme/frio/templates/head.tpl | 104 +++++++++--------- view/theme/frio/templates/jot-header.tpl | 6 +- .../moderation/blocklist/contact.tpl | 4 +- .../templates/moderation/users/active.tpl | 4 +- .../templates/moderation/users/blocked.tpl | 4 +- .../templates/moderation/users/deleted.tpl | 4 +- .../frio/templates/moderation/users/index.tpl | 4 +- .../templates/moderation/users/pending.tpl | 4 +- .../templates/notifications/notifications.tpl | 4 +- view/theme/frio/templates/photos_head.tpl | 2 +- view/theme/frio/templates/theme_settings.tpl | 4 +- .../frio/templates/threaded_conversation.tpl | 4 +- 30 files changed, 127 insertions(+), 125 deletions(-) diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 7f15d60df0..11a7d0a2d6 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -75,8 +75,11 @@ class Renderer { DI::profiler()->startRecording('rendering'); - // pass $baseurl to all templates if it isn't set - $vars = array_merge(['$baseurl' => DI::baseUrl(), '$APP' => DI::app()], $vars); + // Default template variables + $vars = array_merge([ + '$baseurl' => DI::baseUrl(), + '$VERSION' => \Friendica\App::VERSION, + ], $vars); $t = self::getTemplateEngine(); diff --git a/src/Module/Admin/Federation.php b/src/Module/Admin/Federation.php index f6b77aeb66..9240453948 100644 --- a/src/Module/Admin/Federation.php +++ b/src/Module/Admin/Federation.php @@ -221,7 +221,6 @@ class Federation extends BaseAdmin '$page' => DI::l10n()->t('Federation Statistics'), '$intro' => $intro, '$counts' => $counts, - '$version' => App::VERSION, '$legendtext' => DI::l10n()->tt('Currently this node is aware of %2$s node (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', 'Currently this node is aware of %2$s nodes (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', $total, number_format($total), number_format($month), number_format($halfyear), number_format($users)), ]); } diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index 4939bc39cc..638af8842a 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -196,7 +196,7 @@ class Summary extends BaseAdmin '$title' => DI::l10n()->t('Administration'), '$page' => DI::l10n()->t('Summary'), '$queues' => $queues, - '$version' => [DI::l10n()->t('Version'), App::VERSION], + '$version_label' => DI::l10n()->t('Version'), '$platform' => App::PLATFORM, '$codename' => App::CODENAME, '$build' => DI::config()->get('system', 'build'), diff --git a/view/templates/admin/federation.tpl b/view/templates/admin/federation.tpl index 7757691ea5..6a006ebc34 100644 --- a/view/templates/admin/federation.tpl +++ b/view/templates/admin/federation.tpl @@ -1,4 +1,4 @@ - +

{{$title}} - {{$page}}

@@ -115,7 +115,7 @@