Files
wpa-superstar-plugin/wp-seoprostack-plugin.php
Marcus Quinn a6fef6200f 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
2025-03-24 03:38:03 +00:00

93 lines
2.9 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( 'WPINC' ) ) {
die;
}
// Define plugin version - extract from plugin header
if (!function_exists('get_plugin_data')) {
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
// Define the version constant - first try get_plugin_data() if available,
// otherwise fall back to direct string extraction
if (function_exists('get_plugin_data')) {
$plugin_data = get_plugin_data(__FILE__, false, false);
define('SEOPROSTACK_VERSION', $plugin_data['Version']);
} else {
// Manual extraction as fallback
$plugin_file = file_get_contents(__FILE__);
preg_match('/Version:\s*([^\s]+)/i', $plugin_file, $matches);
define('SEOPROSTACK_VERSION', isset($matches[1]) ? $matches[1] : '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__));
// Activation hook
function seoprostack_activate() {
// Add activation logic later if needed
}
register_activation_hook( __FILE__, 'seoprostack_activate' );
// Load core functionality
require_once SEOPROSTACK_PLUGIN_DIR . 'includes/features/auto-upload/class-seoprostack-auto-upload.php';
// Load admin UI and configurations
if ( is_admin() ) {
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/pro-plugins-config.php';
require_once SEOPROSTACK_PLUGIN_DIR . 'admin/settings.php';
}
// Admin assets
function seoprostack_admin_assets() {
// 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');
// Initialize classes
$seoprostack_auto_upload = new SEOProStack_Auto_Upload();