for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace EmailLog\Core\Request;
use EmailLog\Core\Loadie;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
/**
* Check nonce for all Email Log requests.
*
* @since 2.0.0
*/
class NonceChecker implements Loadie {
* Setup hooks.
* @inheritdoc
public function load() {
add_action( 'admin_init', array( $this, 'check_nonce' ) );
}
* Check nonce for all Email Log Requests.
* All Email Log Requests will have the `el_` prefix and
* nonce would be available at `el_{action_name}_nonce`.
public function check_nonce() {
if ( ! isset( $_POST['el-action'] ) ) {
return;
$action = sanitize_text_field( $_POST['el-action'] );
if ( ! isset( $_POST[ $action . '_nonce' ] ) ) {
if ( ! wp_verify_nonce( $_POST[ $action . '_nonce' ], $action ) ) {
* Perform `el` action.
* Nonce check has already happened at this point.
* @since 2.0
* @param string $action Action name.
* @param array $_POST Request data.
do_action( 'el_action', $action, $_POST );
do_action( $action, $_POST );