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

@ -38,7 +38,7 @@ class MenuCategory extends Menu
public function orderMenu()
{
usort($this->childmenu, function($a, $b) {
usort($this->childmenu, function ($a, $b) {
return $a->order - $b->order;
});
}
@ -47,18 +47,18 @@ class MenuCategory extends Menu
{
return $this->last_menu;
}
public function buildHtml()
{
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\">";
foreach($this->childmenu as $key => $menu) {
foreach ($this->childmenu as $key => $menu) {
if ($is_admin != 'super')
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))
$gnb_grp_div = 'gnb_grp_div';
@ -71,7 +71,12 @@ class MenuCategory extends Menu
$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";
$this->selected = true;
}