PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.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.7, at Inc/Classes/Notifications/Latest_Updates.php

127 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 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 <br> <strong>Check Changelogs for </strong> <a href="%1$s" target="__blank">%2$s</a>', 'adminify'),
60 esc_url_raw('https://wpadminify.com/changelogs'),
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"> <strong>Fixed:</strong> Admin menu icon size & Custom icons list not showing issue fixed. </span><br>', 'adminify'),
68 __('<span class="dashicons dashicons-yes"></span><span class="adminify-changes-list"> <strong>Fixed:</strong> Hestia Theme customize screen not working issue fixed. </span><br>', 'adminify'),
69 __('<span class="dashicons dashicons-yes"></span><span class="adminify-changes-list"> <strong>Security:</strong> Vulnerability security issue fixed. </span><br>', 'adminify')
70 );
71 printf(wp_kses_post($jltwp_adminify_changelog_message));
72 }
73 }
74
75 /**
76 * Notice Header
77 *
78 * @author Jewel Theme <support@jeweltheme.com>
79 */
80 public function notice_header() {
81 if("dismissed" !== get_option('_wpadminify_plugin_update_info_notice', true )){ ?>
82 <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">
83 <button type="button" class="notice-dismiss wp-adminify-notice-dismiss" data-notice-type="plugin_update_notice"></button>
84 <div class="notice-content-box">
85 <?php
86 }else{ echo '<div class="hide-notice--ignored customDiv" ><div>';}
87 }
88
89 public function jltwp_handle_plugin_update_notice_dismiss() { ?>
90
91 <script>
92
93 function jltwp_adminify_update_plugin_info_notice_action(evt, $this, action_type) {
94 if (evt) evt.preventDefault();
95 $this.closest('.notice-plugin-update-info').slideUp(200);
96
97 jQuery.post('<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>', {
98 action: 'jltwp_plugin_update_info',
99 _wpnonce: '<?php echo esc_js( wp_create_nonce( 'dismiss_notice_nonce' ) ); ?>',
100 action_type: action_type,
101 plugin_name: $this.data('noticetype')
102 }).then(function(response) {
103 console.log(response);
104 });
105 }
106
107 // Notice Dismiss
108 jQuery('body').on('click', '.notice-wp-adminify.notice-plugin-update-info .wp-adminify-notice-dismiss', function(evt) {
109 jltwp_adminify_update_plugin_info_notice_action(evt, jQuery(this), 'dismiss');
110 });
111 </script>
112
113 <?php
114 }
115
116 /**
117 * Intervals
118 *
119 * @author Jewel Theme <support@jeweltheme.com>
120 */
121 public function intervals()
122 {
123 return array(0);
124 }
125 }
126 }
127