Fix critical error in WordPress site
- Fixed incorrect path to auto-upload class file - Updated JavaScript to use proper AJAX URL reference - Fixed syntax and indentation issues in the admin JS file - Ensured correct class instantiation
This commit is contained in:
@ -30,7 +30,7 @@ jQuery(document).ready(function($) {
|
||||
// Handle option updates
|
||||
function updateOption(option, value) {
|
||||
return $.ajax({
|
||||
url: ajaxurl,
|
||||
url: wpSeoProStack.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wp_seoprostack_update_option',
|
||||
@ -45,70 +45,70 @@ jQuery(document).ready(function($) {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
// Toggle sections
|
||||
// Toggle sections
|
||||
$('.seoprostack-toggle-header').on('click', function() {
|
||||
$(this).toggleClass('active');
|
||||
$(this).next('.seoprostack-toggle-settings').slideToggle(300);
|
||||
});
|
||||
$(this).toggleClass('active');
|
||||
$(this).next('.seoprostack-toggle-settings').slideToggle(300);
|
||||
});
|
||||
|
||||
// Tabs functionality (if not using WP default tabs)
|
||||
$('.seoprostack-tab-nav a').on('click', function(e) {
|
||||
// Tabs functionality (if not using WP default tabs)
|
||||
$('.seoprostack-tab-nav a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var targetTab = $(this).attr('href').substring(1);
|
||||
|
||||
// Update active tab
|
||||
$('.seoprostack-tab-nav a').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
|
||||
// Show target tab content
|
||||
$('.seoprostack-tab-content').hide();
|
||||
$('#' + targetTab).show();
|
||||
|
||||
// Update URL without refreshing
|
||||
if (history.pushState) {
|
||||
var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?page=seoprostack&tab=' + targetTab;
|
||||
window.history.pushState({path: newUrl}, '', newUrl);
|
||||
}
|
||||
});
|
||||
|
||||
// Pro Plugins Tab
|
||||
if ($('#pro-plugins').length) {
|
||||
// Category filter
|
||||
$('.seoprostack-category-filter a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var targetTab = $(this).attr('href').substring(1);
|
||||
|
||||
// Update active tab
|
||||
$('.seoprostack-tab-nav a').removeClass('active');
|
||||
var category = $(this).data('category');
|
||||
|
||||
// Update active filter
|
||||
$('.seoprostack-category-filter a').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
|
||||
// Show target tab content
|
||||
$('.seoprostack-tab-content').hide();
|
||||
$('#' + targetTab).show();
|
||||
// Show loading
|
||||
$('#seoprostack-plugins-grid').addClass('loading');
|
||||
|
||||
// Update URL without refreshing
|
||||
if (history.pushState) {
|
||||
var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?page=seoprostack&tab=' + targetTab;
|
||||
window.history.pushState({path: newUrl}, '', newUrl);
|
||||
}
|
||||
});
|
||||
|
||||
// Pro Plugins Tab
|
||||
if ($('#pro-plugins').length) {
|
||||
// Category filter
|
||||
$('.seoprostack-category-filter a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var category = $(this).data('category');
|
||||
|
||||
// Update active filter
|
||||
$('.seoprostack-category-filter a').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
|
||||
// Show loading
|
||||
$('#seoprostack-plugins-grid').addClass('loading');
|
||||
|
||||
// Load plugins
|
||||
$.ajax({
|
||||
url: wpSeoProStack.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wp_seoprostack_get_plugins',
|
||||
category: category,
|
||||
nonce: wpSeoProStack.nonce
|
||||
},
|
||||
success: function(response) {
|
||||
$('#seoprostack-plugins-grid').removeClass('loading');
|
||||
|
||||
if (response.success) {
|
||||
renderPlugins(response.data.plugins);
|
||||
} else {
|
||||
$('#seoprostack-plugins-grid').html('<div class="seoprostack-notice seoprostack-notice-error">' + response.data.message + '</div>');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$('#seoprostack-plugins-grid').removeClass('loading');
|
||||
$('#seoprostack-plugins-grid').html('<div class="seoprostack-notice seoprostack-notice-error">Error connecting to server</div>');
|
||||
// Load plugins
|
||||
$.ajax({
|
||||
url: wpSeoProStack.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wp_seoprostack_get_plugins',
|
||||
category: category,
|
||||
nonce: wpSeoProStack.nonce
|
||||
},
|
||||
success: function(response) {
|
||||
$('#seoprostack-plugins-grid').removeClass('loading');
|
||||
|
||||
if (response.success) {
|
||||
renderPlugins(response.data.plugins);
|
||||
} else {
|
||||
$('#seoprostack-plugins-grid').html('<div class="seoprostack-notice seoprostack-notice-error">' + response.data.message + '</div>');
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
$('#seoprostack-plugins-grid').removeClass('loading');
|
||||
$('#seoprostack-plugins-grid').html('<div class="seoprostack-notice seoprostack-notice-error">Error connecting to server</div>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Activate plugin
|
||||
|
@ -47,7 +47,7 @@ function seoprostack_activate() {
|
||||
register_activation_hook( __FILE__, 'seoprostack_activate' );
|
||||
|
||||
// Load core functionality
|
||||
require_once SEOPROSTACK_PLUGIN_DIR . 'includes/class-seoprostack-auto-upload.php';
|
||||
require_once SEOPROSTACK_PLUGIN_DIR . 'includes/features/auto-upload/class-seoprostack-auto-upload.php';
|
||||
|
||||
// Load admin UI and configurations
|
||||
if ( is_admin() ) {
|
||||
|
Reference in New Issue
Block a user