From 0e386d2c7fd46832fa67ce574637d30a15e88641 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Tue, 26 Nov 2019 20:12:43 +0100 Subject: Removed global $page --- includes/sys_menu.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'includes/sys_menu.php') diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 4dabc857..3bb061ce 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -40,13 +40,22 @@ function header_render_hints() return $hints_renderer->render(); } +/** + * Returns the path of the current path with underscores instead of hyphens + * + * @return string + */ +function current_page() +{ + return request()->query->get('p') ?: str_replace('-', '_', request()->path()); +} + /** * @return array */ function make_user_submenu() { - global $page; - + $page = current_page(); $user_submenu = make_language_select(); if (auth()->can('user_settings') || auth()->can('logout')) { @@ -79,8 +88,7 @@ function make_user_submenu() */ function make_navigation() { - global $page; - + $page = current_page(); $menu = []; $pages = [ 'news' => __('News'), -- cgit v1.2.3-54-g00ecf