$crumbs Trail after Home; the last is the current page. * @param string $actions Already-escaped buttons for the right of the heading. * @param bool $visible False when the screen draws its own heading; it stays for screen readers. */ public static function open( string $title, string $subtitle = '', array $crumbs = array(), string $actions = '', bool $visible = true ): void { $links = self::header_links(); if ( ! $crumbs ) { $crumbs = array( array( 'label' => $title ) ); } echo '
'; echo '
'; echo ''; echo '
'; Notices::render_toggle(); printf( '%s%s%s%s', esc_url( $links['help'] ), wp_kses( self::icon( '' ), Allowed_Html::svg() ), esc_html__( 'Help', 'submex' ), esc_url( $links['settings'] ), wp_kses( self::icon( '' ), Allowed_Html::svg() ), esc_html__( 'Settings', 'submex' ) ); if ( '' !== $links['upgrade'] ) { printf( '%s%s %s', esc_url( $links['upgrade'] ), wp_kses( self::icon( '' ), Allowed_Html::svg() ), esc_html__( 'Upgrade to Pro', 'submex' ), /* translators: accessibility text for a link that opens in a new tab */ esc_html__( '(opens in a new tab)', 'submex' ) ); } echo '
'; echo '
'; echo '
'; echo '

' . esc_html( $title ) . '

'; if ( '' !== $subtitle ) { echo '

' . esc_html( $subtitle ) . '

'; } echo '
'; if ( '' !== $actions ) { echo '
' . wp_kses_post( $actions ) . '
'; } echo '
'; // WordPress moves admin notices to just below this marker; without it they land // wherever the first heading happens to be, which inside a custom layout is anywhere. echo '
'; Notices::render_important(); } public static function close(): void { printf( '
', /* translators: %s: version number */ esc_html( sprintf( __( 'Submex %s', 'submex' ), SUBMEX_VERSION ) ), esc_url( admin_url( 'admin.php?page=' . Menu::SLUG . '-help' ) ), esc_html__( 'Help and system report', 'submex' ) ); } /** * The header's links, shared with the app shell so both headers go to the same places. * * @return array{home: string, help: string, settings: string, upgrade: string, logo: string} */ public static function header_links(): array { return array( 'logo' => SUBMEX_URL . 'assets/images/logo.svg', 'home' => admin_url( 'admin.php?page=' . Menu::SLUG ), 'help' => admin_url( 'admin.php?page=' . Help_Page::SLUG ), 'settings' => admin_url( 'admin.php?page=' . Settings_Page::SLUG ), 'upgrade' => self::offers_upgrade() ? self::UPGRADE_URL : '', ); } /** * Off for now: the submex_show_upgrade filter brings the header button back. */ private static function offers_upgrade(): bool { return ! did_action( 'submex_pro_loaded' ) && (bool) apply_filters( 'submex_show_upgrade', false ); } private static function icon( string $paths ): string { return ''; } }