array_map_recursive( function( $value ) { return sanitize_text_field( wp_unslash( $value ) ); }, (array) $_GET[ static::DEBUG_PARAM ] ); //phpcs:ignore -- Input is sanitized. // Do not allow passing a non-public post type. if ( isset( $overrides['post_type'] ) ) { $type = get_post_type_object( $overrides['post_type'] ); if ( null !== $type && ! $type->public ) { unset( $overrides['post_type'] ); } } // Adjust global excluded categories. if ( isset( $overrides['excludedCategories'] ) ) { add_filter( 'advanced-sidebar-menu/meta/category-meta/excluded-term-ids', function() use ( $overrides ) { return $overrides['excludedCategories']; }, 100 ); } // Adjust global excluded pages. if ( isset( $overrides['excluded_pages'] ) ) { add_filter( 'advanced-sidebar-menu/meta/page-meta/excluded-page-ids', function() use ( $overrides ) { return $overrides['excluded_pages']; }, 100 ); } return wp_parse_args( $overrides, $instance ); } /** * Get information about the current site. * * 1. PHP version. * 2. Plugin version. * 3. WP version. * 4. PRO version. * 5. Script debug active. * 6. Classic widgets enabled. * * @since 9.0.2 * * @phpstan-return array{ * basic: string, * classicWidgets: bool, * php: string, * pro: string|false, * scriptDebug: bool, * WordPress: string, * pro?: string * } * * @return array */ public function get_site_info(): array { if ( ! \function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $data = [ 'basic' => ADVANCED_SIDEBAR_MENU_BASIC_VERSION, 'classicWidgets' => is_plugin_active( 'classic-widgets/classic-widgets.php' ), 'php' => PHP_VERSION, 'pro' => false, 'scriptDebug' => Scripts::instance()->is_script_debug_enabled(), 'WordPress' => get_bloginfo( 'version' ), ]; $current_post = get_queried_object(); if ( $current_post instanceof \WP_Post ) { $data['classicEditor'] = ! use_block_editor_for_post( $current_post ); } if ( \defined( 'ADVANCED_SIDEBAR_MENU_PRO_VERSION' ) ) { $data['pro'] = ADVANCED_SIDEBAR_MENU_PRO_VERSION; } return $data; } /** * Print the widget settings as a JS variable. * * @param Menu_Abstract> $menu - Menu class. * @param Page|Category $widget - Widget class. * * @return void */ public function print_instance( $menu, $widget ) { $data = apply_filters( 'advanced-sidebar-menu/debug/print-instance', $this->get_site_info(), $menu, $widget ); ?>