PluginProbe
Hostinger Tools / 3.0.0
Hostinger Tools v3.0.0
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.0, at includes/Admin/Ajax.php

36 lines 850 B
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 private const HIDE_PLUGIN_SPLIT_NOTICE = 'hts_plugin_split_notice_hidden';
10
11 public function __construct() {
12 add_action( 'admin_init', array( $this, 'define_ajax_events' ), 0 );
13 }
14
15 public function define_ajax_events(): void {
16 $events = array(
17 'dismiss_plugin_split_notice',
18 );
19
20 foreach ( $events as $event ) {
21 add_action( 'wp_ajax_hostinger_' . $event, array( $this, $event ) );
22 }
23 }
24
25 public function dismiss_plugin_split_notice(): void {
26 $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : '';
27
28 if ( ! wp_verify_nonce( $nonce, 'hts_close_plugin_split' ) ) {
29 wp_send_json_error( 'Invalid nonce' );
30 }
31
32 set_transient( self::HIDE_PLUGIN_SPLIT_NOTICE, true, self::TWO_DAYS );
33 }
34
35 }
36