| @@ -14,10 +14,10 @@ | ||
| 14 | 14 | add_action('wp_ajax_loginizer_export', 'loginizer_export'); |
| 15 | 15 | add_action('wp_ajax_loginizer_social_order', 'loginizer_social_order'); |
| 16 | 16 | add_action('wp_ajax_loginizer_dismiss_license_alert', 'loginizer_dismiss_license_alert'); |
| 17 | 17 | add_action('wp_ajax_loginizer_dismiss_softwp_alert', 'loginizer_dismiss_softwp_alert'); |
| 18 | +add_action('wp_ajax_loginizer_close_update_notice', 'loginizer_close_update_notice'); | |
| 18 | 19 | |
| 19 | - | |
| 20 | 20 | // ----- FUNCTIONS ------// |
| 21 | 21 | |
| 22 | 22 | function loginizer_dismiss_csrf(){ |
| 23 | 23 | |
| @@ -214,5 +214,32 @@ | ||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | update_option('loginizer_softwp_upgrade', (0 - time()), false); |
| 217 | 217 | die('DONE'); |
| 218 | +} | |
| 219 | + | |
| 220 | +function loginizer_close_update_notice(){ | |
| 221 | + | |
| 222 | + if(!wp_verify_nonce($_GET['security'], 'loginizer_promo_nonce')){ | |
| 223 | + wp_send_json_error('Security Check failed!'); | |
| 224 | + } | |
| 225 | + | |
| 226 | + if(!current_user_can('manage_options')){ | |
| 227 | + wp_send_json_error('You don\'t have privilege to close this notice!'); | |
| 228 | + } | |
| 229 | + | |
| 230 | + $plugin_update_notice = get_option('softaculous_plugin_update_notice', []); | |
| 231 | + $available_update_list = get_site_transient('update_plugins'); | |
| 232 | + $to_update_plugins = apply_filters('softaculous_plugin_update_notice', []); | |
| 233 | + | |
| 234 | + if(empty($available_update_list) || empty($available_update_list->response)){ | |
| 235 | + return; | |
| 236 | + } | |
| 237 | + | |
| 238 | + foreach($to_update_plugins as $plugin_path => $plugin_name){ | |
| 239 | + if(isset($available_update_list->response[$plugin_path])){ | |
| 240 | + $plugin_update_notice[$plugin_path] = $available_update_list->response[$plugin_path]->new_version; | |
| 241 | + } | |
| 242 | + } | |
| 243 | + | |
| 244 | + update_option('softaculous_plugin_update_notice', $plugin_update_notice); | |
| 218 | 245 | } |