<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Config; use Illuminate\Support\Str; class MemberMenu { private static $menu = array(); public static function register($VVmJT) { self::$menu[] = $VVmJT; } public static function get() { goto QmUNI; QmUNI: $VVmJT = array(); goto U4qtx; U4qtx: foreach (self::$menu as $jIWZA) { if ($jIWZA instanceof \Closure) { $jIWZA = call_user_func($jIWZA); } $VVmJT = array_merge($VVmJT, $jIWZA); } goto RARPm; q8Pz3: return $VVmJT; goto ogMZ_; RARPm: $VVmJT = self::mergeMenu($VVmJT); goto q8Pz3; ogMZ_: } private static function sort() { static $C6vyf = 1000; return $C6vyf++; } private static function mergeMenu($VVmJT, $nX0hz = '', $C97Yq = 1, $bu01d = null) { goto E2PIP; V89Yi: foreach ($VVmJT as $jIWZA) { goto M7tEe; dMbLA: if (!isset($WtSc0[$kEhTf])) { $WtSc0[$kEhTf] = $jIWZA; } goto Vx41B; herHL: if ($bu01d) { if (!call_user_func($bu01d, $jIWZA)) { continue; } } goto Desht; Desht: if (!isset($jIWZA['sort'])) { $jIWZA['sort'] = self::sort(); } goto bh_6s; Vx41B: unset($WtSc0[$kEhTf]['children']); goto ueaQ_; M7tEe: if (empty($jIWZA)) { continue; } goto herHL; bh_6s: if (1 == $C97Yq) { $kEhTf = $nX0hz . $jIWZA['title'] . '^' . $jIWZA['icon'] . '^' . $jIWZA['sort']; } else { $kEhTf = $nX0hz . $jIWZA['title']; } goto JGTdd; JGTdd: if (isset($jIWZA['icon'])) { if (preg_match('/^[a-zA-Z0-9\\-]+$/', $jIWZA['icon'])) { $jIWZA['icon'] = "<i class='icon iconfont icon-{$jIWZA['icon']}'></i>"; } } goto dMbLA; ueaQ_: if (!empty($jIWZA['children'])) { $WtSc0 = array_merge($WtSc0, self::mergeMenu($jIWZA['children'], $kEhTf . '^^', $C97Yq + 1, $bu01d)); } goto qlu6C; qlu6C: } goto yBLyt; YoneG: $WtSc0 = array(); goto V89Yi; nLhlC: return $WtSc0; goto cL9Ba; yBLyt: if ($C97Yq == 1) { uasort($WtSc0, function ($vgAtT, $ev2YV) { return $vgAtT['sort'] - $ev2YV['sort']; }); return self::mergeMenuTree($WtSc0); } goto nLhlC; E2PIP: if (empty($VVmJT)) { return array(); } goto YoneG; cL9Ba: } private static function mergeMenuTree($Yk3cn, $nX0hz = '') { goto wRkDm; hDdMu: return $r2oZf; goto gIL7X; FCWzV: foreach ($Yk3cn as $kEhTf => $y2Ltn) { goto oXQpa; oXQpa: if ($kEhTf === $nX0hz) { continue; } goto NgraP; NgraP: $DeDpE = explode('^^', $kEhTf); goto vioFf; A2gy5: $r2oZf[] = $jIWZA; goto nzpbO; KHR_t: $jIWZA = $y2Ltn; goto FnGn4; FnGn4: $jIWZA['children'] = self::mergeMenuTree($Yk3cn, $kEhTf . '^^'); goto GBu8z; lCZbq: if (empty($jIWZA['children']) && empty($jIWZA['url'])) { continue; } goto A2gy5; GBu8z: if (empty($jIWZA['children'])) { unset($jIWZA['children']); } goto lCZbq; vioFf: if ($nX0hz) { if (!Str::startsWith($kEhTf, $nX0hz)) { continue; } if (count(explode('^^', $nX0hz)) !== count(explode('^^', $kEhTf))) { continue; } } else { if (1 != count($DeDpE)) { continue; } } goto KHR_t; nzpbO: } goto hDdMu; wRkDm: $r2oZf = array(); goto FCWzV; gIL7X: } }