GithubHelp home page GithubHelp logo

pebo_wp_nonce_helper's Introduction

Pebo_wp_nonce_helper

Helper clas for handling nonces on WorPress.

Ussage:

to include this class in to your project:

  • download or clone this project and place the file Pebo_wp_nonce_helper.php in to your library folder (inside your project).
  • include the class in your code file:
include_once dirname(__FILE__).'/you_library_path/Pebo_wp_nonce_helper.php';
  • Or using composer:
  •     composer require pebo/wp_nonce_helper=dev-master
      
  • Then call methods using the formula:
Pebo_wp_nonce_helper.php::method_name($args ...);

Functionality:

Setting nonces life time:

Pebo_wp_nonce_helper.php::set_nonce_duration($time_in_secconds);

Creating a nonce url (for a link):
<a href="<?php print Pebo_wp_nonce_helper::create_nonce_url(admin_url('options.php?page=my_plugin_settings'), 'doing_something', 'my_nonce');?>" class="button button-primary"><?php esc_html_e('Do Something!', 'my-plugin-textdomain');?></a>
Nonce validation:

  if(Pebo_wp_nonce_helper::nonce_verify('nonce_name', 'action_name') != false){
  	//Do Something..
  {
  
Create nonce hidden field inside a form :
<form method="post">
   <!-- some inputs here ... -->
   <?php Pebo_wp_nonce_helper::get_hidden_field( 'name_of_my_action', 'name_of_nonce_field' ); 
?>
</form>
Validate a nonce hidden field.

  if(Pebo_wp_nonce_helper::check_nonce_field('name_of_my_action', 'name_of_nonce_field') != false){
  	//Do Something..
  {
  

pebo_wp_nonce_helper's People

Contributors

petersk8 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.