Files
wpa-superstar-plugin/wp-seoprostack-plugin.php
Marcus Quinn 0e7b8a5cc6 Maintain exact functionality with reference plugin
- Updated wp-seoprostack-plugin.php to match reference plugin behavior
- Fixed JavaScript variable references to use wpSeoProStack consistently
- Updated AJAX action names to use wp_seoprostack_ prefix
- Ensured plugin matches reference plugin exactly in appearance and functionality
- Maintained pure naming convention and code structure refactoring without functional changes
2025-03-24 03:20:58 +00:00

106 lines
3.2 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__));
// 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() {
// 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');