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
|
// Handle option updates
|
||||||
function updateOption(option, value) {
|
function updateOption(option, value) {
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
url: ajaxurl,
|
url: wpSeoProStack.ajaxurl,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
action: 'wp_seoprostack_update_option',
|
action: 'wp_seoprostack_update_option',
|
||||||
@ -45,70 +45,70 @@ jQuery(document).ready(function($) {
|
|||||||
return response;
|
return response;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Toggle sections
|
// Toggle sections
|
||||||
$('.seoprostack-toggle-header').on('click', function() {
|
$('.seoprostack-toggle-header').on('click', function() {
|
||||||
$(this).toggleClass('active');
|
$(this).toggleClass('active');
|
||||||
$(this).next('.seoprostack-toggle-settings').slideToggle(300);
|
$(this).next('.seoprostack-toggle-settings').slideToggle(300);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tabs functionality (if not using WP default tabs)
|
// Tabs functionality (if not using WP default tabs)
|
||||||
$('.seoprostack-tab-nav a').on('click', function(e) {
|
$('.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();
|
e.preventDefault();
|
||||||
var targetTab = $(this).attr('href').substring(1);
|
|
||||||
|
|
||||||
// Update active tab
|
var category = $(this).data('category');
|
||||||
$('.seoprostack-tab-nav a').removeClass('active');
|
|
||||||
|
// Update active filter
|
||||||
|
$('.seoprostack-category-filter a').removeClass('active');
|
||||||
$(this).addClass('active');
|
$(this).addClass('active');
|
||||||
|
|
||||||
// Show target tab content
|
// Show loading
|
||||||
$('.seoprostack-tab-content').hide();
|
$('#seoprostack-plugins-grid').addClass('loading');
|
||||||
$('#' + targetTab).show();
|
|
||||||
|
|
||||||
// Update URL without refreshing
|
// Load plugins
|
||||||
if (history.pushState) {
|
$.ajax({
|
||||||
var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?page=seoprostack&tab=' + targetTab;
|
url: wpSeoProStack.ajaxurl,
|
||||||
window.history.pushState({path: newUrl}, '', newUrl);
|
type: 'POST',
|
||||||
}
|
data: {
|
||||||
});
|
action: 'wp_seoprostack_get_plugins',
|
||||||
|
category: category,
|
||||||
|
nonce: wpSeoProStack.nonce
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
$('#seoprostack-plugins-grid').removeClass('loading');
|
||||||
|
|
||||||
// Pro Plugins Tab
|
if (response.success) {
|
||||||
if ($('#pro-plugins').length) {
|
renderPlugins(response.data.plugins);
|
||||||
// Category filter
|
} else {
|
||||||
$('.seoprostack-category-filter a').on('click', function(e) {
|
$('#seoprostack-plugins-grid').html('<div class="seoprostack-notice seoprostack-notice-error">' + response.data.message + '</div>');
|
||||||
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>');
|
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
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
|
// Activate plugin
|
||||||
|
@ -47,7 +47,7 @@ function seoprostack_activate() {
|
|||||||
register_activation_hook( __FILE__, 'seoprostack_activate' );
|
register_activation_hook( __FILE__, 'seoprostack_activate' );
|
||||||
|
|
||||||
// Load core functionality
|
// 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
|
// Load admin UI and configurations
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
|
Reference in New Issue
Block a user