diff --git a/admin/includes/class-admin-manager.php b/admin/includes/class-admin-manager.php index 3f1f03a..dd7ea87 100644 --- a/admin/includes/class-admin-manager.php +++ b/admin/includes/class-admin-manager.php @@ -74,4 +74,143 @@ class WP_Allstars_Admin_Manager { 'wp_allstars_settings_page' ); } + + /** + * Render the settings page + */ + public static function render_settings_page() { + global $tabs; + + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'general'; + $active_category = isset($_GET['category']) ? $_GET['category'] : 'minimal'; + + // Clear cache and load required files + if ($active_tab === 'recommended') { + WP_Allstars_Plugin_Manager::clear_plugin_cache(); + require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; + wp_enqueue_script('plugin-install'); + wp_enqueue_script('updates'); + add_thickbox(); + wp_enqueue_style('wp-allstars-admin', plugins_url('css/wp-allstars-admin.css', dirname(__FILE__))); + wp_enqueue_style('wp-allstars-plugins', plugins_url('css/wp-allstars-plugins.css', dirname(__FILE__))); + + // Add inline script to load plugins on page load + wp_add_inline_script('wp-allstars-admin', ' + jQuery(document).ready(function($) { + if ($("#wpa-plugin-list").length && $("#wpa-plugin-list").is(":empty")) { + var category = "' . esc_js($active_category) . '"; + var $container = $("#wpa-plugin-list"); + var $loadingOverlay = $("
"); + + // Show loading overlay + $container.css("position", "relative").append($loadingOverlay); + + // AJAX request to get plugins + $.ajax({ + url: ajaxurl, + type: "POST", + data: { + action: "wp_allstars_get_plugins", + category: category, + _wpnonce: wpAllstars.nonce + }, + success: function(response) { + $loadingOverlay.remove(); + if (response.success) { + $container.html(response.data); + // Initialize plugin action buttons + if (typeof initPluginActions === "function") { + initPluginActions(); + } + + // Spinners have been removed from individual cards + } else { + $container.html("" + response.data + "
Failed to load plugins. Please try again. Error: " + error + "
" + response.data + "
Failed to load plugins. Please try again. Error: " + error + "
- -
-- %filename%, %post_id%, %postname%, %timestamp%, %date%, %year%, %month%, %day% -
-- %filename%, %post_title%, %post_id%, %postname%, %timestamp% -
-