PluginProbe ʕ •ᴥ•ʔ
Disable Admin Notices – Hide Dashboard Notifications / 1.4.7
Disable Admin Notices – Hide Dashboard Notifications v1.4.7
1.4.7 1.4.6 1.4.5 trunk 1.0.0 1.0.2 1.0.3 1.0.5 1.0.6 1.1.1 1.1.3 1.1.4 1.2.0 1.2.2 1.2.3 1.2.4 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4
disable-admin-notices / disable-admin-notices.php
disable-admin-notices Last commit date
admin 1 month ago includes 1 month ago languages 3 years ago libs 1 month ago migrations 1 year ago vendor 1 month ago CHANGELOG.md 1 month ago clearfy.php 7 months ago disable-admin-notices.php 1 month ago readme.txt 1 week ago uninstall.php 2 years ago
disable-admin-notices.php
170 lines
1 <?php
2 /**
3 * Plugin Name: Disable Admin Notices Individually
4 * Plugin URI: https://clearfy.pro/disable-admin-notices
5 * Description: Disable admin notices plugin gives you the option to hide updates warnings and inline notices in the admin panel.
6 * Author: Themeisle
7 * Version: 1.4.7
8 * Text Domain: disable-admin-notices
9 * Domain Path: /languages/
10 * Author URI: https://themeisle.com
11 * Framework Version: FACTORY_480_VERSION
12 * WordPress Available: yes
13 * Requires License: no
14 */
15
16 /**
17 * Developers who contributions in the development plugin:
18 *
19 * Alexander Kovalev
20 * ---------------------------------------------------------------------------------
21 * Full plugin development.
22 *
23 * Email: alex.kovalevv@gmail.com
24 * Personal card: https://alexkovalevv.github.io
25 * Personal repo: https://github.com/alexkovalevv
26 * ---------------------------------------------------------------------------------
27 *
28 * Artem Prihodko
29 * ---------------------------------------------------------------------------------
30 * Updates and fixes
31 *
32 * Email: webtemyk@yandex.ru
33 * GitHub: https://github.com/temyk
34 * ---------------------------------------------------------------------------------
35 */
36
37 // Exit if accessed directly
38 if ( ! defined( 'ABSPATH' ) ) {
39 exit;
40 }
41
42 /**
43 * -----------------------------------------------------------------------------
44 * CHECK REQUIREMENTS
45 * Check compatibility with php and wp version of the user's site. As well as checking
46 * compatibility with other plugins from Webcraftic.
47 * -----------------------------------------------------------------------------
48 */
49
50 require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php' );
51
52 // @formatter:off
53 $wdan_plugin_info = [
54 'prefix' => 'wbcr_dan_',
55 'plugin_name' => 'wbcr_dan',
56 'plugin_title' => 'Disable admin notices',
57
58 // PLUGIN SUPPORT
59 'support_details' => [
60 'url' => 'https://clearfy.pro/',
61 'pages_map' => [
62 'support' => 'support', // {site}/support
63 'docs' => 'docs', // {site}/docs,
64 'pricing' => 'disable-admin-notices'
65 ]
66 ],
67
68 // PLUGIN SUBSCRIBE FORM
69 'subscribe_widget' => true,
70 'subscribe_settings' => [ 'group_id' => '105407140' ],
71
72 // FRAMEWORK MODULES
73 'load_factory_modules' => [
74 [ 'libs/factory/bootstrap', 'factory_bootstrap_482', 'admin' ],
75 [ 'libs/factory/forms', 'factory_forms_480', 'admin' ],
76 [ 'libs/factory/pages', 'factory_pages_480', 'admin' ],
77 [ 'libs/factory/templates', 'factory_templates_134', 'all' ],
78 //array('libs/factory/logger', 'factory_logger_149', 'all')
79 ]
80 ];
81
82 $wdan_compatibility = new Wbcr_Factory480_Requirements( __FILE__, array_merge( $wdan_plugin_info, [
83 'plugin_already_activate' => defined( 'WDN_PLUGIN_ACTIVE' ),
84 'required_php_version' => '7.0',
85 'required_wp_version' => '4.8.0',
86 'required_clearfy_check_component' => false
87 ] ) );
88
89
90
91 /**
92 * If the plugin is compatible, then it will continue its work, otherwise it will be stopped,
93 * and the user will throw a warning.
94 */
95 if ( ! $wdan_compatibility->check() ) {
96 return;
97 }
98
99 /**
100 * -----------------------------------------------------------------------------
101 * CONSTANTS
102 * Install frequently used constants and constants for debugging, which will be
103 * removed after compiling the plugin.
104 * -----------------------------------------------------------------------------
105 */
106
107 // This plugin is activated
108 define( 'WDN_PLUGIN_ACTIVE', true );
109 define( 'WDN_PLUGIN_VERSION', $wdan_compatibility->get_plugin_version() );
110 define( 'WDN_PLUGIN_DIR', dirname( __FILE__ ) );
111 define( 'WDN_PLUGIN_BASE', plugin_basename( __FILE__ ) );
112 define( 'WDN_PLUGIN_URL', plugins_url( '', __FILE__ ) );
113 define( 'WDN_PLUGIN_FILE', __FILE__ );
114 define( 'WDN_PRODUCT_SLUG', basename( dirname( __FILE__ ) ) );
115
116
117 /**
118 * -----------------------------------------------------------------------------
119 * PLUGIN INIT
120 * -----------------------------------------------------------------------------
121 */
122
123 require_once( WDN_PLUGIN_DIR . '/libs/factory/core/boot.php' );
124 require_once( WDN_PLUGIN_DIR . '/includes/functions.php' );
125 require_once( WDN_PLUGIN_DIR . '/includes/class-plugin.php' );
126
127 /**
128 * Deactivate PRO plugin.
129 *
130 * @param WDN_Plugin $disable_admin_notice_obj
131 */
132 function deactivate_pro_plugin( $disable_admin_notice_obj ) {
133 $pro_slug = 'disable-admin-notices-premium-premium/disable-admin-notices-premium.php';
134
135 // If plugin isn't active, we stop immediately.
136 if ( ! is_plugin_active( $pro_slug ) ) {
137 return;
138 }
139
140 // Delete premium option
141 $disable_admin_notice_obj->deletePopulateOption( 'premium_package' );
142
143 // Remove pro plugin action.
144 remove_action( 'plugins_loaded', 'wdan_premium_load', 20 );
145
146 // As register_deactivation_hook called, deactivate the pro plugin silently.
147 deactivate_plugins( $pro_slug, true );
148 }
149
150 try {
151 require_once WDN_PLUGIN_DIR . '/vendor/autoload.php';
152 $disable_admin_notice = new WDN_Plugin( __FILE__, array_merge( $wdan_plugin_info, [
153 'plugin_version' => WDN_PLUGIN_VERSION,
154 'plugin_text_domain' => $wdan_compatibility->get_text_domain(),
155 ] ) );
156
157 deactivate_pro_plugin( $disable_admin_notice );
158 } catch ( Exception $e ) {
159 // Plugin wasn't initialized due to an error
160 define( 'WDN_PLUGIN_THROW_ERROR', true );
161
162 $wdan_plugin_error_func = function () use ( $e ) {
163 $error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Disable Admin Notices', $e->getMessage(), $e->getCode() );
164 echo '<div class="notice notice-error"><p>' . $error . '</p></div>';
165 };
166
167 add_action( 'admin_notices', $wdan_plugin_error_func );
168 add_action( 'network_admin_notices', $wdan_plugin_error_func );
169 }
170 // @formatter:on