PluginProbe
Disable Admin Notices – Hide Dashboard Notifications / 1.2.3
Disable Admin Notices – Hide Dashboard Notifications v1.2.3
1.4.7 1.4.6 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 All 30 releases
disable-admin-notices / admin / boot.php
boot.php
121 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Файл использует для реализации коротки�
4 сниппетов. Обычно сниппеты относятся к интеграции
5 * или каким мелким исправлениям и фиксам в интерфейсе этого плагина.
6 *
7 * Github: https://github.com/alexkovalevv
8 *
9 * @author Alexander Kovalev <alex.kovalevv@gmail.com>
10 * @copyright (c) 2018 Webraftic Ltd
11 * @version 1.0
12 */
13
14 // Exit if accessed directly
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 if ( ! defined( 'LOADING_DISABLE_ADMIN_NOTICES_AS_ADDON' ) ) {
20 add_filter( 'plugin_row_meta', function ( $links, $file ) {
21 if ( $file == WDN_PLUGIN_BASE ) {
22 $url = 'https://clearfy.pro';
23
24 if ( get_locale() == 'ru_RU' ) {
25 $url = 'https://ru.clearfy.pro';
26 }
27 $url .= '?utm_source=wordpress.org&utm_campaign=' . WDN_Plugin::app()->getPluginName();
28 $links[] = '<a href="' . $url . '" style="color: #FF5722;font-weight: bold;" target="_blank">' . __( 'Get ultimate plugin free', 'disable-admin-notices' ) . '</a>';
29 }
30
31 return $links;
32 }, 10, 2 );
33
34 /**
35 * Изменяем ссылку по умолчанию на собственную в виджете "Голосу за нас".
36 *
37 * Ссылка ведет на страницу рейтинга в репозитори Wordpress.org
38 * https://wordpress.org/support/plugin/disable-admin-notices/reviews/
39 *
40 * @param string $page_url
41 * @param string $plugin_name
42 *
43 * @return string
44 * @since 1.0
45 *
46 * @author Alexander Kovalev <alex.kovalevv@gmail.com>
47 */
48 add_filter( 'wbcr_factory_pages_432_imppage_rating_widget_url', function ( $page_url, $plugin_name ) {
49 if ( $plugin_name == WDN_Plugin::app()->getPluginName() ) {
50 return 'https://goo.gl/68ucHp';
51 }
52
53 return $page_url;
54 }, 10, 2 );
55
56 /**
57 * Удаляем лишние виджеты из правого сайдбара в интерфейсе плагина
58 *
59 * - Виджет с премиум рекламой
60 * - Виджет с рейтингом
61 * - Виджет с маркерами информации
62 */
63 add_filter( 'wbcr/factory/pages/impressive/widgets', function ( $widgets, $position, $plugin ) {
64 if ( WDN_Plugin::app()->getPluginName() == $plugin->getPluginName() && 'right' == $position ) {
65 unset( $widgets['business_suggetion'] );
66 unset( $widgets['rating_widget'] );
67 unset( $widgets['info_widget'] );
68 }
69
70 return $widgets;
71 }, 20, 3 );
72 } else {
73 /**
74 * Регистрируем опции плагина в Clearfy, чтобы тот мог совершать манипуляции с опциями этого плагина.
75 * Обычно такие манипуляции относятся к быстрым настройкам, сбросу настроек.
76 *
77 * @author Alexander Kovalev <alex.kovalevv@gmail.com>
78 * @since 1.0
79 */
80 add_filter( "wbcr_clearfy_group_options", function ( $options ) {
81 $options[] = [
82 'name' => 'hide_admin_notices',
83 'title' => __( 'Hide admin notices', 'disable-admin-notices' ),
84 'tags' => [],
85 'values' => [ 'hide_admin_notices' => 'only_selected' ]
86 ];
87 $options[] = [
88 'name' => 'show_notices_in_adminbar',
89 'title' => __( 'Enable hidden notices in adminbar', 'disable-admin-notices' ),
90 'tags' => []
91 ];
92
93 return $options;
94 } );
95 }
96
97 /**
98 * Print admin notice: "Would you like to send them for spam checking?"
99 *
100 * If user clicked button "Yes, do it", plugin will exec action,
101 * that put all unapproved comments to spam check queue.
102 */
103 add_action( 'wbcr/factory/admin_notices', function ( $notices, $plugin_name ) {
104 if ( $plugin_name != WDN_Plugin::app()->getPluginName() ) {
105 return $notices;
106 }
107
108 $page_url = 'https://clearfy.pro/disable-admin-notices/';
109
110 $notice_text = sprintf( __( 'Thanks for using the Disable admin notices plugin! If you need support or all the features of the plugin, please buy the pro version <a class="button" href="%s">Get PRO</a>' ), $page_url );
111
112 $notices[] = [
113 'id' => 'wdan_get_premium',
114 'type' => 'success',
115 'dismissible' => true,
116 'dismiss_expires' => 0,
117 'text' => '<p><strong>Disable Admin Notices Individually:</strong><br>' . $notice_text . '</p>'
118 ];
119
120 return $notices;
121 }, 10, 2 );