get_menu_icon(), 80 ); add_submenu_page( self::MENU_SLUG, __( 'Shiftora Dashboard', 'shiftora' ), __( 'Dashboard', 'shiftora' ), self::CAPABILITY, self::MENU_SLUG, [ DashboardPage::class, 'render' ] ); add_submenu_page( self::MENU_SLUG, __( 'Shiftora Migration', 'shiftora' ), __( 'Migration', 'shiftora' ), self::CAPABILITY, 'shiftora-migrate', [ MigrationPage::class, 'render' ] ); add_submenu_page( self::MENU_SLUG, __( 'Shiftora Connections', 'shiftora' ), __( 'Connections', 'shiftora' ), self::CAPABILITY, 'shiftora-connections', [ ConnectionsPage::class, 'render' ] ); add_submenu_page( self::MENU_SLUG, __( 'Shiftora Profiles', 'shiftora' ), __( 'Profiles', 'shiftora' ), self::CAPABILITY, 'shiftora-profiles', [ ProfilesPage::class, 'render' ] ); add_submenu_page( self::MENU_SLUG, __( 'Shiftora Backups', 'shiftora' ), __( 'Backups', 'shiftora' ), self::CAPABILITY, 'shiftora-backups', [ BackupsPage::class, 'render' ] ); add_submenu_page( self::MENU_SLUG, __( 'Shiftora Settings', 'shiftora' ), __( 'Settings', 'shiftora' ), self::CAPABILITY, 'shiftora-settings', [ SettingsPage::class, 'render' ] ); add_submenu_page( self::MENU_SLUG, __( 'Shiftora Add-ons', 'shiftora' ), __( 'Add-ons', 'shiftora' ), self::CAPABILITY, 'shiftora-upgrades', [ UpgradesPage::class, 'render' ] ); // Help holds support, recent issues, report controls and plugin details; every "View Diagnostics" action lands here. add_submenu_page( self::MENU_SLUG, __( 'Shiftora Help', 'shiftora' ), __( 'Help', 'shiftora' ), self::CAPABILITY, 'shiftora-help', [ HelpPage::class, 'render' ] ); } /** * Drops every Shiftora entry from a `$submenu` array; the parent lives in * `$menu`, so the sidebar keeps a single "Shiftora" link. * * @param array $submenu The $GLOBALS['submenu'] value. * @return array The submenu without the Shiftora branch. */ public static function pruned_submenu( array $submenu ): array { unset( $submenu[ self::MENU_SLUG ] ); return $submenu; } /** * Hides every Shiftora sub-page from the WP sidebar. Runs on `admin_head`: * after the access check and title lookup read `$submenu`, before the sidebar * renders. The in-app nav is the only place users navigate. */ public function prune_sidebar(): void { global $submenu; $submenu = self::pruned_submenu( $submenu ); } /** Returns the menu icon asset for the Shiftora admin entry. */ private function get_menu_icon(): string { $icon_path = SHIFTORA_DIR . 'resources/images/shiftora-wp-icon.svg'; if ( file_exists( $icon_path ) && is_readable( $icon_path ) ) { $svg = trim( (string) file_get_contents( $icon_path ) ); if ( '' !== $svg ) { return 'data:image/svg+xml;base64,' . base64_encode( $svg ); } } return SHIFTORA_URL . 'resources/images/shiftora-wp-icon.png'; } }