', '' ); } return $message; }, 10, 2 ); add_filter( 'adminoptim_notification_banner_content_' . self::SECTION_ID, static function (): array { $content = [ [ 'message' => sprintf( /* translators: 1: Opening strong tag, 2: Closing strong tag. */ __( '%1$sFewer unnecessary scripts, cleaner database, better control over WordPress background activity%2$s Leave a ★★★★★ review on WordPress.org and help others to keep WordPress running smoothly.', 'admin-optimizer' ), '', '' ), 'cta_type' => 'review', ], [ 'message' => sprintf( /* translators: 1: Opening strong tag, 2: Closing strong tag. */ __( '%1$sHaving issues with Admin Optimizer performance tools?%2$s', 'admin-optimizer' ), '', '' ), 'cta_type' => 'support', ], ]; return $content[ wp_rand( 0, 1 ) ]; }, ); } /** * Remove emoji CDN hostname from DNS prefetching hints. * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed for. * * @return array Difference between the two arrays. */ public function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) { if ( 'dns-prefetch' === $relation_type ) { /** This filter is documented in wp-includes/formatting.php */ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound, PluginCheck.CodeAnalysis.Offloading.OffloadedContent -- Removing WP core's own emoji CDN URL from DNS-prefetch hints, not offloading to it. $emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' ); $urls = array_diff( $urls, [ $emoji_svg_url ] ); } return $urls; } /** * Disable jQuery Migrate. * * @param \WP_Scripts $scripts WP_Scripts instance. * * @return void */ public function dequeue_jquery_migrate( $scripts ) { if ( ! is_admin() && ! empty( $scripts->registered['jquery'] ) ) { $scripts->registered['jquery']->deps = array_diff( $scripts->registered['jquery']->deps, [ 'jquery-migrate' ] ); } } /** * Ordinary module IDs this Section owns, mapped to their navigation labels. * * @return array */ protected function section_nav_modules(): array { return [ 'db_cleaner' => 'Database Cleaner', 'heartbeat_control' => 'Heartbeat Control', ]; } /** * Section-owned "Enhancements" presentation group of lightweight * SECTION_FEATURE capabilities. * * @return array{label:string,description:string,members:array} */ protected function section_feature_group(): ?array { return [ 'label' => __( 'Enhancements', 'admin-optimizer' ), 'description' => __( 'Improve WordPress performance and frontend efficiency by removing unnecessary scripts, features, and overhead.', 'admin-optimizer' ), 'members' => [ 'disable_emojis', 'disable_jquery_migrate', 'disable_404_redirect', 'remove_oembed', ], ]; } }