diff --git a/AvocadoEdition_Light/classes/menucategory/menucategory.class.php b/AvocadoEdition_Light/classes/menucategory/menucategory.class.php index b1295e5..8d2d794 100644 --- a/AvocadoEdition_Light/classes/menucategory/menucategory.class.php +++ b/AvocadoEdition_Light/classes/menucategory/menucategory.class.php @@ -49,48 +49,46 @@ class MenuCategory extends Menu } public function buildHtml() { - global $g5, $is_admin, $auth, $menu, $auth_menu; - $sub_menu = preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, "/adm"], ["", ""], $_SERVER["SCRIPT_NAME"])); + global $is_admin; - $str = ""; - foreach ($this->childmenu as $key => $menu) { - if ($is_admin != 'super') + $sub_menu = preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, '/adm'], ['', ''], $_SERVER['SCRIPT_NAME'])); + + $str = ''; + $gnb_grp_style = false; + + foreach ($this->childmenu as $menu) { + if ($is_admin != 'super' || !$menu->display) { continue; + } - if (!$menu->display) - continue; + $gnb_grp_div = (($menu->gnb_grp_div == 1 && !$gnb_grp_style) || ($menu->gnb_grp_div != 1 && $gnb_grp_style)) ? 'gnb_grp_div' : ''; + $gnb_grp_style = $menu->gnb_grp_div == 1 ? 'gnb_grp_style' : ''; - 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'; - else - $gnb_grp_div = ''; + $menu_url = preg_replace('/^.*\/([^\/]+\.php)$/', '/$1', str_replace([G5_ADMIN_URL, '/adm'], ['', ''], $menu->url)); + $check_gnb_grp_style = ''; - if ($menu->gnb_grp_div == 1) - $gnb_grp_style = 'gnb_grp_style'; - else - $gnb_grp_style = ''; - - $check_gnb_grp_style = ""; - $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)); + 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; } - $str .= '
  • ' . $menu->name . '
  • '; - } - $str .= ""; - - if ($this->selected) { - $str = "