PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.0-dev2
Elementor Website Builder – more than just a page builder v3.32.0-dev2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | core/utils/hints.php +42 -94 4.2.03.32.0-dev2 View file →
@@ -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
@@ -24,13 +23,8 @@
24 23 const PLUGIN_INSTALLED = 'plugin_installed';
25 24 const PLUGIN_ACTIVE = 'plugin_active';
26 25 const NOT_HAS_OPTION = 'not_has_option';
27 26
28 - const INSTALL = 'install';
29 - const ACTIVATE = 'activate';
30 - const CONNECT = 'connect';
31 - const CUSTOMIZE = 'customize';
32 -
33 27 /**
34 28 * Get_notice_types
35 29 *
36 30 * @return string[]
@@ -110,13 +104,13 @@
110 104 *
111 105 * Print or Retrieve the notice template.
112 106 *
113 107 * @param array $notice
114 - * @param bool $should_return
108 + * @param bool $return
115 109 *
116 110 * @return string|void
117 111 */
118 - public static function get_notice_template( array $notice, bool $should_return = false ) {
112 + public static function get_notice_template( array $notice, bool $return = false ) {
119 113 $default_settings = [
120 114 'type' => 'info',
121 115 'icon' => false,
122 116 'heading' => '',
@@ -187,9 +181,9 @@
187 181 $dismissible,
188 182 $notice_settings['display']
189 183 );
190 184
191 - if ( $should_return ) {
185 + if ( $return ) {
192 186 return $notice_template;
193 187 }
194 188 echo wp_kses( $notice_template, self::get_notice_allowed_html() );
195 189 }
@@ -344,12 +338,8 @@
344 338 *
345 339 * @return bool
346 340 */
347 341 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 342 $plugins = get_plugins();
353 343 $plugin = self::ensure_plugin_folder( $plugin );
354 344 return ! empty( $plugins[ $plugin ] );
355 345 }
@@ -361,12 +351,8 @@
361 351 *
362 352 * @return bool
363 353 */
364 354 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 355 $plugin = self::ensure_plugin_folder( $plugin );
370 356 return is_plugin_active( $plugin );
371 357 }
372 358
@@ -452,94 +438,56 @@
452 438 public static function is_plugin_connected( $option_prefix ): bool {
453 439 return ! empty( get_option( $option_prefix . '_access_token' ) );
454 440 }
455 441
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 - }
476 - return $steps[ $step ];
477 - }
478 -
479 - private static function get_all_widget_action_button( $step ) {
480 - $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' ),
484 - self::CUSTOMIZE => esc_html__( 'Customize', 'elementor' ),
485 - ];
486 - return $steps[ $step ];
487 - }
488 -
489 - private static function get_all_widget_action_url( $step, $one_subscription = false ) {
490 - 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 - }
507 - return Admin_Notices::add_plg_campaign_data( self::get_plugin_action_url( 'pojo-accessibility' ), $campaign_data );
508 - }
509 - return self::CONNECT === $step ? admin_url( 'admin.php?page=accessibility-settings' ) : admin_url( 'admin.php?page=accessibility-settings#design' );
510 - }
511 -
512 - private static function get_ally_cta_button( $step, $one_subscription = false ) {
513 - return [
514 - 'text' => self::get_all_widget_action_button( $step ),
515 - 'url' => self::get_all_widget_action_url( $step, $one_subscription ),
516 - 'classes' => [ 'elementor-button' ],
517 - ];
518 - }
519 -
520 442 public static function get_ally_action_data(): array {
521 443 $plugin_slug = 'pojo-accessibility';
522 444 $is_installed = self::is_plugin_installed( $plugin_slug );
523 445 $is_active = self::is_plugin_active( $plugin_slug );
524 446 $is_connected = self::is_plugin_connected( 'ea11y' );
525 - $one_subscription = self::is_plugin_connected_to_one_subscription();
526 447
448 + $data = [
449 + 'title' => __( 'Ally web accessibility', 'elementor' ),
450 + ];
451 +
452 + $campaign_data = [
453 + 'name' => 'elementor_ea11y_campaign',
454 + 'campaign' => 'acc-usability-widget-plg-ally',
455 + 'source' => 'editor-ally-widget',
456 + 'medium' => 'editor',
457 + ];
458 +
527 459 if ( ! $is_installed ) {
528 - $step = self::INSTALL;
529 - } elseif ( ! $is_active ) {
530 - $step = self::ACTIVATE;
531 - } elseif ( ! $is_connected ) {
532 - $step = self::CONNECT;
460 + $url = Admin_Notices::add_plg_campaign_data( self::get_plugin_action_url( $plugin_slug ), $campaign_data );
461 + $data['content'] = esc_html__( 'Install Ally to add an accessibility widget visitors can use to navigate your site.', 'elementor' );
462 + $data['action_button'] = [
463 + 'text' => esc_html__( 'install Now', 'elementor' ),
464 + 'url' => $url,
465 + 'classes' => [ 'elementor-button' ],
466 + ];
467 + } else if ( ! $is_active ) {
468 + $url = Admin_Notices::add_plg_campaign_data( self::get_plugin_action_url( $plugin_slug ), $campaign_data );
469 + $data['content'] = esc_html__( 'Activate the Ally plugin to turn its accessibility features on across your site.', 'elementor' );
470 + $data['action_button'] = [
471 + 'text' => esc_html__( 'Activate', 'elementor' ),
472 + 'url' => $url,
473 + 'classes' => [ 'elementor-button' ],
474 + ];
475 + } else if ( ! $is_connected ) {
476 + $data['content'] = esc_html__( "Connect the Ally plugin to your account to access all of it's accessibility features.", 'elementor' );
477 + $data['action_button'] = [
478 + 'text' => esc_html__( 'Connect', 'elementor' ),
479 + 'url' => admin_url( 'admin.php?page=accessibility-settings' ),
480 + 'classes' => [ 'elementor-button' ],
481 + ];
533 482 } else {
534 - $step = self::CUSTOMIZE;
483 + $data['content'] = esc_html__( "Customize the widget's look, position and the capabilities available for your visitors.", 'elementor' );
484 + $data['action_button'] = [
485 + 'text' => esc_html__( 'Customize', 'elementor' ),
486 + 'url' => admin_url( 'admin.php?page=accessibility-settings#design' ),
487 + 'classes' => [ 'elementor-button' ],
488 + ];
535 489 }
536 -
537 - $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 ),
541 - ];
542 490
543 491 return $data;
544 492 }
545 493 }