public function validate($nonce = null, $value = null, $message = null, $data = null)
	{

		$nonce = ($nonce) ? $nonce : $this->app['request']->get('nonce');
		$value = ($value) ? $value : $this->app['config']->get('app.key');

		if (!wp_verify_nonce($nonce, $value))
		{
			$default = ($msg = trans('ajax.invalid')) ? $msg : 'AJAX is invalid.';

			$data = ($data) ? $data : $this->app['request']->except(['nonce', 'action']);

			wp_send_json([
				'error' => true,
				'msg'   => ($message) ? $message : $default,
				'data'  => $data
			]);
		}
	}
public function validate($nonce = null, $value = null, $message = null, $data = null)
	{

		$nonce = ($nonce) ? $nonce : $this->app['request']->get('nonce');
		$value = ($value) ? $value : $this->app['config']->get('app.key');

		if (!wp_verify_nonce($nonce, $value))
		{
			$default = ($msg = trans('ajax.invalid')) ? $msg : 'AJAX is invalid.';

			$data = ($data) ? $data : $this->app['request']->except(['nonce', 'action']);

			wp_send_json([
				'error' => true,
				'msg'   => ($message) ? $message : $default,
				'data'  => $data
			]);
		}
	}
public function validate ( $ nonce = null , $ value = null , $ message = null , $ data = null ) { $ nonce = ( $ nonce ) ? $ nonce : $ this -> app [ 'request' ] -> get ( 'nonce' ) ; $ value = ( $ value ) ? $ value : $ this -> app [ 'config' ] -> get ( 'app.key' ) ; if ( ! wp_verify_nonce ( $ nonce , $ value ) ) { $ default = ( $ msg = trans ( 'ajax.invalid' ) ) ? $ msg : 'AJAX is invalid.' ; $ data = ( $ data ) ? $ data : $ this -> app [ 'request' ] -> except ( [ 'nonce' , 'action' ] ) ; wp_send_json ( [ 'error' => true , 'msg' => ( $ message ) ? $ message : $ default , 'data' => $ data ] ) ; } }
Check nonce against app.key

@param null|string $nonce By default will use 'nonce' index
@param null|string $value By default will get app.key
@param null|string $message By default try to get translation on ajax.invalid
@param null|mixed $data
Check nonce against app . key