base, [ Settings::SETTINGS_PAGE, Settings::TOOLBAR_PAGE ] ); } /** * get_learn_more_link * * @param $campaign * * @return string */ public static function get_learn_more_link( $campaign ) : string { return add_query_arg([ 'utm_source' => 'acc-switch', 'utm_medium' => 'wp-dash', 'utm_campaign' => $campaign, ], 'https://go.elementor.com/acc-notice-switch-oc/' ); } /** * get_switch_now_link * @return string */ public static function get_switch_now_link() : string { return add_query_arg( [ 'page' => 'accessibility-settings', self::CONFIRMATION_MODAL => '1', ], admin_url() ); } /** * add_deprecated_notice_to_customizer_section_description * @return string */ public function add_deprecated_notice_to_customizer_section_description(): string { $content = sprintf( '

%s

%s

%s

', esc_html__( 'New! Switch to our updated accessibility widget for better features and control.', 'pojo-accessibility' ), self::get_learn_more_link( 'acc-notice-switch-custom' ), esc_html__( 'Learn More', 'pojo-accessibility' ), self::get_switch_now_link(), esc_html__( 'Switch Now', 'pojo-accessibility' ) ); return ""; } /** * maybe_add_introduction_modal */ public function maybe_add_introduction_modal() { if ( $this->disable_introduction_modal ) { return; } // only show to admins on legacy pages and to admin users if ( ! $this->is_legacy_page() || ! current_user_can( 'manage_options' ) ) { return; } $dismissed = get_user_meta( get_current_user_id(), self::INTRODUCTION_NOTICE, true ); if ( $dismissed ) { return; } add_thickbox(); wp_enqueue_script( 'jquery' ); add_action( 'admin_footer', function() { ?> is_legacy_page() || ! current_user_can( 'manage_options' ) ) { return; } if ( ! isset( $_GET[ self::CONFIRMATION_MODAL ] ) ) { return; } $this->disable_introduction_modal = true; add_thickbox(); wp_enqueue_script( 'jquery' ); add_action( 'admin_footer', function() { ?> register_notice( new $class_name() ); } } /** * handle_ajax_upgrade */ public function handle_ajax_upgrade() { if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( [ 'message' => 'Unauthorized' ] ); } if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ), self::AJAX_ACTION ) ) { wp_send_json_error( [ 'message' => 'Invalid nonce' ] ); } self::upgrade(); // store upgrade campaign data $campaign_data = [ 'source' => 'one-click-upgrade', 'campaign' => 'a11y-upgrade', 'medium' => 'wp-dash', ]; set_transient( 'elementor_ea11y_campaign', $campaign_data, 30 * DAY_IN_SECONDS ); wp_send_json_success( [] ); } /** * maybe_render_pointer */ public function maybe_render_pointer() { if ( ! current_user_can( 'manage_options' ) ) { return; } if ( $this->is_legacy_page() ) { return; } if ( Pointers::is_dismissed( self::AJAX_ACTION ) ) { return; } wp_enqueue_script( 'wp-pointer' ); wp_enqueue_style( 'wp-pointer' ); $pointer_content = '

' . esc_html__( 'Accessibility', 'pojo-accessibility' ) . '

'; $pointer_content .= '

' . esc_html__( 'Our new, improved accessibility plugin is now available! Ally - Web Accessibility is packed with advanced styling options, improved feature controls, and so much more.', 'pojo-accessibility' ) . '

'; $pointer_content .= sprintf( '

%s

', admin_url( 'admin.php?page=accessibility-settings' ), esc_html__( 'View more details', 'pojo-accessibility' ) ); $allowed_tags = [ 'h3' => [], 'p' => [], 'a' => [ 'class' => [], 'href' => [], ], ]; ?>