Skip to content

manuelRod/WP_Nonce_OOP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP_Nonce_OOP

Wordpress Nonce OOP Implementation. Just an OOP wrap.

Installation

$ composer require manuel-rod/wp_nonce_oop

Usage

$nonce = new WP_Nonce('wp_action_nonce');

Public methods

$nonce->createNonce()
$nonce->verifyNonce($nonce)
$nonce->nonceField($name = '_wpnonce', $referrer = true, $echo = true)
$nonce->nonceUrl($url, $name = '_wpnonce')
$nonce->checkAdminReferer($name = '_wpnonce')
$nonce->checkAjaxReferer($name = false, $die = true)

Testing (phpunit)

Copy phpunit.xml.dist to phpunit.xml and modify to your needs.

$ cd vendor/manuelRod/WP_Nonce_OOP
$ composer install
$ vendor/bin/phpunit

Licence

MIT