asvinb/wp-nonce-oo

dev-master 2016-01-25 22:14 UTC

This package is not auto-updated.

Last update: 2024-09-22 08:24:24 UTC


README

Installation

	composer require asvinb/wp-nonce-oo

How to use

Create nonce

	$nonce = \Nonce\Wrapper::wp_create_nonce();

Verify nonce

	$isValid = \Nonce\Wrapper::wp_verify_nonce($nonce);

Create nonce hidden input

	\Nonce\Wrapper::wp_nonce_field();

Generate nonce URL:

	$url = \Nonce\Wrapper::wp_nonce_url('http://www.google.com');

Check if request was been referred from an admin screen:

	$admin = \Nonce\Wrapper::check_admin_referer();

Verifies the AJAX request to prevent processing requests external of the blog.

	$ajax = \Nonce\Wrapper::check_ajax_referer();

Testing

vendor/bin/phpunit

Do update the WP_INSTALL constant in phpunit.xml to a local working WordPress installation

Changelog

0.1

Initial version