<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Config; use Illuminate\Support\Str; class MemberMenu { private static $menu = array(); public static function register($BXiBs) { self::$menu[] = $BXiBs; } public static function get() { goto Qygcv; vkjNN: foreach (self::$menu as $Z32UA) { if ($Z32UA instanceof \Closure) { $Z32UA = call_user_func($Z32UA); } $BXiBs = array_merge($BXiBs, $Z32UA); } goto aifqT; IpdY4: return $BXiBs; goto r8cJs; aifqT: $BXiBs = self::mergeMenu($BXiBs); goto IpdY4; Qygcv: $BXiBs = array(); goto vkjNN; r8cJs: } private static function sort() { static $S0SDS = 1000; return $S0SDS++; } private static function mergeMenu($BXiBs, $CDU3A = '', $JA4Iq = 1, $wPpmz = null) { goto YBAjs; wnq2h: if ($JA4Iq == 1) { uasort($dmyJT, function ($CMJ6j, $Ct6yy) { return $CMJ6j['sort'] - $Ct6yy['sort']; }); return self::mergeMenuTree($dmyJT); } goto xFV14; YBAjs: if (empty($BXiBs)) { return array(); } goto UDds6; kcJ72: foreach ($BXiBs as $Z32UA) { goto hyk5o; yCxrV: if (!isset($dmyJT[$MFVkb])) { $dmyJT[$MFVkb] = $Z32UA; } goto p5q81; xZJqJ: if (!isset($Z32UA['sort'])) { $Z32UA['sort'] = self::sort(); } goto HlZva; hyk5o: if (empty($Z32UA)) { continue; } goto xxqnQ; HlZva: if (1 == $JA4Iq) { $MFVkb = $CDU3A . $Z32UA['title'] . '^' . $Z32UA['icon'] . '^' . $Z32UA['sort']; } else { $MFVkb = $CDU3A . $Z32UA['title']; } goto tMsSK; p5q81: unset($dmyJT[$MFVkb]['children']); goto Be3gr; Be3gr: if (!empty($Z32UA['children'])) { $dmyJT = array_merge($dmyJT, self::mergeMenu($Z32UA['children'], $MFVkb . '^^', $JA4Iq + 1, $wPpmz)); } goto k7btx; xxqnQ: if ($wPpmz) { if (!call_user_func($wPpmz, $Z32UA)) { continue; } } goto xZJqJ; tMsSK: if (isset($Z32UA['icon'])) { if (preg_match('/^[a-zA-Z0-9\\-]+$/', $Z32UA['icon'])) { $Z32UA['icon'] = "<i class='icon iconfont icon-{$Z32UA['icon']}'></i>"; } } goto yCxrV; k7btx: } goto wnq2h; UDds6: $dmyJT = array(); goto kcJ72; xFV14: return $dmyJT; goto H1XHx; H1XHx: } private static function mergeMenuTree($d37S3, $CDU3A = '') { goto NV9Wu; NV9Wu: $xrR0s = array(); goto XnmjT; amlIg: return $xrR0s; goto TCZIo; XnmjT: foreach ($d37S3 as $MFVkb => $YxV2x) { goto dMX49; A4lnI: $Z32UA = $YxV2x; goto YrqOv; vs6KR: $BsTZ_ = explode('^^', $MFVkb); goto tnPzX; tnPzX: if ($CDU3A) { if (!Str::startsWith($MFVkb, $CDU3A)) { continue; } if (count(explode('^^', $CDU3A)) !== count(explode('^^', $MFVkb))) { continue; } } else { if (1 != count($BsTZ_)) { continue; } } goto A4lnI; Xa8O1: if (empty($Z32UA['children'])) { unset($Z32UA['children']); } goto e3KL3; kRr16: $xrR0s[] = $Z32UA; goto S2HAE; dMX49: if ($MFVkb === $CDU3A) { continue; } goto vs6KR; YrqOv: $Z32UA['children'] = self::mergeMenuTree($d37S3, $MFVkb . '^^'); goto Xa8O1; e3KL3: if (empty($Z32UA['children']) && empty($Z32UA['url'])) { continue; } goto kRr16; S2HAE: } goto amlIg; TCZIo: } }