PluginProbe
Elementor Website Builder – more than just a page builder / 3.33.0-beta1
Elementor Website Builder – more than just a page builder v3.33.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 +252 -171 4.3.1 → 3.33.0-beta1 View file →
@@ -3,11 +3,11 @@
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;
8 7 use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
9 8 use Elementor\Plugin;
9 +use Elementor\Settings;
10 10 use Elementor\Tracker;
11 11 use Elementor\User;
12 12 use Elementor\Utils;
13 13 use Elementor\Core\Admin\Notices\Base_Notice;
@@ -18,11 +18,10 @@
18 18
19 19 class Admin_Notices extends Module {
20 20
21 21 const DEFAULT_EXCLUDED_PAGES = [ 'plugins.php', 'plugin-install.php', 'plugin-editor.php' ];
22 + const LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID = 'local_google_fonts_disabled';
22 23
23 - const EXIT_EARLY_FOR_BACKWARD_COMPATIBILITY = false;
24 -
25 24 private $plain_notices = [
26 25 'api_notice',
27 26 'api_upgrade_plugin',
28 27 'tracker',
@@ -28,10 +27,14 @@
28 27 'tracker',
29 28 'tracker_last_update',
30 29 'rate_us_feedback',
31 30 'role_manager_promote',
31 + 'experiment_promotion',
32 + 'send_app_promotion',
33 + 'site_mailer_promotion',
32 34 'plugin_image_optimization',
33 35 'ally_pages_promotion',
36 + self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID,
34 37 ];
35 38
36 39 private $elementor_pages_count = null;
37 40
@@ -131,16 +134,16 @@
131 134 $message = sprintf(
132 135 /* translators: 1: Details URL, 2: Accessibility text, 3: Version number, 4: Update URL, 5: Accessibility text. */
133 136 __( 'There is a new version of Elementor Page Builder available. <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">View version %3$s details</a> or <a href="%4$s" class="update-link" aria-label="%5$s">update now</a>.', 'elementor' ),
134 137 esc_url( $details_url ),
135 - sprintf(
138 + esc_attr( sprintf(
136 139 /* translators: %s: Elementor version. */
137 - esc_attr__( 'View Elementor version %s details', 'elementor' ),
140 + __( 'View Elementor version %s details', 'elementor' ),
138 141 $new_version
139 - ),
142 + ) ),
140 143 $new_version,
141 144 esc_url( $upgrade_url ),
142 - esc_attr__( 'Update Now', 'elementor' )
145 + esc_attr( esc_html__( 'Update Now', 'elementor' ) )
143 146 );
144 147
145 148 $options = [
146 149 'title' => esc_html__( 'Update Notification', 'elementor' ),
@@ -380,8 +383,55 @@
380 383
381 384 return true;
382 385 }
383 386
387 + private function notice_experiment_promotion() {
388 + $notice_id = 'experiment_promotion';
389 +
390 + if ( ! current_user_can( 'manage_options' ) || User::is_user_notice_viewed( $notice_id ) ) {
391 + return false;
392 + }
393 +
394 + $experiments = Plugin::$instance->experiments;
395 + $is_all_performance_features_active = (
396 + $experiments->is_feature_active( 'e_font_icon_svg' ) &&
397 + $experiments->is_feature_active( 'e_optimized_markup' )
398 + );
399 +
400 + if ( $is_all_performance_features_active ) {
401 + return false;
402 + }
403 +
404 + $options = [
405 + 'title' => esc_html__( 'Improve your site’s performance score.', 'elementor' ),
406 + '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' ),
407 + 'id' => $notice_id,
408 + 'button' => [
409 + 'text' => esc_html__( 'Try it out', 'elementor' ),
410 + 'url' => Settings::get_settings_tab_url( 'experiments' ),
411 + 'type' => 'cta',
412 + ],
413 + 'button_secondary' => [
414 + 'text' => esc_html__( 'Learn more', 'elementor' ),
415 + 'url' => 'https://go.elementor.com/wp-dash-experiment-promotion/',
416 + 'new_tab' => true,
417 + 'type' => 'cta',
418 + ],
419 + ];
420 +
421 + $this->print_admin_notice( $options );
422 +
423 + return true;
424 + }
425 +
426 + private function site_has_forms_plugins() {
427 + 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' );
428 + }
429 +
430 + private function site_has_woocommerce() {
431 + return class_exists( 'WooCommerce' );
432 + }
433 +
384 434 private function get_installed_form_plugin_name() {
385 435 static $detected_form_plugin = null;
386 436
387 437 if ( null !== $detected_form_plugin ) {
@@ -415,8 +465,96 @@
415 465 $detected_form_plugin = false;
416 466 return $detected_form_plugin;
417 467 }
418 468
469 + private function notice_send_app_promotion() {
470 + $notice_id = 'send_app_promotion';
471 +
472 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
473 + return false;
474 + }
475 +
476 + if ( time() < $this->get_install_time() + ( 60 * DAY_IN_SECONDS ) ) {
477 + return false;
478 + }
479 +
480 + if ( ! current_user_can( 'install_plugins' ) || User::is_user_notice_viewed( $notice_id ) ) {
481 + return false;
482 + }
483 +
484 + $plugin_file_path = 'send/send-app.php';
485 + $plugin_slug = 'send-app';
486 +
487 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
488 + if ( empty( $cta_data ) ) {
489 + return false;
490 + }
491 +
492 + $title = sprintf( esc_html__( 'Turn leads into loyal shoppers', 'elementor' ) );
493 +
494 + $options = [
495 + 'title' => $title,
496 + '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' ),
497 + 'id' => $notice_id,
498 + 'type' => 'cta',
499 + 'button' => [
500 + 'text' => $cta_data['text'],
501 + 'url' => $cta_data['url'],
502 + 'type' => 'cta',
503 + ],
504 + 'button_secondary' => [
505 + 'text' => esc_html__( 'Learn more', 'elementor' ),
506 + 'url' => 'https://go.elementor.com/Formslearnmore',
507 + 'new_tab' => true,
508 + 'type' => 'cta',
509 + ],
510 + ];
511 +
512 + $this->print_admin_notice( $options );
513 +
514 + return true;
515 + }
516 +
517 + private function notice_local_google_fonts_disabled() {
518 +
519 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
520 + return false;
521 + }
522 +
523 + if ( User::is_user_notice_viewed( self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID ) ) {
524 + return false;
525 + }
526 +
527 + $is_local_gf_enabled = (bool) get_option( 'elementor_local_google_fonts', '0' );
528 +
529 + if ( $is_local_gf_enabled ) {
530 + return false;
531 + }
532 +
533 + $options = [
534 + 'title' => esc_html__( 'Important: Local Google Fonts Settings in Elementor', 'elementor' ),
535 + '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' ),
536 + 'id' => self::LOCAL_GOOGLE_FONTS_DISABLED_NOTICE_ID,
537 + 'type' => '',
538 + 'button' => [
539 + 'text' => esc_html__( 'Take me there', 'elementor' ),
540 + 'url' => '../wp-admin/admin.php?page=elementor-settings#tab-performance',
541 + 'new_tab' => false,
542 + 'type' => 'cta',
543 + ],
544 + 'button_secondary' => [
545 + 'text' => esc_html__( 'Learn more', 'elementor' ),
546 + 'url' => 'https://go.elementor.com/wp-dash-google-fonts-locally-notice/',
547 + 'new_tab' => true,
548 + 'type' => 'cta',
549 + ],
550 + ];
551 +
552 + $this->print_admin_notice( $options );
553 +
554 + return true;
555 + }
556 +
419 557 private function notice_ally_pages_promotion() {
420 558 global $pagenow;
421 559 $notice_id = 'ally_pages_promotion';
422 560
@@ -423,99 +561,124 @@
423 561 if ( 'edit.php' !== $pagenow || empty( $_GET['post_type'] ) || 'page' !== $_GET['post_type'] ) {
424 562 return false;
425 563 }
426 564
427 - if ( ! current_user_can( 'manage_options' ) ) {
565 + if ( ! current_user_can( 'manage_options' ) || User::is_user_notice_viewed( $notice_id ) ) {
428 566 return false;
429 567 }
430 568
431 - if ( User::is_user_notice_viewed( $notice_id ) ) {
569 + $plugin_file_path = 'pojo-accessibility/pojo-accessibility.php';
570 + $plugin_slug = 'pojo-accessibility';
571 +
572 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
573 + if ( empty( $cta_data ) ) {
432 574 return false;
433 575 }
434 576
435 - $plugin_slug = 'pojo-accessibility';
436 - $plugin_file_path = 'pojo-accessibility/pojo-accessibility.php';
577 + $options = [
578 + 'title' => esc_html__( 'Make sure your site has an accessibility statement page', 'elementor' ),
579 + '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' ),
580 + 'id' => $notice_id,
581 + 'type' => 'cta',
582 + 'button' => [
583 + 'text' => $cta_data['text'],
584 + 'url' => self::add_plg_campaign_data( $cta_data['url'], [
585 + 'name' => 'elementor_ea11y_campaign',
586 + 'campaign' => 'acc-statement-plg-pages',
587 + 'source' => 'wp-pages',
588 + 'medium' => 'wp-dash',
589 + ] ),
590 + 'type' => 'cta',
591 + ],
592 + 'button_secondary' => [
593 + 'text' => esc_html__( 'Learn more', 'elementor' ),
594 + 'url' => 'https://go.elementor.com/acc-plg-learn-more',
595 + 'new_tab' => true,
596 + 'type' => 'cta',
597 + ],
598 + ];
437 599
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 );
600 + $this->print_admin_notice( $options );
441 601
442 - if ( $is_active ) {
602 + return true;
603 + }
604 +
605 + private function notice_site_mailer_promotion() {
606 + $notice_id = 'site_mailer_promotion';
607 + $has_forms = $this->site_has_forms_plugins();
608 + $has_woocommerce = $this->site_has_woocommerce();
609 +
610 + if ( ! $has_forms && ! $has_woocommerce ) {
443 611 return false;
444 612 }
445 613
446 - if ( $one_subscription ) {
447 - $learn_more_url = 'https://go.elementor.com/acc-plg-learn-more-one';
614 + if ( ! $this->is_elementor_page() && ! $this->is_elementor_admin_screen() ) {
615 + return false;
616 + }
448 617
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';
618 + if ( ( Utils::has_pro() && ! $has_woocommerce ) || ! current_user_can( 'install_plugins' ) || User::is_user_notice_viewed( $notice_id ) ) {
619 + return false;
620 + }
473 621
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 - }
622 + $plugin_file_path = 'site-mailer/site-mailer.php';
623 + $plugin_slug = 'site-mailer';
624 +
625 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
626 + if ( empty( $cta_data ) ) {
627 + return false;
493 628 }
494 629
495 630 $options = [
496 - 'title' => esc_html__( 'Make sure your site has an accessibility statement page', 'elementor' ),
497 - 'description' => $description,
631 + 'title' => esc_html__( 'Ensure your form emails avoid the spam folder!', 'elementor' ),
632 + 'description' => esc_html__( 'Use Site Mailer for improved email deliverability, detailed email logs, and an easy setup.', 'elementor' ),
498 633 'id' => $notice_id,
499 634 'type' => 'cta',
500 635 'button' => [
501 - 'text' => $button_text,
502 - 'url' => self::add_plg_campaign_data( $button_url, $campaign_data ),
636 + 'text' => $cta_data['text'],
637 + 'url' => $cta_data['url'],
503 638 'type' => 'cta',
504 639 ],
505 640 'button_secondary' => [
506 641 'text' => esc_html__( 'Learn more', 'elementor' ),
507 - 'url' => $learn_more_url,
642 + 'url' => 'https://go.elementor.com/sm-core-form/',
508 643 'new_tab' => true,
509 644 'type' => 'cta',
510 645 ],
511 646 ];
512 647
648 + if ( $this->should_render_woocommerce_hint( $has_forms, $has_woocommerce ) ) {
649 + // We include WP's default notice class so it will be properly handled by WP's js handler
650 + // And add a new one to distinguish between the two types of notices
651 + $options['classes'] = [ 'notice', 'e-notice', 'sm-notice-wc' ];
652 + $options['title'] = esc_html__( 'Improve Transactional Email Deliverability', 'elementor' );
653 + $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' );
654 + }
655 +
513 656 $this->print_admin_notice( $options );
514 657
515 658 return true;
516 659 }
517 660
661 + private function should_render_woocommerce_hint( $has_forms, $has_woocommerce ): bool {
662 + if ( ! $has_forms && ! $has_woocommerce ) {
663 + return false;
664 + }
665 +
666 + if ( ! $has_forms && $has_woocommerce ) {
667 + return true;
668 + }
669 +
670 + if ( $has_forms && $has_woocommerce && Utils::has_pro() ) {
671 + return true;
672 + }
673 +
674 + if ( ! $has_woocommerce ) {
675 + return false;
676 + }
677 +
678 + return (bool) wp_rand( 0, 1 );
679 + }
680 +
518 681 private function is_elementor_page(): bool {
519 682 return 0 === strpos( $this->current_screen_id, 'elementor_page' );
520 683 }
521 684
@@ -525,31 +688,20 @@
525 688
526 689 private function is_elementor_admin_screen_with_system_info(): bool {
527 690 return in_array( $this->current_screen_id, [ 'toplevel_page_elementor', 'edit-elementor_library', 'elementor_page_elementor-system-info', 'dashboard' ], true );
528 691 }
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 692
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 693 private function get_plugin_cta_data( $plugin_slug, $plugin_file_path ) {
542 - if ( Hints::is_plugin_active( $plugin_slug ) ) {
694 + if ( is_plugin_active( $plugin_file_path ) ) {
543 695 return false;
544 696 }
545 697
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' );
698 + if ( $this->is_plugin_installed( $plugin_file_path ) ) {
699 + $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 );
700 + $cta_text = esc_html__( 'Activate Plugin', 'elementor' );
549 701 } else {
550 - $url = $this->get_plugin_button_install_url( $plugin_slug );
551 - $cta_text = esc_html__( 'Install now', 'elementor' );
702 + $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug ), 'install-plugin_' . $plugin_slug );
703 + $cta_text = esc_html__( 'Install Plugin', 'elementor' );
552 704 }
553 705
554 706 return [
555 707 'url' => $url,
@@ -570,16 +722,12 @@
570 722 if ( 'upload' !== $this->current_screen_id ) {
571 723 return false;
572 724 }
573 725
574 - if ( ! current_user_can( 'manage_options' ) ) {
726 + if ( ! current_user_can( 'manage_options' ) || User::is_user_notice_viewed( $notice_id ) ) {
575 727 return false;
576 728 }
577 729
578 - if ( User::is_user_notice_viewed( $notice_id ) ) {
579 - return false;
580 - }
581 -
582 730 $attachments = new \WP_Query( [
583 731 'post_type' => 'attachment',
584 732 'post_status' => 'any',
585 733 'fields' => 'ids',
@@ -588,79 +736,26 @@
588 736 if ( 1 > $attachments->found_posts ) {
589 737 return false;
590 738 }
591 739
740 + $plugin_file_path = 'image-optimization/image-optimization.php';
592 741 $plugin_slug = 'image-optimization';
593 - $plugin_file_path = 'image-optimization/image-optimization.php';
594 742
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 );
743 + $cta_data = $this->get_plugin_cta_data( $plugin_slug, $plugin_file_path );
598 744
599 - if ( $is_active ) {
745 + if ( empty( $cta_data ) ) {
600 746 return false;
601 747 }
602 748
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 749 $options = [
650 - 'title' => esc_html__( 'Speed up your website with Image Optimization', 'elementor' ),
651 - 'description' => $description,
750 + 'title' => esc_html__( 'Speed up your website with Image Optimizer by Elementor', 'elementor' ),
751 + '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 752 'id' => $notice_id,
653 753 'type' => 'cta',
654 - 'button' => [
655 - 'text' => $button_text,
656 - 'url' => self::add_plg_campaign_data( $button_url, $campaign_data ),
754 + 'button_secondary' => [
755 + 'text' => $cta_data['text'],
756 + 'url' => $cta_data['url'],
657 757 'type' => 'cta',
658 - 'data' => [
659 - 'campaign' => $campaign_data['campaign'],
660 - 'source' => $campaign_data['source'],
661 - 'medium' => $campaign_data['medium'],
662 - ],
663 758 ],
664 759 ];
665 760
666 761 $this->print_admin_notice( $options );
@@ -667,8 +762,14 @@
667 762
668 763 return true;
669 764 }
670 765
766 + private function is_plugin_installed( $file_path ): bool {
767 + $installed_plugins = get_plugins();
768 +
769 + return isset( $installed_plugins[ $file_path ] );
770 + }
771 +
671 772 public function print_admin_notice( array $options, $exclude_pages = self::DEFAULT_EXCLUDED_PAGES ) {
672 773 global $pagenow;
673 774
674 775 if ( in_array( $pagenow, $exclude_pages, true ) ) {
@@ -681,9 +782,9 @@
681 782 'description' => '',
682 783 'classes' => [ 'notice', 'e-notice' ], // We include WP's default notice class so it will be properly handled by WP's js handler
683 784 'type' => '',
684 785 'dismissible' => true,
685 - 'icon' => 'eicon-elementor-circle',
786 + 'icon' => 'eicon-elementor',
686 787 'button' => [],
687 788 'button_secondary' => [],
688 789 ];
689 790
@@ -696,12 +797,9 @@
696 797 if ( $options['type'] ) {
697 798 $notice_classes[] = 'e-notice--' . $options['type'];
698 799 }
699 800
700 - $wrapper_attributes = [
701 - 'role' => 'region',
702 - 'aria-label' => esc_html__( 'Elementor notice', 'elementor' ),
703 - ];
801 + $wrapper_attributes = [];
704 802
705 803 if ( $options['dismissible'] ) {
706 804 $label = esc_html__( 'Dismiss this notice.', 'elementor' );
707 805 $notice_classes[] = 'e-notice--dismissible';
@@ -719,12 +817,8 @@
719 817
720 818 if ( $options['id'] ) {
721 819 $wrapper_attributes['data-notice_id'] = $options['id'];
722 820 }
723 -
724 - if ( ! empty( $options['source'] ) ) {
725 - $wrapper_attributes['data-source'] = $options['source'];
726 - }
727 821 ?>
728 822 <div <?php Utils::print_html_attributes( $wrapper_attributes ); ?>>
729 823 <?php echo $dismiss_button; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
730 824 <div class="e-notice__aside">
@@ -741,9 +835,8 @@
741 835
742 836 <?php if ( ! empty( $options['button']['text'] ) || ! empty( $options['button_secondary']['text'] ) ) { ?>
743 837 <div class="e-notice__actions">
744 838 <?php
745 - $one_subscription = Hints::is_plugin_connected_to_one_subscription();
746 839 foreach ( [ $options['button'], $options['button_secondary'] ] as $index => $button_settings ) {
747 840 if ( empty( $button_settings['variant'] ) && $index ) {
748 841 $button_settings['variant'] = 'outline';
749 842 }
@@ -751,20 +844,8 @@
751 844 if ( empty( $button_settings['text'] ) ) {
752 845 continue;
753 846 }
754 847
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 848 $button = new Button( $button_settings );
768 849 $button->print_button();
769 850 } ?>
770 851 </div>
@@ -804,8 +885,9 @@
804 885
805 886 $allowed_plgs = [
806 887 'elementor_image_optimization_campaign',
807 888 'elementor_ea11y_campaign',
889 + 'elementor_site_mailer_campaign',
808 890 ];
809 891
810 892 if ( ! in_array( $_GET['plg_campaign_name'], $allowed_plgs, true ) ) {
811 893 return;
@@ -855,9 +937,8 @@
855 937 */
856 938 public function __construct() {
857 939 add_action( 'admin_notices', [ $this, 'admin_notices' ], 20 );
858 940 add_action( 'admin_action_install-plugin', [ $this, 'maybe_log_campaign' ] );
859 - add_action( 'admin_action_activate', [ $this, 'maybe_log_campaign' ] );
860 941 }
861 942
862 943 /**
863 944 * Get module name.