nimos / wp-nonce-wrapper
There is no license information available for the latest version (0.1) of this package.
0.1
2017-04-04 18:00 UTC
Requires (Dev)
- phpunit/phpunit: 6.0
This package is not auto-updated.
Last update: 2025-05-30 22:36:54 UTC
README
This wrapper provides Wordpress' nonce functionality in an object-oriented environment.
Installation
To install the package, run composer require nimos/wp-nonce-wrapper
.
Alternatively, you can download the zip file from Github, and run composer update
to install the dependencies.
Usage
Create a Nonce:
$nonce = WpNonceWrapper::create_nonce();
Generate a nonce URL for 'http://example.com':
$url = WpNonceWrapper::nonce_url( 'http://example.com' );
Generate hidden input to use a nonce in a form:
WpNonceWrapper::nonce_field();
Verify a Nonce:
$valid = WpNonceWrapper::verify_nonce( $nonce );
Display an are you sure dialogue, to manually confirm an action:
WpNonceWrapper::nonce_ays( $someAction );
Testing
To run the tests, run vendor\bin\phpunit tests\WrapperTest.php
You will likely have to update WP_DIR in the test file to point to your Wordpress installation.