6aa1ef41e6
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
// Simple autoloader that mirrors the runtime plugin autoloader,
|
|
// mapping Cf7stg\ClassName → includes/class-class-name.php
|
|
spl_autoload_register(static function (string $class): void {
|
|
if (strpos($class, 'Cf7stg\\') !== 0) {
|
|
return;
|
|
}
|
|
$relative = substr($class, strlen('Cf7stg\\'));
|
|
// Turn "PhoneParser" into "phone-parser"
|
|
$slug = strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1-$2', $relative));
|
|
$path = __DIR__ . '/../includes/class-' . $slug . '.php';
|
|
if (is_file($path)) {
|
|
require_once $path;
|
|
}
|
|
});
|
|
|
|
// Minimal shims for functions used by pure-logic classes when WP is absent.
|
|
if (!function_exists('apply_filters')) {
|
|
function apply_filters($tag, $value) { return $value; }
|
|
}
|
|
if (!function_exists('esc_html')) {
|
|
function esc_html($s) { return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
|
|
}
|
|
if (!function_exists('esc_url')) {
|
|
function esc_url($s) { return filter_var((string)$s, FILTER_SANITIZE_URL); }
|
|
}
|
|
if (!function_exists('wp_strip_all_tags')) {
|
|
function wp_strip_all_tags($s) { return trim(strip_tags((string)$s)); }
|
|
}
|
|
if (!function_exists('__')) {
|
|
function __($text) { return $text; }
|
|
}
|