Rename plugin to wp-seoprostack-plugin, update file structure

This commit is contained in:
Marcus Quinn
2025-03-24 02:48:06 +00:00
parent 18b0a2c246
commit aee3cb91e2
35 changed files with 5455 additions and 655 deletions

View File

@ -0,0 +1,69 @@
<?php
/**
* Autoloader for SEO Pro Stack plugin.
*
* @package SEO_Pro_Stack
* @subpackage SEO_Pro_Stack/Core
*/
// If this file is called directly, abort.
if (!defined('ABSPATH')) {
exit;
}
/**
* Class SEOProStack_Autoloader
*
* Handles autoloading of plugin classes.
*/
class SEOProStack_Autoloader {
/**
* Register the autoloader
*/
public static function register() {
spl_autoload_register(array(self::class, 'autoload'));
}
/**
* Autoload a class file based on its name
*
* @param string $class_name The name of the class to load.
*/
public static function autoload($class_name) {
// Check if the class should be loaded by this autoloader
if (false === strpos($class_name, 'SEOProStack')) {
return;
}
// Convert class name to filename
$file_path = str_replace('SEOProStack_', '', $class_name);
$file_path = str_replace('_', '-', $file_path);
$file_path = strtolower($file_path);
// Add 'class-' prefix
$file_path = 'class-' . $file_path . '.php';
// Base paths to check for classes
$base_paths = array(
SEOPROSTACK_PLUGIN_DIR . 'includes/',
SEOPROSTACK_PLUGIN_DIR . 'includes/core/',
SEOPROSTACK_PLUGIN_DIR . 'includes/features/',
SEOPROSTACK_PLUGIN_DIR . 'includes/features/auto-upload/',
SEOPROSTACK_PLUGIN_DIR . 'admin/',
SEOPROSTACK_PLUGIN_DIR . 'admin/settings/',
SEOPROSTACK_PLUGIN_DIR . 'admin/settings/ajax/',
SEOPROSTACK_PLUGIN_DIR . 'admin/settings/tabs/',
);
// Try to find and load the file
foreach ($base_paths as $base_path) {
$full_path = $base_path . $file_path;
if (file_exists($full_path)) {
require_once $full_path;
return;
}
}
}
}
SEOProStack_Autoloader::register();