PluginProbe
Hostinger Tools / 3.0.76
Hostinger Tools v3.0.76
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / includes / Admin / Ajax.php

Ajax.php in Hostinger Tools 3.0.76, at includes/Admin/Ajax.php

36 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hostinger\Admin;
4
5 defined( 'ABSPATH' ) || exit;
6
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';
11
12 public const AJAX_EVENTS = array(
13 'dismiss_plugin_split_notice',
14 );
15
16 public function __construct() {
17 add_action( 'admin_init', array( $this, 'define_ajax_events' ), 0 );
18 }
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 }
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 }
35 }
36