diff --git a/AGENTS.md b/AGENTS.md index e8da06fb..4f907c30 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -106,7 +106,7 @@ Always run `composer lint` and `composer phpstan` before considering PHP work do 1. **`frontblocks.php`** — entry point; defines constants (`FRBL_VERSION`, `FRBL_PLUGIN`, `FRBL_PLUGIN_URL`, `FRBL_PLUGIN_PATH`), loads Composer autoloader, hooks `plugins_loaded` → singleton `FrontBlocks\Plugin_Main::get_instance()`. 2. **`includes/Plugin_Main.php`** — singleton; `load_modules()` instantiates all frontend and admin feature classes. 3. **`includes/Frontend/*.php`** — each feature is a self-contained class; constructor calls `init_hooks()` which registers the WordPress actions/filters it needs (block filtering for block-related features; other hooks — uploads, `wp_head`, `template_redirect`, etc. — for general site-tool features). -4. **`includes/Admin/Settings.php`** — settings page at `themes.php?page=frontblocks-settings`. +4. **`includes/Admin/Settings.php`** — the FrontBlocks menu (`admin.php?page=frontblocks-settings`) with a submenu for each settings tab. Build links with `Settings::get_settings_url( $tab )` and recognize its screens with `Settings::is_settings_screen( $screen_id )`, never with a hard-coded URL or screen ID. ### Module Pattern diff --git a/docs/COOKIE-NOTICE.md b/docs/COOKIE-NOTICE.md index 2cbbc1b8..d386dfc7 100644 --- a/docs/COOKIE-NOTICE.md +++ b/docs/COOKIE-NOTICE.md @@ -13,7 +13,7 @@ and other tracking integrations) has been removed from FrontBlocks. Sites that had it enabled will show no cookie banner at all until FrontConsent is installed — this is intentional, to push migration forward. -**Appearance → FrontBlocks → Cookie Notice** is now a static promo panel: it +**FrontBlocks → Cookie Notice** is now a static promo panel: it explains the move and links to install FrontConsent. If FrontConsent isn't installed yet, that link only installs it — WordPress still requires a separate activation step (a confirmation screen with an "Activate Plugin" diff --git a/docs/GOOGLE-SIGNIN.md b/docs/GOOGLE-SIGNIN.md index 9d7a0ca3..6514d680 100644 --- a/docs/GOOGLE-SIGNIN.md +++ b/docs/GOOGLE-SIGNIN.md @@ -14,7 +14,7 @@ password. It uses [Google Identity Services](https://developers.google.com/ident on the browser side and verifies the resulting ID token server-side — no third-party PHP library or Google API client is required. -Enable it from **Appearance → FrontBlocks → Google Sign-In**. The button +Enable it from **FrontBlocks → Social Login**. The button stays hidden everywhere until a Client ID and Client Secret are set there. ## Settings diff --git a/docs/IMAGE-MANAGEMENT.md b/docs/IMAGE-MANAGEMENT.md index 9a89a903..d8766f1f 100644 --- a/docs/IMAGE-MANAGEMENT.md +++ b/docs/IMAGE-MANAGEMENT.md @@ -13,7 +13,7 @@ intermediate image sizes WordPress generates on upload, and automatically serves modern image formats (WebP/AVIF) on the frontend when the server supports them. -Enable it from **Appearance → FrontBlocks → Image Management**. +Enable it from **FrontBlocks → Image Management**. ## Settings diff --git a/docs/REDUNDANT-PLUGINS.md b/docs/REDUNDANT-PLUGINS.md index f8d62be8..4d8c67d9 100644 --- a/docs/REDUNDANT-PLUGINS.md +++ b/docs/REDUNDANT-PLUGINS.md @@ -27,7 +27,7 @@ add_filter( 'frontblocks_redundant_plugins', function ( $entries ) { 'shortpixel-image-optimiser/wp-shortpixel.php' => 'ShortPixel Image Optimizer', ), // Optional: link shown on the notice for more information. - 'doc_url' => admin_url( 'themes.php?page=frontblocks-settings' ), + 'doc_url' => \FrontBlocks\Admin\Settings::get_settings_url(), ); return $entries; diff --git a/docs/SETTINGS-TAB-EXTENSIONS.md b/docs/SETTINGS-TAB-EXTENSIONS.md index 343aa368..5b46333f 100644 --- a/docs/SETTINGS-TAB-EXTENSIONS.md +++ b/docs/SETTINGS-TAB-EXTENSIONS.md @@ -1,6 +1,6 @@ # Extending FrontBlocks Settings Tabs -FrontBlocks exposes two hooks for companion plugins that need a dedicated tab on the **Appearance → FrontBlocks** settings screen. +FrontBlocks exposes two hooks for companion plugins that need a dedicated tab on the **FrontBlocks** settings screen. Every tab also gets an entry in the FrontBlocks menu of the admin sidebar. ## Add a tab and its panel @@ -31,4 +31,19 @@ function my_plugin_render_settings_tab() { } ``` +## The FrontBlocks menu + +FrontBlocks has a menu of its own in the admin sidebar, right below Appearance, with a submenu entry for each tab. Each entry is a page of its own, so a tab has a URL that can be linked, bookmarked and opened from the sidebar: + +| Tab id | Page slug | URL | +| --- | --- | --- | +| `blocks` (the first tab) | `frontblocks-settings` | `admin.php?page=frontblocks-settings` | +| any other, for example `my-plugin` | `frontblocks-settings-my-plugin` | `admin.php?page=frontblocks-settings-my-plugin` | + +- Your tab appears in the submenu automatically. Add `'menu' => false` to the tab definition to keep it out of the submenu. It is still a tab of the screen. +- Link to a tab with `\FrontBlocks\Admin\Settings::get_settings_url( 'my-plugin' )`, not with a hard-coded URL. +- Recognize the settings screens with `\FrontBlocks\Admin\Settings::is_settings_screen( $hook_or_screen_id )`. The screen ID of a tab is not the same on every tab, and it was different when the screen lived under Appearance. Do not compare it with a fixed string such as `appearance_page_frontblocks-settings`. +- Check that the method exists before you call it if your plugin must work with older versions of FrontBlocks, which had the page under Appearance (`themes.php?page=frontblocks-settings`). +- The old Appearance URL still works. It redirects to the new menu and keeps its query arguments and its `#tab`. + The panel action runs after FrontBlocks closes its settings form. If your tab submits data, provide its own form, nonce, capability checks, and sanitization. diff --git a/docs/TESTING-INSTRUCTIONS.md b/docs/TESTING-INSTRUCTIONS.md index 0cd49475..97b93e60 100644 --- a/docs/TESTING-INSTRUCTIONS.md +++ b/docs/TESTING-INSTRUCTIONS.md @@ -22,7 +22,7 @@ Apariencia → Frontblocks O directamente: ``` -http://tu-sitio.local/wp-admin/themes.php?page=frontblocks-settings +http://tu-sitio.local/wp-admin/admin.php?page=frontblocks-settings ``` --- diff --git a/frontblocks.php b/frontblocks.php index db1619c6..23602575 100644 --- a/frontblocks.php +++ b/frontblocks.php @@ -83,7 +83,7 @@ function frbl_plugin_activation_redirect() { // Redirect to settings page. if ( get_option( 'frbl_activation_redirect', false ) ) { delete_option( 'frbl_activation_redirect' ); - wp_safe_redirect( admin_url( 'themes.php?page=frontblocks-settings' ) ); + wp_safe_redirect( class_exists( '\FrontBlocks\Admin\Settings' ) ? \FrontBlocks\Admin\Settings::get_settings_url() : admin_url( 'admin.php?page=frontblocks-settings' ) ); exit; } } diff --git a/includes/Admin/CookieNoticeDeprecationNotice.php b/includes/Admin/CookieNoticeDeprecationNotice.php index 4025e59b..b292bf62 100644 --- a/includes/Admin/CookieNoticeDeprecationNotice.php +++ b/includes/Admin/CookieNoticeDeprecationNotice.php @@ -139,8 +139,8 @@ public function render_notice() { return; } - $allowed_screens = array( 'appearance_page_frontblocks-settings', 'dashboard', 'plugins' ); - if ( ! in_array( $screen->id, $allowed_screens, true ) ) { + $allowed_screens = array( 'dashboard', 'plugins' ); + if ( ! in_array( $screen->id, $allowed_screens, true ) && ! Settings::is_settings_screen( $screen->id ) ) { return; } diff --git a/includes/Admin/ImageManagement.php b/includes/Admin/ImageManagement.php index d3fe7ebe..38a4b599 100644 --- a/includes/Admin/ImageManagement.php +++ b/includes/Admin/ImageManagement.php @@ -417,7 +417,7 @@ public function sanitize_settings( $value, $option ) { * @return void */ public function enqueue_assets( $hook ) { - if ( 'appearance_page_' . $this->page_slug !== $hook ) { + if ( ! Settings::is_settings_screen( $hook ) ) { return; } diff --git a/includes/Admin/RedundantPlugins.php b/includes/Admin/RedundantPlugins.php index 168ee1b4..56dcf68e 100644 --- a/includes/Admin/RedundantPlugins.php +++ b/includes/Admin/RedundantPlugins.php @@ -101,7 +101,7 @@ private static function get_default_entries() { 'safe-svg/safe-svg.php' => 'Safe SVG', 'svg-support/svg-support.php' => 'SVG Support', ), - 'doc_url' => admin_url( 'themes.php?page=frontblocks-settings' ), + 'doc_url' => Settings::get_settings_url(), ), 'login-google' => array( 'feature' => __( 'Google Login', 'frontblocks' ), @@ -110,7 +110,7 @@ private static function get_default_entries() { 'login-with-google/login-with-google.php' => 'Login with Google', 'login-with/login-with.php' => 'Login with', ), - 'doc_url' => admin_url( 'themes.php?page=frontblocks-settings' ), + 'doc_url' => Settings::get_settings_url( 'google-signin' ), ), 'staging-mode' => array( 'feature' => __( 'Staging Mode', 'frontblocks' ), @@ -119,7 +119,7 @@ private static function get_default_entries() { 'plugins' => array( '360-orbit-staging-guard/360-orbit-staging-guard.php' => '360 Orbit Staging Guard', ), - 'doc_url' => admin_url( 'themes.php?page=frontblocks-settings' ), + 'doc_url' => Settings::get_settings_url( 'maintenance' ), ), ); } @@ -140,8 +140,8 @@ public function render_notices() { return; } - $allowed_screens = array( 'appearance_page_frontblocks-settings', 'dashboard', 'plugins' ); - if ( ! in_array( $screen->id, $allowed_screens, true ) && false === strpos( $screen->id, 'frontblocks' ) ) { + $allowed_screens = array( 'dashboard', 'plugins' ); + if ( ! in_array( $screen->id, $allowed_screens, true ) && ! Settings::is_settings_screen( $screen->id ) && false === strpos( $screen->id, 'frontblocks' ) ) { return; } diff --git a/includes/Admin/ReviewNotice.php b/includes/Admin/ReviewNotice.php index 4a1176b8..b51130bc 100644 --- a/includes/Admin/ReviewNotice.php +++ b/includes/Admin/ReviewNotice.php @@ -51,8 +51,8 @@ public function review_notice() { } if ( ! $debug ) { - $allowed_screens = array( 'appearance_page_frontblocks-settings', 'dashboard' ); - if ( ! in_array( $screen->id, $allowed_screens, true ) && false === strpos( $screen->id, 'frontblocks' ) ) { + $allowed_screens = array( 'dashboard' ); + if ( ! in_array( $screen->id, $allowed_screens, true ) && ! Settings::is_settings_screen( $screen->id ) && false === strpos( $screen->id, 'frontblocks' ) ) { return; } } diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php index ea1992a6..7555bec6 100644 --- a/includes/Admin/Settings.php +++ b/includes/Admin/Settings.php @@ -270,7 +270,7 @@ class Settings { * * @var string */ - private $page_slug = 'frontblocks-settings'; + private $page_slug = self::PAGE_SLUG; /** * Is license valid. @@ -287,6 +287,7 @@ public function __construct() { $this->is_license_valid = function_exists( 'frblp_is_license_valid' ) && frblp_is_license_valid(); add_action( 'admin_menu', array( $this, 'register_menu' ) ); + add_action( 'admin_menu', array( $this, 'redirect_legacy_url' ), 99 ); add_action( 'admin_init', array( $this, 'register_settings' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); add_action( 'admin_head', array( $this, 'add_menu_icon_styles' ) ); @@ -318,7 +319,7 @@ public function add_menu_icon_styles() { * @return void */ public function enqueue_admin_styles( $hook ) { - if ( 'appearance_page_' . $this->page_slug !== $hook ) { + if ( ! self::is_settings_screen( $hook ) ) { return; } @@ -668,6 +669,62 @@ function updateScrollTopVisibility() { var tabPanels = document.querySelectorAll('[data-tab-panel]'); var saveBar = document.querySelector('.frbl-settings-save-bar'); + var wrapper = document.querySelector('.frbl-settings-wrapper'); + var tabPages = {}; + try { + tabPages = JSON.parse(wrapper ? wrapper.getAttribute('data-tab-pages') : '{}') || {}; + } catch (error) { + tabPages = {}; + } + + // Highlight the FrontBlocks submenu entry of the tab being shown. + function syncMenu(tabId) { + var menu = document.getElementById('toplevel_page_frontblocks-settings'); + var page = tabPages[tabId]; + + if (! menu || ! page) { + return; + } + + menu.querySelectorAll('.wp-submenu li').forEach(function (item) { + var link = item.querySelector('a'); + var match = false; + + if (link) { + try { + match = new URL(link.href, window.location.href).searchParams.get('page') === page; + } catch (error) { + match = false; + } + } + + item.classList.toggle('current', match); + if (link) { + link.classList.toggle('current', match); + if (match) { + link.setAttribute('aria-current', 'page'); + } else { + link.removeAttribute('aria-current'); + } + } + }); + } + + // Point the address bar at the page of the tab, so a reload or a copied link opens it. + function updateUrl(tabId) { + var page = tabPages[tabId]; + + if (! page || ! window.history || ! window.history.replaceState) { + return; + } + + var url = new URL(window.location.href); + url.search = ''; + url.hash = ''; + url.searchParams.set('page', page); + window.history.replaceState(null, '', url.toString()); + } + function activateTab(tabId) { var found = false; @@ -693,11 +750,14 @@ function activateTab(tabId) { btn.classList.toggle('is-active', active); btn.setAttribute('aria-selected', active ? 'true' : 'false'); }); + + syncMenu(tabId); } tabButtons.forEach(function (btn) { btn.addEventListener('click', function () { activateTab(btn.getAttribute('data-tab-target')); + updateUrl(btn.getAttribute('data-tab-target')); }); }); @@ -713,6 +773,10 @@ function activateTab(tabId) { }); var initialTab = 'blocks'; + var defaultTab = wrapper ? wrapper.getAttribute('data-default-tab') : ''; + if (defaultTab && document.querySelector('[data-tab-panel=\"' + defaultTab + '\"]')) { + initialTab = defaultTab; + } var hash = window.location.hash.replace('#', ''); if (hash === 'frontblocks_section_license') { hash = 'license'; @@ -722,6 +786,17 @@ function activateTab(tabId) { } activateTab(initialTab); + // A link to a tab with a #hash, followed while the screen is open. + window.addEventListener('hashchange', function () { + var next = window.location.hash.replace('#', ''); + if (next === 'frontblocks_section_license') { + next = 'license'; + } + if (next && document.querySelector('[data-tab-panel=\"' + next + '\"]')) { + activateTab(next); + } + }); + // Keep the active tab across a save (WordPress redirects back to // the referring URL after options.php processes the form). var form = document.getElementById('frbl-settings-form'); @@ -808,18 +883,163 @@ function markDirty() { } /** - * Register options page as dedicated menu. + * Slug of the settings page, and of its first tab. + * + * @since 1.6.0 + * @var string + */ + const PAGE_SLUG = 'frontblocks-settings'; + + /** + * Tab that opens when none is requested. + * + * @since 1.6.0 + * @var string + */ + const DEFAULT_TAB = 'blocks'; + + /** + * Capability needed to open the settings screen and its menu. + * + * @since 1.6.0 + * @var string + */ + const CAPABILITY = 'edit_theme_options'; + + /** + * Slug of the menu page that opens a tab. + * + * The first tab uses the slug of the menu itself, every other tab adds its id. + * + * @since 1.6.0 + * @param string $tab Tab id, empty for the first tab. + * @return string + */ + public static function get_page_slug( $tab = '' ) { + $tab = sanitize_key( $tab ); + + return '' === $tab || self::DEFAULT_TAB === $tab ? self::PAGE_SLUG : self::PAGE_SLUG . '-' . $tab; + } + + /** + * Tab id behind the slug of a menu page. + * + * @since 1.6.0 + * @param string $page Menu page slug. + * @return string The tab id, or an empty string when the slug is not a settings page. + */ + public static function get_tab_from_page( $page ) { + if ( ! is_string( $page ) ) { + return ''; + } + + if ( self::PAGE_SLUG === $page ) { + return self::DEFAULT_TAB; + } + + $prefix = self::PAGE_SLUG . '-'; + + return 0 === strpos( $page, $prefix ) ? substr( $page, strlen( $prefix ) ) : ''; + } + + /** + * URL of the settings screen, optionally on a given tab. + * + * Use it instead of building the URL by hand, so a link keeps working wherever the menu is. + * + * @since 1.6.0 + * @param string $tab Tab id, empty for the first tab. + * @return string + */ + public static function get_settings_url( $tab = '' ) { + return admin_url( 'admin.php?page=' . self::get_page_slug( $tab ) ); + } + + /** + * Whether an admin screen ID (or hook suffix) is one of the settings screens. + * + * It matches the screens of every tab, and the one the page had under Appearance. + * + * @since 1.6.0 + * @param mixed $screen_id Screen ID or hook suffix. + * @return bool + */ + public static function is_settings_screen( $screen_id ) { + return is_string( $screen_id ) && false !== strpos( $screen_id, self::PAGE_SLUG ); + } + + /** + * Register the FrontBlocks menu, with a submenu for each tab. * * @return void */ public function register_menu() { - add_theme_page( + $icon_path = FRBL_PLUGIN_PATH . 'assets/admin/icons/icon-menu.svg'; + $icon = file_exists( $icon_path ) ? FRBL_PLUGIN_URL . 'assets/admin/icons/icon-menu.svg' : 'dashicons-block-default'; + + // The page callback goes on the first submenu, so the page is not rendered twice. + add_menu_page( __( 'FrontBlocks Settings', 'frontblocks' ), __( 'FrontBlocks', 'frontblocks' ), - 'edit_theme_options', - $this->page_slug, - array( $this, 'render_page' ) + self::CAPABILITY, + self::PAGE_SLUG, + '', + $icon, + 60.5 ); + + foreach ( $this->get_tabs() as $tab ) { + if ( ! isset( $tab['id'], $tab['label'] ) || ! is_string( $tab['id'] ) || ! is_string( $tab['label'] ) || '' === $tab['id'] ) { + continue; + } + + // A companion plugin can keep a tab out of the menu with 'menu' => false. + if ( isset( $tab['menu'] ) && false === $tab['menu'] ) { + continue; + } + + add_submenu_page( + self::PAGE_SLUG, + /* translators: %s: name of the settings tab, for example Backup */ + sprintf( __( 'FrontBlocks: %s', 'frontblocks' ), $tab['label'] ), + $tab['label'], + self::CAPABILITY, + self::get_page_slug( $tab['id'] ), + array( $this, 'render_page' ) + ); + } + } + + /** + * Send the old settings URL, under Appearance, to the FrontBlocks menu. + * + * Bookmarks, links in other plugins and the notices of older versions point at + * themes.php?page=frontblocks-settings. The query arguments and the #tab of the + * old link are kept, so a link that opened a tab or showed a notice still does. + * + * @since 1.6.0 + * @return void + */ + public function redirect_legacy_url() { + global $pagenow; + + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only reads the page being asked for, nothing is processed. + $page = isset( $_GET['page'] ) && is_string( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; + + if ( 'themes.php' !== $pagenow || self::PAGE_SLUG !== $page || ! current_user_can( self::CAPABILITY ) ) { + return; + } + + $args = array(); + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only forwards sanitized values to the new URL. + foreach ( $_GET as $key => $value ) { + if ( 'page' !== $key && is_string( $value ) ) { + $args[ sanitize_key( $key ) ] = sanitize_text_field( wp_unslash( $value ) ); + } + } + + wp_safe_redirect( add_query_arg( $args, self::get_settings_url() ) ); + exit; } /** @@ -1179,30 +1399,13 @@ function () use ( $frblp_license ) { } /** - * Render settings page. + * Tabs of the settings screen, which are also the entries of the submenu. * - * @return void + * @since 1.6.0 + * @param array $counts Tab id => array( toggles on, toggles total ), to show next to a tab. The settings fields they come from exist once the page renders, not when the menu is registered. + * @return array */ - public function render_page() { - if ( ! current_user_can( 'edit_theme_options' ) ) { - return; - } - - global $wp_settings_sections; - - $sections = isset( $wp_settings_sections[ $this->page_slug ] ) ? (array) $wp_settings_sections[ $this->page_slug ] : array(); - $has_cpt_tab = false; - - foreach ( $sections as $section ) { - if ( 'frontblocks_section_custom_post_types' === $section['id'] ) { - $has_cpt_tab = true; - break; - } - } - - list( $features_on, $features_total ) = $this->count_section_toggles( 'frontblocks_section_features' ); - list( $woo_on, $woo_total ) = $this->count_section_toggles( 'frontblocks_section_woocommerce_features' ); - + private function get_tabs( $counts = array() ) { $tabs = array( array( 'id' => 'blocks', @@ -1215,8 +1418,6 @@ public function render_page() { array( 'id' => 'optional', 'label' => __( 'Optional features', 'frontblocks' ), - 'on' => $features_on, - 'total' => $features_total, ), array( 'id' => 'image-management', @@ -1229,8 +1430,6 @@ public function render_page() { array( 'id' => 'woocommerce', 'label' => __( 'WooCommerce', 'frontblocks' ), - 'on' => $woo_on, - 'total' => $woo_total, ), array( 'id' => 'cookies', @@ -1250,19 +1449,72 @@ public function render_page() { ), ); + foreach ( $tabs as $index => $tab ) { + if ( isset( $counts[ $tab['id'] ] ) ) { + $tabs[ $index ]['on'] = $counts[ $tab['id'] ][0]; + $tabs[ $index ]['total'] = $counts[ $tab['id'] ][1]; + } + } + /** * Filters the settings tabs displayed in the FrontBlocks admin screen. * * Companion plugins can add a tab by appending an array with an `id` and * `label` key, then render its matching panel on - * `frontblocks_settings_tab_panels`. + * `frontblocks_settings_tab_panels`. Every tab also gets an entry in the + * FrontBlocks menu. Add `'menu' => false` to keep a tab out of it. * * @since 1.5.3 * @param array $tabs Settings tabs. */ $tabs = apply_filters( 'frontblocks_settings_tabs', $tabs ); + + return is_array( $tabs ) ? $tabs : array(); + } + + /** + * Render settings page. + * + * @return void + */ + public function render_page() { + if ( ! current_user_can( 'edit_theme_options' ) ) { + return; + } + + global $wp_settings_sections; + + $sections = isset( $wp_settings_sections[ $this->page_slug ] ) ? (array) $wp_settings_sections[ $this->page_slug ] : array(); + $has_cpt_tab = false; + + foreach ( $sections as $section ) { + if ( 'frontblocks_section_custom_post_types' === $section['id'] ) { + $has_cpt_tab = true; + break; + } + } + + list( $features_on, $features_total ) = $this->count_section_toggles( 'frontblocks_section_features' ); + list( $woo_on, $woo_total ) = $this->count_section_toggles( 'frontblocks_section_woocommerce_features' ); + + $tabs = $this->get_tabs( + array( + 'optional' => array( $features_on, $features_total ), + 'woocommerce' => array( $woo_on, $woo_total ), + ) + ); + + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only reads which tab to open first, nothing is processed. + $requested_page = isset( $_GET['page'] ) && is_string( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : self::PAGE_SLUG; + $default_tab = self::get_tab_from_page( $requested_page ); + $tab_pages = array(); + foreach ( $tabs as $tab ) { + if ( isset( $tab['id'] ) && is_string( $tab['id'] ) ) { + $tab_pages[ $tab['id'] ] = self::get_page_slug( $tab['id'] ); + } + } ?> -