PluginProbe
Bubble Menu – Floating Button Menu with Sticky Navigation / 4.0.6
Bubble Menu – Floating Button Menu with Sticky Navigation v4.0.6
trunk 1.3 2.0 2.2 2.2.1 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.1 4.1.1
bubble-menu / classes / Admin / AdminNotices.php

AdminNotices.php in Bubble Menu – Floating Button Menu with Sticky Navigation 4.0.6, at classes/Admin/AdminNotices.php

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BubbleMenu\Admin;
4
5 use BubbleMenu\WOWP_Plugin;
6
7 defined( 'ABSPATH' ) || exit;
8
9 class AdminNotices {
10
11
12 public static function init(): void {
13 add_action( 'admin_notices', [ __CLASS__, 'admin_notice' ] );
14 }
15
16 public static function admin_notice(): bool {
17
18 if ( ! isset( $_GET['page'] ) ) {
19 return false;
20 }
21
22 if ( $_GET['page'] !== WOWP_Plugin::SLUG ) {
23 return false;
24 }
25
26 if ( ! empty( $_GET['notice'] ) && $_GET['notice'] === 'save_item' ) {
27 self::save_item();
28 } elseif ( ! empty( $_GET['notice'] ) && $_GET['notice'] === 'remove_item' ) {
29 self::remove_item();
30 }
31
32 return true;
33 }
34
35 public static function save_item(): void {
36 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : '';
37
38 if ( ! empty( $nonce ) && wp_verify_nonce( $nonce, 'save-item' ) ) {
39 $text = __( 'Item Saved', 'bubble-menu' );
40 echo '<div class="wpie-notice notice notice-success is-dismissible">' . esc_html( $text ) . '</div>';
41 }
42 }
43
44 public static function remove_item(): void {
45 $text = __( 'Item Remove', 'bubble-menu' );
46 echo '<div class="wpie-notice notice notice-warning is-dismissible">' . esc_html( $text ) . '</div>';
47 }
48
49 }