2017 © Pedro Peláez
 

composer-wordpress-package wpnonce

A simple OOP Class for using nonces in WordPress

image

christophwolff/wpnonce

A simple OOP Class for using nonces in WordPress

  • Thursday, June 2, 2016
  • by christophwolff
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

WPnonce

Some class to use WP nonces in a OOP kind of way, (*1)

Install

composer require christophwolff/wpnonce

Or just add, (*2)

"christophwolff/wpnonce": "0.0.1"

to your compsoer.json file and run a compposer update, (*3)

Usage:

Create a nonce with a specific action

$myNonce = new WPnonce( 'myAction' );
$freshNonce = $myNonce->createNonce();

Verify a nonce with a specific action

$myNonce = new WPnonce( 'myAction' );

$result = $myNonce->verifyNonce( '34653456f' );

Create a noncefield with a specific action

$myNonce = new WPnonce( 'myAction' );

$htmlField = $myNonce->createNonceField( '_wpnonce', true );

Create an URL with a nonce parameter

$name = '_wpnonce';
$actionUrl = 'http://my.wrdprss.com/foo/bar';

$myNonce = new WPnonce( 'myAction' );

$actionUrlNonce = $myNonce->createNonceUrl( $actionUrl, $name, true );

Check an URL for a vaild nonce

$myNonce = new WPnonce( 'myAction' );

$result = $myNonce->checkAdminReferer( $query_arg );

Check an AJAX URL for a vaild nonce

$query_arg = '_wpnonce_name';
$myNonce = new WPnonce( 'myAction' );

$result = myNonce->checkAjaxReferer( $query_arg, true );

Changelog

0.0.1

  • Init

The Versions

02/06 2016

dev-master

9999999-dev

A simple OOP Class for using nonces in WordPress

  Sources   Download

MIT

The Development Requires

by Christoph Wolff

02/06 2016

0.0.1

0.0.1.0

A simple OOP Class for using nonces in WordPress

  Sources   Download

MIT

The Development Requires

by Christoph Wolff