Files
wpa-superstar-plugin/wp-seoprostack-plugin.php
Marcus Quinn 6fc054f2bf Fix plugin activation and critical errors
- Fixed class naming inconsistency in auto-upload functionality
- Resolved duplicate menu items by removing direct inclusion of settings.php
- Fixed JavaScript variable naming from seoProStack to wpSeoProStack
- Added deprecation notice to legacy auto-upload class
- Updated AJAX nonce references for consistency
2025-03-24 03:11:03 +00:00

96 lines
2.7 KiB
PHP

<?php
/**
* Plugin Name: SEO Pro Stack
* Plugin URI: https://www.seoprostack.com
* Description: SEO Pro Stack Plugin for WordPress. Speed Matters.
* Version: 1.0.0
* Author: SEO Pro Stack
* Author URI: https://www.seoprostack.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: seoprostack
* Domain Path: /languages
* Requires at least: 5.0
* Requires PHP: 7.2
*/
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
// Define plugin constants
define('SEOPROSTACK_VERSION', '1.0.0');
define('SEOPROSTACK_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('SEOPROSTACK_PLUGIN_URL', plugin_dir_url(__FILE__));
define('SEOPROSTACK_PLUGIN_BASENAME', plugin_basename(__FILE__));
// Load autoloader
require_once SEOPROSTACK_PLUGIN_DIR . 'includes/core/class-seoprostack-autoloader.php';
// Backward compatibility - load only necessary legacy files
// This will be removed in future iterations
if (is_admin()) {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/pro-plugins-config.php';
// Legacy settings.php is now handled through the OOP structure
}
// Activation hook
function seoprostack_activate() {
// Activation logic
}
register_activation_hook(__FILE__, 'seoprostack_activate');
// Deactivation hook
function seoprostack_deactivate() {
// Deactivation logic
}
register_deactivation_hook(__FILE__, 'seoprostack_deactivate');
/**
* Begin execution of the plugin.
*/
function run_seoprostack() {
require_once SEOPROSTACK_PLUGIN_DIR . 'includes/core/class-seoprostack-plugin.php';
$plugin = new SEOProStack_Plugin();
$plugin->run();
}
run_seoprostack();
// Admin assets
function seoprostack_admin_assets() {
// Only load on the plugin settings page
$screen = get_current_screen();
if ($screen->id !== 'settings_page_seoprostack') {
return;
}
// Enqueue styles
wp_enqueue_style(
'seoprostack-admin',
SEOPROSTACK_PLUGIN_URL . 'admin/css/seoprostack-admin.css',
array(),
SEOPROSTACK_VERSION
);
// Enqueue WordPress updates script for theme installation
wp_enqueue_script('updates');
wp_enqueue_script(
'seoprostack-admin',
SEOPROSTACK_PLUGIN_URL . 'admin/js/seoprostack-admin.js',
array('jquery', 'updates'),
SEOPROSTACK_VERSION,
true
);
// Localize script for AJAX
$ajax_data = array(
'ajaxurl' => admin_url('admin-ajax.php'),
'adminUrl' => admin_url(),
'nonce' => wp_create_nonce('seoprostack-nonce'),
'updateNonce' => wp_create_nonce('updates')
);
wp_localize_script('seoprostack-admin', 'wpSeoProStack', $ajax_data);
}
add_action('admin_enqueue_scripts', 'seoprostack_admin_assets');