From f064d8f1efffde0b205a025706d3b2a862a7246a Mon Sep 17 00:00:00 2001 From: 0xRenegade Date: Sat, 24 Sep 2022 14:32:04 -0500 Subject: [PATCH] add base_url() function in helpers, works with https and port number --- qrcode/helpers/helpers.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qrcode/helpers/helpers.php b/qrcode/helpers/helpers.php index e232703..82a53a6 100644 --- a/qrcode/helpers/helpers.php +++ b/qrcode/helpers/helpers.php @@ -116,3 +116,12 @@ function paginationLinks($current_page, $total_pages, $base_url) { return $html; } + +function base_url(){ + return sprintf( + "%s://%s:%s", + isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', + $_SERVER['SERVER_NAME'], + $_SERVER['SERVER_PORT'] + ); +}