*/ 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; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. 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, 'pxlbsadminify_handle_plugin_update_notice_dismiss' ),99999 ); add_action( 'wp_ajax_pxlbsadminify_plugin_update_info', array( $this, 'pxlbsadminify_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 pxlbsadminify_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( wp_unslash( $_POST['action_type'] ) ) : 'dismiss'; $option_value = ( 'forever' === $action_type ) ? 'forever' : 'dismissed'; wp_send_json_success( array( 'message' => 'Notice dismissed.', 'data' => update_option('pxlbsadminify_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('pxlbsadminify_plugin_update_info_notice', true ); if( 'forever' === $forever_notice ){ return; } if("dismissed" !== $forever_notice){ $pxlbsadminify_changelog_items = __(' Improved: WordPress 7.1 compatibility.
', 'adminify') . __(' Improved: The Gutenberg Editor Logo option is now hidden on WordPress 7.1 and newer, where WordPress no longer provides the editor button it replaced. It keeps working on older versions.
', 'adminify') . __(' Improved: The Infinite Scroll for Media Library option is now hidden on WordPress 7.1 and newer, where the Media Library already scrolls infinitely and each user can opt out from their own profile. It keeps working on older versions.
', 'adminify') . __(' Improved: Dark mode in the block editor.
', 'adminify') . __(' Improved: Disabled buttons now look disabled instead of appearing fully active.
', 'adminify') . __(' Improved: Heartbeat intervals longer than 2 minutes are now marked as not recommended, and the post editor is capped at 2 minutes so post locks and autosave keep working.
', 'adminify') . __(' Fixed: Custom Gravatar images now show up on Settings > Discussion and for users who do not have a Gravatar.
', 'adminify') . __(' Fixed: The Light/Dark switcher in the admin bar now looks and works correctly on the Site Editor and Customizer screens.
', 'adminify') . __(' Fixed: With Adminify UI on, publishing a post now updates the browser address bar, and the back button in the editor returns to the post list.
', 'adminify') . __(' Fixed: The block editor pre-publish panel no longer leaves a duplicate Publish button showing above it.
', 'adminify') . __(' Fixed: The Control Heartbeat API interval settings now take effect. Picking 15 or 30 seconds previously changed nothing at all.
', 'adminify') . __(' Fixed: Disabling the Heartbeat API no longer stops autosave and the session expiry check from loading, and the post editor setting now applies on WordPress installed in a subdirectory.
', 'adminify'); $pxlbsadminify_changelog_message = sprintf( /* translators: %1$s: changelogs page URL. %2$s: link anchor text. %3$s: plugin update heading HTML. %4$s: changelog list items HTML. */ __('%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 */ '

' . PXLBSADMINIFY . ' v' . esc_html(PXLBSADMINIFY_VER) . '' . __(' has some updates..', 'adminify') . '


', // %3$s // changelogs $pxlbsadminify_changelog_items ); printf(wp_kses_post($pxlbsadminify_changelog_message)); } $this->pxlbsadminify_handle_plugin_update_notice_dismiss(); } /** * Notice Header * * @author Jewel Theme */ public function notice_header() { if ( ! $this->is_adminify_settings_page() ) { echo '