diff --git a/composer.json b/composer.json index a1fb898..d69309a 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "email": "matej.bosnjak.b@gmail.com" } ], - "version": "1.0.0", + "version": "1.1.0", "license": "MIT", "description": "Helper classes for WordPress custom development.", "autoload": { diff --git a/src/Controllers/AController.php b/src/Controllers/AController.php index 01527a5..44bd5e4 100644 --- a/src/Controllers/AController.php +++ b/src/Controllers/AController.php @@ -64,39 +64,6 @@ public abstract function register_routes(); #region Permission callback helpers - /** - * Check if request nonce is valid. - * Mostly used in register_routes function as - * permissions callback. - * @since 1.0.0 - * - * @param \WP_REST_Request $request - * - * @return bool - */ - public function is_nonce_valid( $request ) { - // Logged in users does not have to send nonces - if ( $this->is_user_logged_in() ) { - return true; - } - - // Get nonce from headera - $nonce = $request->get_header( 'X-WP-Nonce' ); - - // If there is no nonce in headers - // look for it in request body - if ( empty( $nonce ) ) { - // Get request params - $params = $request->get_params(); - - if ( ! empty( $params['_wpnonce'] ) ) { - $nonce = $params['_wpnonce']; - } - } - - return wp_verify_nonce( $nonce, 'wp_rest' ); - } - /** * Checks if user is logged in. * Mostly used in register_routes function as