From a6fef6200f1526deee4304e7eaaea9e42f6c8b67 Mon Sep 17 00:00:00 2001 From: Marcus Quinn Date: Mon, 24 Mar 2025 03:38:03 +0000 Subject: [PATCH] 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 --- admin/js/seoprostack-admin.js | 114 +++++++++++++++++----------------- wp-seoprostack-plugin.php | 2 +- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/admin/js/seoprostack-admin.js b/admin/js/seoprostack-admin.js index c48182f..41656e0 100644 --- a/admin/js/seoprostack-admin.js +++ b/admin/js/seoprostack-admin.js @@ -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('
' + response.data.message + '
'); - } - }, - error: function() { - $('#seoprostack-plugins-grid').removeClass('loading'); - $('#seoprostack-plugins-grid').html('
Error connecting to server
'); + // 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('
' + response.data.message + '
'); } - }); + }, + error: function() { + $('#seoprostack-plugins-grid').removeClass('loading'); + $('#seoprostack-plugins-grid').html('
Error connecting to server
'); + } + }); }); // Activate plugin diff --git a/wp-seoprostack-plugin.php b/wp-seoprostack-plugin.php index fc9c737..389dc4a 100644 --- a/wp-seoprostack-plugin.php +++ b/wp-seoprostack-plugin.php @@ -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() ) {