PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.4
Elementor Website Builder – more than just a page builder v4.2.4
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 +287 -0 4.3.0-beta24.2.4 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
@@ -514,8 +612,196 @@
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 Email Deliverability 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 + $campaign_data = [
654 + 'name' => 'elementor_site_mailer_campaign',
655 + 'campaign' => 'sm-plg-one',
656 + 'source' => 'sm-core-woo-one-install',
657 + 'medium' => 'wp-dash',
658 + ];
659 + } elseif ( ! $is_active ) {
660 + $description = esc_html__( 'Email Deliverability 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' );
661 + $button_text = esc_html__( 'Activate now', 'elementor' );
662 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
663 + $campaign_data = [
664 + 'name' => 'elementor_site_mailer_campaign',
665 + 'campaign' => 'sm-plg-one',
666 + 'source' => 'sm-core-woo-one-activate',
667 + 'medium' => 'wp-dash',
668 + ];
669 + }
670 + } else {
671 + $title = esc_html__( 'Keep your form emails out of the spam folder', 'elementor' );
672 +
673 + if ( ! $is_installed ) {
674 + $description = esc_html__( 'Use Email Deliverability to ensure emails reach the inbox and track delivery with built-in logs. Included in your ONE subscription.', 'elementor' );
675 + $button_text = esc_html__( 'Install now', 'elementor' );
676 + $button_url = $this->get_plugin_button_install_url( $plugin_slug );
677 + $campaign_data = [
678 + 'name' => 'elementor_site_mailer_campaign',
679 + 'campaign' => 'sm-plg-one',
680 + 'source' => 'sm-core-form-one-install',
681 + 'medium' => 'wp-dash',
682 + ];
683 + } elseif ( ! $is_active ) {
684 + $description = esc_html__( 'Use Email Deliverability to ensure emails reach the inbox and track delivery with built-in logs. Email Deliverability is included in your ONE subscription. Activate it to continue.', 'elementor' );
685 + $button_text = esc_html__( 'Activate now', 'elementor' );
686 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
687 + $campaign_data = [
688 + 'name' => 'elementor_site_mailer_campaign',
689 + 'campaign' => 'sm-plg-one',
690 + 'source' => 'sm-core-form-one-activate',
691 + 'medium' => 'wp-dash',
692 + ];
693 + }
694 + }
695 + // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found
696 + } else {
697 + if ( $is_woocommerce ) {
698 + $title = esc_html__( 'Improve Transactional Email Deliverability', 'elementor' );
699 + $description = esc_html__( "Use Elementor's Email Deliverability to ensure your store emails like purchase confirmations, shipping updates and more are reliably delivered.", 'elementor' );
700 +
701 + if ( ! $is_installed ) {
702 + $button_text = esc_html__( 'Install now', 'elementor' );
703 + $button_url = $this->get_plugin_button_install_url( $plugin_slug );
704 + $campaign_data = [
705 + 'name' => 'elementor_site_mailer_campaign',
706 + 'campaign' => 'sm-plg',
707 + 'source' => 'sm-core-woo-install',
708 + 'medium' => 'wp-dash',
709 + ];
710 + } elseif ( ! $is_active ) {
711 + $button_text = esc_html__( 'Activate now', 'elementor' );
712 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
713 + $campaign_data = [
714 + 'name' => 'elementor_site_mailer_campaign',
715 + 'campaign' => 'sm-plg',
716 + 'source' => 'sm-core-woo-activate',
717 + 'medium' => 'wp-dash',
718 + ];
719 + }
720 + } else {
721 + $title = esc_html__( 'Ensure your form emails avoid the spam folder!', 'elementor' );
722 + $description = esc_html__( 'Use Email Deliverability for improved email deliverability, detailed email logs, and an easy setup.', 'elementor' );
723 +
724 + if ( ! $is_installed ) {
725 + $button_text = esc_html__( 'Install now', 'elementor' );
726 + $button_url = $this->get_plugin_button_install_url( $plugin_slug );
727 + $campaign_data = [
728 + 'name' => 'elementor_site_mailer_campaign',
729 + 'campaign' => 'sm-plg',
730 + 'source' => 'sm-core-form-install',
731 + 'medium' => 'wp-dash',
732 + ];
733 + } elseif ( ! $is_active ) {
734 + $button_text = esc_html__( 'Activate now', 'elementor' );
735 + $button_url = $this->get_plugin_button_activate_url( $plugin_file_path );
736 + $campaign_data = [
737 + 'name' => 'elementor_site_mailer_campaign',
738 + 'campaign' => 'sm-plg',
739 + 'source' => 'sm-core-form-activate',
740 + 'medium' => 'wp-dash',
741 + ];
742 + }
743 + }
744 + }
745 +
746 + $learn_more_url = $one_subscription && $is_woocommerce
747 + ? 'https://go.elementor.com/sm-woo-learn-more-one'
748 + : 'https://go.elementor.com/sm-core-form/';
749 +
750 + $options = [
751 + 'title' => $title,
752 + 'description' => $description,
753 + 'id' => $notice_id,
754 + 'type' => 'cta',
755 + 'button' => [
756 + 'text' => $button_text,
757 + 'url' => self::add_plg_campaign_data( $button_url, $campaign_data ),
758 + 'type' => 'cta',
759 + 'data' => [
760 + 'campaign' => $campaign_data['campaign'],
761 + 'source' => $campaign_data['source'],
762 + 'medium' => $campaign_data['medium'],
763 + ],
764 + ],
765 + 'button_secondary' => [
766 + 'text' => esc_html__( 'Learn more', 'elementor' ),
767 + 'url' => $learn_more_url,
768 + 'new_tab' => true,
769 + 'type' => 'cta',
770 + ],
771 + ];
772 +
773 + if ( $is_woocommerce ) {
774 + // We include WP's default notice class so it will be properly handled by WP's js handler
775 + // And add a new one to distinguish between the two types of notices
776 + $options['classes'] = [ 'notice', 'e-notice', 'sm-notice-wc' ];
777 + }
778 +
779 + $this->print_admin_notice( $options );
780 +
781 + return true;
782 + }
783 +
784 + private function should_render_woocommerce_hint( $has_forms, $has_woocommerce ): bool {
785 + if ( ! $has_forms && ! $has_woocommerce ) {
786 + return false;
787 + }
788 +
789 + if ( ! $has_forms && $has_woocommerce ) {
790 + return true;
791 + }
792 +
793 + if ( $has_forms && $has_woocommerce && Utils::has_pro() ) {
794 + return true;
795 + }
796 +
797 + if ( ! $has_woocommerce ) {
798 + return false;
799 + }
800 +
801 + return (bool) wp_rand( 0, 1 );
802 + }
803 +
518 804 private function is_elementor_page(): bool {
519 805 return 0 === strpos( $this->current_screen_id, 'elementor_page' );
520 806 }
521 807
@@ -804,8 +1090,9 @@
804 1090
805 1091 $allowed_plgs = [
806 1092 'elementor_image_optimization_campaign',
807 1093 'elementor_ea11y_campaign',
1094 + 'elementor_site_mailer_campaign',
808 1095 ];
809 1096
810 1097 if ( ! in_array( $_GET['plg_campaign_name'], $allowed_plgs, true ) ) {
811 1098 return;