array( 'advanced-custom-fields', 'admin-menu-editor', 'antispam-bee', 'burst-statistics', 'freesoul-deactivate-plugins', 'plugin-toggle', 'pretty-links', 'seo-by-rank-math', 'turnstile' ), 'advanced' => array( 'fluent-crm', 'fluentform', 'fluent-smtp', 'fluent-support' ), 'ecommerce' => array( 'woocommerce', 'client-booking' ), 'lms' => array( 'tutor' ) ); } // Add transient caching for plugin data function wpa_superstar_get_cached_plugins($category) { $cache_key = 'wpa_superstar_plugins_' . $category; $cached_data = get_transient($cache_key); if ($cached_data !== false) { return $cached_data; } return false; } function wpa_superstar_set_cached_plugins($category, $data) { $cache_key = 'wpa_superstar_plugins_' . $category; set_transient($cache_key, $data, 12 * HOUR_IN_SECONDS); } // Filter plugins API to show only our recommended plugins function wpa_superstar_plugins_api_result($res, $action, $args) { // Only filter if we're on our plugin page and it's a plugin query if (!is_admin() || empty($_GET['page']) || $_GET['page'] !== 'wpa-superstar' || $action !== 'query_plugins') { return $res; } // Get the current category $category = isset($_GET['category']) ? sanitize_key($_GET['category']) : 'minimal'; // Try to get cached data first $cached_data = wpa_superstar_get_cached_plugins($category); if ($cached_data !== false) { return $cached_data; } $recommended_plugins = wpa_superstar_get_recommended_plugins(); // Check if category exists and has plugins if (!isset($recommended_plugins[$category]) || empty($recommended_plugins[$category])) { return $res; } try { // Get plugin data for each slug individually to prevent timeouts $plugins = array(); foreach ($recommended_plugins[$category] as $slug) { $plugin_data = plugins_api('plugin_information', array( 'slug' => $slug, 'fields' => array( 'short_description' => true, 'sections' => false, 'requires' => true, 'rating' => true, 'ratings' => false, 'downloaded' => true, 'last_updated' => true, 'added' => false, 'tags' => false, 'compatibility' => false, 'homepage' => true, 'versions' => false, 'donate_link' => false, 'reviews' => false, 'banners' => false, 'icons' => true, 'active_installs' => true, 'group' => false, 'contributors' => false, ) )); if (!is_wp_error($plugin_data)) { $plugins[] = $plugin_data; } } // Create a valid response object $res = (object) array( 'info' => array( 'page' => 1, 'pages' => 1, 'results' => count($plugins), ), 'plugins' => $plugins ); // Cache the results wpa_superstar_set_cached_plugins($category, $res); return $res; } catch (Exception $e) { return $res; } } add_filter('plugins_api_result', 'wpa_superstar_plugins_api_result', 10, 3); // Settings page HTML function wpa_superstar_settings_page() { global $tabs; $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'recommended'; $active_category = isset($_GET['category']) ? $_GET['category'] : 'minimal'; // Ensure required files are loaded if ($active_tab === 'recommended') { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; wp_enqueue_script('plugin-install'); wp_enqueue_script('updates'); add_thickbox(); } ?>

Version
prepare_items(); $wp_list_table->display(); ?>