Server IP : 172.67.157.199 / Your IP : 18.221.102.79 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/templately/vendor/priyomukul/wp-notice/src/Utils/ |
Upload File : |
<?php namespace PriyoMukul\WPNotice\Utils; use PriyoMukul\WPNotice\Notices; class NoticeRemover { private static $instance = null; public static function get_instance( $version ) { if ( self::$instance == null ) { self::$instance = new static( $version ); } return self::$instance; } public function __construct( $version = '1.0.0', $instanceOf = null ) { add_action( 'init', function () use ( $version, $instanceOf ) { global $wp_filter; if ( $instanceOf === null ) { $instanceOf = Notices::class; } if(!isset($wp_filter['admin_notices']->callbacks[10])) return; foreach ( $wp_filter['admin_notices']->callbacks[10] as $callback ) { if ( is_array( $callback['function'] ) && $callback['function'][0] instanceof $instanceOf ) { $notice = $callback['function'][0]; if ( $notice->version === $version ) { remove_action( 'admin_notices', [ $notice, 'notices' ] ); remove_action( 'admin_footer', [ $notice, 'scripts' ] ); } } } } ); } }