| @@ -4,9 +4,8 @@ | ||
| 4 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | 5 | exit; // Exit if accessed directly. |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -use Elementor\Plugin; | |
| 9 | 8 | use Elementor\User; |
| 10 | 9 | use Elementor\Utils; |
| 11 | 10 | use Elementor\Core\Admin\Admin_Notices; |
| 12 | 11 | |
| @@ -361,12 +360,8 @@ | ||
| 361 | 360 | * |
| 362 | 361 | * @return bool |
| 363 | 362 | */ |
| 364 | 363 | public static function is_plugin_active( $plugin ): bool { |
| 365 | - if ( ! function_exists( 'is_plugin_active' ) ) { | |
| 366 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 367 | - } | |
| 368 | - | |
| 369 | 364 | $plugin = self::ensure_plugin_folder( $plugin ); |
| 370 | 365 | return is_plugin_active( $plugin ); |
| 371 | 366 | } |
| 372 | 367 | |
| @@ -452,68 +447,45 @@ | ||
| 452 | 447 | public static function is_plugin_connected( $option_prefix ): bool { |
| 453 | 448 | return ! empty( get_option( $option_prefix . '_access_token' ) ); |
| 454 | 449 | } |
| 455 | 450 | |
| 456 | - public static function is_plugin_connected_to_one_subscription(): bool { | |
| 457 | - return self::is_plugin_connected( 'elementor_one' ); | |
| 458 | - } | |
| 459 | - | |
| 460 | - private static function get_all_widget_content( $step, $one_subscription = false ) { | |
| 461 | - if ( $one_subscription ) { | |
| 462 | - $steps = [ | |
| 463 | - self::INSTALL => esc_html__( 'Want to create an inclusive experience? Install Web Accessibility, included in ONE, and add an accessibility widget to your site.', 'elementor' ), | |
| 464 | - self::ACTIVATE => esc_html__( 'Your ONE subscription includes Web Accessibility. Activate it to place an accessibility widget on your site.', 'elementor' ), | |
| 465 | - self::CONNECT => esc_html__( "Connect the Web Accessibility plugin to your account to access all of it's accessibility features.", 'elementor' ), | |
| 466 | - self::CUSTOMIZE => esc_html__( "Customize the widget's look, position and the capabilities available for your visitors.", 'elementor' ), | |
| 467 | - ]; | |
| 468 | - } else { | |
| 469 | - $steps = [ | |
| 470 | - self::INSTALL => esc_html__( 'Install Web Accessibility to add an accessibility widget visitors can use to navigate your site.', 'elementor' ), | |
| 471 | - self::ACTIVATE => esc_html__( 'Activate the Web Accessibility plugin to turn its accessibility features on across your site.', 'elementor' ), | |
| 472 | - self::CONNECT => esc_html__( "Connect the Web Accessibility plugin to your account to access all of it's accessibility features.", 'elementor' ), | |
| 473 | - self::CUSTOMIZE => esc_html__( "Customize the widget's look, position and the capabilities available for your visitors.", 'elementor' ), | |
| 474 | - ]; | |
| 475 | - } | |
| 451 | + private static function get_all_widget_content( $step ) { | |
| 452 | + $steps = [ | |
| 453 | + self::INSTALL => esc_html__( 'Install Ally to add an accessibility widget visitors can use to navigate your site.', 'elementor' ), | |
| 454 | + self::ACTIVATE => esc_html__( 'Activate the Ally plugin to turn its accessibility features on across your site.', 'elementor' ), | |
| 455 | + self::CONNECT => esc_html__( "Connect the Ally plugin to your account to access all of it's accessibility features.", 'elementor' ), | |
| 456 | + self::CUSTOMIZE => esc_html__( "Customize the widget's look, position and the capabilities available for your visitors.", 'elementor' ), | |
| 457 | + ]; | |
| 476 | 458 | return $steps[ $step ]; |
| 477 | 459 | } |
| 478 | 460 | |
| 479 | 461 | private static function get_all_widget_action_button( $step ) { |
| 480 | 462 | $steps = [ |
| 481 | - self::INSTALL => esc_html__( 'Install now', 'elementor' ), | |
| 482 | - self::ACTIVATE => esc_html__( 'Activate now', 'elementor' ), | |
| 483 | - self::CONNECT => esc_html__( 'Connect now', 'elementor' ), | |
| 463 | + self::INSTALL => esc_html__( 'install Now', 'elementor' ), | |
| 464 | + self::ACTIVATE => esc_html__( 'Activate', 'elementor' ), | |
| 465 | + self::CONNECT => esc_html__( 'Connect', 'elementor' ), | |
| 484 | 466 | self::CUSTOMIZE => esc_html__( 'Customize', 'elementor' ), |
| 485 | 467 | ]; |
| 486 | 468 | return $steps[ $step ]; |
| 487 | 469 | } |
| 488 | 470 | |
| 489 | - private static function get_all_widget_action_url( $step, $one_subscription = false ) { | |
| 471 | + private static function get_all_widget_action_url( $step ) { | |
| 490 | 472 | if ( in_array( $step, [ self::INSTALL, self::ACTIVATE ], true ) ) { |
| 491 | - $action = ( self::INSTALL === $step ? 'install' : 'activate' ); | |
| 492 | - if ( $one_subscription ) { | |
| 493 | - $campaign_data = [ | |
| 494 | - 'name' => 'elementor_ea11y_campaign', | |
| 495 | - 'campaign' => 'acc-usability-widget-plg-ally-one-' . $action, | |
| 496 | - 'source' => 'editor-ally-widget-one-' . $action, | |
| 497 | - 'medium' => 'editor-one', | |
| 498 | - ]; | |
| 499 | - } else { | |
| 500 | - $campaign_data = [ | |
| 501 | - 'name' => 'elementor_ea11y_campaign', | |
| 502 | - 'campaign' => 'acc-usability-widget-plg-ally', | |
| 503 | - 'source' => 'editor-ally-widget', | |
| 504 | - 'medium' => 'editor', | |
| 505 | - ]; | |
| 506 | - } | |
| 473 | + $campaign_data = [ | |
| 474 | + 'name' => 'elementor_ea11y_campaign', | |
| 475 | + 'campaign' => 'acc-usability-widget-plg-ally', | |
| 476 | + 'source' => 'editor-ally-widget', | |
| 477 | + 'medium' => 'editor', | |
| 478 | + ]; | |
| 507 | 479 | return Admin_Notices::add_plg_campaign_data( self::get_plugin_action_url( 'pojo-accessibility' ), $campaign_data ); |
| 508 | 480 | } |
| 509 | 481 | return self::CONNECT === $step ? admin_url( 'admin.php?page=accessibility-settings' ) : admin_url( 'admin.php?page=accessibility-settings#design' ); |
| 510 | 482 | } |
| 511 | 483 | |
| 512 | - private static function get_ally_cta_button( $step, $one_subscription = false ) { | |
| 484 | + private static function get_ally_cta_button( $step ) { | |
| 513 | 485 | return [ |
| 514 | 486 | 'text' => self::get_all_widget_action_button( $step ), |
| 515 | - 'url' => self::get_all_widget_action_url( $step, $one_subscription ), | |
| 487 | + 'url' => self::get_all_widget_action_url( $step ), | |
| 516 | 488 | 'classes' => [ 'elementor-button' ], |
| 517 | 489 | ]; |
| 518 | 490 | } |
| 519 | 491 | |
| @@ -521,9 +493,8 @@ | ||
| 521 | 493 | $plugin_slug = 'pojo-accessibility'; |
| 522 | 494 | $is_installed = self::is_plugin_installed( $plugin_slug ); |
| 523 | 495 | $is_active = self::is_plugin_active( $plugin_slug ); |
| 524 | 496 | $is_connected = self::is_plugin_connected( 'ea11y' ); |
| 525 | - $one_subscription = self::is_plugin_connected_to_one_subscription(); | |
| 526 | 497 | |
| 527 | 498 | if ( ! $is_installed ) { |
| 528 | 499 | $step = self::INSTALL; |
| 529 | 500 | } elseif ( ! $is_active ) { |
| @@ -534,11 +505,11 @@ | ||
| 534 | 505 | $step = self::CUSTOMIZE; |
| 535 | 506 | } |
| 536 | 507 | |
| 537 | 508 | $data = [ |
| 538 | - 'title' => __( 'Web accessibility', 'elementor' ), | |
| 539 | - 'content' => self::get_all_widget_content( $step, $one_subscription ), | |
| 540 | - 'action_button' => self::get_ally_cta_button( $step, $one_subscription ), | |
| 509 | + 'title' => __( 'Ally web accessibility', 'elementor' ), | |
| 510 | + 'content' => self::get_all_widget_content( $step ), | |
| 511 | + 'action_button' => self::get_ally_cta_button( $step ), | |
| 541 | 512 | ]; |
| 542 | 513 | |
| 543 | 514 | return $data; |
| 544 | 515 | } |