From db978e198d69023f529c54d116b67644d269bc55 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Sun, 11 Feb 2024 19:52:11 -0400 Subject: [PATCH] Move some global functions to ViewHelper class --- app/controllers/ViewHelper.php | 16 ++++++++++++++++ app/views/admin/dashboard.php | 2 +- app/views/admin/emails/password_restore.php | 4 ++-- app/views/admin/link.php | 2 +- app/views/admin/list.php | 2 +- app/views/admin/login.php | 2 +- app/views/admin/page.php | 8 ++++---- app/views/admin/partials/lists/media.php | 2 +- app/views/admin/partials/lists/pages.php | 2 +- app/views/admin/partials/nav.php | 2 +- app/views/admin/password_restore.php | 2 +- app/views/admin/post.php | 6 +++--- app/views/admin/settings.php | 2 +- app/views/admin/tag.php | 2 +- app/views/admin/user.php | 2 +- app/views/themes/default/blog.php | 4 ++-- app/views/themes/default/information.php | 4 ++-- app/views/themes/default/page.php | 4 ++-- app/views/themes/default/partials/head.php | 2 +- app/views/themes/default/post.php | 4 ++-- bootstrap/index.php | 14 -------------- 21 files changed, 45 insertions(+), 43 deletions(-) diff --git a/app/controllers/ViewHelper.php b/app/controllers/ViewHelper.php index 92f27c9..d6d626f 100644 --- a/app/controllers/ViewHelper.php +++ b/app/controllers/ViewHelper.php @@ -56,4 +56,20 @@ public function dateFormat(mixed $tstamp): string $formatter->setPattern(\Aurora\App\Setting::get('date_format') ?? ''); return $formatter->format($tstamp); } + + /** + * @see \Aurora\System\Helper::getUrl + */ + public function url(string $path = ''): string + { + return \Aurora\System\Helper::getUrl($path); + } + + /** + * @see \Aurora\System\Language::getCode + */ + public function lang(): string + { + return \Aurora\System\Container::get('language')->getCode(); + } } diff --git a/app/views/admin/dashboard.php b/app/views/admin/dashboard.php index 794b2f3..4a2a0d1 100755 --- a/app/views/admin/dashboard.php +++ b/app/views/admin/dashboard.php @@ -1,5 +1,5 @@ - + <?= t('dashboard') . ' - ' . e(setting('title')) ?> include('admin/partials/head.php') ?> diff --git a/app/views/admin/emails/password_restore.php b/app/views/admin/emails/password_restore.php index 95089a9..780551d 100644 --- a/app/views/admin/emails/password_restore.php +++ b/app/views/admin/emails/password_restore.php @@ -8,8 +8,8 @@

- +
- + url()) ?> diff --git a/app/views/admin/link.php b/app/views/admin/link.php index 417e952..565b14d 100755 --- a/app/views/admin/link.php +++ b/app/views/admin/link.php @@ -1,5 +1,5 @@ - + <?= t('link') . ' - ' . e(setting('title')) ?> include('admin/partials/head.php') ?> diff --git a/app/views/admin/list.php b/app/views/admin/list.php index 4e86a7d..4212b15 100755 --- a/app/views/admin/list.php +++ b/app/views/admin/list.php @@ -1,5 +1,5 @@ - + <?= e("$title - " . setting('title')) ?> include('admin/partials/head.php') ?> diff --git a/app/views/admin/login.php b/app/views/admin/login.php index 12efd36..edbd472 100755 --- a/app/views/admin/login.php +++ b/app/views/admin/login.php @@ -1,5 +1,5 @@ - + <?= t('sign_in') . ' - ' . e(setting('title')) ?> include('admin/partials/head.php') ?> diff --git a/app/views/admin/page.php b/app/views/admin/page.php index 3885a61..b2a3de4 100755 --- a/app/views/admin/page.php +++ b/app/views/admin/page.php @@ -1,5 +1,5 @@ - + <?= t('page') . ' - ' . e(setting('title')) ?> include('admin/partials/head.php') ?> @@ -18,7 +18,7 @@ - + @@ -85,7 +85,7 @@
- +
@@ -119,7 +119,7 @@ function remove(btn) { } function updateUrl() { - let url = + '/' + get('#slug').value; + let url = url()) ?> + '/' + get('#slug').value; get('#page-link').innerHTML = url; get('#page-link').setAttribute('href', url); } diff --git a/app/views/admin/partials/lists/media.php b/app/views/admin/partials/lists/media.php index 64ee547..0087364 100644 --- a/app/views/admin/partials/lists/media.php +++ b/app/views/admin/partials/lists/media.php @@ -30,7 +30,7 @@
include('icons/dots.svg') ?>