diff --git a/inc/disable-public-json-rest-api/namespace.php b/inc/disable-public-json-rest-api/namespace.php index 97a309d..4a618a6 100644 --- a/inc/disable-public-json-rest-api/namespace.php +++ b/inc/disable-public-json-rest-api/namespace.php @@ -17,10 +17,9 @@ * * @return void */ -function bootstrap() :void { +function bootstrap(): void { add_action( 'init', __NAMESPACE__ . '\\load', 0 ); - } /** @@ -28,7 +27,7 @@ function bootstrap() :void { * * @return void */ -function load() :void { +function load(): void { // Disable some endpoints for unauthenticated users. add_filter( 'rest_endpoints', __NAMESPACE__ . '\\disable_default_endpoints', 1000 ); @@ -77,25 +76,25 @@ function load() :void { * * ``` * add_filter( 'rest_authentication_errors', function( $result ) { - * // If a previous authentication check was applied, - * // pass that result along without modification. - * if ( true === $result || is_wp_error( $result ) ) { - * return $result; - * } + * // If a previous authentication check was applied, + * // pass that result along without modification. + * if ( true === $result || is_wp_error( $result ) ) { + * return $result; + * } * - * // No authentication has been performed yet. - * // Return an error if user is not logged in. - * if ( ! is_user_logged_in() ) { - * return new WP_Error( - * 'rest_not_logged_in', - * __( 'You are not currently logged in.' ), - * array( 'status' => 401 ) - * ); - * } + * // No authentication has been performed yet. + * // Return an error if user is not logged in. + * if ( ! is_user_logged_in() ) { + * return new WP_Error( + * 'rest_not_logged_in', + * __( 'You are not currently logged in.' ), + * array( 'status' => 401 ) + * ); + * } * - * // Our custom authentication check should have no effect - * // on logged-in requests - * return $result; + * // Our custom authentication check should have no effect + * // on logged-in requests + * return $result; * }); * ``` */ @@ -112,7 +111,7 @@ function load() :void { * * @return array $endpoints */ -function disable_default_endpoints( array $endpoints ) :array { +function disable_default_endpoints( array $endpoints ): array { if ( is_user_logged_in() ) { return $endpoints; @@ -195,9 +194,6 @@ function disable_default_endpoints( array $endpoints ) :array { '/wp/v2/ft_product', - '/wp-site-health/v1/tests', - '/wp-site-health/v1/directory-sizes', - '/wp-block-editor/v1', '/wp-block-editor/v1/url-details', '/wp-block-editor/v1/export', @@ -239,7 +235,7 @@ function disable_default_endpoints( array $endpoints ) :array { $endpoints = array_filter( $endpoints, - function( $k ) use ( $endpoints_to_remove ) { + function ( $k ) use ( $endpoints_to_remove ) { // Reduce keys. $_k = explode( '/(?P', $k ); diff --git a/inc/namespace.php b/inc/namespace.php index d016b15..53abcaf 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -17,7 +17,7 @@ * * @return void */ -function register() :void { +function register(): void { $default_settings = [ 'enabled' => true, // Needs to be set.