Refactor(Admin): Implement Settings API & AJAX save for Settings Manager
- Refactored WPALLSTARS_Settings_Manager to use WordPress Settings API. - Stores settings in single 'wpallstars_options' array. - Implemented robust AJAX saving for specific settings (e.g., color scheme, auto-upload) via WPALLSTARS_Admin_Manager::update_option. - Updated JS and setting render functions for AJAX. - Corrected admin menu registration and script enqueue hooks. - Includes file renames from wp-allstars to wpallstars.
This commit is contained in:
@@ -50,15 +50,15 @@ class WP_Allstars_Free_Plugins_Manager {
|
||||
// Define all categories in the desired display order
|
||||
$priority_categories = array(
|
||||
'minimal', 'admin', 'affiliates', 'ai', 'cms',
|
||||
'compliance', 'crm', 'ecommerce', 'lms', 'media',
|
||||
'seo', 'setup', 'social', 'speed', 'translation',
|
||||
'compliance', 'crm', 'ecommerce', 'events', 'lms', 'media',
|
||||
'members', 'seo', 'setup', 'social', 'speed', 'translation',
|
||||
'advanced', 'debug'
|
||||
);
|
||||
|
||||
// Start HTML output
|
||||
?>
|
||||
<div class="wp-allstars-settings-content tab-content" id="recommended">
|
||||
<div id="wpa-plugin-filters" class="wp-filter">
|
||||
<div id="wpallstars-plugin-filters" class="wp-filter">
|
||||
<ul class="filter-links">
|
||||
<?php
|
||||
// First output priority categories
|
||||
@@ -100,7 +100,7 @@ class WP_Allstars_Free_Plugins_Manager {
|
||||
</div>
|
||||
|
||||
<div class="wp-allstars-plugin-browser" style="margin-top: 22px;">
|
||||
<div id="wpa-plugin-list" class="wpa-plugin-container" style="position: relative; min-height: 200px;">
|
||||
<div id="wpallstars-plugin-list" class="wpallstars-plugin-container" style="position: relative; min-height: 200px;">
|
||||
<!-- Plugin content will be loaded via AJAX -->
|
||||
<div class="wp-allstars-loading-overlay">
|
||||
<span class="spinner is-active"></span>
|
||||
@@ -112,14 +112,14 @@ class WP_Allstars_Free_Plugins_Manager {
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
// Filter tab click handler
|
||||
$('#wpa-plugin-filters .filter-links a').on('click', function(e) {
|
||||
$('#wpallstars-plugin-filters .filter-links a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var category = $(this).data('category');
|
||||
var $container = $('#wpa-plugin-list');
|
||||
var $container = $('#wpallstars-plugin-list');
|
||||
|
||||
// Update filter UI
|
||||
$('#wpa-plugin-filters .filter-links a').removeClass('current');
|
||||
$('#wpallstars-plugin-filters .filter-links a').removeClass('current');
|
||||
$(this).addClass('current');
|
||||
|
||||
// Create new loading overlay
|
||||
@@ -163,7 +163,7 @@ class WP_Allstars_Free_Plugins_Manager {
|
||||
});
|
||||
|
||||
// Load initial category (minimal or from URL)
|
||||
$('#wpa-plugin-filters .filter-links a.current').trigger('click');
|
||||
$('#wpallstars-plugin-filters .filter-links a.current').trigger('click');
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user