| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/VegeBasketDO/wp-content/plugins/wp-coder/classes/Admin/ |
Upload File : |
<?php
namespace WPCoder\Admin;
use WPCoder\WPCoder;
defined( 'ABSPATH' ) || exit;
class AdminNotices {
public function __construct() {
add_action( 'admin_notices', [ $this, 'admin_notice' ] );
}
public function admin_notice() {
if ( ! isset( $_GET['page'], $_GET['notice'] ) ) {
return;
}
$page = $_GET['page'];
$notice = $_GET['notice'];
if ( in_array( $page, [ WPCoder::SLUG, WPCoder::SLUG . '-settings' ], true ) ) {
switch ( $notice ) {
case 'save_item':
$this->save_item();
break;
case 'remove_item':
$this->remove_item();
break;
}
}
}
public function save_item() {
$text = __( 'Item saved successfully.', 'wp-coder' );
echo '<div class="wowp-notification notification-success notice notice-success is-dismissible">' . esc_html( $text ) . '</div>';
}
public function remove_item() {
$text = __( 'Item has been deleted', 'wp-coder' );
echo '<div class="wowp-notification notification-warning notice notice-warning is-dismissible">' . esc_html( $text ) . '</div>';
}
}