dinamiko/nonces

There is no license information available for the latest version (1.0.1) of this package.

1.0.1 2017-04-08 12:52 UTC

This package is not auto-updated.

Last update: 2024-04-28 01:13:59 UTC


README

Introduction

A simple to use implementation of WordPress Nonces.

Table of Contents

Installation

Install with Composer:

$ composer require dinamiko/nonces

Usage

Create a nonce:

$nonce = new Dinamiko\Nonces\Nonce( 'my-action' );
$nonce_value = (string) $nonce;

Create a nonce field:

$nonce = new Dinamiko\Nonces\Nonce( 'my-action' );
$field = $nonce->create_field();

Create a nonce URL:

$nonce = new Dinamiko\Nonces\Nonce( 'my-action' );
$url = $nonce->create_url( 'http://example.com' );

Verify a nonce:

$nonce = new Dinamiko\Nonces\Nonce( 'my-action' );
$is_valid = $nonce->is_valid( $_POST['foo'] );

Run the tests

$ cd vendor/dinamiko/nonces
$ composer install
$ vendor/bin/phpunit