PluginProbe
WP Coder – Insert & Manage Code Snippets / 3.0.1
WP Coder – Insert & Manage Code Snippets v3.0.1
4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 3.5.1 All 39 releases
wp-coder / classes / Admin / AdminNotices.php

AdminNotices.php in WP Coder – Insert & Manage Code Snippets 3.0.1, at classes/Admin/AdminNotices.php

33 lines 797 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPCoder\Admin;
4
5 defined( 'ABSPATH' ) || exit;
6
7 class AdminNotices {
8
9
10 public function __construct() {
11 add_action( 'admin_notices', [ $this, 'admin_notice' ] );
12 }
13
14 public function admin_notice() {
15 $notice = $_GET['notice'] ?? '';
16 if ( ! empty( $notice ) && $notice === 'save_item' ) {
17 $this->save_item();
18 } elseif ( ! empty( $notice ) && $notice === 'remove_item' ) {
19 $this->remove_item();
20 }
21 }
22
23 public function save_item() {
24 $text = __( 'Item saved.', 'wpcoder' );
25 echo '<div class="wowp-notice notice notice-success is-dismissible">' . esc_html( $text ) . '</div>';
26 }
27
28 public function remove_item() {
29 $text = __( 'Item delete.', 'wpcoder' );
30 echo '<div class="wowp-notice notice notice-warning is-dismissible">' . esc_html( $text ) . '</div>';
31 }
32
33 }