WP_Super_Cache_Router::register_routes()
Register the routes for the objects of the controller.
GET /wp-super-cache/v1/settings POST /wp-super-cache/v1/settings GET /wp-super-cache/v1/stats GET /wp-super-cache/v1/cache POST /wp-super-cache/v1/cache
Method of the class: WP_Super_Cache_Router{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = WP_Super_Cache_Router::register_routes();
WP_Super_Cache_Router::register_routes() WP Super Cache Router::register routes code WPSCache 1.12.4
public static function register_routes() { $version = '1'; $namespace = 'wp-super-cache/v' . $version; $get_settings = new WP_Super_Cache_Rest_Get_Settings(); $update_settings = new WP_Super_Cache_Rest_Update_Settings(); $get_stats = new WP_Super_Cache_Rest_Get_Stats(); $get_cache = new WP_Super_Cache_Rest_Get_Cache(); $test_cache = new WP_Super_Cache_Rest_Test_Cache(); $delete_cache = new WP_Super_Cache_Rest_Delete_Cache(); $preload_cache = new WP_Super_Cache_Rest_Preload(); $get_status = new WP_Super_Cache_Rest_Get_Status(); $get_plugins = new WP_Super_Cache_Rest_Get_Plugins(); $update_plugins = new WP_Super_Cache_Rest_Update_Plugins(); register_rest_route( $namespace, '/settings', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $get_settings, 'callback' ), 'permission_callback' => __CLASS__ . '::get_item_permissions_check', 'args' => array(), ), array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $update_settings, 'callback' ), 'permission_callback' => __CLASS__ . '::update_item_permissions_check', 'args' => array(), ), ) ); register_rest_route( $namespace, '/status', array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $get_status, 'callback' ), 'permission_callback' => __CLASS__ . '::get_item_permissions_check', ) ); register_rest_route( $namespace, '/stats', array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $get_stats, 'callback' ), 'permission_callback' => __CLASS__ . '::get_item_permissions_check', ) ); register_rest_route( $namespace, '/cache', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $get_cache, 'callback' ), 'permission_callback' => __CLASS__ . '::get_item_permissions_check', 'args' => array(), ), array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $delete_cache, 'callback' ), 'permission_callback' => __CLASS__ . '::delete_item_permissions_check', 'args' => array(), ), ) ); register_rest_route( $namespace, '/preload', array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $preload_cache, 'callback' ), 'permission_callback' => __CLASS__ . '::update_item_permissions_check', ) ); register_rest_route( $namespace, '/cache/test', array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $test_cache, 'callback' ), 'permission_callback' => __CLASS__ . '::create_item_permissions_check', ) ); register_rest_route( $namespace, '/plugins', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $get_plugins, 'callback' ), 'permission_callback' => __CLASS__ . '::get_item_permissions_check', 'args' => array(), ), array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $update_plugins, 'callback' ), 'permission_callback' => __CLASS__ . '::update_item_permissions_check', 'args' => array(), ), ) ); }