*/ class Latest_Updates extends Notice { public $type = 'notice'; public $color = 'info'; /** * Check if we're on the WP Adminify settings page * * @return bool */ private function is_adminify_settings_page() { global $pagenow; return is_admin() && $pagenow === 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'wp-adminify-settings'; } /** * Latest Updates Notice * * @return void */ public function __construct() { parent::__construct(); if(is_admin()){ // TODO: Need to check about conflicts with other plugins // add_action( 'admin_footer', array( $this, 'jltwp_handle_plugin_update_notice_dismiss' ),99999 ); add_action( 'wp_ajax_jltwp_plugin_update_info', array( $this, 'jltwp_plugin_update_info' ) ); } } /** * Handles the AJAX request for the plugin update info notice dismissal. * * Triggered when the user clicks the Dismiss button in the notice. * * @since 1.0 * * @return void */ public function jltwp_plugin_update_info() { if (!current_user_can('install_plugins')) { return; } // Verify nonce for security. check_ajax_referer( 'dismiss_notice_nonce', 'nonce' ); $action_type = isset( $_POST['action_type'] ) ? sanitize_text_field( $_POST['action_type'] ) : 'dismiss'; $option_value = ( 'forever' === $action_type ) ? 'forever' : 'dismissed'; wp_send_json_success( array( 'message' => 'Notice dismissed.', 'data' => update_option('_wpadminify_plugin_update_info_notice', $option_value ) ) ); } /** * Notice Content * * @author Jewel Theme */ public function notice_content() { if ( ! $this->is_adminify_settings_page() ) { return; } $forever_notice = get_option('_wpadminify_plugin_update_info_notice', true ); if( 'forever' === $forever_notice ){ return; } if("dismissed" !== $forever_notice){ $jltwp_adminify_changelog_message = sprintf( __('%3$s %4$s
Check Changelogs for %2$s', 'adminify'), esc_url_raw('https://wpadminify.com/changelogs'), __('More about Updates ', 'adminify'), /** Changelog Items * Starts from: %3$s */ '

' . WP_ADMINIFY . ' v' . esc_html(WP_ADMINIFY_VER) . '' . __(' has some updates..', 'adminify') . '


', // %3$s // changelogs __(' Fixed: Gutenberg block editor some Dark Mode style issue fixed.
', 'adminify'), ); printf(wp_kses_post($jltwp_adminify_changelog_message)); } $this->jltwp_handle_plugin_update_notice_dismiss(); } /** * Notice Header * * @author Jewel Theme */ public function notice_header() { if ( ! $this->is_adminify_settings_page() ) { echo '