PluginProbe ʕ •ᴥ•ʔ
Disable Admin Notices – Hide Dashboard Notifications / trunk
Disable Admin Notices – Hide Dashboard Notifications vtrunk
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 / includes / class-plugin.php
disable-admin-notices / includes Last commit date
3rd-party 3 years ago classes 5 months ago class-plugin.php 2 months ago functions.php 3 years ago index.php 8 years ago
class-plugin.php
146 lines
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_159\Base;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 class WDN_Plugin extends Wbcr_Factory480_Plugin {
19
20 /**
21 * @var Wbcr_Factory480_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 // Wordpress 6.7 fix
46 add_action( 'init', function () {
47 if ( is_admin() ) {
48 $this->register_pages();
49 }
50 } );
51
52 add_filter( 'themeisle_sdk_products', [ __CLASS__, 'register_sdk' ] );
53
54 add_filter( 'themeisle_sdk_ran_promos', '__return_true' );
55
56 add_action( 'admin_enqueue_scripts', [ $this, 'mark_internal_page' ] );
57 add_filter( 'themeisle_sdk_blackfriday_data', [ $this, 'add_black_friday_data' ] );
58 }
59 /**
60 * Register product into SDK.
61 *
62 * @param array $products All products.
63 *
64 * @return array Registered product.
65 */
66 public static function register_sdk( $products ) {
67 $products[] = WDN_PLUGIN_FILE;
68
69 return $products;
70 }
71 /**
72 * @return Wbcr_Factory480_Plugin
73 */
74 public static function app() {
75 return self::$app;
76 }
77
78 private function register_pages() {
79 //self::app()->registerPage( 'WDN_Log_Page', WDN_PLUGIN_DIR . '/admin/pages/class-pages-log.php' );
80 self::app()->registerPage( 'WDN_Settings_Page', WDN_PLUGIN_DIR . '/admin/pages/class-pages-settings.php' );
81 self::app()->registerPage( 'WDAN_Notices', WDN_PLUGIN_DIR . '/admin/pages/class-pages-notices.php' );
82 self::app()->registerPage( 'WDAN_Block_Ad_Redirects', WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-redirects.php' );
83 self::app()->registerPage( 'WDAN_Edit_Admin_Bar', WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-admin-bar.php' );
84 }
85
86 private function admin_scripts() {
87 require( WDN_PLUGIN_DIR . '/admin/options.php' );
88 require( WDN_PLUGIN_DIR . '/admin/class-page-basic.php' );
89
90 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
91 require_once( WDN_PLUGIN_DIR . '/admin/ajax/hide-notice.php' );
92 require_once( WDN_PLUGIN_DIR . '/admin/ajax/restore-notice.php' );
93 require_once( WDN_PLUGIN_DIR . '/admin/ajax/disable-adminbar-menus.php' );
94 }
95
96 require_once( WDN_PLUGIN_DIR . '/admin/boot.php' );
97 require_once( WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-admin-bar.php' );
98 require_once( WDN_PLUGIN_DIR . '/admin/pages/class-pages-edit-redirects.php' );
99 require_once( WDN_PLUGIN_DIR . '/admin/pages/class-pages-notices.php' );
100
101 /*add_action( 'plugins_loaded', function () {
102 $this->register_pages();
103 }, 30 );*/
104 }
105
106 private function global_scripts() {
107 require_once( WDN_PLUGIN_DIR . '/includes/classes/class-configurate-notices.php' );
108 new WDN_ConfigHideNotices( self::$app );
109 }
110
111 public function add_black_friday_data( $configs ) {
112 $config = $configs['default'];
113
114 if ( defined( 'NEVE_VERSION' ) ) {
115 return $configs;
116 }
117
118 // translators: 1. Number of free licenses, 2. The price of the product.
119 $config['message'] = sprintf( __( 'You\'re using Disable Admin Notices, and the team behind it is celebrating Black Friday by giving away %1$s licences of Neve Pro. A premium WordPress theme worth %2$s, packed with starter sites, a header builder, and WooCommerce layouts. Claim yours before they run out.', 'disable-admin-notices' ), 100, '$69' );
120 $config['cta_label'] = __( 'Get Neve Pro free', 'disable-admin-notices' );
121 $config['plugin_meta_message'] = __( 'Black Friday Sale - Get Neve Pro free', 'disable-admin-notices' );
122 $config['sale_url'] = add_query_arg(
123 array(
124 'utm_term' => 'free',
125 ),
126 tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/neve-claim-bf', 'bfcm', 'disable-notices' ) )
127 );
128
129 $configs[ WDN_PRODUCT_SLUG ] = $config;
130
131 return $configs;
132 }
133
134 public function mark_internal_page( $hook ) {
135 if ( strpos( $hook, 'wdan_settings' ) !== false ) {
136 do_action( 'themeisle_internal_page', WDN_PRODUCT_SLUG, 'settings' );
137 } elseif ( strpos( $hook, 'wdan-notices' ) !== false ) {
138 do_action( 'themeisle_internal_page', WDN_PRODUCT_SLUG, 'notices' );
139 } elseif ( strpos( $hook, 'wdanp-edit-redirects' ) !== false ) {
140 do_action( 'themeisle_internal_page', WDN_PRODUCT_SLUG, 'edit-redirects' );
141 } elseif ( strpos( $hook, 'wdanp-edit-admin-bar' ) !== false ) {
142 do_action( 'themeisle_internal_page', WDN_PRODUCT_SLUG, 'edit-admin-bar' );
143 }
144 }
145 }
146