@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * Abort if this file is called directly |
| 13 | 13 | */ |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'Algolia_Verify_Nonces' ) ) { |
|
| 18 | +if ( ! class_exists('Algolia_Verify_Nonces')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Verify submitted nonces |
| 21 | 21 | */ |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * Filter incoming nonces and values |
| 31 | 31 | */ |
| 32 | - $settings_nonce = filter_input( INPUT_POST, 'algolia_woo_indexer_admin_api_nonce_name', FILTER_DEFAULT ); |
|
| 32 | + $settings_nonce = filter_input(INPUT_POST, 'algolia_woo_indexer_admin_api_nonce_name', FILTER_DEFAULT); |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Return boolean depending on if the nonce has been set |
| 36 | 36 | */ |
| 37 | - if ( ! isset( $settings_nonce ) ) { |
|
| 37 | + if ( ! isset($settings_nonce)) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * Filter incoming nonces and values |
| 51 | 51 | */ |
| 52 | - $send_products_nonce = filter_input( INPUT_POST, 'send_products_to_algolia_nonce_name', FILTER_DEFAULT ); |
|
| 53 | - $send_products_to_algolia = filter_input( INPUT_POST, 'send_products_to_algolia', FILTER_DEFAULT ); |
|
| 52 | + $send_products_nonce = filter_input(INPUT_POST, 'send_products_to_algolia_nonce_name', FILTER_DEFAULT); |
|
| 53 | + $send_products_to_algolia = filter_input(INPUT_POST, 'send_products_to_algolia', FILTER_DEFAULT); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Display error and die if nonce is not verified and does not pass security check |
| 57 | 57 | * Also check if the hidden value field send_products_to_algolia is set |
| 58 | 58 | */ |
| 59 | 59 | |
| 60 | - if ( ! wp_verify_nonce( $send_products_nonce, 'send_products_to_algolia_nonce_action' ) && isset( $send_products_to_algolia ) ) { |
|
| 61 | - wp_die( esc_html__( 'Action is not allowed.', 'algolia-woo-indexer' ), esc_html__( 'Error!', 'algolia-woo-indexer' ) ); |
|
| 60 | + if ( ! wp_verify_nonce($send_products_nonce, 'send_products_to_algolia_nonce_action') && isset($send_products_to_algolia)) { |
|
| 61 | + wp_die(esc_html__('Action is not allowed.', 'algolia-woo-indexer'), esc_html__('Error!', 'algolia-woo-indexer')); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * If we have verified the send_products_nonce and the send_products hidden field is set, return true |
| 66 | 66 | */ |
| 67 | - if ( wp_verify_nonce( $send_products_nonce, 'send_products_to_algolia_nonce_action' ) && isset( $send_products_to_algolia ) ) { |
|
| 67 | + if (wp_verify_nonce($send_products_nonce, 'send_products_to_algolia_nonce_action') && isset($send_products_to_algolia)) { |
|
| 68 | 68 | return true; |
| 69 | 69 | } |
| 70 | 70 | } |