This commit is contained in:
Amberstone 2024-09-23 14:37:58 +09:00
parent ca0a04bc24
commit 0df973e534
Signed by: amber
GPG key ID: 094B0E55F98D8BF1

View file

@ -47,18 +47,18 @@ class MenuCategory extends Menu
{ {
return $this->last_menu; return $this->last_menu;
} }
public function buildHtml() public function buildHtml()
{ {
global $g5, $is_admin, $auth, $menu, $auth_menu; global $g5, $is_admin, $auth, $menu, $auth_menu;
$sub_menu = str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $_SERVER["SCRIPT_NAME"]); $sub_menu = preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $_SERVER["SCRIPT_NAME"]));
$str = "<ul class=\"gnb_2dul\">"; $str = "<ul class=\"gnb_2dul\">";
foreach ($this->childmenu as $key => $menu) { foreach ($this->childmenu as $key => $menu) {
if ($is_admin != 'super') if ($is_admin != 'super')
continue; continue;
if (!$menu->display) continue; if (!$menu->display)
continue;
if (($menu->gnb_grp_div == 1 && $gnb_grp_style == false) || ($menu->gnb_grp_div != 1 && $gnb_grp_style == true)) if (($menu->gnb_grp_div == 1 && $gnb_grp_style == false) || ($menu->gnb_grp_div != 1 && $gnb_grp_style == true))
$gnb_grp_div = 'gnb_grp_div'; $gnb_grp_div = 'gnb_grp_div';
@ -71,7 +71,12 @@ class MenuCategory extends Menu
$gnb_grp_style = ''; $gnb_grp_style = '';
$check_gnb_grp_style = ""; $check_gnb_grp_style = "";
if (str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $menu->url) == $sub_menu || in_array($sub_menu, $menu->suburl)) { $menu_url = preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $menu->url));
if (
$menu_url == $sub_menu || in_array($sub_menu, array_map(function ($url) {
return preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $url));
}, $menu->suburl))
) {
$check_gnb_grp_style = "check"; $check_gnb_grp_style = "check";
$this->selected = true; $this->selected = true;
} }