43815dea2d
tests / phpunit (push) Has been cancelled
- PluginBootS7Test idempotency: assertTrue(class_exists) instead of assertTrue(true) - ZipArchiveBuildTest: try/finally cleanup + unzip exit-code check - bootstrap.php: drop unused PUC shims (wp_remote_post, transient*) - CHANGELOG.md: header references Keep a Changelog (was: mirrors readme.txt) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
120 lines
3.7 KiB
PHP
120 lines
3.7 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
if (!defined('ABSPATH')) {
|
|
define('ABSPATH', __DIR__ . '/');
|
|
}
|
|
|
|
// WordPress path constants needed by plugin-update-checker
|
|
if (!defined('WP_PLUGIN_DIR')) {
|
|
define('WP_PLUGIN_DIR', dirname(__DIR__, 2));
|
|
}
|
|
if (!defined('WPMU_PLUGIN_DIR')) {
|
|
define('WPMU_PLUGIN_DIR', dirname(__DIR__, 2) . '/mu-plugins');
|
|
}
|
|
if (!defined('WP_DEBUG')) {
|
|
define('WP_DEBUG', false);
|
|
}
|
|
|
|
// WPMC plugin constants (normally defined in wp-multi-city.php when running under WordPress)
|
|
if (!defined('WPMC_PLUGIN_DIR')) {
|
|
define('WPMC_PLUGIN_DIR', dirname(__DIR__) . '/');
|
|
}
|
|
if (!defined('WPMC_PLUGIN_FILE')) {
|
|
define('WPMC_PLUGIN_FILE', dirname(__DIR__) . '/wp-multi-city.php');
|
|
}
|
|
if (!defined('WPMC_VERSION')) {
|
|
define('WPMC_VERSION', '1.0.0');
|
|
}
|
|
|
|
// WP function shims needed by plugin-update-checker at runtime.
|
|
// NOTE: add_action, add_filter, apply_filters, do_action, has_action, has_filter,
|
|
// is_admin, current_user_can are provided by Brain Monkey — do NOT define them here.
|
|
if (!function_exists('wp_parse_url')) {
|
|
function wp_parse_url(string $url, int $component = -1) {
|
|
return parse_url($url, $component);
|
|
}
|
|
}
|
|
if (!function_exists('wp_normalize_path')) {
|
|
function wp_normalize_path(string $path): string {
|
|
$path = str_replace('\\', '/', $path);
|
|
$path = preg_replace('|(?<=.)/+|', '/', $path);
|
|
return $path;
|
|
}
|
|
}
|
|
if (!function_exists('esc_html')) {
|
|
function esc_html(string $s): string {
|
|
return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
|
|
}
|
|
}
|
|
if (!function_exists('get_file_data')) {
|
|
function get_file_data(string $file, array $headers): array {
|
|
$data = [];
|
|
foreach ($headers as $key => $header) {
|
|
$data[$key] = '';
|
|
}
|
|
return $data;
|
|
}
|
|
}
|
|
if (!function_exists('get_option')) {
|
|
function get_option(string $key, $default = false) {
|
|
return $default;
|
|
}
|
|
}
|
|
if (!function_exists('update_option')) {
|
|
function update_option(string $key, $value, $autoload = null): bool {
|
|
return true;
|
|
}
|
|
}
|
|
if (!function_exists('wp_next_scheduled')) {
|
|
function wp_next_scheduled(string $hook, array $args = []) {
|
|
return false;
|
|
}
|
|
}
|
|
if (!function_exists('wp_schedule_event')) {
|
|
function wp_schedule_event(int $timestamp, string $recurrence, string $hook, array $args = []): bool {
|
|
return true;
|
|
}
|
|
}
|
|
if (!function_exists('is_wp_error')) {
|
|
function is_wp_error($thing): bool {
|
|
return false;
|
|
}
|
|
}
|
|
if (!function_exists('plugin_basename')) {
|
|
function plugin_basename(string $file): string {
|
|
return basename(dirname($file)) . '/' . basename($file);
|
|
}
|
|
}
|
|
if (!function_exists('register_deactivation_hook')) {
|
|
function register_deactivation_hook(string $file, $cb): void {}
|
|
}
|
|
if (!function_exists('register_activation_hook')) {
|
|
function register_activation_hook(string $file, $cb): void {}
|
|
}
|
|
if (!function_exists('wp_remote_get')) {
|
|
function wp_remote_get(string $url, array $args = []) {
|
|
return false;
|
|
}
|
|
}
|
|
require_once __DIR__ . '/../includes/class-plugin.php';
|
|
\WPMultiCity\Plugin::register_autoloader();
|
|
|
|
if (!class_exists('WP_Term', false)) {
|
|
eval('class WP_Term { public int $term_id = 0; public string $slug = ""; public string $taxonomy = ""; }');
|
|
}
|
|
|
|
if (!class_exists('WP_Query', false)) {
|
|
eval('class WP_Query {
|
|
public array $constructor_args = [];
|
|
public bool $is_page = false;
|
|
public bool $is_front_page = false;
|
|
public bool $is_404 = false;
|
|
public function __construct($args = []) { $this->constructor_args = is_array($args) ? $args : []; }
|
|
public function set_404(): void { $this->is_404 = true; }
|
|
public function set($k, $v): void {}
|
|
}');
|
|
}
|