PluginProbe ʕ •ᴥ•ʔ
Disable Admin Notices – Hide Dashboard Notifications / 1.4.7
Disable Admin Notices – Hide Dashboard Notifications v1.4.7
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 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4
disable-admin-notices / admin / pages / class-pages-notices.php
disable-admin-notices / admin / pages Last commit date
class-pages-edit-admin-bar.php 1 month ago class-pages-edit-redirects.php 6 months ago class-pages-notices.php 7 months ago class-pages-settings.php 1 year ago index.php 3 years ago
class-pages-notices.php
150 lines
1 <?php
2
3 // Exit if accessed directly
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Страница со списком скрыты�
10 нотисов.
11 *
12 * @author Artem Prihodko <webtemyk@yandex.ru>
13 * @copyright (c) 2020 Webraftic Ltd
14 * @version 1.0
15 */
16 class WDAN_Notices extends WDN_Page {
17
18 /**
19 * {@inheritDoc}
20 *
21 * @var string
22 */
23 public $id = "wdan-notices";
24
25 /**
26 * {@inheritDoc}
27 *
28 * @var string
29 */
30 public $type = "page";
31
32 /**
33 * {@inheritDoc}
34 *
35 * @var string
36 */
37 public $page_menu_dashicon = 'dashicons-hidden';
38
39 /**
40 * {@inheritDoc}
41 *
42 * @since 2.0.5 - добавлен
43 * @var bool
44 */
45 public $show_right_sidebar_in_options = false;
46
47
48 /**
49 * @param WDN_Plugin $plugin
50 */
51 public function __construct( $plugin ) {
52 $this->menu_title = __( 'Hidden notices', 'disable-admin-notices' );
53 $this->page_menu_short_description = __( 'Manage hidden notices', 'disable-admin-notices' );
54
55 parent::__construct( $plugin );
56
57 $this->plugin = $plugin;
58 }
59
60 /**
61 * Requests assets (js and css) for the page.
62 *
63 * @param Wbcr_Factory480_ScriptList $scripts
64 * @param Wbcr_Factory480_StyleList $styles
65 *
66 * @return void
67 * @see Wbcr_FactoryPages480_AdminPage
68 *
69 */
70 public function assets( $scripts, $styles ) {
71 parent::assets( $scripts, $styles );
72
73 $this->styles->add( WDN_PLUGIN_URL . '/admin/assets/css/settings.css' );
74 $this->scripts->add( WDN_PLUGIN_URL . '/admin/assets/js/settings.js' );
75 }
76
77 public function showPageContent() {
78 $notifications_user = get_user_meta( get_current_user_id(), WDN_Plugin::app()->getOptionName( 'hidden_notices' ), true );
79 if ( ! is_array( $notifications_user ) ) {
80 $notifications_user = [];
81 }
82
83 $notifications_all = WDN_Plugin::app()->getPopulateOption( 'hidden_notices', [] );
84
85 if ( count( $notifications_user ) ) {
86 ?>
87 <div class="wbcr-factory-page-group-header">
88 <strong><?php echo esc_html__( 'Hidden for you', 'disable-admin-notices' ); ?></strong>
89 <p>
90 <?php echo esc_html__( 'Notices that are hidden only for you', 'disable-admin-notices' ); ?>
91 </p>
92 </div>
93 <div class="wdan-hidden-list">
94 <?php $this->notice_list_table( $notifications_user ); ?>
95 </div>
96 <?php
97 }
98 if ( count( $notifications_all ) ) {
99 ?>
100 <div class="wbcr-factory-page-group-header">
101 <strong><?php echo esc_html__( 'Hidden for all', 'disable-admin-notices' ); ?></strong>
102 <p>
103 <?php echo esc_html__( 'Notices that are hidden for all users of the site', 'disable-admin-notices' ); ?>
104 </p>
105 </div>
106 <div class="wdan-hidden-list">
107 <?php $this->notice_list_table( $notifications_all ); ?>
108 </div>
109 <?php
110 }
111 }
112
113 /**
114 * @param $notifications
115 */
116 public function notice_list_table( $notifications ) {
117 ?>
118 <table class="wdan-hidden-list-table">
119 <tbody>
120 <?php
121 foreach ( $notifications as $notice_id => $message ) {
122 $button = '<div class="wdan-hidden-list-notice-action">
123 <a href="#"
124 data-nonce="' . wp_create_nonce( $this->plugin->getPluginName() . '_ajax_restore_notice_nonce' ) . '"
125 data-notice-id="' . esc_attr( $notice_id ) . '"
126 class="button wdan-page-restore-notice-link">' .
127 __( 'Restore', 'disable-admin-notices' ) .
128 '</a>
129 <div class="wdan-page-restore-notice-link-loader" style="display: none;">&nbsp;</div>
130 </div>';
131 ?>
132 <tr>
133 <td>
134 <div class="wdan-hidden-list-notice">
135 <div class="wdan-notice-p"><?php echo $message; ?></div>
136 </div>
137 </td>
138 <td>
139 <?= $button; ?>
140 </td>
141 </tr>
142 <?php
143 }
144 ?>
145 </tbody>
146 </table>
147 <?php
148 }
149 }
150