优化首页服务入口、统一导航与登录页配色
This commit is contained in:
@@ -16,12 +16,24 @@ $template = new think\Template([
|
||||
$vars = [
|
||||
'seo' => ['title' => 'EVUS 中文登记服务', 'description' => '首页本地预览', 'keywords' => 'EVUS'],
|
||||
'logo_icon' => '', 'asset_version' => 'preview', 'menu_url' => 'index/index',
|
||||
'footer' => '', 'phone' => '',
|
||||
'footer' => '', 'phone' => '', 'base_path' => '/evus',
|
||||
];
|
||||
foreach ([[], [['id' => 7, 'title' => '<script>alert(1)</script>', 'create_time' => '2026-10-29']]] as $news) {
|
||||
ob_start();
|
||||
$template->fetch('index/index', $vars + ['data' => $news]);
|
||||
$html = ob_get_clean();
|
||||
preg_match('~<header\b.*?</header>~s', $html, $header);
|
||||
$homepageNavigation = str_replace('aria-current="page"', '', $header[0]);
|
||||
preg_match_all('~<nav\b[^>]*>(.*?)</nav>~s', $header[0], $menus);
|
||||
preg_match_all('~href="([^"]+)"~', $menus[1][0], $desktopLinks);
|
||||
preg_match_all('~href="([^"]+)"~', $menus[1][1], $mobileLinks);
|
||||
$desktopLinks[1][] = (string) url('home/user/order');
|
||||
if (count($mobileLinks[1]) !== 8 || $desktopLinks[1] !== $mobileLinks[1]) {
|
||||
throw new RuntimeException('Homepage desktop and mobile menus must share all eight entries in order');
|
||||
}
|
||||
if (str_contains($html, 'https://visa.evus.cn')) {
|
||||
throw new RuntimeException('Unfinished US visa website must not be linked from the homepage');
|
||||
}
|
||||
if (substr_count($html, 'src="/static/home/images/logo_113.png"') !== 2 || !str_contains($html, 'href="/static/home/images/evus-icon.png"')) {
|
||||
throw new RuntimeException('Original EVUS logo and default site icon must render');
|
||||
}
|
||||
@@ -70,11 +82,15 @@ foreach (['detail/index' => 'detail/index', 'lookup/index' => 'lookup/index', 'n
|
||||
ob_start();
|
||||
$template->fetch('public/home_menu', array_replace($vars, ['menu_url' => $current]));
|
||||
$navigation = ob_get_clean();
|
||||
preg_match('~<header\b.*?</header>~s', $navigation, $innerHeader);
|
||||
if (str_replace('aria-current="page"', '', $innerHeader[0]) !== $homepageNavigation) {
|
||||
throw new RuntimeException('Homepage and inner navigation must match apart from the active page');
|
||||
}
|
||||
$activeLink = 'href="' . url('home/' . $active) . '" aria-current="page"';
|
||||
if (substr_count($navigation, $activeLink) !== 2) {
|
||||
throw new RuntimeException('Desktop and mobile navigation must highlight: ' . $current);
|
||||
}
|
||||
foreach (['https://visa.evus.cn', (string) url('home/esta/index'), 'class="ac-mobile-menu"', 'id="ac-mobile-menu-dismiss"'] as $required) {
|
||||
foreach ([(string) url('home/esta/index'), 'class="ac-mobile-menu"', 'id="ac-mobile-menu-dismiss"'] as $required) {
|
||||
if (!str_contains($navigation, $required)) {
|
||||
throw new RuntimeException('Shared navigation must retain: ' . $required);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user