id ) ) { return; } $screens = [ 'toplevel_page_accessibility_checker', 'accessibility-checker_page_accessibility_checker_issues', 'accessibility-checker_page_accessibility_checker_ignored', 'accessibility-checker_page_accessibility_checker_settings', ]; /** * Filter the screens where admin notices should be removed. * * @since 1.14.0 * * @param array $screens The screens where admin notices should be removed. */ $screens = apply_filters( 'edac_filter_remove_admin_notices_screens', $screens ); if ( ! is_array( $screens ) ) { $screens = []; } if ( in_array( $current_screen->id, $screens, true ) ) { remove_all_actions( 'admin_notices' ); remove_all_actions( 'all_admin_notices' ); } } /** * Black Friday Admin Notice * * @return void */ public function edac_black_friday_notice() { // Check if the notice has been dismissed. if ( absint( get_option( 'edac_black_friday_2026_notice_dismiss', 0 ) ) ) { return; } // Show from November 23 to December 02. $current_date = date_i18n( 'Ymd' ); // Use date_i18n for localization. $start_date = '20261123'; $end_date = '20261202'; if ( $current_date >= $start_date && $current_date <= $end_date ) { // Get the promotional message from a separate function/file. $message = $this->edac_get_black_friday_message(); // Output the message with appropriate sanitization. echo wp_kses_post( $message ); } } /** * Work out which Black Friday audience the current site belongs to. * * An expired Pro license is Lapsed. Without Pro active, or without a usable license (no key, * disabled, revoked or invalid), the site is Free. A valid license is * segmented by the plan stored in the license metadata (Professional, Small Business, SMB+, * or Agency/Enterprise); SMB+ gets the Small Business notice. Licenses whose plan hasn't been * recorded yet, which happens until the next daily license check after an update, and licenses * that aren't activated on this site, are left without a notice rather than guessed. * * @return string One of 'free', 'lapsed', 'professional', 'smb', 'agency', or an empty string * when the audience can't be determined and no notice should show. */ public function edac_get_black_friday_segment() { $pro_status = (string) get_option( 'edacp_license_status', '' ); if ( 'expired' === $pro_status ) { $expired_plan = \EqualizeDigital\AccessibilityChecker\MyDot\Connector::get_license_plan_or_last_known(); return in_array( $expired_plan, [ 'agency', 'enterprise' ], true ) ? 'agency' : 'lapsed'; } if ( ! defined( 'EDACP_VERSION' ) ) { return 'free'; } if ( 'valid' === $pro_status ) { switch ( \EqualizeDigital\AccessibilityChecker\MyDot\Connector::get_license_plan() ) { case 'professional': return 'professional'; case 'small-business': case 'small-business-plus': return 'smb'; case 'agency': case 'enterprise': return 'agency'; default: return ''; } } // A license that isn't activated on this site can't be judged, so no notice. if ( in_array( $pro_status, [ 'inactive', 'site_inactive' ], true ) ) { return ''; } // Pro is active but has no usable license: no key, or one that is disabled, revoked or invalid. return 'free'; } /** * Get Black Friday Promo Message * * @return string Empty when the current site's audience shouldn't see a notice. */ public function edac_get_black_friday_message() { $segment = $this->edac_get_black_friday_segment(); $presale_url = 'https://my.equalizedigital.com/support/pre-sale-questions/'; $pricing_url = 'https://equalizedigital.com/accessibility-checker/pricing/'; $account_url = 'https://my.equalizedigital.com/'; $new_code = 'BF2674B96A3C'; $pro_code = 'BF26856B22FF'; $smb_code = 'BF2622E6189C'; $presale_label = __( 'Ask a Pre-Sale Question', 'accessibility-checker' ); $upgrade_label = __( 'Upgrade Now', 'accessibility-checker' ); switch ( $segment ) { case 'free': $heading = __( '🎉 Black Friday special: save 20% and get a free course! 🎉', 'accessibility-checker' ); $body = __( 'Scan custom post types and archive pages, see every issue in one place, and get enhanced email reports. Upgrade between November 23rd and December 2nd to save 20% and get a free course of your choice.', 'accessibility-checker' ); $buttons = [ [ $presale_label, $presale_url, 'BlackFriday26-free-presale' ], [ $upgrade_label, add_query_arg( 'discount', $new_code, $pricing_url ), 'BlackFriday26-free-pricing' ], ]; break; case 'lapsed': $heading = __( '👋 Welcome back: 20% off Accessibility Checker Pro + a free course! 🎉', 'accessibility-checker' ); $body = __( 'Accessibility Checker is way different than you remember. Renew between November 23rd and December 2nd to save 20% and pick a free course.', 'accessibility-checker' ); $buttons = [ [ $presale_label, $presale_url, 'BlackFriday26-lapsed-presale' ], [ __( 'Renew Now', 'accessibility-checker' ), add_query_arg( 'discount', $new_code, $account_url ), 'BlackFriday26-lapsed-renew' ], ]; break; case 'professional': $heading = __( '🎉 Black Friday: Save 25% on your upgrade to Small Business! 🎉', 'accessibility-checker' ); $body = __( 'Get 5 site licenses, Audit History, CSV Export, and access to biweekly office hours, with 25% off when you upgrade from November 23rd to December 2nd.', 'accessibility-checker' ); $buttons = [ [ $upgrade_label, add_query_arg( [ 'discount' => $pro_code, 'pro' => 'true', ], $account_url ), 'BlackFriday26-pro-upgrade', ], ]; break; case 'smb': $heading = __( '🎉 Black Friday: Save 25% on your upgrade! 🎉', 'accessibility-checker' ); $body = __( 'Need more licenses? Upgrade to SMB+ for 10 sites, or go bigger with Agency for 25 sites, Multisite tools, and VIP support.', 'accessibility-checker' ); $buttons = [ [ __( 'Upgrade & Save 25%', 'accessibility-checker' ), add_query_arg( 'discount', $smb_code, $account_url ), 'BlackFriday26-smb-upgrade' ], ]; break; default: // Agency licenses get a 1:1 email instead of a banner, and unknown states show nothing. return ''; } // Construct the promotional message. $message = '
'; $message .= '

' . preg_replace( '/[\x{1F300}-\x{1FAFF}\x{2600}-\x{27BF}\x{FE0F}]+/u', '', esc_html( $heading ) ) . '
'; $message .= esc_html( $body ) . '
'; $links = []; foreach ( $buttons as $button ) { $links[] = '' . esc_html( $button[0] ) . ''; } $message .= implode( ' ', $links ) . '

'; $message .= '
'; return $message; } /** * Black Friday Admin Notice Ajax * * @return void * * - '-1' means that nonce could not be varified * - '-2' means that update option wasn't successful */ public function edac_black_friday_notice_ajax() { // nonce security. if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ajax-nonce' ) ) { $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) ); wp_send_json_error( $error ); } $results = update_option( 'edac_black_friday_2026_notice_dismiss', true ); // Delete old options if they exist. delete_option( 'edac_black_friday_2025_notice_dismiss' ); delete_option( 'edac_black_friday_2024_notice_dismiss' ); delete_option( 'edac_black_friday_2023_notice_dismiss' ); if ( ! $results ) { $error = new \WP_Error( '-2', __( 'Update option wasn\'t successful', 'accessibility-checker' ) ); wp_send_json_error( $error ); } wp_send_json_success( wp_json_encode( $results ) ); } /** * GAAD Pre-Sale Notice * * Displays May 13–19 to build awareness of Global Accessibility Awareness Day * and tease the upcoming flash sale. * * @return void */ public function edac_gaad_presale_notice() { // Check if the notice has been dismissed. if ( absint( get_option( 'edac_gaad_presale_notice_dismiss_2026', 0 ) ) ) { return; } $current_date = gmdate( 'Y-m-d' ); $start_date = '2026-05-13'; $end_date = '2026-05-19'; if ( $current_date >= $start_date && $current_date <= $end_date ) { echo wp_kses_post( $this->edac_get_gaad_presale_message() ); } } /** * Get GAAD Pre-Sale Message * * Awareness-focused copy shown May 13–19 before the sale goes live. * * @return string */ public function edac_get_gaad_presale_message() { $message = '
'; $message .= '

' . esc_html__( '⚡️ Global Accessibility Awareness Day Flash Sale', 'accessibility-checker' ) . '
'; if ( defined( 'EDACP_VERSION' ) && edac_is_pro() ) { $message .= esc_html__( 'Starting May 20th: Save 15% on accessibility courses and ArchiveWP with coupon code ', 'accessibility-checker' ) . 'GAAD2026.
'; $message .= esc_html__( '3 days only • May 20–22', 'accessibility-checker' ) . '

'; $message .= '' . esc_html__( 'View ArchiveWP Pricing', 'accessibility-checker' ) . ' '; $message .= '' . esc_html__( 'View Course Pricing', 'accessibility-checker' ) . '

'; } else { $message .= esc_html__( 'Starting May 20th: Save 15% on Accessibility Checker Pro with coupon code ', 'accessibility-checker' ) . 'GAAD2026.
'; $message .= esc_html__( '3 days only • May 20–22', 'accessibility-checker' ) . '

'; $message .= '' . esc_html__( 'View Pricing', 'accessibility-checker' ) . '

'; } $message .= '
'; return $message; } /** * GAAD Pre-Sale Notice Ajax * * @return void * * - '-1' means that nonce could not be verified * - '-2' means that update option wasn't successful */ public function edac_gaad_presale_notice_ajax() { if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ajax-nonce' ) ) { $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) ); wp_send_json_error( $error ); } $results = update_option( 'edac_gaad_presale_notice_dismiss_2026', true ); if ( ! $results ) { $error = new \WP_Error( '-2', __( 'Update option wasn\'t successful', 'accessibility-checker' ) ); wp_send_json_error( $error ); } wp_send_json_success( wp_json_encode( $results ) ); } /** * GAAD Sale Notice * * Displays May 20–22 during the active flash sale. * * @return void */ public function edac_gaad_sale_notice() { // Check if the notice has been dismissed. if ( absint( get_option( 'edac_gaad_sale_notice_dismiss_2026', 0 ) ) ) { return; } $current_date = gmdate( 'Y-m-d' ); $start_date = '2026-05-20'; $end_date = '2026-05-22'; if ( $current_date >= $start_date && $current_date <= $end_date ) { echo wp_kses_post( $this->edac_get_gaad_sale_message() ); } } /** * Get GAAD Sale Message * * Urgency-focused copy shown May 20–22 while the sale is live. * * @return string */ public function edac_get_gaad_sale_message() { $message = '
'; $message .= '

' . esc_html__( '⚡️ Global Accessibility Awareness Day Flash Sale', 'accessibility-checker' ) . '
'; if ( defined( 'EDACP_VERSION' ) && edac_is_pro() ) { $message .= esc_html__( 'Save 15% on accessibility courses and ArchiveWP with coupon code ', 'accessibility-checker' ) . 'GAAD2026.
'; $message .= esc_html__( 'Limited-time offer • Ends May 22nd', 'accessibility-checker' ) . '

'; $message .= '' . esc_html__( 'View ArchiveWP Pricing', 'accessibility-checker' ) . ' '; $message .= '' . esc_html__( 'View Course Pricing', 'accessibility-checker' ) . '

'; } else { $message .= esc_html__( '3 days only: Save 15% when you upgrade to Accessibility Checker Pro with coupon code ', 'accessibility-checker' ) . 'GAAD2026.
'; $message .= esc_html__( 'Limited-time offer • Ends May 22nd', 'accessibility-checker' ) . '

'; $message .= '' . esc_html__( 'Upgrade Now', 'accessibility-checker' ) . '

'; } $message .= '
'; return $message; } /** * GAAD Sale Notice Ajax * * @return void * * - '-1' means that nonce could not be verified * - '-2' means that update option wasn't successful */ public function edac_gaad_sale_notice_ajax() { if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ajax-nonce' ) ) { $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) ); wp_send_json_error( $error ); } $results = update_option( 'edac_gaad_sale_notice_dismiss_2026', true ); // Delete old option keys if they exist. delete_option( 'edac_gaad_notice_dismiss_2026' ); delete_option( 'edac_gaad_notice_dismiss_2025' ); delete_option( 'edac_gaad_notice_dismiss_2024' ); delete_option( 'edac_gaad_notice_dismiss' ); if ( ! $results ) { $error = new \WP_Error( '-2', __( 'Update option wasn\'t successful', 'accessibility-checker' ) ); wp_send_json_error( $error ); } wp_send_json_success( wp_json_encode( $results ) ); } /** * Review Admin Notice * * @return void */ public function edac_review_notice() { $option = 'edac_review_notice'; $edac_review_notice = get_option( $option ); // exit if option is set to stop. if ( 'stop' === $edac_review_notice ) { return; } $transient = 'edac_review_notice_reminder'; $edac_review_notice_reminder = get_transient( $transient ); // first time if notice has never been shown wait 14 days. if ( false === $edac_review_notice_reminder && empty( $edac_review_notice ) ) { // if option isn't set and plugin has been active for more than 14 days show notice. This is for current users. if ( edac_days_active() > 14 ) { update_option( $option, 'play' ); } else { // if plugin has been active less than 14 days set transient for 14 days. set_transient( $transient, true, 14 * DAY_IN_SECONDS ); // set option to pause. update_option( $option, 'pause' ); } } // if transient has expired and option is set to pause update option to play. if ( false === $edac_review_notice_reminder && 'pause' === $edac_review_notice ) { update_option( $option, 'play' ); } // if option is not set to play exit. if ( get_option( $option ) !== 'play' ) { return; } ?>

get_fixes_settings(); $options_keys = []; foreach ( $fixes_settings as $fix ) { $options_keys = array_merge( $options_keys, array_keys( $fix['fields'] ) ); } if ( in_array( $option, $options_keys, true ) ) { // Set a custom transient as a flag. set_transient( 'edac_fixes_settings_saved', true, 60 ); } } }