debabratakarfa/wordpress-nonce

This will enable WordPress Nonce function to use on project

dev-master 2017-02-24 16:52 UTC

This package is auto-updated.

Last update: 2025-06-21 21:55:21 UTC


README

WordPress plugin that enables the wordpress nonce function in environment.

##How to install using composer

The composer.json file:

"debabratakarfa/wordpress-nonce": "1.0.*"

{
	"repositories": [
		{
			"type": "vcs",
			"url" : "https://github.com/debabratakarfa/wordpress-nonce"
		}
	],
	"require": {
		"debabratakarfa/wordpress-nonce" : "1.0.*"
	}
}

Add to your composer.json file this package as a require an then run 'composer install'

Or

Open Terminal

cd /path/to/your/install/wordpress/plugin_folder/
git clone https://github.com/debabratakarfa/wordpress-nonce.git
cd wordpress-nonce
composer install

Then go to Wp-Admin access to activate it

##How to use

Create nonce

$Nonce = new Nonce();
$nonce = $Nonce->create_nonce('my-nonce');

Verify nonce

$Nonce = new Nonce();

//Create New nonce
$nonce = $Nonce->create_nonce('my-nonce');
if ($nonce->verify_nonce($nonce, 'my-nonce')) {
	//If true, then your code
}else{
	//If false, then your code
}

Create nonce url

$nonce = new Nonce();
$url = $nonce->nonce_url('http://my-url.com', 'doing-something', 'my-nonce');

##How to do Test

Open Terminal [Consider you using VVV and PHPUnit Test properly setup]

vagrant ssh
cd /path/to/your/install/wordpress/plugin_folder/wordpress-nonce/
phpunit