<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Config; use Illuminate\Support\Str; class MemberHomeIcon { private static $menu = array(); public static function register($VVmJT) { self::$menu[] = $VVmJT; } public static function get() { goto dJu9u; iZi37: $VVmJT = self::mergeMenu($VVmJT); goto MRBHc; dJu9u: $VVmJT = array(); goto DIEog; MRBHc: return $VVmJT; goto oku_Y; DIEog: foreach (self::$menu as $jIWZA) { if ($jIWZA instanceof \Closure) { $jIWZA = call_user_func($jIWZA); } $VVmJT = array_merge($VVmJT, $jIWZA); } goto iZi37; oku_Y: } private static function sort() { static $C6vyf = 1000; return $C6vyf++; } private static function mergeMenu($VVmJT, $nX0hz = '', $C97Yq = 1, $bu01d = null) { goto N00kd; semG2: $WtSc0 = array(); goto fko48; N00kd: if (empty($VVmJT)) { return array(); } goto semG2; LnbnB: if ($C97Yq == 1) { uasort($WtSc0, function ($vgAtT, $ev2YV) { return $vgAtT['sort'] - $ev2YV['sort']; }); return self::mergeMenuTree($WtSc0); } goto HcEVl; HcEVl: return $WtSc0; goto kk2qR; fko48: foreach ($VVmJT as $jIWZA) { goto vQQJH; B1NjH: if (!empty($jIWZA['children'])) { $WtSc0 = array_merge($WtSc0, self::mergeMenu($jIWZA['children'], $kEhTf . '^^', $C97Yq + 1, $bu01d)); } goto fvAjy; dm5nr: if (!isset($jIWZA['sort'])) { $jIWZA['sort'] = self::sort(); } goto wvrER; wvrER: if (1 == $C97Yq) { $kEhTf = $nX0hz . $jIWZA['title'] . '^' . $jIWZA['sort']; } else { $kEhTf = $nX0hz . $jIWZA['title']; } goto Ae_U8; vQQJH: if (empty($jIWZA)) { continue; } goto N5K1E; Ae_U8: if (!isset($WtSc0[$kEhTf])) { $WtSc0[$kEhTf] = $jIWZA; } goto ldtlR; ldtlR: unset($WtSc0[$kEhTf]['children']); goto B1NjH; N5K1E: if ($bu01d) { if (!call_user_func($bu01d, $jIWZA)) { continue; } } goto dm5nr; fvAjy: } goto LnbnB; kk2qR: } private static function mergeMenuTree($Yk3cn, $nX0hz = '') { goto TyKx0; jKafj: return $r2oZf; goto r5uuU; TyKx0: $r2oZf = array(); goto ws_Ih; ws_Ih: foreach ($Yk3cn as $kEhTf => $y2Ltn) { goto XrnoJ; ZEyE3: $DeDpE = explode('^^', $kEhTf); goto HviXf; XrnoJ: if ($kEhTf === $nX0hz) { continue; } goto ZEyE3; Sh02w: $r2oZf[] = $jIWZA; goto HAFST; SEY6L: if (empty($jIWZA['children'])) { unset($jIWZA['children']); } goto c22Go; c22Go: if (empty($jIWZA['children']) && empty($jIWZA['url'])) { continue; } goto Sh02w; rrX9r: $jIWZA['children'] = self::mergeMenuTree($Yk3cn, $kEhTf . '^^'); goto SEY6L; RE1Yn: $jIWZA = $y2Ltn; goto rrX9r; HviXf: if ($nX0hz) { if (!Str::startsWith($kEhTf, $nX0hz)) { continue; } if (count(explode('^^', $nX0hz)) !== count(explode('^^', $kEhTf))) { continue; } } else { if (1 != count($DeDpE)) { continue; } } goto RE1Yn; HAFST: } goto jKafj; r5uuU: } }