disable-admin-notices.php
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Webcraftic Disable Admin Notices Individually |
| 4 | * Plugin URI: https://wordpress.org/plugins/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: Webcraftic <wordpress.webraftic@gmail.com> |
| 7 | * Version: 1.0.3 |
| 8 | * Text Domain: disable-admin-notices |
| 9 | * Domain Path: /languages/ |
| 10 | */ |
| 11 | |
| 12 | if( defined('WBCR_DAN_PLUGIN_ACTIVE') || (defined('WBCR_CLEARFY_PLUGIN_ACTIVE') && !defined('LOADING_DISABLE_ADMIN_NOTICES_AS_ADDON')) ) { |
| 13 | function wbcr_dan_admin_notice_error() |
| 14 | { |
| 15 | ?> |
| 16 | <div class="notice notice-error"> |
| 17 | <p><?php _e('We found that you have the "Clearfy - disable unused features" plugin installed, this plugin already has disable comments functions, so you can deactivate plugin "Disable admin notices"!'); ?></p> |
| 18 | </div> |
| 19 | <?php |
| 20 | } |
| 21 | |
| 22 | add_action('admin_notices', 'wbcr_dan_admin_notice_error'); |
| 23 | |
| 24 | return; |
| 25 | } else { |
| 26 | |
| 27 | define('WBCR_DAN_PLUGIN_ACTIVE', true); |
| 28 | |
| 29 | define('WBCR_DAN_PLUGIN_DIR', dirname(__FILE__)); |
| 30 | define('WBCR_DAN_PLUGIN_BASE', plugin_basename(__FILE__)); |
| 31 | define('WBCR_DAN_PLUGIN_URL', plugins_url(null, __FILE__)); |
| 32 | |
| 33 | |
| 34 | |
| 35 | if( !defined('LOADING_DISABLE_ADMIN_NOTICES_AS_ADDON') ) { |
| 36 | require_once(WBCR_DAN_PLUGIN_DIR . '/libs/factory/core/boot.php'); |
| 37 | } |
| 38 | |
| 39 | function wbcr_dan_plugin_init() |
| 40 | { |
| 41 | global $wbcr_dan_plugin; |
| 42 | |
| 43 | // Localization plugin |
| 44 | load_plugin_textdomain('disable-admin-notices', false, dirname(WBCR_DAN_PLUGIN_BASE) . '/languages/'); |
| 45 | |
| 46 | if( defined('LOADING_DISABLE_ADMIN_NOTICES_AS_ADDON') ) { |
| 47 | //return; |
| 48 | global $wbcr_clearfy_plugin; |
| 49 | $wbcr_dan_plugin = $wbcr_clearfy_plugin; |
| 50 | } else { |
| 51 | |
| 52 | $wbcr_dan_plugin = new Factory326_Plugin(__FILE__, array( |
| 53 | 'name' => 'wbcr_dan', |
| 54 | 'title' => __('Webcraftic disable admin notices', 'disable-admin-notices'), |
| 55 | 'version' => '1.0.3', |
| 56 | 'host' => 'wordpress.org', |
| 57 | 'url' => 'https://wordpress.org/plugins/disable-admin-notices/', |
| 58 | 'assembly' => 'free', |
| 59 | 'updates' => WBCR_DAN_PLUGIN_DIR . '/updates/' |
| 60 | )); |
| 61 | |
| 62 | // requires factory modules |
| 63 | $wbcr_dan_plugin->load(array( |
| 64 | array('libs/factory/bootstrap', 'factory_bootstrap_330', 'admin'), |
| 65 | array('libs/factory/forms', 'factory_forms_329', 'admin'), |
| 66 | array('libs/factory/pages', 'factory_pages_324', 'admin'), |
| 67 | array('libs/factory/clearfy', 'factory_clearfy_102', 'all') |
| 68 | )); |
| 69 | } |
| 70 | |
| 71 | // loading other files |
| 72 | if( is_admin() ) { |
| 73 | require(WBCR_DAN_PLUGIN_DIR . '/admin/boot.php'); |
| 74 | } |
| 75 | |
| 76 | require(WBCR_DAN_PLUGIN_DIR . '/includes/classes/class.configurate-notices.php'); |
| 77 | new WbcrHan_ConfigHideNotices($wbcr_dan_plugin); |
| 78 | } |
| 79 | |
| 80 | if( defined('LOADING_DISABLE_ADMIN_NOTICES_AS_ADDON') ) { |
| 81 | wbcr_dan_plugin_init(); |
| 82 | } else { |
| 83 | add_action('plugins_loaded', 'wbcr_dan_plugin_init'); |
| 84 | } |
| 85 | } |