Files
Logo-Soup/tests/php/wp-stubs.php
T
2026-04-13 20:06:32 -05:00

210 lines
4.2 KiB
PHP

<?php
/**
* WordPress stubs for static analysis and local tests.
*
* @package LogoSoup\Tests
*/
if ( ! class_exists( 'WP_Error' ) ) {
class WP_Error {
public function __construct( $code = '', $message = '', $data = array() ) {}
}
}
if ( ! class_exists( 'WP_REST_Request' ) ) {
class WP_REST_Request {
public function get_method() {
return 'GET';
}
public function get_header( $name ) {
return '';
}
public function get_json_params() {
return array();
}
}
}
if ( ! class_exists( 'WP_REST_Response' ) ) {
class WP_REST_Response {
public function __construct( $data = null, $status = 200 ) {}
}
}
if ( ! class_exists( 'WP_REST_Server' ) ) {
class WP_REST_Server {
const READABLE = 'GET';
const EDITABLE = 'POST';
}
}
if ( ! function_exists( '__' ) ) {
function __( $text, $domain = 'default' ) {
return $text;
}
}
if ( ! function_exists( 'esc_html__' ) ) {
function esc_html__( $text, $domain = 'default' ) {
return $text;
}
}
if ( ! function_exists( 'esc_attr' ) ) {
function esc_attr( $text ) {
return (string) $text;
}
}
if ( ! function_exists( 'esc_html' ) ) {
function esc_html( $text ) {
return (string) $text;
}
}
if ( ! function_exists( 'esc_url' ) ) {
function esc_url( $url ) {
return (string) $url;
}
}
if ( ! function_exists( 'selected' ) ) {
function selected( $value, $current ) {
return $value === $current ? 'selected="selected"' : '';
}
}
if ( ! function_exists( 'checked' ) ) {
function checked( $is_checked ) {
return $is_checked ? 'checked="checked"' : '';
}
}
if ( ! function_exists( 'plugins_url' ) ) {
function plugins_url( $path = '', $plugin = '' ) {
return (string) $path;
}
}
if ( ! function_exists( 'load_plugin_textdomain' ) ) {
function load_plugin_textdomain( $domain = 'default', $deprecated = false, $plugin_rel_path = '' ) {
return true;
}
}
if ( ! function_exists( 'register_activation_hook' ) ) {
function register_activation_hook( $file, $callback ) {
return true;
}
}
if ( ! function_exists( 'register_deactivation_hook' ) ) {
function register_deactivation_hook( $file, $callback ) {
return true;
}
}
if ( ! function_exists( 'add_action' ) ) {
function add_action( $hook, $callback ) {
return true;
}
}
if ( ! function_exists( 'register_setting' ) ) {
function register_setting( $group, $name, $args = array() ) {
return true;
}
}
if ( ! function_exists( 'add_options_page' ) ) {
function add_options_page( $page_title = '', $menu_title = '', $capability = '', $menu_slug = '', $callback = null ) {
return true;
}
}
if ( ! function_exists( 'add_settings_section' ) ) {
function add_settings_section( $id = '', $title = '', $callback = null, $page = '' ) {
return true;
}
}
if ( ! function_exists( 'add_settings_field' ) ) {
function add_settings_field( $id = '', $title = '', $callback = null, $page = '', $section = '' ) {
return true;
}
}
if ( ! function_exists( 'current_user_can' ) ) {
function current_user_can( $capability = '' ) {
return true;
}
}
if ( ! function_exists( 'settings_fields' ) ) {
function settings_fields( $group ) {
return true;
}
}
if ( ! function_exists( 'do_settings_sections' ) ) {
function do_settings_sections( $page ) {
return true;
}
}
if ( ! function_exists( 'submit_button' ) ) {
function submit_button() {
return true;
}
}
if ( ! function_exists( 'register_rest_route' ) ) {
function register_rest_route( $route_namespace, $route, $args ) {
return true;
}
}
if ( ! function_exists( 'wp_verify_nonce' ) ) {
function wp_verify_nonce( $nonce, $action ) {
return true;
}
}
if ( ! function_exists( 'register_block_type' ) ) {
function register_block_type( $path, $args = array() ) {
return true;
}
}
if ( ! function_exists( 'get_option' ) ) {
function get_option( $name, $fallback = false ) {
return $fallback;
}
}
if ( ! function_exists( 'add_option' ) ) {
function add_option( $name, $value ) {
return true;
}
}
if ( ! function_exists( 'update_option' ) ) {
function update_option( $name, $value ) {
return true;
}
}
if ( ! function_exists( 'delete_option' ) ) {
function delete_option( $name ) {
return true;
}
}
if ( ! function_exists( 'wp_clear_scheduled_hook' ) ) {
function wp_clear_scheduled_hook( $hook ) {
return true;
}
}