[#30718] minor code optimization: libraries/legacy/html/menu.php (Fix #1052)