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:
2025-04-19 13:12:37 +01:00
parent 2870a43ae5
commit f65d648a82
26 changed files with 2191 additions and 1591 deletions
+7 -7
View File
@@ -38,7 +38,7 @@ class WP_Allstars_Tools_Manager {
// Add inline CSS for tools to match the single column layout
$custom_css = '
#tools .wpa-pro-plugins {
#tools .wpallstars-pro-plugins {
padding: 15px 20px;
display: flex;
flex-direction: column;
@@ -46,7 +46,7 @@ class WP_Allstars_Tools_Manager {
max-width: 700px;
margin: 0 auto;
}
#tools .wpa-pro-plugin {
#tools .wpallstars-pro-plugin {
background: #fff;
border: 1px solid #ddd;
padding: 24px;
@@ -59,14 +59,14 @@ class WP_Allstars_Tools_Manager {
margin-bottom: 24px;
max-width: 100%;
}
#tools .wpa-pro-plugin:last-child {
#tools .wpallstars-pro-plugin:last-child {
margin-bottom: 0;
}
#tools .wpa-pro-plugin:hover {
#tools .wpallstars-pro-plugin:hover {
border-color: #2271b1;
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
#tools .wpa-pro-plugin .button-group {
#tools .wpallstars-pro-plugin .button-group {
justify-content: flex-start;
}
';
@@ -96,7 +96,7 @@ class WP_Allstars_Tools_Manager {
?>
<div class="wp-allstars-settings-content tab-content" id="tools">
<div class="wpa-pro-plugins">
<div class="wpallstars-pro-plugins">
<?php
foreach ($tools as $tool) {
self::display_tool_card(self::sanitize_tool_data($tool));
@@ -118,7 +118,7 @@ class WP_Allstars_Tools_Manager {
return;
}
?>
<div class="wpa-pro-plugin">
<div class="wpallstars-pro-plugin">
<h3><?php echo esc_html($tool['name']); ?></h3>
<?php if (!empty($tool['description'])): ?>