PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.2
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.2
3.3.2 3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 All 157 releases
notificationx / vendor / priyomukul / wp-notice / src / Utils / NoticeRemover.php

NoticeRemover.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 3.3.2, at vendor/priyomukul/wp-notice/src/Utils/NoticeRemover.php

40 lines 1017 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PriyoMukul\WPNotice\Utils;
4
5 use PriyoMukul\WPNotice\Notices;
6
7 class NoticeRemover {
8 private static $instance = null;
9
10 public static function get_instance( $version ) {
11 if ( self::$instance == null ) {
12 self::$instance = new static( $version );
13 }
14
15 return self::$instance;
16 }
17
18 public function __construct( $version = '1.0.0', $instanceOf = null ) {
19 add_action( 'init', function () use ( $version, $instanceOf ) {
20 global $wp_filter;
21
22 if ( $instanceOf === null ) {
23 $instanceOf = Notices::class;
24 }
25
26 if(!isset($wp_filter['admin_notices']->callbacks[10])) return;
27
28 foreach ( $wp_filter['admin_notices']->callbacks[10] as $callback ) {
29 if ( is_array( $callback['function'] ) && $callback['function'][0] instanceof $instanceOf ) {
30 $notice = $callback['function'][0];
31
32 if ( $notice->version === $version ) {
33 remove_action( 'admin_notices', [ $notice, 'notices' ] );
34 remove_action( 'admin_footer', [ $notice, 'scripts' ] );
35 }
36 }
37 }
38 } );
39 }
40 }