| @@ -462,62 +462,30 @@ | ||
| 462 | 462 | |
| 463 | 463 | public function maybe_add_ally_heading_hint() { |
| 464 | 464 | $notice_id = 'ally_heading_notice'; |
| 465 | 465 | $plugin_slug = 'pojo-accessibility'; |
| 466 | - | |
| 467 | 466 | if ( ! Hints::should_display_hint( $notice_id ) ) { |
| 468 | 467 | return; |
| 469 | 468 | } |
| 469 | + $notice_content = esc_html__( 'Make sure your page is structured with accessibility in mind. Ally helps detect and fix common issues across your site.', 'elementor' ); | |
| 470 | 470 | |
| 471 | - $one_subscription = Hints::is_plugin_connected_to_one_subscription(); | |
| 472 | - $is_installed = Hints::is_plugin_installed( $plugin_slug ); | |
| 473 | - $is_active = Hints::is_plugin_active( $plugin_slug ); | |
| 471 | + $campaign_data = [ | |
| 472 | + 'name' => 'elementor_ea11y_campaign', | |
| 473 | + 'campaign' => 'acc-scanner-plg-heading', | |
| 474 | + 'source' => 'editor-heading-widget', | |
| 475 | + 'medium' => 'editor', | |
| 476 | + ]; | |
| 474 | 477 | |
| 475 | - if ( $is_active ) { | |
| 476 | - return; | |
| 477 | - } | |
| 478 | + $button_text = __( 'Install Plugin', 'elementor' ); | |
| 479 | + $action_url = Admin_Notices::add_plg_campaign_data( Hints::get_plugin_action_url( $plugin_slug ), $campaign_data ); | |
| 478 | 480 | |
| 479 | - if ( $one_subscription ) { | |
| 480 | - if ( ! $is_installed ) { | |
| 481 | - $notice_content = esc_html__( 'Want to ensure this heading is accessible? Your ONE subscription includes Ally. Install it and scan your page.', 'elementor' ); | |
| 482 | - $button_text = esc_html__( 'Install now', 'elementor' ); | |
| 483 | - $button_url = Hints::get_plugin_install_url( $plugin_slug ); | |
| 484 | - $campaign_data = [ | |
| 485 | - 'name' => 'elementor_ea11y_campaign', | |
| 486 | - 'campaign' => 'acc-scanner-plg-heading-one-install', | |
| 487 | - 'source' => 'editor-heading-widget-one-install', | |
| 488 | - 'medium' => 'editor-one', | |
| 489 | - ]; | |
| 490 | - } elseif ( ! $is_active ) { | |
| 491 | - $notice_content = esc_html__( 'Keep your content accessible. Activate Ally, included in ONE, to scan this page.', 'elementor' ); | |
| 492 | - $button_text = esc_html__( 'Activate now', 'elementor' ); | |
| 493 | - $button_url = Hints::get_plugin_activate_url( $plugin_slug ); | |
| 494 | - $campaign_data = [ | |
| 495 | - 'name' => 'elementor_ea11y_campaign', | |
| 496 | - 'campaign' => 'acc-scanner-plg-heading-one-activate', | |
| 497 | - 'source' => 'editor-heading-widget-one-non-activate', | |
| 498 | - 'medium' => 'editor-one', | |
| 499 | - ]; | |
| 500 | - } | |
| 501 | - } else { | |
| 502 | - $notice_content = esc_html__( 'Make sure your page is structured with accessibility in mind. Ally helps detect and fix common issues across your site.', 'elementor' ); | |
| 503 | - if ( ! $is_installed ) { | |
| 504 | - $button_text = esc_html__( 'Install now', 'elementor' ); | |
| 505 | - $button_url = Hints::get_plugin_install_url( $plugin_slug ); | |
| 506 | - } elseif ( ! $is_active ) { | |
| 507 | - $button_text = esc_html__( 'Activate now', 'elementor' ); | |
| 508 | - $button_url = Hints::get_plugin_activate_url( $plugin_slug ); | |
| 509 | - } | |
| 510 | - $campaign_data = [ | |
| 511 | - 'name' => 'elementor_ea11y_campaign', | |
| 512 | - 'campaign' => 'acc-scanner-plg-heading', | |
| 513 | - 'source' => 'editor-heading-widget', | |
| 514 | - 'medium' => 'editor', | |
| 515 | - ]; | |
| 481 | + if ( Hints::is_plugin_installed( $plugin_slug ) && ! Hints::is_plugin_active( $plugin_slug ) ) { | |
| 482 | + $button_text = __( 'Activate Plugin', 'elementor' ); | |
| 483 | + } elseif ( Hints::is_plugin_active( $plugin_slug ) && empty( get_option( 'ea11y_access_token' ) ) ) { | |
| 484 | + $button_text = __( 'Connect to Ally', 'elementor' ); | |
| 485 | + $action_url = admin_url( 'admin.php?page=accessibility-settings' ); | |
| 516 | 486 | } |
| 517 | 487 | |
| 518 | - $notice_heading = esc_html__( 'Accessible structure matters', 'elementor' ); | |
| 519 | - | |
| 520 | 488 | $this->add_control( |
| 521 | 489 | $notice_id, |
| 522 | 490 | [ |
| 523 | 491 | 'type' => Controls_Manager::RAW_HTML, |
| @@ -522,9 +490,9 @@ | ||
| 522 | 490 | [ |
| 523 | 491 | 'type' => Controls_Manager::RAW_HTML, |
| 524 | 492 | 'raw' => Hints::get_notice_template( [ |
| 525 | 493 | 'display' => ! Hints::is_dismissed( $notice_id ), |
| 526 | - 'heading' => $notice_heading, | |
| 494 | + 'heading' => esc_html__( 'Accessible structure matters', 'elementor' ), | |
| 527 | 495 | 'type' => 'info', |
| 528 | 496 | 'content' => $notice_content, |
| 529 | 497 | 'icon' => true, |
| 530 | 498 | 'dismissible' => $notice_id, |
| @@ -530,9 +498,9 @@ | ||
| 530 | 498 | 'dismissible' => $notice_id, |
| 531 | 499 | 'button_text' => $button_text, |
| 532 | 500 | 'button_event' => $notice_id, |
| 533 | 501 | 'button_data' => [ |
| 534 | - 'action_url' => Admin_Notices::add_plg_campaign_data( $button_url, $campaign_data ), | |
| 502 | + 'action_url' => $action_url, | |
| 535 | 503 | ], |
| 536 | 504 | ], true ), |
| 537 | 505 | ] |
| 538 | 506 | ); |