PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.0-beta1
Elementor Website Builder – more than just a page builder v3.34.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 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 All 457 releases
← All changes | core/admin/admin-notices.php +256 -165 4.3.4 → 3.34.0-beta1 View file →
@@ -3,11 +3,12 @@
3 3
4 4 use Elementor\Api;
5 5 use Elementor\Core\Admin\UI\Components\Button;
6 6 use Elementor\Core\Base\Module;
7 -use Elementor\Core\Utils\Hints;
7 +use Elementor\Core\Upgrade\Manager;
8 8 use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
9 9 use Elementor\Plugin;
10 +use Elementor\Settings;
10 11 use Elementor\Tracker;
11 12 use Elementor\User;
12 13 use Elementor\Utils;
13 14 use Elementor\Core\Admin\Notices\Base_Notice;
@@ -18,8 +19,10 @@
18 19
19 20 class Admin_Notices extends Module {
20 21
21 22 const DEFAULT_EXCLUDED_PAGES = [ 'plugins.php', 'plugin-install.php', 'plugin-editor.php' ];
23 + const LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID = 'local_google_fonts_disabled';
24 + const LOCAL_GOOGLE_FONTS_NOTICE_MIN_VERSION = '3.33.3';
22 25
23 26 const EXIT_EARLY_FOR_BACKWARD_COMPATIBILITY = false;
24 27
25 28 private $plain_notices = [
@@ -28,10 +31,14 @@
28 31 'tracker',
29 32 'tracker_last_update',
30 33 'rate_us_feedback',
31 34 'role_manager_promote',
35 + 'experiment_promotion',
36 + 'send_app_promotion',
37 + 'site_mailer_promotion',
32 38 'plugin_image_optimization',
33 39 'ally_pages_promotion',
40 + self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID,
34 41 ];
35 42
36 43 private $elementor_pages_count = null;
37 44
@@ -380,8 +387,55 @@
380 387
381 388 return true;
382 389 }
383 390
391 + private function notice_experiment_promotion() {
392 + $notice_id = 'experiment_promotion';
393 +
394 + if ( ! current_user_can( 'manage_options' ) || User::is_user_notice_viewed( $notice_id ) ) {
395 + return false;
396 + }
397 +
398 + $experiments = Plugin::$instance->experiments;
399 + $is_all_performance_features_active = (
400 + $experiments->is_feature_active( 'e_font_icon_svg' ) &&
401 + $experiments->is_feature_active( 'e_optimized_markup' )
402 + );
403 +
404 + if ( $is_all_performance_features_active ) {
405 + return false;
406 + }
407 +
408 + $options = [
409 + 'title' => esc_html__( 'Improve your site’s performance score.', 'elementor' ),
410 + 'description' => esc_html__( 'With our experimental speed boosting features you can go faster than ever before. Look for the Performance label on our Experiments page and activate those experiments to improve your site loading speed.', 'elementor' ),
411 + 'id' => $notice_id,
412 + 'button' => [
413 + 'text' => esc_html__( 'Try it out', 'elementor' ),
414 + 'url' => Settings::get_settings_tab_url( 'experiments' ),
415 + 'type' => 'cta',
416 + ],
417 + 'button_secondary' => [
418 + 'text' => esc_html__( 'Learn more', 'elementor' ),
419 + 'url' => 'https://go.elementor.com/wp-dash-experiment-promotion/',
420 + 'new_tab' => true,
421 + 'type' => 'cta',
422 + ],
423 + ];
424 +
425 + $this->print_admin_notice( $options );
426 +
427 + return true;
428 + }
429 +
430 + private function site_has_forms_plugins() {
431 + return defined( 'WPFORMS_VERSION' ) || defined( 'WPCF7_VERSION' ) || defined( 'FLUENTFORM_VERSION' ) || class_exists( '\GFCommon' ) || class_exists( '\Ninja_Forms' ) || function_exists( 'load_formidable_forms' ) || did_action( 'metform/after_load' ) || defined( 'FORMINATOR_PLUGIN_BASENAME' );
432 + }
433 +
434 + private function site_has_woocommerce() {
435 + return class_exists( 'WooCommerce' );
436 + }
437 +
384 438 private function get_installed_form_plugin_name() {
385 439 static $detected_form_plugin = null;
386 440
387 441 if ( null !== $detected_form_plugin ) {
@@ -415,8 +469,102 @@
415 469 $detected_form_plugin = false;
416 470 return $detected_form_plugin;
417 471 }
418 472
473 + private function notice_send_app_promotion() {
474 + return self::EXIT_EARLY_FOR_BACKWARD_COMPATIBILITY;
475 +
476 + $notice_id = 'send_app_promotion';
477 +
478 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
479 + return false;
480 + }
481 +
482 + if ( time() < $this->get_install_time() + ( 60 * DAY_IN_SECONDS ) ) {
483 + return false;
484 + }
485 +
486 + if ( ! current_user_can( 'install_plugins' ) || User::is_user_notice_viewed( $notice_id ) ) {
487 + return false;
488 + }
489 +
490 + $plugin_file_path = 'send/send-app.php';
491 + $plugin_slug = 'send-app';
492 +
493 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
494 + if ( empty( $cta_data ) ) {
495 + return false;
496 + }
497 +
498 + $title = sprintf( esc_html__( 'Turn leads into loyal shoppers', 'elementor' ) );
499 +
500 + $options = [
501 + 'title' => $title,
502 + 'description' => esc_html__( 'Collecting leads is just the beginning. With Send by Elementor, you can manage contacts, launch automations, and turn form submissions into sales.', 'elementor' ),
503 + 'id' => $notice_id,
504 + 'type' => 'cta',
505 + 'button' => [
506 + 'text' => $cta_data['text'],
507 + 'url' => $cta_data['url'],
508 + 'type' => 'cta',
509 + ],
510 + 'button_secondary' => [
511 + 'text' => esc_html__( 'Learn more', 'elementor' ),
512 + 'url' => 'https://go.elementor.com/Formslearnmore',
513 + 'new_tab' => true,
514 + 'type' => 'cta',
515 + ],
516 + ];
517 +
518 + $this->print_admin_notice( $options );
519 +
520 + return true;
521 + }
522 +
523 + private function notice_local_google_fonts_disabled() {
524 +
525 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
526 + return false;
527 + }
528 +
529 + if ( ! Manager::had_install_prior_to( self::LOCAL_GOOGLE_FONTS_NOTICE_MIN_VERSION ) ) {
530 + return false;
531 + }
532 +
533 + if ( User::is_user_notice_viewed( self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID ) ) {
534 + return false;
535 + }
536 +
537 + $is_local_gf_enabled = (bool) get_option( 'elementor_local_google_fonts', '0' );
538 +
539 + if ( $is_local_gf_enabled ) {
540 + return false;
541 + }
542 +
543 + $options = [
544 + 'title' => esc_html__( 'Important: Local Google Fonts Settings in Elementor', 'elementor' ),
545 + 'description' => esc_html__( 'Please note: The "Load Google Fonts Locally" feature has been disabled by default on all websites. To turn it back on, go to Elementor → Settings → Performance → Enable Load Google Fonts Locally.', 'elementor' ),
546 + 'id' => self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID,
547 + 'type' => '',
548 + 'button' => [
549 + 'text' => esc_html__( 'Take me there', 'elementor' ),
550 + 'url' => '../wp-admin/admin.php?page=elementor-settings#tab-performance',
551 + 'new_tab' => false,
552 + 'type' => 'cta',
553 + ],
554 + 'button_secondary' => [
555 + 'text' => esc_html__( 'Learn more', 'elementor' ),
556 + 'url' => 'https://go.elementor.com/wp-dash-google-fonts-locally-notice/',
557 + 'new_tab' => true,
558 + 'type' => 'cta',
559 + ],
560 + ];
561 +
562 + $this->print_admin_notice( $options );
563 +
564 + return true;
565 + }
566 +
419 567 private function notice_ally_pages_promotion() {
420 568 global $pagenow;
421 569 $notice_id = 'ally_pages_promotion';
422 570
@@ -423,99 +571,124 @@
423 571 if ( 'edit.php' !== $pagenow || empty( $_GET['post_type'] ) || 'page' !== $_GET['post_type'] ) {
424 572 return false;
425 573 }
426 574
427 - if ( ! current_user_can( 'manage_options' ) ) {
575 + if ( ! current_user_can( 'manage_options' ) || User::is_user_notice_viewed( $notice_id ) ) {
428 576 return false;
429 577 }
430 578
431 - if ( User::is_user_notice_viewed( $notice_id ) ) {
579 + $plugin_file_path = 'pojo-accessibility/pojo-accessibility.php';
580 + $plugin_slug = 'pojo-accessibility';
581 +
582 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
583 + if ( empty( $cta_data ) ) {
432 584 return false;
433 585 }
434 586
435 - $plugin_slug = 'pojo-accessibility';
436 - $plugin_file_path = 'pojo-accessibility/pojo-accessibility.php';
587 + $options = [
588 + 'title' => esc_html__( 'Make sure your site has an accessibility statement page', 'elementor' ),
589 + 'description' => esc_html__( 'Create a more inclusive site experience for all your visitors. With Ally, it\'s easy to add your statement page in just a few clicks.', 'elementor' ),
590 + 'id' => $notice_id,
591 + 'type' => 'cta',
592 + 'button' => [
593 + 'text' => $cta_data['text'],
594 + 'url' => self::add_plg_campaign_data( $cta_data['url'], [
595 + 'name' => 'elementor_ea11y_campaign',
596 + 'campaign' => 'acc-statement-plg-pages',
597 + 'source' => 'wp-pages',
598 + 'medium' => 'wp-dash',
599 + ] ),
600 + 'type' => 'cta',
601 + ],
602 + 'button_secondary' => [
603 + 'text' => esc_html__( 'Learn more', 'elementor' ),
604 + 'url' => 'https://go.elementor.com/acc-plg-learn-more',
605 + 'new_tab' => true,
606 + 'type' => 'cta',
607 + ],
608 + ];
437 609
438 - $one_subscription = Hints::is_plugin_connected_to_one_subscription();
439 - $is_installed = Hints::is_plugin_installed( $plugin_slug );
440 - $is_active = Hints::is_plugin_active( $plugin_slug );
610 + $this->print_admin_notice( $options );
441 611
442 - if ( $is_active ) {
612 + return true;
613 + }
614 +
615 + private function notice_site_mailer_promotion() {
616 + $notice_id = 'site_mailer_promotion';
617 + $has_forms = $this->site_has_forms_plugins();
618 + $has_woocommerce = $this->site_has_woocommerce();
619 +
620 + if ( ! $has_forms && ! $has_woocommerce ) {
443 621 return false;
444 622 }
445 623
446 - if ( $one_subscription ) {
447 - $learn_more_url = 'https://go.elementor.com/acc-plg-learn-more-one';
624 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
625 + return false;
626 + }
448 627
449 - if ( ! $is_installed ) {
450 - $description = esc_html__( 'Make sure your site has an accessibility statement page. Install Web Accessibility, included in ONE, to create it in a few clicks.', 'elementor' );
451 - $button_text = esc_html__( 'Install now', 'elementor' );
452 - $button_url = $this->get_plugin_button_install_url( $plugin_slug );
453 - $campaign_data = [
454 - 'name' => 'elementor_ea11y_campaign',
455 - 'campaign' => 'acc-statement-plg-pages-one-install',
456 - 'source' => 'wp-pages-one-install',
457 - 'medium' => 'wp-dash-one',
458 - ];
459 - } elseif ( ! $is_active ) {
460 - $description = esc_html__( 'Your ONE subscription includes Web Accessibility. Activate it to create your accessibility statement page quickly.', 'elementor' );
461 - $button_text = esc_html__( 'Activate now', 'elementor' );
462 - $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
463 - $campaign_data = [
464 - 'name' => 'elementor_ea11y_campaign',
465 - 'campaign' => 'acc-statement-plg-pages-one-activate',
466 - 'source' => 'wp-pages-one-activate',
467 - 'medium' => 'wp-dash-one',
468 - ];
469 - }
470 - } else {
471 - $description = esc_html__( "Create a more inclusive site experience for all your visitors. With Web Accessibility, it's easy to add your statement page in just a few clicks.", 'elementor' );
472 - $learn_more_url = 'https://go.elementor.com/acc-plg-learn-more';
628 + if ( ( Utils::has_pro() && ! $has_woocommerce ) || ! current_user_can( 'install_plugins' ) || User::is_user_notice_viewed( $notice_id ) ) {
629 + return false;
630 + }
473 631
474 - if ( ! $is_installed ) {
475 - $button_text = esc_html__( 'Install now', 'elementor' );
476 - $button_url = $this->get_plugin_button_install_url( $plugin_slug );
477 - $campaign_data = [
478 - 'name' => 'elementor_ea11y_campaign',
479 - 'campaign' => 'acc-statement-plg-pages-install',
480 - 'source' => 'wp-pages-install',
481 - 'medium' => 'wp-dash',
482 - ];
483 - } elseif ( ! $is_active ) {
484 - $button_text = esc_html__( 'Activate now', 'elementor' );
485 - $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
486 - $campaign_data = [
487 - 'name' => 'elementor_ea11y_campaign',
488 - 'campaign' => 'acc-statement-plg-pages-activate',
489 - 'source' => 'wp-pages-activate',
490 - 'medium' => 'wp-dash',
491 - ];
492 - }
632 + $plugin_file_path = 'site-mailer/site-mailer.php';
633 + $plugin_slug = 'site-mailer';
634 +
635 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
636 + if ( empty( $cta_data ) ) {
637 + return false;
493 638 }
494 639
495 640 $options = [
496 - 'title' => esc_html__( 'Make sure your site has an accessibility statement page', 'elementor' ),
497 - 'description' => $description,
641 + 'title' => esc_html__( 'Ensure your form emails avoid the spam folder!', 'elementor' ),
642 + 'description' => esc_html__( 'Use Site Mailer for improved email deliverability, detailed email logs, and an easy setup.', 'elementor' ),
498 643 'id' => $notice_id,
499 644 'type' => 'cta',
500 645 'button' => [
501 - 'text' => $button_text,
502 - 'url' => self::add_plg_campaign_data( $button_url, $campaign_data ),
646 + 'text' => $cta_data['text'],
647 + 'url' => $cta_data['url'],
503 648 'type' => 'cta',
504 649 ],
505 650 'button_secondary' => [
506 651 'text' => esc_html__( 'Learn more', 'elementor' ),
507 - 'url' => $learn_more_url,
652 + 'url' => 'https://go.elementor.com/sm-core-form/',
508 653 'new_tab' => true,
509 654 'type' => 'cta',
510 655 ],
511 656 ];
512 657
658 + if ( $this->should_render_woocommerce_hint( $has_forms, $has_woocommerce ) ) {
659 + // We include WP's default notice class so it will be properly handled by WP's js handler
660 + // And add a new one to distinguish between the two types of notices
661 + $options['classes'] = [ 'notice', 'e-notice', 'sm-notice-wc' ];
662 + $options['title'] = esc_html__( 'Improve Transactional Email Deliverability', 'elementor' );
663 + $options['description'] = esc_html__( 'Use Elementor\'s Site Mailer to ensure your store emails like purchase confirmations, shipping updates and more are reliably delivered.', 'elementor' );
664 + }
665 +
513 666 $this->print_admin_notice( $options );
514 667
515 668 return true;
516 669 }
517 670
671 + private function should_render_woocommerce_hint( $has_forms, $has_woocommerce ): bool {
672 + if ( ! $has_forms && ! $has_woocommerce ) {
673 + return false;
674 + }
675 +
676 + if ( ! $has_forms && $has_woocommerce ) {
677 + return true;
678 + }
679 +
680 + if ( $has_forms && $has_woocommerce && Utils::has_pro() ) {
681 + return true;
682 + }
683 +
684 + if ( ! $has_woocommerce ) {
685 + return false;
686 + }
687 +
688 + return (bool) wp_rand( 0, 1 );
689 + }
690 +
518 691 private function is_elementor_page(): bool {
519 692 return 0 === strpos( $this->current_screen_id, 'elementor_page' );
520 693 }
521 694
@@ -525,31 +698,20 @@
525 698
526 699 private function is_elementor_admin_screen_with_system_info(): bool {
527 700 return in_array( $this->current_screen_id, [ 'toplevel_page_elementor', 'edit-elementor_library', 'elementor_page_elementor-system-info', 'dashboard' ], true );
528 701 }
529 - private function get_plugin_button_install_url( $plugin_slug ) {
530 - return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug ), 'install-plugin_' . $plugin_slug );
531 - }
532 702
533 - private function get_plugin_button_activate_url( $plugin_file_path ) {
534 - return wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin_file_path . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin_file_path );
535 - }
536 -
537 - private function get_plugin_button_connect_url( $plugin_settings_page ) {
538 - return self_admin_url( $plugin_settings_page );
539 - }
540 -
541 703 private function get_plugin_cta_data( $plugin_slug, $plugin_file_path ) {
542 - if ( Hints::is_plugin_active( $plugin_slug ) ) {
704 + if ( is_plugin_active( $plugin_file_path ) ) {
543 705 return false;
544 706 }
545 707
546 - if ( Hints::is_plugin_installed( $plugin_slug ) ) {
547 - $url = $this->get_plugin_button_activate_url( $plugin_file_path );
548 - $cta_text = esc_html__( 'Activate now', 'elementor' );
708 + if ( $this->is_plugin_installed( $plugin_file_path ) ) {
709 + $url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin_file_path . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin_file_path );
710 + $cta_text = esc_html__( 'Activate Plugin', 'elementor' );
549 711 } else {
550 - $url = $this->get_plugin_button_install_url( $plugin_slug );
551 - $cta_text = esc_html__( 'Install now', 'elementor' );
712 + $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug ), 'install-plugin_' . $plugin_slug );
713 + $cta_text = esc_html__( 'Install Plugin', 'elementor' );
552 714 }
553 715
554 716 return [
555 717 'url' => $url,
@@ -570,16 +732,12 @@
570 732 if ( 'upload' !== $this->current_screen_id ) {
571 733 return false;
572 734 }
573 735
574 - if ( ! current_user_can( 'manage_options' ) ) {
736 + if ( ! current_user_can( 'manage_options' ) || User::is_user_notice_viewed( $notice_id ) ) {
575 737 return false;
576 738 }
577 739
578 - if ( User::is_user_notice_viewed( $notice_id ) ) {
579 - return false;
580 - }
581 -
582 740 $attachments = new \WP_Query( [
583 741 'post_type' => 'attachment',
584 742 'post_status' => 'any',
585 743 'fields' => 'ids',
@@ -588,79 +746,26 @@
588 746 if ( 1 > $attachments->found_posts ) {
589 747 return false;
590 748 }
591 749
750 + $plugin_file_path = 'image-optimization/image-optimization.php';
592 751 $plugin_slug = 'image-optimization';
593 - $plugin_file_path = 'image-optimization/image-optimization.php';
594 752
595 - $one_subscription = Hints::is_plugin_connected_to_one_subscription();
596 - $is_installed = Hints::is_plugin_installed( $plugin_slug );
597 - $is_active = Hints::is_plugin_active( $plugin_slug );
753 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
598 754
599 - if ( $is_active ) {
755 + if ( empty( $cta_data ) ) {
600 756 return false;
601 757 }
602 758
603 - if ( $one_subscription ) {
604 - if ( ! $is_installed ) {
605 - $description = esc_html__( 'Automatically optimize images to improve site speed and performance. Included with your ONE subscription.', 'elementor' );
606 - $button_text = esc_html__( 'Install now', 'elementor' );
607 - $button_url = $this->get_plugin_button_install_url( $plugin_slug );
608 - $campaign_data = [
609 - 'name' => 'elementor_image_optimization_campaign',
610 - 'campaign' => 'io-plg-one',
611 - 'source' => 'io-wp-media-library-one-install',
612 - 'medium' => 'wp-dash-one',
613 - ];
614 - } elseif ( ! $is_active ) {
615 - $description = esc_html__( 'Your ONE subscription includes Image Optimization. Activate it to optimize images and improve site performance.', 'elementor' );
616 - $button_text = esc_html__( 'Activate now', 'elementor' );
617 - $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
618 - $campaign_data = [
619 - 'name' => 'elementor_image_optimization_campaign',
620 - 'campaign' => 'io-plg-one',
621 - 'source' => 'io-wp-media-library-one-activate',
622 - 'medium' => 'wp-dash-one',
623 - ];
624 - }
625 - } else {
626 - $description = esc_html__( 'Automatically compress and optimize images, resize larger files, or convert to WebP. Optimize images individually, in bulk, or on upload.', 'elementor' );
627 -
628 - if ( ! $is_installed ) {
629 - $button_text = esc_html__( 'Install now', 'elementor' );
630 - $button_url = $this->get_plugin_button_install_url( $plugin_slug );
631 - $campaign_data = [
632 - 'name' => 'elementor_image_optimization_campaign',
633 - 'campaign' => 'io-plg',
634 - 'source' => 'io-wp-media-library-install',
635 - 'medium' => 'wp-dash',
636 - ];
637 - } elseif ( ! $is_active ) {
638 - $button_text = esc_html__( 'Activate now', 'elementor' );
639 - $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
640 - $campaign_data = [
641 - 'name' => 'elementor_image_optimization_campaign',
642 - 'campaign' => 'io-plg',
643 - 'source' => 'io-wp-media-library-activate',
644 - 'medium' => 'wp-dash',
645 - ];
646 - }
647 - }
648 -
649 759 $options = [
650 - 'title' => esc_html__( 'Speed up your website with Image Optimization', 'elementor' ),
651 - 'description' => $description,
760 + 'title' => esc_html__( 'Speed up your website with Image Optimizer by Elementor', 'elementor' ),
761 + 'description' => esc_html__( 'Automatically compress and optimize images, resize larger files, or convert to WebP. Optimize images individually, in bulk, or on upload.', 'elementor' ),
652 762 'id' => $notice_id,
653 763 'type' => 'cta',
654 - 'button' => [
655 - 'text' => $button_text,
656 - 'url' => self::add_plg_campaign_data( $button_url, $campaign_data ),
764 + 'button_secondary' => [
765 + 'text' => $cta_data['text'],
766 + 'url' => $cta_data['url'],
657 767 'type' => 'cta',
658 - 'data' => [
659 - 'campaign' => $campaign_data['campaign'],
660 - 'source' => $campaign_data['source'],
661 - 'medium' => $campaign_data['medium'],
662 - ],
663 768 ],
664 769 ];
665 770
666 771 $this->print_admin_notice( $options );
@@ -667,8 +772,14 @@
667 772
668 773 return true;
669 774 }
670 775
776 + private function is_plugin_installed( $file_path ): bool {
777 + $installed_plugins = get_plugins();
778 +
779 + return isset( $installed_plugins[ $file_path ] );
780 + }
781 +
671 782 public function print_admin_notice( array $options, $exclude_pages = self::DEFAULT_EXCLUDED_PAGES ) {
672 783 global $pagenow;
673 784
674 785 if ( in_array( $pagenow, $exclude_pages, true ) ) {
@@ -681,9 +792,9 @@
681 792 'description' => '',
682 793 'classes' => [ 'notice', 'e-notice' ], // We include WP's default notice class so it will be properly handled by WP's js handler
683 794 'type' => '',
684 795 'dismissible' => true,
685 - 'icon' => 'eicon-elementor-circle',
796 + 'icon' => 'eicon-elementor',
686 797 'button' => [],
687 798 'button_secondary' => [],
688 799 ];
689 800
@@ -696,12 +807,9 @@
696 807 if ( $options['type'] ) {
697 808 $notice_classes[] = 'e-notice--' . $options['type'];
698 809 }
699 810
700 - $wrapper_attributes = [
701 - 'role' => 'region',
702 - 'aria-label' => esc_html__( 'Elementor notice', 'elementor' ),
703 - ];
811 + $wrapper_attributes = [];
704 812
705 813 if ( $options['dismissible'] ) {
706 814 $label = esc_html__( 'Dismiss this notice.', 'elementor' );
707 815 $notice_classes[] = 'e-notice--dismissible';
@@ -719,12 +827,8 @@
719 827
720 828 if ( $options['id'] ) {
721 829 $wrapper_attributes['data-notice_id'] = $options['id'];
722 830 }
723 -
724 - if ( ! empty( $options['source'] ) ) {
725 - $wrapper_attributes['data-source'] = $options['source'];
726 - }
727 831 ?>
728 832 <div <?php Utils::print_html_attributes( $wrapper_attributes ); ?>>
729 833 <?php echo $dismiss_button; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
730 834 <div class="e-notice__aside">
@@ -741,9 +845,8 @@
741 845
742 846 <?php if ( ! empty( $options['button']['text'] ) || ! empty( $options['button_secondary']['text'] ) ) { ?>
743 847 <div class="e-notice__actions">
744 848 <?php
745 - $one_subscription = Hints::is_plugin_connected_to_one_subscription();
746 849 foreach ( [ $options['button'], $options['button_secondary'] ] as $index => $button_settings ) {
747 850 if ( empty( $button_settings['variant'] ) && $index ) {
748 851 $button_settings['variant'] = 'outline';
749 852 }
@@ -751,20 +854,8 @@
751 854 if ( empty( $button_settings['text'] ) ) {
752 855 continue;
753 856 }
754 857
755 - if ( $one_subscription ) {
756 - if ( ! isset( $button_settings['classes'] ) ) {
757 - $button_settings['classes'] = [];
758 - }
759 - if ( ! is_array( $button_settings['classes'] ) ) {
760 - $button_settings['classes'] = [ $button_settings['classes'] ];
761 - }
762 - // index 0 = button, index 1 = button_secondary
763 - $button_class = ( 0 === $index ) ? 'button-primary' : 'button-secondary';
764 - $button_settings['classes'][] = $button_class;
765 - }
766 -
767 858 $button = new Button( $button_settings );
768 859 $button->print_button();
769 860 } ?>
770 861 </div>
@@ -804,8 +895,9 @@
804 895
805 896 $allowed_plgs = [
806 897 'elementor_image_optimization_campaign',
807 898 'elementor_ea11y_campaign',
899 + 'elementor_site_mailer_campaign',
808 900 ];
809 901
810 902 if ( ! in_array( $_GET['plg_campaign_name'], $allowed_plgs, true ) ) {
811 903 return;
@@ -855,9 +947,8 @@
855 947 */
856 948 public function __construct() {
857 949 add_action( 'admin_notices', [ $this, 'admin_notices' ], 20 );
858 950 add_action( 'admin_action_install-plugin', [ $this, 'maybe_log_campaign' ] );
859 - add_action( 'admin_action_activate', [ $this, 'maybe_log_campaign' ] );
860 951 }
861 952
862 953 /**
863 954 * Get module name.