PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev4
Elementor Website Builder – more than just a page builder v3.35.0-dev4
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | core/admin/admin-notices.php +256 -17 4.3.0-beta33.35.0-dev4 View file →
@@ -3,11 +3,13 @@
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\Upgrade\Manager;
7 8 use Elementor\Core\Utils\Hints;
8 9 use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
9 10 use Elementor\Plugin;
11 +use Elementor\Settings;
10 12 use Elementor\Tracker;
11 13 use Elementor\User;
12 14 use Elementor\Utils;
13 15 use Elementor\Core\Admin\Notices\Base_Notice;
@@ -18,8 +20,10 @@
18 20
19 21 class Admin_Notices extends Module {
20 22
21 23 const DEFAULT_EXCLUDED_PAGES = [ 'plugins.php', 'plugin-install.php', 'plugin-editor.php' ];
24 + const LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID = 'local_google_fonts_disabled';
25 + const LOCAL_GOOGLE_FONTS_NOTICE_MIN_VERSION = '3.33.3';
22 26
23 27 const EXIT_EARLY_FOR_BACKWARD_COMPATIBILITY = false;
24 28
25 29 private $plain_notices = [
@@ -28,10 +32,13 @@
28 32 'tracker',
29 33 'tracker_last_update',
30 34 'rate_us_feedback',
31 35 'role_manager_promote',
36 + 'experiment_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,52 @@
415 469 $detected_form_plugin = false;
416 470 return $detected_form_plugin;
417 471 }
418 472
473 + private function notice_local_google_fonts_disabled() {
474 +
475 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
476 + return false;
477 + }
478 +
479 + if ( ! Manager::had_install_prior_to( self::LOCAL_GOOGLE_FONTS_NOTICE_MIN_VERSION ) ) {
480 + return false;
481 + }
482 +
483 + if ( User::is_user_notice_viewed( self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID ) ) {
484 + return false;
485 + }
486 +
487 + $is_local_gf_enabled = (bool) get_option( 'elementor_local_google_fonts', '0' );
488 +
489 + if ( $is_local_gf_enabled ) {
490 + return false;
491 + }
492 +
493 + $options = [
494 + 'title' => esc_html__( 'Important: Local Google Fonts Settings in Elementor', 'elementor' ),
495 + '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' ),
496 + 'id' => self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID,
497 + 'type' => '',
498 + 'button' => [
499 + 'text' => esc_html__( 'Take me there', 'elementor' ),
500 + 'url' => '../wp-admin/admin.php?page=elementor-settings#tab-performance',
501 + 'new_tab' => false,
502 + 'type' => 'cta',
503 + ],
504 + 'button_secondary' => [
505 + 'text' => esc_html__( 'Learn more', 'elementor' ),
506 + 'url' => 'https://go.elementor.com/wp-dash-google-fonts-locally-notice/',
507 + 'new_tab' => true,
508 + 'type' => 'cta',
509 + ],
510 + ];
511 +
512 + $this->print_admin_notice( $options );
513 +
514 + return true;
515 + }
516 +
419 517 private function notice_ally_pages_promotion() {
420 518 global $pagenow;
421 519 $notice_id = 'ally_pages_promotion';
422 520
@@ -446,9 +544,9 @@
446 544 if ( $one_subscription ) {
447 545 $learn_more_url = 'https://go.elementor.com/acc-plg-learn-more-one';
448 546
449 547 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' );
548 + $description = esc_html__( 'Make sure your site has an accessibility statement page. Install Ally, included in ONE, to create it in a few clicks.', 'elementor' );
451 549 $button_text = esc_html__( 'Install now', 'elementor' );
452 550 $button_url = $this->get_plugin_button_install_url( $plugin_slug );
453 551 $campaign_data = [
454 552 'name' => 'elementor_ea11y_campaign',
@@ -456,9 +554,9 @@
456 554 'source' => 'wp-pages-one-install',
457 555 'medium' => 'wp-dash-one',
458 556 ];
459 557 } elseif ( ! $is_active ) {
460 - $description = esc_html__( 'Your ONE subscription includes Web Accessibility. Activate it to create your accessibility statement page quickly.', 'elementor' );
558 + $description = esc_html__( 'Your ONE subscription includes Ally. Activate it to create your accessibility statement page quickly.', 'elementor' );
461 559 $button_text = esc_html__( 'Activate now', 'elementor' );
462 560 $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
463 561 $campaign_data = [
464 562 'name' => 'elementor_ea11y_campaign',
@@ -467,9 +565,9 @@
467 565 'medium' => 'wp-dash-one',
468 566 ];
469 567 }
470 568 } 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' );
569 + $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' );
472 570 $learn_more_url = 'https://go.elementor.com/acc-plg-learn-more';
473 571
474 572 if ( ! $is_installed ) {
475 573 $button_text = esc_html__( 'Install now', 'elementor' );
@@ -514,8 +612,154 @@
514 612
515 613 return true;
516 614 }
517 615
616 + private function notice_site_mailer_promotion() {
617 + $notice_id = 'site_mailer_promotion';
618 + $has_forms = $this->site_has_forms_plugins();
619 + $has_woocommerce = $this->site_has_woocommerce();
620 +
621 + if ( ! $has_forms && ! $has_woocommerce ) {
622 + return false;
623 + }
624 +
625 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
626 + return false;
627 + }
628 +
629 + if ( ( Utils::has_pro() && ! $has_woocommerce ) || ! current_user_can( 'install_plugins' ) || User::is_user_notice_viewed( $notice_id ) ) {
630 + return false;
631 + }
632 +
633 + $plugin_slug = 'site-mailer';
634 + $plugin_file_path = 'site-mailer/site-mailer.php';
635 +
636 + $one_subscription = Hints::is_plugin_connected_to_one_subscription();
637 + $is_woocommerce = $this->should_render_woocommerce_hint( $has_forms, $has_woocommerce );
638 + $is_installed = Hints::is_plugin_installed( $plugin_slug );
639 + $is_active = Hints::is_plugin_active( $plugin_slug );
640 +
641 + if ( $is_active ) {
642 + return false;
643 + }
644 +
645 + if ( $one_subscription ) {
646 + if ( $is_woocommerce ) {
647 + $title = esc_html__( 'Improve transactional email deliverability', 'elementor' );
648 +
649 + if ( ! $is_installed ) {
650 + $description = esc_html__( 'Use Site Mailer to ensure store emails like purchase confirmations and shipping updates reach the inbox every time. Included in your ONE subscription.', 'elementor' );
651 + $button_text = esc_html__( 'Install now', 'elementor' );
652 + $button_url = $this->get_plugin_button_install_url( $plugin_slug );
653 + $source = 'sm-core-woo-one-install';
654 + } elseif ( ! $is_active ) {
655 + $description = esc_html__( 'Site Mailer is installed and included in your ONE subscription. Activate it to ensure store emails like purchase confirmations and shipping updates reach the inbox every time.', 'elementor' );
656 + $button_text = esc_html__( 'Activate now', 'elementor' );
657 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
658 + $source = 'sm-core-woo-one-activate';
659 + }
660 + } else {
661 + $title = esc_html__( 'Keep your form emails out of the spam folder', 'elementor' );
662 +
663 + if ( ! $is_installed ) {
664 + $description = esc_html__( 'Use Site Mailer to ensure emails reach the inbox and track delivery with built-in logs. Included in your ONE subscription.', 'elementor' );
665 + $button_text = esc_html__( 'Install now', 'elementor' );
666 + $button_url = $this->get_plugin_button_install_url( $plugin_slug );
667 + $source = 'sm-core-form-one-install';
668 + } elseif ( ! $is_active ) {
669 + $description = esc_html__( 'Use Site Mailer to ensure emails reach the inbox and track delivery with built-in logs. Site Mailer is included in your ONE subscription. Activate it to continue.', 'elementor' );
670 + $button_text = esc_html__( 'Activate now', 'elementor' );
671 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
672 + $source = 'sm-core-form-one-activate';
673 + }
674 + }
675 + // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found
676 + } else {
677 + if ( $is_woocommerce ) {
678 + $title = esc_html__( 'Improve Transactional Email Deliverability', 'elementor' );
679 + $description = esc_html__( "Use Elementor's Site Mailer to ensure your store emails like purchase confirmations, shipping updates and more are reliably delivered.", 'elementor' );
680 +
681 + if ( ! $is_installed ) {
682 + $button_text = esc_html__( 'Install now', 'elementor' );
683 + $button_url = $this->get_plugin_button_install_url( $plugin_slug );
684 + $source = 'sm-core-woo-install';
685 + } elseif ( ! $is_active ) {
686 + $button_text = esc_html__( 'Activate now', 'elementor' );
687 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
688 + $source = 'sm-core-woo-activate';
689 + }
690 + } else {
691 + $title = esc_html__( 'Ensure your form emails avoid the spam folder!', 'elementor' );
692 + $description = esc_html__( 'Use Site Mailer for improved email deliverability, detailed email logs, and an easy setup.', 'elementor' );
693 +
694 + if ( ! $is_installed ) {
695 + $button_text = esc_html__( 'Install now', 'elementor' );
696 + $button_url = $this->get_plugin_button_install_url( $plugin_slug );
697 + $source = 'sm-core-form-install';
698 + } elseif ( ! $is_active ) {
699 + $button_text = esc_html__( 'Activate now', 'elementor' );
700 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
701 + $source = 'sm-core-form-activate';
702 + }
703 + }
704 + }
705 +
706 + $learn_more_url = $one_subscription && $is_woocommerce
707 + ? 'https://go.elementor.com/sm-woo-learn-more-one'
708 + : 'https://go.elementor.com/sm-core-form/';
709 +
710 + $options = [
711 + 'title' => $title,
712 + 'description' => $description,
713 + 'id' => $notice_id,
714 + 'type' => 'cta',
715 + 'button' => [
716 + 'text' => $button_text,
717 + 'url' => $button_url,
718 + 'type' => 'cta',
719 + 'data' => [
720 + 'source' => $source,
721 + ],
722 + ],
723 + 'button_secondary' => [
724 + 'text' => esc_html__( 'Learn more', 'elementor' ),
725 + 'url' => $learn_more_url,
726 + 'new_tab' => true,
727 + 'type' => 'cta',
728 + ],
729 + ];
730 +
731 + if ( $is_woocommerce ) {
732 + // We include WP's default notice class so it will be properly handled by WP's js handler
733 + // And add a new one to distinguish between the two types of notices
734 + $options['classes'] = [ 'notice', 'e-notice', 'sm-notice-wc' ];
735 + }
736 +
737 + $this->print_admin_notice( $options );
738 +
739 + return true;
740 + }
741 +
742 + private function should_render_woocommerce_hint( $has_forms, $has_woocommerce ): bool {
743 + if ( ! $has_forms && ! $has_woocommerce ) {
744 + return false;
745 + }
746 +
747 + if ( ! $has_forms && $has_woocommerce ) {
748 + return true;
749 + }
750 +
751 + if ( $has_forms && $has_woocommerce && Utils::has_pro() ) {
752 + return true;
753 + }
754 +
755 + if ( ! $has_woocommerce ) {
756 + return false;
757 + }
758 +
759 + return (bool) wp_rand( 0, 1 );
760 + }
761 +
518 762 private function is_elementor_page(): bool {
519 763 return 0 === strpos( $this->current_screen_id, 'elementor_page' );
520 764 }
521 765
@@ -606,19 +850,19 @@
606 850 $button_text = esc_html__( 'Install now', 'elementor' );
607 851 $button_url = $this->get_plugin_button_install_url( $plugin_slug );
608 852 $campaign_data = [
609 853 'name' => 'elementor_image_optimization_campaign',
610 - 'campaign' => 'io-plg-one',
854 + 'campaign' => 'image-optimization-plg-wp-media-library-one-install',
611 855 'source' => 'io-wp-media-library-one-install',
612 856 'medium' => 'wp-dash-one',
613 857 ];
614 858 } elseif ( ! $is_active ) {
615 - $description = esc_html__( 'Your ONE subscription includes Image Optimization. Activate it to optimize images and improve site performance.', 'elementor' );
859 + $description = esc_html__( 'Your ONE subscription includes Image Optimizer. Activate it to optimize images and improve site performance.', 'elementor' );
616 860 $button_text = esc_html__( 'Activate now', 'elementor' );
617 861 $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
618 862 $campaign_data = [
619 863 'name' => 'elementor_image_optimization_campaign',
620 - 'campaign' => 'io-plg-one',
864 + 'campaign' => 'image-optimization-plg-wp-media-library-one-activate',
621 865 'source' => 'io-wp-media-library-one-activate',
622 866 'medium' => 'wp-dash-one',
623 867 ];
624 868 }
@@ -629,9 +873,9 @@
629 873 $button_text = esc_html__( 'Install now', 'elementor' );
630 874 $button_url = $this->get_plugin_button_install_url( $plugin_slug );
631 875 $campaign_data = [
632 876 'name' => 'elementor_image_optimization_campaign',
633 - 'campaign' => 'io-plg',
877 + 'campaign' => 'image-optimization-plg-wp-media-library-install',
634 878 'source' => 'io-wp-media-library-install',
635 879 'medium' => 'wp-dash',
636 880 ];
637 881 } elseif ( ! $is_active ) {
@@ -638,9 +882,9 @@
638 882 $button_text = esc_html__( 'Activate now', 'elementor' );
639 883 $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
640 884 $campaign_data = [
641 885 'name' => 'elementor_image_optimization_campaign',
642 - 'campaign' => 'io-plg',
886 + 'campaign' => 'image-optimization-plg-wp-media-library-activate',
643 887 'source' => 'io-wp-media-library-activate',
644 888 'medium' => 'wp-dash',
645 889 ];
646 890 }
@@ -646,20 +890,18 @@
646 890 }
647 891 }
648 892
649 893 $options = [
650 - 'title' => esc_html__( 'Speed up your website with Image Optimization', 'elementor' ),
894 + 'title' => esc_html__( 'Speed up your website with Image Optimizer', 'elementor' ),
651 895 'description' => $description,
652 896 'id' => $notice_id,
653 897 'type' => 'cta',
654 898 'button' => [
655 899 'text' => $button_text,
656 - 'url' => self::add_plg_campaign_data( $button_url, $campaign_data ),
900 + 'url' => $button_url,
657 901 'type' => 'cta',
658 902 'data' => [
659 - 'campaign' => $campaign_data['campaign'],
660 903 'source' => $campaign_data['source'],
661 - 'medium' => $campaign_data['medium'],
662 904 ],
663 905 ],
664 906 ];
665 907
@@ -696,12 +938,9 @@
696 938 if ( $options['type'] ) {
697 939 $notice_classes[] = 'e-notice--' . $options['type'];
698 940 }
699 941
700 - $wrapper_attributes = [
701 - 'role' => 'region',
702 - 'aria-label' => esc_html__( 'Elementor notice', 'elementor' ),
703 - ];
942 + $wrapper_attributes = [];
704 943
705 944 if ( $options['dismissible'] ) {
706 945 $label = esc_html__( 'Dismiss this notice.', 'elementor' );
707 946 $notice_classes[] = 'e-notice--dismissible';
@@ -804,8 +1043,9 @@
804 1043
805 1044 $allowed_plgs = [
806 1045 'elementor_image_optimization_campaign',
807 1046 'elementor_ea11y_campaign',
1047 + 'elementor_site_mailer_campaign',
808 1048 ];
809 1049
810 1050 if ( ! in_array( $_GET['plg_campaign_name'], $allowed_plgs, true ) ) {
811 1051 return;
@@ -855,9 +1095,8 @@
855 1095 */
856 1096 public function __construct() {
857 1097 add_action( 'admin_notices', [ $this, 'admin_notices' ], 20 );
858 1098 add_action( 'admin_action_install-plugin', [ $this, 'maybe_log_campaign' ] );
859 - add_action( 'admin_action_activate', [ $this, 'maybe_log_campaign' ] );
860 1099 }
861 1100
862 1101 /**
863 1102 * Get module name.