This commit is contained in:
proelements
2026-02-16 11:44:35 +02:00
parent 08ec8d01f1
commit b499583e5a
348 changed files with 3915 additions and 1414 deletions

View File

@@ -2,6 +2,7 @@
namespace ElementorPro\Modules\Forms\Actions;
use Elementor\Controls_Manager;
use Elementor\Core\Admin\Admin_Notices;
use ElementorPro\Core\Utils\Hints;
use ElementorPro\Core\Utils;
use ElementorPro\Core\Utils\Collection;
@@ -227,13 +228,69 @@ class Email extends Action_Base {
public function maybe_add_site_mailer_notice( $widget ) {
$notice_id = 'site_mailer_forms_email_notice';
if ( ! Hints::should_show_hint( $notice_id ) ) {
return;
}
$notice_content = esc_html__( 'Experiencing email deliverability issues? Get your emails delivered with Site Mailer.', 'elementor-pro' );
if ( 2 === Utils\Abtest::get_variation( 'plg_site_mailer_submission' ) ) {
$notice_content = esc_html__( 'Make sure your emails reach the inbox every time with Site Mailer', 'elementor-pro' );
$plugin_slug = 'site-mailer';
$one_subscription = method_exists( Hints::class, 'is_plugin_connected_to_one_subscription' ) && Hints::is_plugin_connected_to_one_subscription();
$is_installed = Hints::is_plugin_installed( $plugin_slug );
$is_active = Hints::is_plugin_active( $plugin_slug );
if ( $is_active ) {
return;
}
if ( $one_subscription ) {
if ( ! $is_installed ) {
$notice_content = esc_html__( 'Make sure your sites emails reach the inbox every time. Site Mailer is included in your ONE subscription.', 'elementor-pro' );
$button_text = esc_html__( 'Install now', 'elementor-pro' );
$button_url = Hints::get_plugin_install_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_email_notice',
'campaign' => 'sm-plg-form-v1-one-install',
'source' => 'sm-editor-form-one-install',
'medium' => 'wp-dash-one',
];
} elseif ( ! $is_active ) {
$notice_content = esc_html__( 'Ensure your sites emails reach the inbox every time. Site Mailer is included in your ONE subscription. Activate it to continue.', 'elementor-pro' );
$button_text = esc_html__( 'Activate now', 'elementor-pro' );
$button_url = Hints::get_plugin_activate_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_email_notice',
'campaign' => 'sm-plg-form-v1-one-activate',
'source' => 'sm-editor-form-one-activate',
'medium' => 'wp-dash-one',
];
}
} else {
$notice_content = esc_html__( 'Experiencing email deliverability issues? Get your emails delivered with Site Mailer.', 'elementor-pro' );
if ( 2 === Utils\Abtest::get_variation( 'plg_site_mailer_submission' ) ) {
$notice_content = esc_html__( 'Make sure your emails reach the inbox every time with Site Mailer.', 'elementor-pro' );
}
if ( ! $is_installed ) {
$button_text = esc_html__( 'Install now', 'elementor-pro' );
$button_url = Hints::get_plugin_install_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_email_notice',
'campaign' => 'sm-form-install',
'source' => 'sm-plg-form-v1-install',
'medium' => 'wp-dash',
];
} elseif ( ! $is_active ) {
$button_text = esc_html__( 'Activate now', 'elementor-pro' );
$button_url = Hints::get_plugin_activate_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_email_notice',
'campaign' => 'sm-form-activate',
'source' => 'sm-plg-form-v1-activate',
'medium' => 'wp-dash',
];
}
}
$widget->add_control(
@@ -246,10 +303,11 @@ class Email extends Action_Base {
'content' => $notice_content,
'icon' => true,
'dismissible' => $notice_id,
'button_text' => Hints::is_plugin_installed( 'site-mailer' ) ? __( 'Activate Plugin', 'elementor-pro' ) : __( 'Install Plugin', 'elementor-pro' ),
'button_text' => $button_text,
'button_event' => $notice_id,
'button_data' => [
'action_url' => Hints::get_plugin_action_url( 'site-mailer' ),
'action_url' => $button_url,
'source' => $campaign_data['source'],
],
], true ),
]

View File

@@ -2,29 +2,34 @@
namespace ElementorPro\Modules\Forms;
use Elementor\Controls_Manager;
use Elementor\Settings;
use Elementor\Core\Admin\Admin_Notices;
use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
use ElementorPro\Core\Upgrade\Manager as Upgrade_Manager;
use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
use Elementor\Settings;
use Elementor\User;
use ElementorPro\Core\Utils;
use ElementorPro\Modules\Forms\Data\Controller;
use ElementorPro\Base\Editor_One_Trait;
use ElementorPro\Base\Module_Base;
use ElementorPro\Core\Upgrade\Manager as Upgrade_Manager;
use ElementorPro\Core\Utils;
use ElementorPro\License\API;
use ElementorPro\Modules\Forms\Controls\Fields_Map;
use ElementorPro\Modules\Forms\Controls\Fields_Repeater;
use ElementorPro\Modules\Forms\Data\Controller;
use ElementorPro\Modules\Forms\Registrars\Form_Actions_Registrar;
use ElementorPro\Modules\Forms\Registrars\Form_Fields_Registrar;
use ElementorPro\Modules\Forms\Submissions\Component as Form_Submissions_Component;
use ElementorPro\Modules\Forms\Controls\Fields_Repeater;
use ElementorPro\Plugin;
use ElementorPro\License\API;
use ElementorPro\Modules\Forms\Submissions\AdminMenuItems\Submissions_Promotion_Menu_Item;
use ElementorPro\Modules\Forms\Submissions\Component as Form_Submissions_Component;
use ElementorPro\Modules\Forms\Submissions\EditorOneMenuItems\Editor_One_Submissions_Menu_Item;
use ElementorPro\Modules\Forms\Submissions\EditorOneMenuItems\Editor_One_Submissions_Promotion;
use ElementorPro\Plugin;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Module extends Module_Base {
use Editor_One_Trait;
/**
* @var Form_Actions_Registrar
*/
@@ -195,6 +200,10 @@ class Module extends Module_Base {
$this->add_component( $name, new Form_Submissions_Component() );
}
private function are_submissions_disabled(): bool {
return '1' === get_option( 'elementor_' . Form_Submissions_Component::NAME );
}
public function register_submissions_admin_fields( Settings $settings ) {
$settings->add_field(
Settings::TAB_ADVANCED,
@@ -209,15 +218,12 @@ class Module extends Module_Base {
'' => esc_html__( 'Enable', 'elementor-pro' ),
'1' => esc_html__( 'Disable', 'elementor-pro' ),
],
'desc' => esc_html__( 'Never lose another submission! Using Actions After Submit you can now choose to save all submissions to an internal database.', 'elementor-pro' ),
'desc' => esc_html__( 'Never lose another submission! Using "Actions After Submit" you can now choose to save all submissions to an internal database.', 'elementor-pro' ),
],
],
);
}
/**
* Module constructor.
*/
public function __construct() {
parent::__construct();
@@ -238,10 +244,30 @@ class Module extends Module_Base {
$this->register_submissions_component();
} else {
add_action( 'elementor/admin/menu/register', function( $admin_menu ) {
if ( $this->are_submissions_disabled() ) {
return;
}
if ( $this->is_editor_one_active() ) {
return;
}
$admin_menu->register( Form_Submissions_Component::PAGE_ID, new Submissions_Promotion_Menu_Item() );
}, 9 /* After "Settings" */ );
}
add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
if ( $this->are_submissions_disabled() ) {
return;
}
if ( API::is_licence_has_feature( Form_Submissions_Component::NAME ) ) {
$menu_data_provider->register_menu( new Editor_One_Submissions_Menu_Item() );
} else {
$menu_data_provider->register_menu( new Editor_One_Submissions_Promotion() );
}
} );
// Initialize registrars.
$this->actions_registrar = new Form_Actions_Registrar();
$this->fields_registrar = new Form_Fields_Registrar();

View File

@@ -15,31 +15,31 @@ if ( ! defined( 'ABSPATH' ) ) {
}
class Submissions_Menu_Item implements Admin_Menu_Item_With_Page {
public function get_capability() {
public function get_capability(): string {
return 'manage_options';
}
public function get_label() {
public function get_label(): string {
return esc_html__( 'Submissions', 'elementor-pro' );
}
public function get_page_title() {
public function get_page_title(): string {
return esc_html__( 'Submissions', 'elementor-pro' );
}
public function get_parent_slug() {
public function get_parent_slug(): string {
return Settings::PAGE_ID;
}
public function is_visible() {
public function is_visible(): bool {
return true;
}
public function get_position() {
return null;
public function get_position(): ?int {
return 50;
}
public function render() {
public function render(): void {
$this->maybe_render_hints();
?>
<div class="wrap">
@@ -55,61 +55,98 @@ class Submissions_Menu_Item implements Admin_Menu_Item_With_Page {
return;
}
if ( $this->should_show_send_app_hint() ) {
$this->render_send_app_notice();
return;
}
if ( $this->should_show_site_mailer_hint() ) {
$this->render_site_mailer_notice();
}
}
private function render_site_mailer_notice() {
/**
* @var Admin_Notices $admin_notices
*/
$admin_notices = Plugin::elementor()->admin->get_component( 'admin-notices' );
$notice_id = 'site_mailer_forms_submissions_notice';
$notice_options = [
'description' => esc_html__( 'Experiencing email deliverability issues? Get your emails delivered with Site Mailer.', 'elementor-pro' ),
'id' => 'site_mailer_forms_submissions_notice',
'type' => 'cta',
'button_secondary' => [
'text' => Hints::is_plugin_installed( 'site-mailer' ) ? esc_html__( 'Activate Plugin', 'elementor-pro' ) : esc_html__( 'Install Plugin', 'elementor-pro' ),
'url' => Hints::get_plugin_action_url( 'site-mailer' ),
'type' => 'cta',
],
];
if ( 2 === Abtest::get_variation( 'plg_site_mailer_submission' ) ) {
$notice_options['title'] = esc_html__( 'Get Your Emails Delivered With Site Mailer', 'elementor-pro' );
$notice_options['description'] = esc_html__( 'Make sure emails reach the inbox every time with improved deliverability, detailed email logs, and an easy setup with no need for an SMTP plugin.', 'elementor-pro' );
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
$admin_notices->print_admin_notice( $notice_options );
}
$plugin_slug = 'site-mailer';
$one_subscription = method_exists( Hints::class, 'is_plugin_connected_to_one_subscription' ) && Hints::is_plugin_connected_to_one_subscription();
$is_installed = Hints::is_plugin_installed( $plugin_slug );
$is_active = Hints::is_plugin_active( $plugin_slug );
if ( $is_active ) {
return;
}
if ( $one_subscription ) {
$title = esc_html__( 'Get your emails delivered with Site Mailer', 'elementor-pro' );
if ( ! $is_installed ) {
$description = esc_html__( 'Ensure form submission emails reach the inbox and track delivery with built-in logs. Site Mailer is included in your ONE subscription.', 'elementor-pro' );
$button_text = esc_html__( 'Install now', 'elementor-pro' );
$button_url = Hints::get_plugin_install_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_submissions_notice',
'campaign' => 'sm-plg-submission-v1',
'source' => 'sm-submission-one-install',
'medium' => 'wp-dash-one',
];
} elseif ( ! $is_active ) {
$description = esc_html__( 'Ensure form submission emails reach the inbox and track delivery with built-in logs. Site Mailer is included in your ONE subscription. Activate it to continue.', 'elementor-pro' );
$button_text = esc_html__( 'Activate now', 'elementor-pro' );
$button_url = Hints::get_plugin_action_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_submissions_notice',
'campaign' => 'sm-plg-submission-v1',
'source' => 'sm-submission-one-activate',
'medium' => 'wp-dash-one',
];
}
} else {
$title = esc_html__( 'Get Your Emails Delivered With Site Mailer', 'elementor-pro' );
$description = esc_html__( 'Make sure emails reach the inbox every time with improved deliverability, detailed email logs, and an easy setup with no need for an SMTP plugin.', 'elementor-pro' );
if ( ! $is_installed ) {
$button_text = esc_html__( 'Install now', 'elementor-pro' );
$button_url = Hints::get_plugin_install_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_submissions_notice',
'campaign' => 'sm-plg-submission-v1',
'source' => 'sm-submission-install',
'medium' => 'wp-dash',
];
} elseif ( ! $is_active ) {
$button_text = esc_html__( 'Activate now', 'elementor-pro' );
$button_url = Hints::get_plugin_action_url( $plugin_slug );
$campaign_data = [
'name' => 'site_mailer_forms_submissions_notice',
'campaign' => 'sm-plg-submission-v1',
'source' => 'sm-submission-activate',
'medium' => 'wp-dash',
];
}
}
$notice_options = [
'id' => $notice_id,
'title' => $title,
'description' => $description,
'type' => 'cta',
'button_secondary' => [
'text' => $button_text,
'url' => $button_url,
'type' => 'cta',
'data' => [
'source' => $campaign_data['source'],
],
],
];
private function render_send_app_notice() {
/**
* @var Admin_Notices $admin_notices
*/
$admin_notices = Plugin::elementor()->admin->get_component( 'admin-notices' );
$send_app_notice_options = [
'title' => esc_html__( 'Forms are just the beginning', 'elementor-pro' ),
'description' => esc_html__( 'Turn submissions into leads with automated replies, welcome series, and smart tagging — all inside WordPress.
With Send, you build relationships from the first interaction.', 'elementor-pro' ),
'id' => 'send_app_forms_submissions_notice',
'type' => 'cta',
'button_secondary' => [
'text' => Hints::is_plugin_installed( 'send-app' ) ? esc_html__( 'Activate Send Now', 'elementor-pro' ) : esc_html__( 'Install Send Now', 'elementor-pro' ),
'url' => Hints::get_plugin_action_url( 'send-app' ),
'type' => 'cta',
],
];
$admin_notices->print_admin_notice( $send_app_notice_options );
$admin_notices->print_admin_notice( $notice_options );
}
public function has_submissions( $min_count = 1 ): bool {
@@ -127,14 +164,4 @@ With Send, you build relationships from the first interaction.', 'elementor-pro'
&& ! User::is_user_notice_viewed( 'site_mailer_forms_submissions_notice' )
);
}
public function should_show_send_app_hint(): bool {
if ( Hints::is_plugin_active( 'woocommerce' ) || ! $this->should_show_site_mailer_hint() ) {
if ( ! User::is_user_notice_viewed( 'send_app_forms_submissions_notice' ) ) {
return Hints::should_show_hint( 'send_app_forms_submissions_notice' );
}
}
return false;
}
}

View File

@@ -39,7 +39,7 @@ class Submissions_Promotion_Menu_Item extends Base_Promotion_Template {
return 'https://www.youtube-nocookie.com/embed/LNfnwba9C-8?si=JLHk3UAexnvTfU1a';
}
public function get_cta_text() {
public function get_cta_text(): string {
if ( ! API::active_licence_has_feature( Form_Submissions_Component::NAME ) ) {
return esc_html__( 'Upgrade Now', 'elementor-pro' );
}

View File

@@ -10,6 +10,7 @@ use ElementorPro\Modules\Forms\Submissions\AdminMenuItems\Submissions_Menu_Item;
use ElementorPro\Modules\Forms\Submissions\AdminMenuItems\Submissions_Promotion_Menu_Item;
use ElementorPro\Plugin;
use ElementorPro\Base\Module_Base;
use ElementorPro\Base\Editor_One_Trait;
use ElementorPro\Modules\Forms\Submissions\Database\Query;
use ElementorPro\Modules\Forms\Submissions\Data\Controller;
use ElementorPro\Modules\Forms\Submissions\Database\Migration;
@@ -21,6 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
class Component extends Module_Base {
use Editor_One_Trait;
const NAME = 'form-submissions';
const PAGE_ID = 'e-form-submissions';
@@ -187,6 +189,9 @@ class Component extends Module_Base {
} );
} else {
add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) {
if ( $this->is_editor_one_active() ) {
return;
}
$this->register_admin_menu_legacy( $admin_menu );
}, 9 /* After "Settings" */ );

View File

@@ -0,0 +1,44 @@
<?php
namespace ElementorPro\Modules\Forms\Submissions\EditorOneMenuItems;
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Third_Level_Interface;
use Elementor\Modules\EditorOne\Classes\Menu_Config;
use ElementorPro\Modules\Forms\Submissions\AdminMenuItems\Submissions_Menu_Item;
use ElementorPro\Modules\Forms\Submissions\Component;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Editor_One_Submissions_Menu_Item extends Submissions_Menu_Item implements Menu_Item_Third_Level_Interface {
public function get_position(): int {
return 50;
}
public function get_slug(): string {
return Component::PAGE_ID;
}
public function get_parent_slug(): string {
return Menu_Config::ELEMENTOR_HOME_MENU_SLUG;
}
public function get_label(): string {
return esc_html__( 'Submissions', 'elementor-pro' );
}
public function get_group_id(): string {
return Menu_Config::EDITOR_GROUP_ID;
}
public function get_icon(): string {
return 'send';
}
public function has_children(): bool {
return false;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace ElementorPro\Modules\Forms\Submissions\EditorOneMenuItems;
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Third_Level_Interface;
use Elementor\Modules\EditorOne\Classes\Menu_Config;
use ElementorPro\Modules\Forms\Submissions\AdminMenuItems\Submissions_Promotion_Menu_Item;
use ElementorPro\Modules\Forms\Submissions\Component;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Editor_One_Submissions_Promotion extends Submissions_Promotion_Menu_Item implements Menu_Item_Third_Level_Interface {
public function get_position(): int {
return 50;
}
public function get_slug(): string {
return Component::PAGE_ID;
}
public function get_parent_slug(): string {
return Menu_Config::ELEMENTOR_HOME_MENU_SLUG;
}
public function get_label(): string {
return esc_html__( 'Submissions', 'elementor-pro' );
}
public function get_group_id(): string {
return '';
}
public function get_capability(): string {
return 'manage_options';
}
public function is_visible(): bool {
return true;
}
public function get_icon(): string {
return 'send';
}
public function has_children(): bool {
return false;
}
}

View File

@@ -823,8 +823,6 @@ class Form extends Form_Base {
]
);
$this->maybe_add_send_app_promotion_control();
$actions = Module::instance()->actions_registrar->get();
$actions_options = [];
@@ -2760,36 +2758,4 @@ class Form extends Form_Base {
public function get_group_name() {
return 'forms';
}
private function maybe_add_send_app_promotion_control(): void {
if ( Hints::is_plugin_installed( 'send-app' ) ) {
return;
}
$notice_id = 'send_app_forms_actions_notice';
if ( ! Hints::should_show_hint( $notice_id ) ) {
return;
}
$notice_content = wp_kses( __( 'Turning leads into sales can be easy.<br />Let Send do the work', 'elementor-pro' ), [ 'br' => [] ] );
$this->add_control(
'send_app_promo',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => Hints::get_notice_template( [
'display' => ! Hints::is_dismissed( $notice_id ),
'type' => 'info',
'content' => $notice_content,
'icon' => true,
'dismissible' => $notice_id,
'button_text' => __( 'Start for free', 'elementor-pro' ),
'button_event' => $notice_id,
'button_data' => [
'action_url' => Hints::get_plugin_action_url( 'send-app' ),
],
], true ),
]
);
}
}