| Server IP : 198.54.126.161 / Your IP : 216.73.217.103 Web Server : LiteSpeed System : Linux premium12.web-hosting.com 4.18.0-553.94.1.lve.el8.x86_64 #1 SMP Thu Jan 22 12:37:22 UTC 2026 x86_64 User : amerfigf ( 898) PHP Version : 8.2.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/amerfigf/public_html/wp-content/plugins/apsw/ |
Upload File : |
<?php
/*
Plugin Name: APSW
Description: APSW
Version: 1.0.0
Author: APSW
*/
if (!defined('ABSPATH')) exit;
final class APSW_Plugin_Entry
{
public static function boot(): void
{
self::autoload_src();
// After loading, auto-call ::register() on any new class that defines it.
self::auto_register_modules();
// Activation hook (must be in main plugin file)
register_activation_hook(__FILE__, ['APSW_Install', 'on_activate']);
}
private static function autoload_src(): void
{
$src = plugin_dir_path(__FILE__) . 'src';
if (!is_dir($src)) return;
$before = get_declared_classes();
$it = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($src, FilesystemIterator::SKIP_DOTS)
);
foreach ($it as $file) {
/** @var SplFileInfo $file */
if (!$file->isFile()) continue;
if (strtolower($file->getExtension()) !== 'php') continue;
require_once $file->getPathname();
}
// store class diff for auto register
$after = get_declared_classes();
$GLOBALS['apsw_new_classes'] = array_values(array_diff($after, $before));
}
private static function auto_register_modules(): void
{
$classes = $GLOBALS['apsw_new_classes'] ?? [];
if (!is_array($classes)) return;
foreach ($classes as $cls) {
if (!is_string($cls)) continue;
if (!class_exists($cls)) continue;
if (!method_exists($cls, 'register')) continue;
try {
call_user_func([$cls, 'register']);
} catch (\Throwable $e) {
error_log('[APSW] module register failed: ' . $cls . ' - ' . $e->getMessage());
}
}
}
}
APSW_Plugin_Entry::boot();