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

@@ -10,23 +10,23 @@ if ( ! defined( 'ABSPATH' ) ) {
}
class Popups_Menu_Item implements Admin_Menu_Item {
public function get_capability() {
public function get_capability(): string {
return 'publish_posts';
}
public function get_label() {
public function get_label(): string {
return esc_html__( 'Popups', 'elementor-pro' );
}
public function get_parent_slug() {
public function get_parent_slug(): string {
return Source_Local::ADMIN_MENU_SLUG;
}
public function get_position() {
public function get_position(): ?int {
return null;
}
public function is_visible() {
public function is_visible(): bool {
return true;
}
}

View File

@@ -14,15 +14,15 @@ if ( ! defined( 'ABSPATH' ) ) {
class Popups_Promotion_Menu_Item extends Base_Promotion_Item {
public function get_name() {
public function get_name(): string {
return 'popups';
}
public function get_position() {
public function get_position(): ?int {
return null;
}
public function get_cta_text() {
public function get_cta_text(): string {
if ( ! API::active_licence_has_feature( Popup_Module::DOCUMENT_TYPE ) ) {
return esc_html__( 'Upgrade Now', 'elementor-pro' );
}
@@ -32,7 +32,7 @@ class Popups_Promotion_Menu_Item extends Base_Promotion_Item {
: esc_html__( 'Connect & Activate', 'elementor-pro' );
}
public function get_cta_url() {
public function get_cta_url(): string {
if ( ! API::active_licence_has_feature( Popup_Module::DOCUMENT_TYPE ) ) {
$upgrade_url = 'https://go.elementor.com/go-pro-advanced-popups/';
@@ -52,23 +52,23 @@ class Popups_Promotion_Menu_Item extends Base_Promotion_Item {
: $connect_url;
}
public function get_parent_slug() {
public function get_parent_slug(): string {
return Source_Local::ADMIN_MENU_SLUG;
}
public function get_label() {
public function get_label(): string {
return esc_html__( 'Popups', 'elementor-pro' );
}
public function get_page_title() {
public function get_page_title(): string {
return esc_html__( 'Popups', 'elementor-pro' );
}
public function get_promotion_title() {
public function get_promotion_title(): string {
return esc_html__( 'Get Popup Builder', 'elementor-pro' );
}
public function get_promotion_description() {
public function get_promotion_description(): string {
return esc_html__(
"Create custom designed Popups. Use advanced display conditions and triggers to display the right popup, to the right visitor, at the right time and maximize conversions.",
'elementor-pro'

View File

@@ -28,8 +28,6 @@ class Triggers extends Base {
protected function register_controls() {
$this->start_controls_section( 'triggers' );
$this->maybe_add_send_app_promotion_control();
$this->start_settings_group( 'page_load', esc_html__( 'On Page Load', 'elementor-pro' ) );
$this->add_settings_group_control(
@@ -142,59 +140,4 @@ class Triggers extends Base {
$this->end_controls_section();
}
private function get_send_app_notice_template( $notice_id, $notice_content ): string {
if ( Hints::is_dismissed( $notice_id ) ) {
return '';
}
$action_url = Hints::get_plugin_action_url( 'send-app' );
$button_data = wp_json_encode( [ 'action_url' => $action_url ] );
return '<div class="elementor-control-notice elementor-control-notice-type-info">
<div class="elementor-control-notice-icon">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.25 9H3M9 2.25V3M15 9H15.75M4.2 4.2L4.725 4.725M13.8 4.2L13.275 4.725M7.27496 12.75H10.725M6.75 12C6.12035 11.5278 5.65525 10.8694 5.42057 10.1181C5.1859 9.36687 5.19355 8.56082 5.44244 7.81415C5.69133 7.06748 6.16884 6.41804 6.80734 5.95784C7.44583 5.49764 8.21294 5.25 9 5.25C9.78706 5.25 10.5542 5.49764 11.1927 5.95784C11.8312 6.41804 12.3087 7.06748 12.5576 7.81415C12.8065 8.56082 12.8141 9.36687 12.5794 10.1181C12.3448 10.8694 11.8796 11.5278 11.25 12C10.9572 12.2899 10.7367 12.6446 10.6064 13.0355C10.4761 13.4264 10.4397 13.8424 10.5 14.25C10.5 14.6478 10.342 15.0294 10.0607 15.3107C9.77936 15.592 9.39782 15.75 9 15.75C8.60218 15.75 8.22064 15.592 7.93934 15.3107C7.65804 15.0294 7.5 14.6478 7.5 14.25C7.56034 13.8424 7.52389 13.4264 7.3936 13.0355C7.2633 12.6446 7.04282 12.2899 6.75 12Z" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</div>
<div class="elementor-control-notice-main">
<div class="elementor-control-notice-main-content">' . $notice_content . '</div>
<div class="elementor-control-notice-main-actions">
<button type="button" class="e-btn e-info e-btn-1" data-event="' . esc_attr( $notice_id ) . '" data-settings="' . esc_attr( $button_data ) . '" onclick="window.open(\'' . esc_url( $action_url ) . '\', \'_blank\');">
' . __( 'Install Send', 'elementor-pro' ) . '
</button>
</div>
</div>
<button class="elementor-control-notice-dismiss tooltip-target" data-event="' . esc_attr( $notice_id ) . '" data-tooltip="' . esc_attr__( 'Don\'t show again.', 'elementor-pro' ) . '" aria-label="' . esc_attr__( 'Don\'t show again.', 'elementor-pro' ) . '" onclick="this.closest(\'.elementor-control-notice\').style.display=\'none\'; elementorCommon.ajax.addRequest(\'dismissed_editor_notices\', {data: {dismissId: \'' . esc_js( $notice_id ) . '\'}}); return false;">
<i class="eicon eicon-close" aria-hidden="true"></i>
</button>
</div>';
}
private function maybe_add_send_app_promotion_control(): void {
if ( Hints::is_plugin_installed( 'send-app' ) ) {
return;
}
$notice_id = 'send_app_forms_triggers_notice';
if ( ! Hints::should_show_hint( $notice_id ) ) {
return;
}
$notice_content = wp_kses(
__( '<strong>Turn popup clicks into sales with Send.</strong> Trigger automated emails the moment visitors engage.', 'elementor-pro' ),
[
'br' => [],
'strong' => [],
]
);
$this->add_control(
'send_app_promo',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => $this->get_send_app_notice_template( $notice_id, $notice_content ),
]
);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace ElementorPro\Modules\Popup\EditorOneMenuItems;
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Interface;
use Elementor\Modules\EditorOne\Classes\Menu_Config;
use ElementorPro\Modules\Popup\AdminMenuItems\Popups_Menu_Item;
use ElementorPro\Modules\Popup\Module;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Editor_One_Popups_Menu_Item extends Popups_Menu_Item implements Menu_Item_Interface {
public function get_position(): int {
return 70;
}
public function get_slug(): string {
return Module::instance()->get_admin_url( true );
}
public function get_parent_slug(): string {
return Menu_Config::ELEMENTOR_MENU_SLUG;
}
public function get_label(): string {
return esc_html__( 'Popups', 'elementor-pro' );
}
public function get_group_id(): string {
return Menu_Config::TEMPLATES_GROUP_ID;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace ElementorPro\Modules\Popup\EditorOneMenuItems;
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Interface;
use Elementor\Modules\EditorOne\Classes\Menu_Config;
use ElementorPro\Modules\Popup\AdminMenuItems\Popups_Promotion_Menu_Item;
use ElementorPro\Modules\Popup\Module;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Editor_One_Popups_Promotion extends Popups_Promotion_Menu_Item implements Menu_Item_Interface {
public function get_position(): int {
return 70;
}
public function get_slug(): string {
return Module::PROMOTION_MENU_SLUG;
}
public function get_parent_slug(): string {
return Menu_Config::ELEMENTOR_MENU_SLUG;
}
public function get_label(): string {
return esc_html__( 'Popups', 'elementor-pro' );
}
public function get_group_id(): string {
return Menu_Config::TEMPLATES_GROUP_ID;
}
}

View File

@@ -7,13 +7,17 @@ use Elementor\Core\Base\Document as DocumentBase;
use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
use Elementor\Core\Documents_Manager;
use Elementor\Core\DynamicTags\Manager as DynamicTagsManager;
use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
use Elementor\TemplateLibrary\Source_Local;
use ElementorPro\Base\Editor_One_Trait;
use ElementorPro\Base\Module_Base;
use ElementorPro\Core\Behaviors\Feature_Lock;
use ElementorPro\Core\Utils;
use ElementorPro\License\API;
use ElementorPro\Modules\Popup\AdminMenuItems\Popups_Menu_Item;
use ElementorPro\Modules\Popup\AdminMenuItems\Popups_Promotion_Menu_Item;
use ElementorPro\Modules\Popup\EditorOneMenuItems\Editor_One_Popups_Menu_Item;
use ElementorPro\Modules\Popup\EditorOneMenuItems\Editor_One_Popups_Promotion;
use ElementorPro\Modules\ThemeBuilder\Classes\Locations_Manager;
use ElementorPro\Plugin;
@@ -22,6 +26,8 @@ if ( ! defined( 'ABSPATH' ) ) {
}
class Module extends Module_Base {
use Editor_One_Trait;
const DOCUMENT_TYPE = 'popup';
const PROMOTION_MENU_SLUG = 'e-popups';
@@ -31,6 +37,8 @@ class Module extends Module_Base {
public function __construct() {
parent::__construct();
add_action( 'admin_init', [ $this, 'redirect_legacy_popups_promotion_url' ] );
add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_frontend_styles' ] );
add_action( 'elementor/preview/enqueue_styles', [ $this, 'enqueue_preview_styles' ] );
@@ -55,6 +63,10 @@ class Module extends Module_Base {
} );
} else {
add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu_manager ) {
if ( $this->is_editor_one_active() ) {
return;
}
if ( $this->can_use_popups() ) {
$admin_menu_manager->register( $this->get_admin_url( true ), new Popups_Menu_Item() );
} else {
@@ -66,6 +78,14 @@ class Module extends Module_Base {
add_action( 'admin_menu', function() {
$this->register_admin_menu_legacy();
}, 21 /* After `Admin_Menu_Manager` */ );
add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
if ( $this->can_use_popups() ) {
$menu_data_provider->register_menu( new Editor_One_Popups_Menu_Item() );
} else {
$menu_data_provider->register_menu( new Editor_One_Popups_Promotion() );
}
} );
}
add_filter( 'elementor/finder/categories', [ $this, 'add_finder_items' ] );
@@ -83,6 +103,34 @@ class Module extends Module_Base {
);
}
public function redirect_legacy_popups_promotion_url(): void {
$page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
if ( static::PROMOTION_MENU_SLUG !== $page ) {
return;
}
if ( $this->can_use_popups() ) {
wp_safe_redirect( $this->get_admin_url() );
exit;
}
global $pagenow;
if ( $this->is_editor_one_active() ) {
if ( 'edit.php' !== $pagenow ) {
return;
}
if ( Source_Local::CPT !== filter_input( INPUT_GET, 'post_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ) {
return;
}
wp_safe_redirect( admin_url( 'admin.php?page=' . static::PROMOTION_MENU_SLUG ) );
exit;
}
}
public function enqueue_preview_styles() {
wp_enqueue_style( 'e-popup' );
}
@@ -241,7 +289,7 @@ class Module extends Module_Base {
return $categories;
}
private function get_admin_url( $relative = false ) {
public function get_admin_url( $relative = false ) {
$base_url = Source_Local::ADMIN_MENU_SLUG;
if ( ! $relative ) {
$base_url = admin_url( $base_url );