class-plugin.php
| 1 | <?php |
| 2 | /** |
| 3 | * Disable admin notices core class |
| 4 | * |
| 5 | * @author Alexander Kovalev <alex.kovalevv@gmail.com> |
| 6 | * Github: https://github.com/alexkovalevv |
| 7 | * @copyright (c) 2018 Webraftic Ltd |
| 8 | * @version 1.0 |
| 9 | */ |
| 10 | |
| 11 | // Exit if accessed directly |
| 12 | //use WBCR\Factory_Adverts_111\Base; |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; |
| 16 | } |
| 17 | |
| 18 | class WDN_Plugin extends Wbcr_Factory431_Plugin { |
| 19 | |
| 20 | /** |
| 21 | * @var Wbcr_Factory431_Plugin |
| 22 | */ |
| 23 | private static $app; |
| 24 | private $plugin_data; |
| 25 | |
| 26 | |
| 27 | /** |
| 28 | * @param string $plugin_path |
| 29 | * @param array $data |
| 30 | * |
| 31 | * @throws Exception |
| 32 | */ |
| 33 | public function __construct( $plugin_path, $data ) { |
| 34 | parent::__construct( $plugin_path, $data ); |
| 35 | |
| 36 | self::$app = $this; |
| 37 | $this->plugin_data = $data; |
| 38 | |
| 39 | $this->global_scripts(); |
| 40 | |
| 41 | if ( is_admin() ) { |
| 42 | $this->admin_scripts(); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @return Wbcr_Factory431_Plugin |
| 48 | */ |
| 49 | public static function app() { |
| 50 | return self::$app; |
| 51 | } |
| 52 | |
| 53 | private function registerPages() { |
| 54 | self::app()->registerPage( 'WDN_Settings_Page', WDN_PLUGIN_DIR . '/admin/pages/class-pages-settings.php' ); |
| 55 | |
| 56 | if ( ! ( $this->premium->is_activate() && $this->premium->is_install_package() ) ) { |
| 57 | self::app()->registerPage( 'WDAN_Block_Ad_Redirects', WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-redirects.php' ); |
| 58 | self::app()->registerPage( 'WDAN_Edit_Admin_Bar', WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-admin-bar.php' ); |
| 59 | } |
| 60 | |
| 61 | self::app()->registerPage( 'WDN_LicensePage', WDN_PLUGIN_DIR . '/admin/pages/class-pages-license.php' ); |
| 62 | } |
| 63 | |
| 64 | private function admin_scripts() { |
| 65 | require( WDN_PLUGIN_DIR . '/admin/options.php' ); |
| 66 | |
| 67 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
| 68 | require_once( WDN_PLUGIN_DIR . '/admin/ajax/hide-notice.php' ); |
| 69 | require_once( WDN_PLUGIN_DIR . '/admin/ajax/restore-notice.php' ); |
| 70 | } |
| 71 | |
| 72 | require_once( WDN_PLUGIN_DIR . '/admin/boot.php' ); |
| 73 | require_once( WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-admin-bar.php' ); |
| 74 | require_once( WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-redirects.php' ); |
| 75 | |
| 76 | add_action( 'plugins_loaded', function () { |
| 77 | $this->registerPages(); |
| 78 | }, 30 ); |
| 79 | } |
| 80 | |
| 81 | private function global_scripts() { |
| 82 | require_once( WDN_PLUGIN_DIR . '/includes/function.php' ); |
| 83 | require_once( WDN_PLUGIN_DIR . '/includes/classes/class-configurate-notices.php' ); |
| 84 | new WDN_ConfigHideNotices( self::$app ); |
| 85 | } |
| 86 | } |
| 87 |