88 lines
1.9 KiB
PHP
88 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
if (!defined('ABSPATH')) {
|
|
define('ABSPATH', __DIR__ . '/');
|
|
}
|
|
|
|
if (!defined('AUTH_KEY')) {
|
|
define('AUTH_KEY', 'fixture-auth-key');
|
|
}
|
|
if (!defined('SECURE_AUTH_KEY')) {
|
|
define('SECURE_AUTH_KEY', 'fixture-secure-auth-key');
|
|
}
|
|
if (!defined('LOGGED_IN_KEY')) {
|
|
define('LOGGED_IN_KEY', 'fixture-logged-in-key');
|
|
}
|
|
if (!defined('NONCE_KEY')) {
|
|
define('NONCE_KEY', 'fixture-nonce-key');
|
|
}
|
|
|
|
$GLOBALS['feca_wp_actions'] = [];
|
|
|
|
if (!function_exists('add_action')) {
|
|
function add_action(string $hook, callable $callback): void
|
|
{
|
|
if (!isset($GLOBALS['feca_wp_actions'][$hook])) {
|
|
$GLOBALS['feca_wp_actions'][$hook] = [];
|
|
}
|
|
$GLOBALS['feca_wp_actions'][$hook][] = $callback;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('add_menu_page')) {
|
|
function add_menu_page(...$args): void
|
|
{
|
|
}
|
|
}
|
|
|
|
if (!function_exists('add_submenu_page')) {
|
|
function add_submenu_page(...$args): void
|
|
{
|
|
}
|
|
}
|
|
|
|
if (!function_exists('current_user_can')) {
|
|
function current_user_can(string $capability): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('wp_verify_nonce')) {
|
|
function wp_verify_nonce(string $nonce, string $action): int
|
|
{
|
|
return $nonce !== '' ? 1 : 0;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('wp_create_nonce')) {
|
|
function wp_create_nonce(string $action): string
|
|
{
|
|
return 'fixture-nonce-' . $action;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('status_header')) {
|
|
function status_header(int $code): void
|
|
{
|
|
http_response_code($code);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('wp_send_json')) {
|
|
function wp_send_json(array $payload): void
|
|
{
|
|
header('Content-Type: application/json');
|
|
echo json_encode($payload, JSON_UNESCAPED_SLASHES);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('admin_url')) {
|
|
function admin_url(string $path = ''): string
|
|
{
|
|
return '/wp-admin/' . ltrim($path, '/');
|
|
}
|
|
}
|