| @@ -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 | |
| @@ -344,12 +343,8 @@ | ||
| 344 | 343 | * |
| 345 | 344 | * @return bool |
| 346 | 345 | */ |
| 347 | 346 | public static function is_plugin_installed( $plugin ): bool { |
| 348 | - if ( ! function_exists( 'get_plugins' ) ) { | |
| 349 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 350 | - } | |
| 351 | - | |
| 352 | 347 | $plugins = get_plugins(); |
| 353 | 348 | $plugin = self::ensure_plugin_folder( $plugin ); |
| 354 | 349 | return ! empty( $plugins[ $plugin ] ); |
| 355 | 350 | } |
| @@ -448,68 +443,45 @@ | ||
| 448 | 443 | public static function is_plugin_connected( $option_prefix ): bool { |
| 449 | 444 | return ! empty( get_option( $option_prefix . '_access_token' ) ); |
| 450 | 445 | } |
| 451 | 446 | |
| 452 | - public static function is_plugin_connected_to_one_subscription(): bool { | |
| 453 | - return self::is_plugin_connected( 'elementor_one' ); | |
| 454 | - } | |
| 455 | - | |
| 456 | - private static function get_all_widget_content( $step, $one_subscription = false ) { | |
| 457 | - if ( $one_subscription ) { | |
| 458 | - $steps = [ | |
| 459 | - 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' ), | |
| 460 | - self::ACTIVATE => esc_html__( 'Your ONE subscription includes Web Accessibility. Activate it to place an accessibility widget on your site.', 'elementor' ), | |
| 461 | - self::CONNECT => esc_html__( "Connect the Web Accessibility plugin to your account to access all of it's accessibility features.", 'elementor' ), | |
| 462 | - self::CUSTOMIZE => esc_html__( "Customize the widget's look, position and the capabilities available for your visitors.", 'elementor' ), | |
| 463 | - ]; | |
| 464 | - } else { | |
| 465 | - $steps = [ | |
| 466 | - self::INSTALL => esc_html__( 'Install Web Accessibility to add an accessibility widget visitors can use to navigate your site.', 'elementor' ), | |
| 467 | - self::ACTIVATE => esc_html__( 'Activate the Web Accessibility plugin to turn its accessibility features on across your site.', 'elementor' ), | |
| 468 | - self::CONNECT => esc_html__( "Connect the Web Accessibility plugin to your account to access all of it's accessibility features.", 'elementor' ), | |
| 469 | - self::CUSTOMIZE => esc_html__( "Customize the widget's look, position and the capabilities available for your visitors.", 'elementor' ), | |
| 470 | - ]; | |
| 471 | - } | |
| 447 | + private static function get_all_widget_content( $step ) { | |
| 448 | + $steps = [ | |
| 449 | + self::INSTALL => esc_html__( 'Install Ally to add an accessibility widget visitors can use to navigate your site.', 'elementor' ), | |
| 450 | + self::ACTIVATE => esc_html__( 'Activate the Ally plugin to turn its accessibility features on across your site.', 'elementor' ), | |
| 451 | + self::CONNECT => esc_html__( "Connect the Ally plugin to your account to access all of it's accessibility features.", 'elementor' ), | |
| 452 | + self::CUSTOMIZE => esc_html__( "Customize the widget's look, position and the capabilities available for your visitors.", 'elementor' ), | |
| 453 | + ]; | |
| 472 | 454 | return $steps[ $step ]; |
| 473 | 455 | } |
| 474 | 456 | |
| 475 | 457 | private static function get_all_widget_action_button( $step ) { |
| 476 | 458 | $steps = [ |
| 477 | - self::INSTALL => esc_html__( 'Install now', 'elementor' ), | |
| 478 | - self::ACTIVATE => esc_html__( 'Activate now', 'elementor' ), | |
| 479 | - self::CONNECT => esc_html__( 'Connect now', 'elementor' ), | |
| 459 | + self::INSTALL => esc_html__( 'install Now', 'elementor' ), | |
| 460 | + self::ACTIVATE => esc_html__( 'Activate', 'elementor' ), | |
| 461 | + self::CONNECT => esc_html__( 'Connect', 'elementor' ), | |
| 480 | 462 | self::CUSTOMIZE => esc_html__( 'Customize', 'elementor' ), |
| 481 | 463 | ]; |
| 482 | 464 | return $steps[ $step ]; |
| 483 | 465 | } |
| 484 | 466 | |
| 485 | - private static function get_all_widget_action_url( $step, $one_subscription = false ) { | |
| 467 | + private static function get_all_widget_action_url( $step ) { | |
| 486 | 468 | if ( in_array( $step, [ self::INSTALL, self::ACTIVATE ], true ) ) { |
| 487 | - $action = ( self::INSTALL === $step ? 'install' : 'activate' ); | |
| 488 | - if ( $one_subscription ) { | |
| 489 | - $campaign_data = [ | |
| 490 | - 'name' => 'elementor_ea11y_campaign', | |
| 491 | - 'campaign' => 'acc-usability-widget-plg-ally-one-' . $action, | |
| 492 | - 'source' => 'editor-ally-widget-one-' . $action, | |
| 493 | - 'medium' => 'editor-one', | |
| 494 | - ]; | |
| 495 | - } else { | |
| 496 | - $campaign_data = [ | |
| 497 | - 'name' => 'elementor_ea11y_campaign', | |
| 498 | - 'campaign' => 'acc-usability-widget-plg-ally', | |
| 499 | - 'source' => 'editor-ally-widget', | |
| 500 | - 'medium' => 'editor', | |
| 501 | - ]; | |
| 502 | - } | |
| 469 | + $campaign_data = [ | |
| 470 | + 'name' => 'elementor_ea11y_campaign', | |
| 471 | + 'campaign' => 'acc-usability-widget-plg-ally', | |
| 472 | + 'source' => 'editor-ally-widget', | |
| 473 | + 'medium' => 'editor', | |
| 474 | + ]; | |
| 503 | 475 | return Admin_Notices::add_plg_campaign_data( self::get_plugin_action_url( 'pojo-accessibility' ), $campaign_data ); |
| 504 | 476 | } |
| 505 | 477 | return self::CONNECT === $step ? admin_url( 'admin.php?page=accessibility-settings' ) : admin_url( 'admin.php?page=accessibility-settings#design' ); |
| 506 | 478 | } |
| 507 | 479 | |
| 508 | - private static function get_ally_cta_button( $step, $one_subscription = false ) { | |
| 480 | + private static function get_ally_cta_button( $step ) { | |
| 509 | 481 | return [ |
| 510 | 482 | 'text' => self::get_all_widget_action_button( $step ), |
| 511 | - 'url' => self::get_all_widget_action_url( $step, $one_subscription ), | |
| 483 | + 'url' => self::get_all_widget_action_url( $step ), | |
| 512 | 484 | 'classes' => [ 'elementor-button' ], |
| 513 | 485 | ]; |
| 514 | 486 | } |
| 515 | 487 | |
| @@ -517,9 +489,8 @@ | ||
| 517 | 489 | $plugin_slug = 'pojo-accessibility'; |
| 518 | 490 | $is_installed = self::is_plugin_installed( $plugin_slug ); |
| 519 | 491 | $is_active = self::is_plugin_active( $plugin_slug ); |
| 520 | 492 | $is_connected = self::is_plugin_connected( 'ea11y' ); |
| 521 | - $one_subscription = self::is_plugin_connected_to_one_subscription(); | |
| 522 | 493 | |
| 523 | 494 | if ( ! $is_installed ) { |
| 524 | 495 | $step = self::INSTALL; |
| 525 | 496 | } elseif ( ! $is_active ) { |
| @@ -530,11 +501,11 @@ | ||
| 530 | 501 | $step = self::CUSTOMIZE; |
| 531 | 502 | } |
| 532 | 503 | |
| 533 | 504 | $data = [ |
| 534 | - 'title' => __( 'Web accessibility', 'elementor' ), | |
| 535 | - 'content' => self::get_all_widget_content( $step, $one_subscription ), | |
| 536 | - 'action_button' => self::get_ally_cta_button( $step, $one_subscription ), | |
| 505 | + 'title' => __( 'Ally web accessibility', 'elementor' ), | |
| 506 | + 'content' => self::get_all_widget_content( $step ), | |
| 507 | + 'action_button' => self::get_ally_cta_button( $step ), | |
| 537 | 508 | ]; |
| 538 | 509 | |
| 539 | 510 | return $data; |
| 540 | 511 | } |