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
@@ -24,7 +24,7 @@ class WP_Allstars_Hosting_Manager {
public static function display_tab_content() {
?>
<div class="wp-allstars-settings-content tab-content" id="hosting">
<div class="wpa-pro-plugins">
<div class="wpallstars-pro-plugins">
<?php
$hosting_providers = self::get_hosting_providers();
// Sort providers alphabetically by name
@@ -33,7 +33,7 @@ class WP_Allstars_Hosting_Manager {
});
foreach ($hosting_providers as $provider) {
?>
<div class="wpa-pro-plugin">
<div class="wpallstars-pro-plugin">
<h3><?php echo esc_html($provider['name']); ?></h3>
<p><?php echo esc_html($provider['description']); ?></p>
<?php if (isset($provider['button_group'])): ?>
@@ -100,7 +100,7 @@ class WP_Allstars_Hosting_Manager {
// Add inline CSS for hosting to match the single column layout
$custom_css = '
#hosting .wpa-pro-plugins {
#hosting .wpallstars-pro-plugins {
padding: 15px 20px;
display: flex;
flex-direction: column;
@@ -108,7 +108,7 @@ class WP_Allstars_Hosting_Manager {
max-width: 700px;
margin: 0 auto;
}
#hosting .wpa-pro-plugin {
#hosting .wpallstars-pro-plugin {
background: #fff;
border: 1px solid #ddd;
padding: 24px;
@@ -121,14 +121,14 @@ class WP_Allstars_Hosting_Manager {
margin-bottom: 24px;
max-width: 100%;
}
#hosting .wpa-pro-plugin:last-child {
#hosting .wpallstars-pro-plugin:last-child {
margin-bottom: 0;
}
#hosting .wpa-pro-plugin:hover {
#hosting .wpallstars-pro-plugin:hover {
border-color: #2271b1;
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
#hosting .wpa-pro-plugin .button-group {
#hosting .wpallstars-pro-plugin .button-group {
justify-content: flex-start;
}
';