HEX
Server: LiteSpeed
System: Linux linux31.centraldnserver.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: salamatk (1501)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: //proc/self/root/home/salamatk/takarzan.ir/wp-content/plugins/apsw/apsw.php
<?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();