disable-admin-notices
Last commit date
admin
5 months ago
includes
3 months ago
languages
3 years ago
libs
3 months ago
migrations
1 year ago
vendor
1 month ago
CHANGELOG.md
1 month ago
clearfy.php
6 months ago
disable-admin-notices.php
1 month ago
readme.txt
1 month ago
uninstall.php
2 years ago
clearfy.php
55 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Этот файл инициализирует этот плагин, как аддон для плагина Clearfy. |
| 4 | * |
| 5 | * |
| 6 | * Github: https://github.com/alexkovalevv |
| 7 | * |
| 8 | * @author Alexander Kovalev <alex.kovalevv@gmail.com> |
| 9 | * @copyright (c) 2018 Webraftic Ltd |
| 10 | * @version 1.0 |
| 11 | */ |
| 12 | |
| 13 | // Exit if accessed directly |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; |
| 16 | } |
| 17 | |
| 18 | if ( ! defined( 'WDN_PLUGIN_ACTIVE' ) ) { |
| 19 | define( 'WDN_PLUGIN_VERSION', '1.3.6' ); |
| 20 | define( 'WDN_TEXT_DOMAIN', 'disable-admin-notices' ); |
| 21 | define( 'WDN_PLUGIN_ACTIVE', true ); |
| 22 | |
| 23 | // Этот плагин загружен, как аддон для плагина Clearfy |
| 24 | define( 'LOADING_DISABLE_ADMIN_NOTICES_AS_ADDON', true ); |
| 25 | |
| 26 | if ( ! defined( 'WDN_PLUGIN_DIR' ) ) { |
| 27 | define( 'WDN_PLUGIN_DIR', dirname( __FILE__ ) ); |
| 28 | } |
| 29 | |
| 30 | if ( ! defined( 'WDN_PLUGIN_BASE' ) ) { |
| 31 | define( 'WDN_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
| 32 | } |
| 33 | |
| 34 | if ( ! defined( 'WDN_PLUGIN_URL' ) ) { |
| 35 | define( 'WDN_PLUGIN_URL', plugins_url( '', __FILE__ ) ); |
| 36 | } |
| 37 | |
| 38 | try { |
| 39 | // Global scripts |
| 40 | require_once( WDN_PLUGIN_DIR . '/includes/functions.php' ); |
| 41 | require_once( WDN_PLUGIN_DIR . '/includes/3rd-party/class-clearfy-plugin.php' ); |
| 42 | new WDN_Plugin(); |
| 43 | } catch( Exception $e ) { |
| 44 | $wdan_plugin_error_func = function () use ( $e ) { |
| 45 | $error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Disable Admin Notices', $e->getMessage(), $e->getCode() ); |
| 46 | echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; |
| 47 | }; |
| 48 | |
| 49 | add_action( 'admin_notices', $wdan_plugin_error_func ); |
| 50 | add_action( 'network_admin_notices', $wdan_plugin_error_func ); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | |
| 55 |