From 0f9f3846433b75165faf0eb6b28ae7cb8fa6fc3d Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 15 Mar 2025 16:37:01 -0500 Subject: [PATCH 1/2] Small fix for anchor function Fixes function "anchor" not updating the hostname even when it is set in Config\App::$allowedHostnames and when the current URL matches. --- system/Helpers/url_helper.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index 4d49447bf33a..a877057c9bfd 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -150,11 +150,8 @@ function index_page(?App $altConfig = null): string * @param array|object|string $attributes Any attributes * @param App|null $altConfig Alternate configuration to use */ - function anchor($uri = '', string $title = '', $attributes = '', ?App $altConfig = null): string + function anchor($uri = '', string $title = '', $attributes = '', ?App $config = null): string { - // use alternate config if provided, else default one - $config = $altConfig ?? config(App::class); - $siteUrl = is_array($uri) ? site_url($uri, null, $config) : (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri, null, $config)); // eliminate trailing slash $siteUrl = rtrim($siteUrl, '/'); From 99b23a73dd218707d9b848877384022e9364caf4 Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 17 Mar 2025 13:44:31 -0500 Subject: [PATCH 2/2] Update url_helper.php --- system/Helpers/url_helper.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index a877057c9bfd..3baf2573e62d 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -148,7 +148,7 @@ function index_page(?App $altConfig = null): string * @param array|string $uri URI string or array of URI segments * @param string $title The link title * @param array|object|string $attributes Any attributes - * @param App|null $altConfig Alternate configuration to use + * @param App|null $config Alternate configuration to use */ function anchor($uri = '', string $title = '', $attributes = '', ?App $config = null): string { @@ -178,13 +178,10 @@ function anchor($uri = '', string $title = '', $attributes = '', ?App $config = * @param string $uri the URL * @param string $title the link title * @param array|false|object|string $attributes any attributes - * @param App|null $altConfig Alternate configuration to use + * @param App|null $config Alternate configuration to use */ - function anchor_popup($uri = '', string $title = '', $attributes = false, ?App $altConfig = null): string + function anchor_popup($uri = '', string $title = '', $attributes = false, ?App $config = null): string { - // use alternate config if provided, else default one - $config = $altConfig ?? config(App::class); - $siteUrl = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri, null, $config); $siteUrl = rtrim($siteUrl, '/');