Fix tab navigation and plugin/theme loading issues
This commit is contained in:
@ -199,7 +199,7 @@ function wp_allstars_ajax_get_plugins() {
|
||||
wp_die(-1);
|
||||
}
|
||||
|
||||
$category = isset($_GET['category']) ? sanitize_key($_GET['category']) : 'minimal';
|
||||
$category = isset($_POST['category']) ? sanitize_key($_POST['category']) : 'minimal';
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
|
||||
@ -446,7 +446,7 @@ function wp_allstars_set_cached_theme($data) {
|
||||
}
|
||||
|
||||
// Add AJAX endpoint for theme
|
||||
function wp_allstars_ajax_get_theme() {
|
||||
function wp_allstars_ajax_get_themes() {
|
||||
// Check nonce with the correct action name
|
||||
if (!check_ajax_referer('wp-allstars-nonce', '_wpnonce', false)) {
|
||||
wp_send_json_error('Invalid security token sent.');
|
||||
@ -506,60 +506,6 @@ function wp_allstars_ajax_get_theme() {
|
||||
// Generate custom HTML for the theme
|
||||
ob_start();
|
||||
?>
|
||||
<style>
|
||||
.theme-browser .theme {
|
||||
cursor: pointer;
|
||||
float: none;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border: 1px solid #dcdcde;
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.theme-browser .theme .theme-screenshot {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
}
|
||||
.theme-browser .theme .theme-screenshot img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.theme-browser .theme .theme-name {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
height: 48px;
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
box-shadow: inset 0 1px 0 rgba(0,0,0,.1);
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
background: #f6f7f7;
|
||||
position: relative;
|
||||
}
|
||||
.theme-browser .theme .theme-actions {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: auto;
|
||||
height: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
padding: 20px 0;
|
||||
}
|
||||
.theme-browser .theme .theme-actions .button {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<div class="theme-browser">
|
||||
<div class="themes wp-clearfix">
|
||||
<div class="theme" tabindex="0">
|
||||
@ -573,11 +519,11 @@ function wp_allstars_ajax_get_theme() {
|
||||
<?php
|
||||
$installed_theme = wp_get_theme('kadence');
|
||||
if ($installed_theme->exists()): ?>
|
||||
<button type="button" class="button button-primary activate-theme" data-slug="kadence">
|
||||
<button type="button" class="button button-primary activate-now" data-slug="kadence">
|
||||
<?php esc_html_e('Activate'); ?>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button type="button" class="button button-primary install-theme" data-slug="kadence">
|
||||
<button type="button" class="button button-primary install-now" data-slug="kadence">
|
||||
<?php esc_html_e('Install'); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
@ -611,7 +557,7 @@ function wp_allstars_ajax_get_theme() {
|
||||
wp_send_json_error('Theme loading error: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
add_action('wp_ajax_wp_allstars_get_theme', 'wp_allstars_ajax_get_theme');
|
||||
add_action('wp_ajax_wp_allstars_get_themes', 'wp_allstars_ajax_get_themes');
|
||||
|
||||
// Clear theme cache when themes are updated
|
||||
function wp_allstars_clear_theme_cache() {
|
||||
@ -695,22 +641,22 @@ function wp_allstars_settings_page() {
|
||||
<div class="wpa-settings-container">
|
||||
<div class="wp-allstars-nav">
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<a href="?page=wp-allstars&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>">
|
||||
<a href="?page=wp-allstars&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>" data-tab="general">
|
||||
<?php esc_html_e('General', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=advanced" class="nav-tab <?php echo $active_tab == 'advanced' ? 'nav-tab-active' : ''; ?>">
|
||||
<a href="?page=wp-allstars&tab=advanced" class="nav-tab <?php echo $active_tab == 'advanced' ? 'nav-tab-active' : ''; ?>" data-tab="advanced">
|
||||
<?php esc_html_e('Advanced', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=workflow" class="nav-tab <?php echo $active_tab == 'workflow' ? 'nav-tab-active' : ''; ?>">
|
||||
<a href="?page=wp-allstars&tab=workflow" class="nav-tab <?php echo $active_tab == 'workflow' ? 'nav-tab-active' : ''; ?>" data-tab="workflow">
|
||||
<?php esc_html_e('Workflow', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended" class="nav-tab <?php echo $active_tab == 'recommended' ? 'nav-tab-active' : ''; ?>">
|
||||
<a href="?page=wp-allstars&tab=recommended" class="nav-tab <?php echo $active_tab == 'recommended' ? 'nav-tab-active' : ''; ?>" data-tab="recommended">
|
||||
<?php esc_html_e('Free Plugins', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=pro" class="nav-tab <?php echo $active_tab == 'pro' ? 'nav-tab-active' : ''; ?>">
|
||||
<a href="?page=wp-allstars&tab=pro" class="nav-tab <?php echo $active_tab == 'pro' ? 'nav-tab-active' : ''; ?>" data-tab="pro">
|
||||
<?php esc_html_e('Pro Plugins', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=theme" class="nav-tab <?php echo $active_tab == 'theme' ? 'nav-tab-active' : ''; ?>">
|
||||
<a href="?page=wp-allstars&tab=theme" class="nav-tab <?php echo $active_tab == 'theme' ? 'nav-tab-active' : ''; ?>" data-tab="theme">
|
||||
<?php esc_html_e('Theme', 'wp-allstars'); ?>
|
||||
</a>
|
||||
</h2>
|
||||
@ -718,7 +664,7 @@ function wp_allstars_settings_page() {
|
||||
|
||||
<div class="wpa-settings-content">
|
||||
<?php if ($active_tab == 'workflow'): ?>
|
||||
<div class="wp-allstars-settings-content">
|
||||
<div class="wp-allstars-settings-content tab-content" id="workflow">
|
||||
<div class="wp-allstars-toggle">
|
||||
<div class="wp-allstars-toggle-header" aria-expanded="false">
|
||||
<div class="wp-allstars-toggle-main">
|
||||
@ -797,88 +743,77 @@ function wp_allstars_settings_page() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php elseif ($active_tab == 'theme'): ?>
|
||||
<div class="tab-content" id="theme">
|
||||
<div class="wp-list-table-container">
|
||||
<div class="wpa-loading-overlay">
|
||||
<span class="spinner is-active"></span>
|
||||
</div>
|
||||
<div id="wpa-theme-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php elseif ($active_tab == 'recommended'): ?>
|
||||
<div class="wpa-plugin-filters">
|
||||
<a href="?page=wp-allstars&tab=recommended&category=minimal"
|
||||
class="button <?php echo $active_category == 'minimal' ? 'button-primary' : ''; ?>">
|
||||
<div class="tab-content" id="recommended">
|
||||
<div id="wpa-plugin-filters" class="wp-filter">
|
||||
<ul class="filter-links">
|
||||
<li><a href="#" data-category="minimal" class="<?php echo $active_category == 'minimal' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Minimal', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=admin"
|
||||
class="button <?php echo $active_category == 'admin' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="admin" class="<?php echo $active_category == 'admin' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Admin', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=ai"
|
||||
class="button <?php echo $active_category == 'ai' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="ai" class="<?php echo $active_category == 'ai' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('AI', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=cms"
|
||||
class="button <?php echo $active_category == 'cms' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="cms" class="<?php echo $active_category == 'cms' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('CMS', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=compliance"
|
||||
class="button <?php echo $active_category == 'compliance' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="compliance" class="<?php echo $active_category == 'compliance' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Compliance', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=crm"
|
||||
class="button <?php echo $active_category == 'crm' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="crm" class="<?php echo $active_category == 'crm' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('CRM', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=ecommerce"
|
||||
class="button <?php echo $active_category == 'ecommerce' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="ecommerce" class="<?php echo $active_category == 'ecommerce' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Ecommerce', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=lms"
|
||||
class="button <?php echo $active_category == 'lms' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="lms" class="<?php echo $active_category == 'lms' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('LMS', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=media"
|
||||
class="button <?php echo $active_category == 'media' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="media" class="<?php echo $active_category == 'media' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Media', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=seo"
|
||||
class="button <?php echo $active_category == 'seo' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="seo" class="<?php echo $active_category == 'seo' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('SEO', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=setup"
|
||||
class="button <?php echo $active_category == 'setup' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="setup" class="<?php echo $active_category == 'setup' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Setup', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=social"
|
||||
class="button <?php echo $active_category == 'social' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="social" class="<?php echo $active_category == 'social' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Social', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=speed"
|
||||
class="button <?php echo $active_category == 'speed' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="speed" class="<?php echo $active_category == 'speed' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Speed', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=translation"
|
||||
class="button <?php echo $active_category == 'translation' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="translation" class="<?php echo $active_category == 'translation' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Translation', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=advanced"
|
||||
class="button <?php echo $active_category == 'advanced' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="advanced" class="<?php echo $active_category == 'advanced' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Advanced', 'wp-allstars'); ?>
|
||||
</a>
|
||||
<a href="?page=wp-allstars&tab=recommended&category=debug"
|
||||
class="button <?php echo $active_category == 'debug' ? 'button-primary' : ''; ?>">
|
||||
</a></li>
|
||||
<li><a href="#" data-category="debug" class="<?php echo $active_category == 'debug' ? 'current' : ''; ?>">
|
||||
<?php esc_html_e('Debug', 'wp-allstars'); ?>
|
||||
</a>
|
||||
</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wp-list-table-container">
|
||||
<div class="wpa-loading-overlay">
|
||||
<span class="spinner is-active"></span>
|
||||
</div>
|
||||
<div class="wp-allstars-plugin-browser">
|
||||
<div id="wpa-plugin-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php elseif ($active_tab == 'pro'): ?>
|
||||
<div class="tab-content" id="pro">
|
||||
<div class="wpa-pro-plugins">
|
||||
<?php
|
||||
$pro_plugins = wp_allstars_get_pro_plugins_config();
|
||||
@ -1013,7 +948,9 @@ function wp_allstars_settings_page() {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</div>
|
||||
<?php elseif ($active_tab == 'general'): ?>
|
||||
<div class="tab-content" id="general">
|
||||
<div class="wp-allstars-settings-section">
|
||||
<div class="wp-allstars-settings-grid">
|
||||
<!-- Example of a simple toggle setting (no panel) -->
|
||||
@ -1043,6 +980,7 @@ function wp_allstars_settings_page() {
|
||||
</div>
|
||||
</div>
|
||||
<?php elseif ($active_tab == 'advanced'): ?>
|
||||
<div class="tab-content" id="advanced">
|
||||
<div class="wp-allstars-settings-section">
|
||||
<div class="wp-allstars-settings-grid">
|
||||
<!-- Example of an expandable panel setting -->
|
||||
|
Reference in New Issue
Block a user