2017 © Pedro Peláez
 

library wp-nonce-wrapper

Simplified WordPress nonce usage

image

spock/wp-nonce-wrapper

Simplified WordPress nonce usage

  • Thursday, March 17, 2016
  • by spock
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

wp-nonce-wrapper

Use WordPress Nonce an object oriented way, (*1)

Build Status, (*2)

Installation:

"spock/wp-nonce-wrapper": "0.4"

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

Or, (*4)

composer require spock/wp-nonce-wrapper

Usage:

Get Nonce with expiry:, (*5)

use spock\helper\Nonce_Wrapper;
$nonce_obj = new Nonce_Wrapper('doing_some_form_job', 60*60); // 60 sec * 60 min = 1hr; Note: default is 1 day.
$nonce = $nonce_obj->create_nonce();

Verify Nonce:, (*6)

$nonce = $_REQUEST['nonce'];
$nonce_obj = new Nonce_Wrapper('doing_some_form_job');
if ( $nonce_obj->verify_nonce( $nonce ) )
    //Verified Source 
else 
    // Unknown Source

Create nonce input field:, (*7)

//This will echo input field
$nonce_obj->create_nonce_field();

Create nonce url, (*8)

$url   = $nonce_obj->create_nonce_url( 'http://w.org' );

Check user is coming from another admin page., (*9)

php // This will check current url if ($nonce_obj->check_admin_referral()) //doing it right else //doing it wrong, (*10)

Changelog

0.4

  • Remove php magic method usage
  • Refactor code
  • Improved documentation

0.3

  • Nonce expire control added
  • Added missing nonce function

0.2

  • Nonce field support
  • Nonce url support
  • Check user is coming from admin referral

0.1

  • Initial basic functionality

The Versions

17/03 2016

dev-master

9999999-dev

Simplified WordPress nonce usage

  Sources   Download

The Development Requires

by Avatar spock

17/03 2016

v0.4

0.4.0.0

Simplified WordPress nonce usage

  Sources   Download

The Development Requires

by Avatar spock

09/03 2016

v0.3

0.3.0.0

Use WordPress Nonce a object oriented way

  Sources   Download

The Development Requires

by Avatar spock

21/01 2016

v0.2

0.2.0.0

Use WordPress Nonce a object oriented way

  Sources   Download

by Avatar spock

20/01 2016

v0.1

0.1.0.0

Use WordPress Nonce a object oriented way

  Sources   Download

by Avatar spock