| 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: Creative Motion <info@cm-wp.com> |
| 7 |
* Version: 1.3.1 |
| 8 |
* Text Domain: disable-admin-notices |
| 9 |
* Domain Path: /languages/ |
| 10 |
* Author URI: https://webcraftic.com |
| 11 |
* Framework Version: FACTORY_460_VERSION |
| 12 |
*/ |
| 13 |
|
| 14 |
/** |
| 15 |
* Developers who contributions in the development plugin: |
| 16 |
* |
| 17 |
* Alexander Kovalev |
| 18 |
* --------------------------------------------------------------------------------- |
| 19 |
* Full plugin development. |
| 20 |
* |
| 21 |
* Email: alex.kovalevv@gmail.com |
| 22 |
* Personal card: https://alexkovalevv.github.io |
| 23 |
* Personal repo: https://github.com/alexkovalevv |
| 24 |
* --------------------------------------------------------------------------------- |
| 25 |
* |
| 26 |
* Artem Prihodko |
| 27 |
* --------------------------------------------------------------------------------- |
| 28 |
* Updates and fixes |
| 29 |
* |
| 30 |
* Email: webtemyk@yandex.ru |
| 31 |
* GitHub: https://github.com/temyk |
| 32 |
* --------------------------------------------------------------------------------- |
| 33 |
*/ |
| 34 |
|
| 35 |
// Exit if accessed directly |
| 36 |
if ( ! defined( 'ABSPATH' ) ) { |
| 37 |
exit; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* ----------------------------------------------------------------------------- |
| 42 |
* CHECK REQUIREMENTS |
| 43 |
* Check compatibility with php and wp version of the user's site. As well as checking |
| 44 |
* compatibility with other plugins from Webcraftic. |
| 45 |
* ----------------------------------------------------------------------------- |
| 46 |
*/ |
| 47 |
|
| 48 |
require_once dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php'; |
| 49 |
|
| 50 |
// @formatter:off |
| 51 |
$wdan_plugin_info = [ |
| 52 |
'prefix' => 'wbcr_dan_', |
| 53 |
'plugin_name' => 'wbcr_dan', |
| 54 |
'plugin_title' => __( 'Webcraftic disable admin notices', 'disable-admin-notices' ), |
| 55 |
|
| 56 |
// PLUGIN SUPPORT |
| 57 |
'support_details' => [ |
| 58 |
'url' => 'https://clearfy.pro/', |
| 59 |
'pages_map' => [ |
| 60 |
'support' => 'support', // {site}/support |
| 61 |
'docs' => 'docs', // {site}/docs, |
| 62 |
'pricing' => 'disable-admin-notices', |
| 63 |
], |
| 64 |
], |
| 65 |
// PLUGIN PREMIUM SETTINGS |
| 66 |
'has_premium' => true, |
| 67 |
'license_settings' => [ |
| 68 |
'provider' => 'freemius', |
| 69 |
'slug' => 'disable-admin-notices-premium', |
| 70 |
'plugin_id' => '6456', |
| 71 |
'public_key' => 'pk_0570ec3c1b4100b9c9a0cbfe80f9f', |
| 72 |
'price' => 29, |
| 73 |
'has_updates' => true, |
| 74 |
'updates_settings' => [ |
| 75 |
'maybe_rollback' => true, |
| 76 |
'rollback_settings' => [ |
| 77 |
'prev_stable_version' => '0.0.0', |
| 78 |
], |
| 79 |
], |
| 80 |
], |
| 81 |
|
| 82 |
// PLUGIN SUBSCRIBE FORM |
| 83 |
'subscribe_widget' => true, |
| 84 |
'subscribe_settings' => [ 'group_id' => '105407140' ], |
| 85 |
|
| 86 |
// PLUGIN ADVERTS |
| 87 |
'render_adverts' => true, |
| 88 |
'adverts_settings' => [ |
| 89 |
'dashboard_widget' => false, // show dashboard widget (default: false) |
| 90 |
'right_sidebar' => true, // show adverts sidebar (default: false) |
| 91 |
'notice' => false, // show notice message (default: false) |
| 92 |
], |
| 93 |
|
| 94 |
// FRAMEWORK MODULES |
| 95 |
'load_factory_modules' => [ |
| 96 |
[ 'libs/factory/bootstrap', 'factory_bootstrap_461', 'admin' ], |
| 97 |
[ 'libs/factory/forms', 'factory_forms_457', 'admin' ], |
| 98 |
[ 'libs/factory/pages', 'factory_pages_460', 'admin' ], |
| 99 |
[ 'libs/factory/templates', 'factory_templates_112', 'all' ], |
| 100 |
[ 'libs/factory/freemius', 'factory_freemius_147', 'all' ], |
| 101 |
[ 'libs/factory/adverts', 'factory_adverts_137', 'admin' ], |
| 102 |
//array('libs/factory/logger', 'factory_logger_124', 'all') |
| 103 |
], |
| 104 |
]; |
| 105 |
|
| 106 |
$wdan_compatibility = new Wbcr_Factory460_Requirements( __FILE__, array_merge( $wdan_plugin_info, [ |
| 107 |
'plugin_already_activate' => defined( 'WDN_PLUGIN_ACTIVE' ), |
| 108 |
'required_php_version' => '7.0', |
| 109 |
'required_wp_version' => '4.8.0', |
| 110 |
'required_clearfy_check_component' => false, |
| 111 |
] ) ); |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
/** |
| 116 |
* If the plugin is compatible, then it will continue its work, otherwise it will be stopped, |
| 117 |
* and the user will throw a warning. |
| 118 |
*/ |
| 119 |
if ( ! $wdan_compatibility->check() ) { |
| 120 |
return; |
| 121 |
} |
| 122 |
|
| 123 |
/** |
| 124 |
* ----------------------------------------------------------------------------- |
| 125 |
* CONSTANTS |
| 126 |
* Install frequently used constants and constants for debugging, which will be |
| 127 |
* removed after compiling the plugin. |
| 128 |
* ----------------------------------------------------------------------------- |
| 129 |
*/ |
| 130 |
|
| 131 |
// This plugin is activated |
| 132 |
define( 'WDN_PLUGIN_ACTIVE', true ); |
| 133 |
define( 'WDN_PLUGIN_VERSION', $wdan_compatibility->get_plugin_version() ); |
| 134 |
define( 'WDN_PLUGIN_DIR', dirname( __FILE__ ) ); |
| 135 |
define( 'WDN_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
| 136 |
define( 'WDN_PLUGIN_URL', plugins_url( null, __FILE__ ) ); |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
/** |
| 141 |
* ----------------------------------------------------------------------------- |
| 142 |
* PLUGIN INIT |
| 143 |
* ----------------------------------------------------------------------------- |
| 144 |
*/ |
| 145 |
|
| 146 |
require_once WDN_PLUGIN_DIR . '/libs/factory/core/boot.php'; |
| 147 |
require_once WDN_PLUGIN_DIR . '/includes/functions.php'; |
| 148 |
require_once WDN_PLUGIN_DIR . '/includes/class-plugin.php'; |
| 149 |
|
| 150 |
try { |
| 151 |
new WDN_Plugin( __FILE__, array_merge( $wdan_plugin_info, [ |
| 152 |
'plugin_version' => WDN_PLUGIN_VERSION, |
| 153 |
'plugin_text_domain' => $wdan_compatibility->get_text_domain(), |
| 154 |
] ) ); |
| 155 |
} catch ( Exception $e ) { |
| 156 |
// Plugin wasn't initialized due to an error |
| 157 |
define( 'WDN_PLUGIN_THROW_ERROR', true ); |
| 158 |
|
| 159 |
$wdan_plugin_error_func = function () use ( $e ) { |
| 160 |
$error = sprintf( 'The %s plugin has stopped. <b>Error:</b> %s Code: %s', 'Disable Admin Notices', $e->getMessage(), $e->getCode() ); |
| 161 |
echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; |
| 162 |
}; |
| 163 |
|
| 164 |
add_action( 'admin_notices', $wdan_plugin_error_func ); |
| 165 |
add_action( 'network_admin_notices', $wdan_plugin_error_func ); |
| 166 |
} |
| 167 |
// @formatter:on |
| 168 |
|