| @@ -4,32 +4,32 @@ | ||
| 4 | 4 | |
| 5 | 5 | defined( 'ABSPATH' ) || exit; |
| 6 | 6 | |
| 7 | 7 | class Ajax { |
| 8 | - private const TWO_DAYS = 86400 * 2; | |
| 9 | - public const AJAX_METHOD_PREFIX = 'wp_ajax_hostinger_'; | |
| 10 | - public const HIDE_PLUGIN_SPLIT_NOTICE = 'hts_plugin_split_notice_hidden'; | |
| 8 | + private const TWO_DAYS = 86400 * 2; | |
| 9 | + public const AJAX_METHOD_PREFIX = 'wp_ajax_hostinger_'; | |
| 10 | + public const HIDE_PLUGIN_SPLIT_NOTICE = 'hts_plugin_split_notice_hidden'; | |
| 11 | 11 | |
| 12 | 12 | public const AJAX_EVENTS = array( |
| 13 | 13 | 'dismiss_plugin_split_notice', |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | - public function __construct() { | |
| 17 | - add_action( 'admin_init', array( $this, 'define_ajax_events' ), 0 ); | |
| 18 | - } | |
| 16 | + public function __construct() { | |
| 17 | + add_action( 'admin_init', array( $this, 'define_ajax_events' ), 0 ); | |
| 18 | + } | |
| 19 | 19 | |
| 20 | - public function define_ajax_events(): void { | |
| 21 | - foreach ( self::AJAX_EVENTS as $event ) { | |
| 22 | - add_action( self::AJAX_METHOD_PREFIX . $event, array( $this, $event ) ); | |
| 23 | - } | |
| 24 | - } | |
| 20 | + public function define_ajax_events(): void { | |
| 21 | + foreach ( self::AJAX_EVENTS as $event ) { | |
| 22 | + add_action( self::AJAX_METHOD_PREFIX . $event, array( $this, $event ) ); | |
| 23 | + } | |
| 24 | + } | |
| 25 | 25 | |
| 26 | - public function dismiss_plugin_split_notice(): void { | |
| 27 | - $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : ''; | |
| 28 | - // @codeCoverageIgnoreStart | |
| 29 | - if ( ! wp_verify_nonce( $nonce, 'hts_close_plugin_split' ) ) { | |
| 30 | - wp_send_json_error( 'Invalid nonce' ); | |
| 31 | - } | |
| 32 | - // @codeCoverageIgnoreEnd | |
| 33 | - update_option( self::HIDE_PLUGIN_SPLIT_NOTICE, true ); | |
| 34 | - } | |
| 26 | + public function dismiss_plugin_split_notice(): void { | |
| 27 | + $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : ''; | |
| 28 | + // @codeCoverageIgnoreStart | |
| 29 | + if ( ! wp_verify_nonce( $nonce, 'hts_close_plugin_split' ) ) { | |
| 30 | + wp_send_json_error( 'Invalid nonce' ); | |
| 31 | + } | |
| 32 | + // @codeCoverageIgnoreEnd | |
| 33 | + set_transient( self::HIDE_PLUGIN_SPLIT_NOTICE, true, self::TWO_DAYS ); | |
| 34 | + } | |
| 35 | 35 | } |