PluginProbe
Disable Admin Notices – Hide Dashboard Notifications / 1.4.1
Disable Admin Notices – Hide Dashboard Notifications v1.4.1
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
117 lines 4.2 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/disable-admin-notices/';
23 $url .= '?utm_source=wordpress.org&utm_campaign=' . WDN_Plugin::app()->getPluginName();
24 $links[] = '<a href="' . $url . '" style="color: #FF5722;font-weight: bold;" target="_blank">' . __( 'Get premium plugin', 'disable-admin-notices' ) . '</a>';
25 }
26
27 return $links;
28 }, 10, 2 );
29
30 /**
31 * Изменяем ссылку по умолчанию на собственную в виджете "Голосу за нас".
32 *
33 * Ссылка ведет на страницу рейтинга в репозитории Wordpress.org
34 * https://wordpress.org/support/plugin/disable-admin-notices/reviews/
35 *
36 * @param string $page_url
37 * @param string $plugin_name
38 *
39 * @return string
40 * @since 1.0
41 *
42 * @author Alexander Kovalev <alex.kovalevv@gmail.com>
43 */
44 add_filter( 'wbcr_factory_pages_480_imppage_rating_widget_url', function ( $page_url, $plugin_name ) {
45 if ( $plugin_name == WDN_Plugin::app()->getPluginName() ) {
46 return 'https://goo.gl/68ucHp';
47 }
48
49 return $page_url;
50 }, 10, 2 );
51
52 /**
53 * Удаляем лишние виджеты из правого сайдбара в интерфейсе плагина
54 *
55 * - Виджет с премиум рекламой
56 * - Виджет с рейтингом
57 * - Виджет с маркерами информации
58 */
59 add_filter( 'wbcr/factory/pages/impressive/widgets', function ( $widgets, $position, $plugin ) {
60 if ( WDN_Plugin::app()->getPluginName() == $plugin->getPluginName() && 'right' == $position ) {
61 unset( $widgets['business_suggetion'] );
62 unset( $widgets['rating_widget'] );
63 unset( $widgets['info_widget'] );
64 }
65
66 return $widgets;
67 }, 20, 3 );
68 } else {
69 /**
70 * Регистрируем опции плагина в Clearfy, чтобы тот мог совершать манипуляции с опциями этого плагина.
71 * Обычно такие манипуляции относятся к быстрым настройкам, сбросу настроек.
72 *
73 * @author Alexander Kovalev <alex.kovalevv@gmail.com>
74 * @since 1.0
75 */
76 add_filter( "wbcr_clearfy_group_options", function ( $options ) {
77 $options[] = [
78 'name' => 'hide_admin_notices',
79 'title' => __( 'Hide admin notices', 'disable-admin-notices' ),
80 'tags' => [],
81 'values' => [ 'hide_admin_notices' => 'only_selected' ]
82 ];
83 $options[] = [
84 'name' => 'show_notices_in_adminbar',
85 'title' => __( 'Enable hidden notices in adminbar', 'disable-admin-notices' ),
86 'tags' => []
87 ];
88
89 return $options;
90 } );
91 }
92
93 /**
94 * Print admin notice: "Would you like to send them for spam checking?"
95 *
96 * If user clicked button "Yes, do it", plugin will exec action,
97 * that put all unapproved comments to spam check queue.
98 */
99 add_action( 'wbcr/factory/admin_notices', function ( $notices, $plugin_name ) {
100 if ( $plugin_name != WDN_Plugin::app()->getPluginName() || 'wbcr_clearfy' === $plugin_name ) {
101 return $notices;
102 }
103
104 $page_url = 'https://clearfy.pro/disable-admin-notices/';
105
106 $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 );
107
108 $notices[] = [
109 'id' => 'wdan_get_premium',
110 'type' => 'success',
111 'dismissible' => true,
112 'dismiss_expires' => 0,
113 'text' => '<p><strong>Disable Admin Notices Individually:</strong><br>' . $notice_text . '</p>'
114 ];
115
116 return $notices;
117 }, 10, 2 );