asvinb / wp-nonce-oo

WordPress Nonces in an object orientated environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implementation of WordPress Nonces in an object oriented way

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

About

WordPress Nonces in an object orientated environment.


Languages

Language:PHP 100.0%