PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.3.7
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.3.7
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Classes / Notifications / Latest_Updates.php

Latest_Updates.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.0.3.7, at Inc/Classes/Notifications/Latest_Updates.php

130 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Classes\Notifications;
4
5 use WPAdminify\Inc\Classes\Notifications\Model\Notice;
6
7 if (!class_exists('Latest_Updates')) {
8 /**
9 * Latest Pugin Updates Notice Class
10 *
11 * Jewel Theme <support@jeweltheme.com>
12 */
13 class Latest_Updates extends Notice
14 {
15
16 /**
17 * Latest Updates Notice
18 *
19 * @return void
20 */
21 public function __construct()
22 {
23 parent::__construct();
24 if(is_admin()){
25 add_action( 'admin_footer', array( $this, 'jltwp_handle_plugin_update_notice_dismiss' ),99999 );
26 add_action( 'wp_ajax_jltwp_plugin_update_info', array( $this, 'jltwp_plugin_update_info' ) );
27 }
28 }
29
30 /**
31 * Handles the AJAX request for the plugin update info notice dismissal.
32 *
33 * Triggered when the user clicks the Dismiss button in the notice.
34 *
35 * @since 1.0
36 *
37 * @return void
38 */
39 public function jltwp_plugin_update_info() {
40 if (!current_user_can('install_plugins')) {
41 return;
42 }
43
44 // Verify nonce for security.
45 check_ajax_referer( 'dismiss_notice_nonce', 'nonce' );
46 wp_send_json_success( array( 'message' => 'Notice dismissed.', 'data' => update_option('_wpadminify_plugin_update_info_notice', "dismissed" ) ) );
47 }
48
49
50 /**
51 * Notice Content
52 *
53 * @author Jewel Theme <support@jeweltheme.com>
54 */
55 public function notice_content()
56 {
57 if("dismissed" !== get_option('_wpadminify_plugin_update_info_notice', true )){
58 $jltwp_adminify_changelog_message = sprintf(
59 __('%3$s %4$s %5$s %6$s %7$s %8$s <br> <strong>Check Changelogs for </strong> <a href="%1$s" target="__blank">%2$s</a>', 'adminify'),
60 esc_url_raw('https://wpadminify.com/v4-0-3-1-update-released'),
61 __('More about Updates ', 'adminify'),
62 /** Changelog Items
63 * Starts from: %3$s
64 */
65
66 '<h3 class="adminify-update-head">' . WP_ADMINIFY . ' <span><small><em>v' . esc_html(WP_ADMINIFY_VER) . '</em></small>' . __(' has some updates..', 'adminify') . '</span></h3><br>', // %3$s
67 __('<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Admin Bar adding &amp; on url dynamically </span><br>', 'adminify'),
68 __('<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Added Adminify UI for Guttenberg editor </span><br>', 'adminify'),
69 __('<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Admin Menu custom url and admin page url swicthing issue </span><br>', 'adminify'),
70 __('<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Admin Menu custom menu icon support for Simple Line Icon and FontAwesome Icon </span><br>', 'adminify'),
71 __('<span class="dashicons dashicons-yes"></span> <span class="adminify-changes-list"> Mini Mode Icon option added </span><br>', 'adminify')
72 );
73
74 printf(wp_kses_post($jltwp_adminify_changelog_message));
75 }
76 }
77
78 /**
79 * Notice Header
80 *
81 * @author Jewel Theme <support@jeweltheme.com>
82 */
83 public function notice_header() {
84 if("dismissed" !== get_option('_wpadminify_plugin_update_info_notice', true )){ ?>
85 <div class="hide-notice--ignored notice notice-wp-adminify is-dismissible notice-<?php echo esc_attr( $this->color ); ?> wp-adminify-notice-<?php echo esc_attr( $this->get_id() ); ?> notice-plugin-update-info">
86 <button type="button" class="notice-dismiss wp-adminify-notice-dismiss" data-notice-type="plugin_update_notice"></button>
87 <div class="notice-content-box">
88 <?php
89 }else{ echo '<div class="hide-notice--ignored customDiv" ><div>';}
90 }
91
92 public function jltwp_handle_plugin_update_notice_dismiss() { ?>
93
94 <script>
95
96 function jltwp_adminify_update_plugin_info_notice_action(evt, $this, action_type) {
97 if (evt) evt.preventDefault();
98 $this.closest('.notice-plugin-update-info').slideUp(200);
99
100 jQuery.post('<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>', {
101 action: 'jltwp_plugin_update_info',
102 _wpnonce: '<?php echo esc_js( wp_create_nonce( 'dismiss_notice_nonce' ) ); ?>',
103 action_type: action_type,
104 plugin_name: $this.data('noticetype')
105 }).then(function(response) {
106 console.log(response);
107 });
108 }
109
110 // Notice Dismiss
111 jQuery('body').on('click', '.notice-wp-adminify.notice-plugin-update-info .wp-adminify-notice-dismiss', function(evt) {
112 jltwp_adminify_update_plugin_info_notice_action(evt, jQuery(this), 'dismiss');
113 });
114 </script>
115
116 <?php
117 }
118
119 /**
120 * Intervals
121 *
122 * @author Jewel Theme <support@jeweltheme.com>
123 */
124 public function intervals()
125 {
126 return array(0);
127 }
128 }
129 }
130