Three defects slipped into the sign-card rebuild: The hidden-glyph rule was dropped. `.fa` sets display:inline-block, which outranks the UA [hidden] rule, so every hidden glyph stayed visible — most visibly a spinner rendered beside the login button at rest. `.sign [hidden]` restores the override. Closing account login produced an empty shell. The whole sign-in pane was gated on `!$close_signin`, and the social block carried the same gate, so a site with account login off but registration on still opened on an empty panel with no social entry. The pane is now rendered in three shapes: open registration falls through to the signup tab, a QR entry falls through to the QR tab, social-only renders a notice plus the social bar, and when nothing is available it states that login is closed. The modal close button sat in normal flow and pushed the card content down; `#u_sign .sign > .close` pins it back to the top-right corner. The /sign/ route is `index.php?jio_sign=1`, so WordPress reports it as home. The header multifunction component resolves page type by query flags and the home branch won, so the component appeared on the auth page whenever "首页" was in its scope — even though the sign page template itself was already excluded. `jio_header_slide_current_page_type()` now bails out on `jio_sign` before any of the is_* checks. The breakpoint overrides that were fighting the shared sheet between 641px and 991px are narrowed to the one offset that actually needed adjusting. Verification: the modal was rendered through a PHP stub, served with the real theme stylesheets, and driven by the real auth.js in a headless browser — tab switching, signin-mode switching, password reveal, close button and geometry at 1440/1100/900/760/500/390px. The header harness gained a `jio_sign` case asserting no markup, and 860 widget/navigation tests pass.
141 lines
6.3 KiB
PHP
141 lines
6.3 KiB
PHP
<?php
|
|
/** Render-level harness for the header multifunction component. */
|
|
|
|
namespace Jio\Core {
|
|
final class Color {
|
|
public static function sanitize(string $value): string { return $value; }
|
|
}
|
|
}
|
|
|
|
namespace Jio\Settings {
|
|
final class Settings {
|
|
public static array $headerSlider = [];
|
|
public static function get_header_slider_settings(): array { return self::$headerSlider; }
|
|
}
|
|
}
|
|
|
|
namespace {
|
|
define('ABSPATH', __DIR__);
|
|
$GLOBALS['jio_mobile'] = false;
|
|
$GLOBALS['jio_lazy'] = true;
|
|
|
|
final class WP_Query {
|
|
public function get(string $key) { return 0; }
|
|
}
|
|
$GLOBALS['wp_query'] = new WP_Query();
|
|
|
|
function is_admin(): bool { return false; }
|
|
function wp_is_mobile(): bool { return !empty($GLOBALS['jio_mobile']); }
|
|
function is_author(): bool { return false; }
|
|
function is_front_page(): bool { return true; }
|
|
function is_category(): bool { return false; }
|
|
function is_tag(): bool { return false; }
|
|
function is_singular($type = ''): bool { return false; }
|
|
function is_search(): bool { return false; }
|
|
function is_page(): bool { return false; }
|
|
function is_home(): bool { return false; }
|
|
$GLOBALS['jio_query_vars'] = [];
|
|
function get_query_var(string $key) { return $GLOBALS['jio_query_vars'][$key] ?? ''; }
|
|
function sanitize_key($value): string { return preg_replace('/[^a-z0-9_-]/', '', strtolower((string) $value)); }
|
|
function sanitize_html_class($value): string { return preg_replace('/[^a-zA-Z0-9_-]/', '', (string) $value); }
|
|
function wp_parse_args($args, array $defaults = []): array { return array_merge($defaults, is_array($args) ? $args : []); }
|
|
function esc_url($value): string { return htmlspecialchars((string) $value, ENT_QUOTES); }
|
|
function esc_url_raw($value): string { return (string) $value; }
|
|
function esc_attr($value): string { return htmlspecialchars((string) $value, ENT_QUOTES); }
|
|
function esc_html($value): string { return htmlspecialchars((string) $value, ENT_QUOTES); }
|
|
function wp_strip_all_tags($value): string { return strip_tags((string) $value); }
|
|
function __($value, $domain = ''): string { return (string) $value; }
|
|
function get_bloginfo($show = ''): string { return 'Jio'; }
|
|
function home_url($path = ''): string { return 'https://example.test/' . ltrim((string) $path, '/'); }
|
|
function wp_kses($value, $allowed = []): string { return (string) $value; }
|
|
function jio_is_lazy(string $key): bool { return !empty($GLOBALS['jio_lazy']); }
|
|
function jio_get_lazy_thumb(string $size = ''): string { return 'https://example.test/placeholder.svg'; }
|
|
function jio_get_lazy_attr(string $key, string $src, string $class = '', string $lazy_src = ''): string {
|
|
if (jio_is_lazy($key)) {
|
|
return ' class="lazyload ' . esc_attr($class) . '" src="' . esc_url($lazy_src) . '" data-src="' . esc_url($src) . '"';
|
|
}
|
|
return ' class="' . esc_attr($class) . '" src="' . esc_url($src) . '"';
|
|
}
|
|
function jio_get_search_box(array $args = []): string { return '<div class="search-input">search-box</div>'; }
|
|
function jio_icon_cover_card(array $card): string {
|
|
return '<div class="icon-cover-card flex ac ' . esc_attr((string) ($card['class'] ?? '')) . '">' . esc_html((string) ($card['title'] ?? '')) . '</div>';
|
|
}
|
|
|
|
require_once dirname(__DIR__, 2) . '/inc/helpers/homepage/header-components.php';
|
|
|
|
$slides = [
|
|
['background' => 'https://example.test/slide.jpg', 'link' => ['url' => 'https://example.test/one', 'target' => '_blank', 'text' => 'One'], 'text' => ['title' => 'Title', 'desc' => 'Description'], 'image_layer' => [['image' => 'https://example.test/layer.png', 'free_size' => true, 'align' => 'right', 'parallax' => 40, 'parallax_opacity' => 80, 'parallax_scale' => 110]]],
|
|
['background_video' => 'https://example.test/background.mp4', 'background' => 'https://example.test/poster.jpg'],
|
|
['video' => 'https://example.test/content.mp4', 'background' => 'https://example.test/content-poster.jpg'],
|
|
['background' => 'https://example.test/pc-only.jpg', 'hide' => 'm'],
|
|
['background' => 'https://example.test/mobile-only.jpg', 'hide' => 'pc'],
|
|
];
|
|
$settings = [
|
|
'slides' => $slides,
|
|
'show_on_pages' => ['home'],
|
|
'show_type' => '',
|
|
'nav_color' => '#ffffff',
|
|
'slider_config' => ['loop' => true, 'autoplay' => true, 'interval' => 6, 'pagination' => true],
|
|
'search_show' => ['pc_s', 'm_s'],
|
|
'search_config' => ['before_html' => '<div>Search intro</div>'],
|
|
'card_show' => ['pc_s', 'm_s'],
|
|
'card_config' => ['show_widget_bg' => false, 'cards' => [['icon' => 'fa fas fa-star', 'title' => 'Card one']]],
|
|
'filter_blur' => ['pc_s', 'm_s'],
|
|
];
|
|
\Jio\Settings\Settings::$headerSlider = $settings;
|
|
|
|
ob_start();
|
|
jio_header_slide();
|
|
$desktop = (string) ob_get_clean();
|
|
|
|
$GLOBALS['jio_mobile'] = true;
|
|
ob_start();
|
|
jio_header_slide();
|
|
$mobile = (string) ob_get_clean();
|
|
|
|
$settings['card_config']['show_widget_bg'] = true;
|
|
\Jio\Settings\Settings::$headerSlider = $settings;
|
|
ob_start();
|
|
jio_header_slide();
|
|
$module_background = (string) ob_get_clean();
|
|
|
|
$GLOBALS['jio_mobile'] = false;
|
|
$GLOBALS['jio_lazy'] = false;
|
|
$lazy_disabled = jio_get_header_slider_markup([
|
|
'slides' => [['background' => 'https://example.test/eager.jpg']],
|
|
'class' => 'slide-index slide-header',
|
|
]);
|
|
$single_slide = jio_get_header_slider_markup([
|
|
'slides' => [['background' => 'https://example.test/single.jpg']],
|
|
'class' => 'slide-index slide-header',
|
|
'pagination' => true,
|
|
'button' => true,
|
|
]);
|
|
|
|
// /sign/ is `index.php?jio_sign=1`, so is_front_page() stays true. The auth
|
|
// surface must not inherit the home scope.
|
|
$GLOBALS['jio_query_vars']['jio_sign'] = '1';
|
|
$auth_page_show = jio_header_slide_is_show();
|
|
$auth_page_type = jio_header_slide_current_page_type();
|
|
ob_start();
|
|
jio_header_slide();
|
|
$auth_page_markup = (string) ob_get_clean();
|
|
$GLOBALS['jio_query_vars']['jio_sign'] = '';
|
|
|
|
require_once dirname(__DIR__, 2) . '/src/Admin/PageConfigMetaBox.php';
|
|
$sanitize_cards = new \ReflectionMethod('Jio\\Admin\\PageConfigMetaBox', 'sanitize_card_options');
|
|
$page_config_save = $sanitize_cards->invoke(null, ['show_widget_bg' => true, 'cards' => []]);
|
|
|
|
echo json_encode([
|
|
'desktop' => $desktop,
|
|
'mobile' => $mobile,
|
|
'module_background' => $module_background,
|
|
'lazy_disabled' => $lazy_disabled,
|
|
'single_slide' => $single_slide,
|
|
'page_config_save' => $page_config_save,
|
|
'auth_page_show' => $auth_page_show,
|
|
'auth_page_type' => $auth_page_type,
|
|
'auth_page_markup' => $auth_page_markup,
|
|
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
}
|