first commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
|
||||
use Elementor\Modules\Promotions\AdminMenuItems\Interfaces\Promotion_Menu_Item;
|
||||
use Elementor\Settings;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
abstract class Base_Promotion_Item implements Promotion_Menu_Item {
|
||||
|
||||
public function get_name() {
|
||||
return 'base_promotion';
|
||||
}
|
||||
|
||||
public function is_visible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_parent_slug() {
|
||||
return Settings::PAGE_ID;
|
||||
}
|
||||
|
||||
public function get_capability() {
|
||||
return 'manage_options';
|
||||
}
|
||||
|
||||
public function get_cta_text() {
|
||||
return esc_html__( 'Upgrade Now', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_image_url() {
|
||||
return ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg';
|
||||
}
|
||||
|
||||
public function get_promotion_description() {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$config = [
|
||||
'title' => $this->get_promotion_title(),
|
||||
'description' => $this->get_promotion_description(),
|
||||
'image' => $this->get_image_url(),
|
||||
'upgrade_text' => $this->get_cta_text(),
|
||||
'upgrade_url' => $this->get_cta_url(),
|
||||
];
|
||||
|
||||
$config = Filtered_Promotions_Manager::get_filtered_promotion_data( $config, 'elementor/' . $this->get_name() . '/custom_promotion', 'upgrade_url' );
|
||||
|
||||
$description = $config['description'] ?? $this->get_promotion_description() ?? '';
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div class="elementor-blank_state">
|
||||
<img src="<?php echo esc_url( $config['image'] ?? $this->get_image_url() ); ?>" loading="lazy" />
|
||||
|
||||
<h3><?php echo esc_html( $config['title'] ?? $this->get_promotion_title() ); ?></h3>
|
||||
<?php if ( $description ) : ?>
|
||||
<p><?php echo esc_html( $description ); ?></p>
|
||||
<?php endif; ?>
|
||||
<a class="elementor-button go-pro" href="<?php echo esc_url( $config['upgrade_url'] ?? $this->get_cta_url() ); ?>">
|
||||
<?php echo esc_html( $config['upgrade_text'] ?? $this->get_cta_text() ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page;
|
||||
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
|
||||
use Elementor\Settings;
|
||||
use Elementor\Utils;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
abstract class Base_Promotion_Template implements Admin_Menu_Item_With_Page {
|
||||
|
||||
abstract protected function get_promotion_title():string;
|
||||
|
||||
abstract protected function get_cta_url():string;
|
||||
|
||||
abstract protected function get_content_lines():array;
|
||||
|
||||
abstract protected function get_video_url():string;
|
||||
|
||||
public function is_visible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_parent_slug() {
|
||||
return Settings::PAGE_ID;
|
||||
}
|
||||
|
||||
public function get_capability() {
|
||||
return 'manage_options';
|
||||
}
|
||||
|
||||
protected function get_cta_text() {
|
||||
return esc_html__( 'Upgrade Now', 'elementor' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the promotion have a side note.
|
||||
* @return string
|
||||
*/
|
||||
protected function get_side_note():string {
|
||||
return '';
|
||||
}
|
||||
|
||||
private function get_lines() {
|
||||
ob_start();
|
||||
if ( ! empty( $this->get_content_lines() ) ) {
|
||||
?>
|
||||
<ul>
|
||||
<?php foreach ( $this->get_content_lines() as $item ) { ?>
|
||||
<li><?php Utils::print_unescaped_internal_string( $item ); ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$promotion_data = $this->get_promotion_data();
|
||||
?>
|
||||
<div class="e-feature-promotion">
|
||||
<div class="e-feature-promotion_data">
|
||||
<h3><?php Utils::print_unescaped_internal_string( $promotion_data['promotion_title'] ); ?></h3>
|
||||
|
||||
<?php Utils::print_unescaped_internal_string( $promotion_data['lines'] ); ?>
|
||||
|
||||
<a class="elementor-button go-pro" href="<?php echo esc_url( $promotion_data['cta_url'] ); ?>" target="_blank">
|
||||
<?php Utils::print_unescaped_internal_string( $promotion_data['cta_text'] ); ?>
|
||||
</a>
|
||||
|
||||
<?php if ( ! empty( $promotion_data['side_note'] ) ) { ?>
|
||||
<div class="side-note">
|
||||
<p><?php Utils::print_unescaped_internal_string( $promotion_data['side_note'] ); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<iframe class="e-feature-promotion_iframe" src="<?php Utils::print_unescaped_internal_string( $promotion_data['video_url'] ); ?>&rel=0" title="Elementor" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
private function get_promotion_data(): ?array {
|
||||
return Filtered_Promotions_Manager::get_filtered_promotion_data( $this->build_promotion_data_array(), 'elementor/' . $this->get_name() . '/custom_promotion', 'cta_url' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function build_promotion_data_array(): array {
|
||||
return [
|
||||
'promotion_title' => $this->get_promotion_title(),
|
||||
'cta_url' => $this->get_cta_url(),
|
||||
'cta_text' => $this->get_cta_text(),
|
||||
'video_url' => $this->get_video_url(),
|
||||
'lines' => $this->get_lines(),
|
||||
'side_note' => $this->get_side_note(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Custom_Code_Promotion_Item extends Base_Promotion_Template {
|
||||
public function get_name() {
|
||||
return 'custom_code';
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
return esc_html__( 'Custom Code', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
return esc_html__( 'Custom Code', 'elementor' );
|
||||
}
|
||||
|
||||
protected function get_promotion_title(): string {
|
||||
return esc_html__( 'Enjoy Creative Freedom with Custom Code', 'elementor' );
|
||||
}
|
||||
|
||||
protected function get_content_lines():array {
|
||||
return [
|
||||
esc_html__( 'Add Custom Code snippets anywhere on your website, including the header or footer to measure your page’s performance*', 'elementor' ),
|
||||
esc_html__( 'Use Custom Code to create sophisticated custom interactions to engage visitors', 'elementor' ),
|
||||
esc_html__( 'Leverage Elementor AI to instantly generate Custom Code for Elementor', 'elementor' ),
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_side_note():string {
|
||||
return esc_html__( '* Requires an Advanced subscription or higher', 'elementor' );
|
||||
}
|
||||
|
||||
protected function get_cta_url():string {
|
||||
return 'https://go.elementor.com/go-pro-custom-code/';
|
||||
}
|
||||
|
||||
protected function get_video_url():string {
|
||||
return 'https://www.youtube-nocookie.com/embed/IOovQd1hJUg?si=xeBJ_mRZxRH1l5O6';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Custom_Fonts_Promotion_Item extends Base_Promotion_Template {
|
||||
public function get_name() {
|
||||
return 'custom_fonts';
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
return esc_html__( 'Custom Fonts', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
return esc_html__( 'Custom Fonts', 'elementor' );
|
||||
}
|
||||
|
||||
protected function get_promotion_title(): string {
|
||||
return esc_html__( 'Stay on brand with a Custom Font', 'elementor' );
|
||||
}
|
||||
|
||||
protected function get_content_lines(): array {
|
||||
return [
|
||||
esc_html__( 'Upload any font to keep your website true to your brand', 'elementor' ),
|
||||
sprintf(
|
||||
/* translators: %s: br */
|
||||
esc_html__( 'Remain GDPR compliant with Custom Fonts that let you disable %s Google Fonts from your website', 'elementor' ),
|
||||
'<br />'
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_cta_url(): string {
|
||||
return 'https://go.elementor.com/go-pro-custom-fonts/';
|
||||
}
|
||||
|
||||
protected function get_video_url(): string {
|
||||
return 'https://www.youtube-nocookie.com/embed/j_guJkm28eY?si=cdd2TInwuGDTtCGD';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Custom_Icons_Promotion_Item extends Base_Promotion_Template {
|
||||
public function get_name() {
|
||||
return 'custom_icons';
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
return esc_html__( 'Custom Icons', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
return esc_html__( 'Custom Icons', 'elementor' );
|
||||
}
|
||||
|
||||
protected function get_promotion_title():string {
|
||||
return sprintf(
|
||||
/* translators: %s: br */
|
||||
esc_html( 'Enjoy creative freedom %s with Custom Icons', 'elementor' ),
|
||||
'<br />'
|
||||
);
|
||||
}
|
||||
|
||||
protected function get_content_lines(): array {
|
||||
return [
|
||||
sprintf(
|
||||
esc_html__( 'Expand your icon library beyond FontAwesome and add icon %s libraries of your choice', 'elementor' ),
|
||||
'<br />'
|
||||
),
|
||||
esc_html__( 'Add any icon, anywhere on your website', 'elementor' ),
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_cta_url(): string {
|
||||
return 'https://go.elementor.com/go-pro-custom-icons/';
|
||||
}
|
||||
|
||||
protected function get_video_url(): string {
|
||||
return 'https://www.youtube-nocookie.com/embed/PsowinxDWfM?si=SV9Z3TLz3_XEy5C6';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Form_Submissions_Promotion_Item extends Base_Promotion_Template {
|
||||
public function get_name() {
|
||||
return 'submissions';
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
return esc_html__( 'Submissions', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
return esc_html__( 'Submissions', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_promotion_title():string {
|
||||
return sprintf(
|
||||
/* translators: %s: br */
|
||||
esc_html( 'Create Forms and Collect Leads %s with Elementor Pro', 'elementor' ),
|
||||
'<br />'
|
||||
);
|
||||
}
|
||||
|
||||
protected function get_content_lines(): array {
|
||||
return [
|
||||
esc_html__( 'Create single or multi-step forms to engage and convert visitors', 'elementor' ),
|
||||
esc_html__( 'Use any field to collect the information you need', 'elementor' ),
|
||||
esc_html__( 'Integrate your favorite marketing software*', 'elementor' ),
|
||||
esc_html__( 'Collect lead submissions directly within your WordPress Admin to manage, analyze and perform bulk actions on the submitted lead*', 'elementor' ),
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_cta_url():string {
|
||||
return 'https://go.elementor.com/go-pro-submissions/';
|
||||
}
|
||||
|
||||
protected function get_video_url():string {
|
||||
return 'https://www.youtube-nocookie.com/embed/LNfnwba9C-8?si=JLHk3UAexnvTfU1a';
|
||||
}
|
||||
|
||||
protected function get_side_note():string {
|
||||
return esc_html__( '* Requires an Advanced subscription or higher', 'elementor' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page;
|
||||
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
|
||||
use Elementor\Settings;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Go_Pro_Promotion_Item implements Admin_Menu_Item_With_Page {
|
||||
const URL = 'https://go.elementor.com/pro-admin-menu/';
|
||||
|
||||
public function get_name() {
|
||||
return 'admin_menu_promo';
|
||||
}
|
||||
|
||||
public function is_visible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_parent_slug() {
|
||||
return Settings::PAGE_ID;
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
$upgrade_text = esc_html__( 'Upgrade', 'elementor' );
|
||||
|
||||
return apply_filters( 'elementor/admin_menu/custom_promotion', [ 'upgrade_text' => $upgrade_text ] )['upgrade_text'] ?? $upgrade_text;
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function get_capability() {
|
||||
return 'manage_options';
|
||||
}
|
||||
|
||||
public static function get_url() {
|
||||
$url = self::URL;
|
||||
$filtered_url = apply_filters( 'elementor/admin_menu/custom_promotion', [ 'upgrade_url' => $url ] )['upgrade_url'] ?? '';
|
||||
$promotion_data = Filtered_Promotions_Manager::get_filtered_promotion_data( [ 'upgrade_url' => $filtered_url ], 'elementor/admin_menu/custom_promotion', 'upgrade_url' );
|
||||
return $promotion_data ['upgrade_url'];
|
||||
}
|
||||
|
||||
public function render() {
|
||||
// Redirects from the module on `admin_init`.
|
||||
die;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems\Interfaces;
|
||||
|
||||
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
interface Promotion_Menu_Item extends Admin_Menu_Item_With_Page {
|
||||
public function get_image_url();
|
||||
|
||||
public function get_promotion_title();
|
||||
|
||||
public function render_promotion_description();
|
||||
|
||||
public function get_cta_text();
|
||||
|
||||
public function get_cta_url();
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions\AdminMenuItems;
|
||||
|
||||
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
|
||||
use Elementor\TemplateLibrary\Source_Local;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Popups_Promotion_Item extends Base_Promotion_Item {
|
||||
|
||||
private array $promotion_data;
|
||||
|
||||
public function __construct() {
|
||||
$this->promotion_data = [
|
||||
'title' => esc_html__( 'Get Popup Builder', 'elementor' ),
|
||||
'content' => esc_html__(
|
||||
'The Popup Builder lets you take advantage of all the amazing features in Elementor, so you can build beautiful & highly converting popups. Get Elementor Pro and start designing your popups today.',
|
||||
'elementor'
|
||||
),
|
||||
'action_button' => [
|
||||
'text' => esc_html__( 'Upgrade Now', 'elementor' ),
|
||||
'url' => 'https://go.elementor.com/go-pro-popup-builder/',
|
||||
],
|
||||
];
|
||||
|
||||
$this->promotion_data = Filtered_Promotions_Manager::get_filtered_promotion_data( $this->promotion_data, 'elementor/templates/popup', 'action_button', 'url' );
|
||||
}
|
||||
|
||||
public function get_parent_slug() {
|
||||
return Source_Local::ADMIN_MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'popups';
|
||||
}
|
||||
|
||||
|
||||
public function get_label() {
|
||||
return esc_html__( 'Popups', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
return esc_html__( 'Popups', 'elementor' );
|
||||
}
|
||||
|
||||
public function get_promotion_title() {
|
||||
return $this->promotion_data['title'];
|
||||
}
|
||||
|
||||
public function get_promotion_description() {
|
||||
return $this->promotion_data['content'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use get_promotion_description instead
|
||||
* @return void
|
||||
*/
|
||||
public function render_promotion_description() {
|
||||
echo $this->get_promotion_description(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
public function get_cta_url() {
|
||||
return $this->promotion_data['action_button']['url'];
|
||||
}
|
||||
|
||||
public function get_cta_text() {
|
||||
return $this->promotion_data['action_button']['text'];
|
||||
}
|
||||
}
|
||||
82
wp-content/plugins/elementor/modules/promotions/module.php
Normal file
82
wp-content/plugins/elementor/modules/promotions/module.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor\Modules\Promotions;
|
||||
|
||||
use Elementor\Api;
|
||||
use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
|
||||
use Elementor\Core\Base\Module as Base_Module;
|
||||
use Elementor\Modules\Promotions\AdminMenuItems\Custom_Code_Promotion_Item;
|
||||
use Elementor\Modules\Promotions\AdminMenuItems\Custom_Fonts_Promotion_Item;
|
||||
use Elementor\Modules\Promotions\AdminMenuItems\Custom_Icons_Promotion_Item;
|
||||
use Elementor\Modules\Promotions\AdminMenuItems\Form_Submissions_Promotion_Item;
|
||||
use Elementor\Modules\Promotions\AdminMenuItems\Go_Pro_Promotion_Item;
|
||||
use Elementor\Modules\Promotions\AdminMenuItems\Popups_Promotion_Item;
|
||||
use Elementor\Widgets_Manager;
|
||||
use Elementor\Utils;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
class Module extends Base_Module {
|
||||
|
||||
const ADMIN_MENU_PRIORITY = 100;
|
||||
|
||||
const ADMIN_MENU_PROMOTIONS_PRIORITY = 120;
|
||||
|
||||
public static function is_active() {
|
||||
return ! Utils::has_pro();
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'promotions';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
add_action( 'admin_init', function () {
|
||||
$this->handle_external_redirects();
|
||||
} );
|
||||
|
||||
add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) {
|
||||
$this->register_menu_items( $admin_menu );
|
||||
}, static::ADMIN_MENU_PRIORITY );
|
||||
|
||||
add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) {
|
||||
$this->register_promotion_menu_item( $admin_menu );
|
||||
}, static::ADMIN_MENU_PROMOTIONS_PRIORITY );
|
||||
|
||||
add_action( 'elementor/widgets/register', function( Widgets_Manager $manager ) {
|
||||
foreach ( Api::get_promotion_widgets() as $widget_data ) {
|
||||
$manager->register( new Widgets\Pro_Widget_Promotion( [], [
|
||||
'widget_name' => $widget_data['name'],
|
||||
'widget_title' => $widget_data['title'],
|
||||
] ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private function handle_external_redirects() {
|
||||
if ( empty( $_GET['page'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'go_elementor_pro' === $_GET['page'] ) {
|
||||
wp_redirect( Go_Pro_Promotion_Item::get_url() );
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
private function register_menu_items( Admin_Menu_Manager $admin_menu ) {
|
||||
$admin_menu->register( 'e-form-submissions', new Form_Submissions_Promotion_Item() );
|
||||
$admin_menu->register( 'elementor_custom_fonts', new Custom_Fonts_Promotion_Item() );
|
||||
$admin_menu->register( 'elementor_custom_icons', new Custom_Icons_Promotion_Item() );
|
||||
$admin_menu->register( 'elementor_custom_code', new Custom_Code_Promotion_Item() );
|
||||
$admin_menu->register( 'popup_templates', new Popups_Promotion_Item() );
|
||||
}
|
||||
|
||||
private function register_promotion_menu_item( Admin_Menu_Manager $admin_menu ) {
|
||||
$admin_menu->register( 'go_elementor_pro', new Go_Pro_Promotion_Item() );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace Elementor\Modules\Promotions\Widgets;
|
||||
|
||||
use Elementor\Widget_Base;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Pro_Widget_Promotion extends Widget_Base {
|
||||
|
||||
private $widget_data;
|
||||
|
||||
public function hide_on_search() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function show_in_panel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return $this->widget_data['widget_name'];
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return $this->widget_data['widget_title'];
|
||||
}
|
||||
|
||||
public function on_import( $element ) {
|
||||
$element['settings']['__should_import'] = true;
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function register_controls() {}
|
||||
|
||||
protected function render() {
|
||||
if ( $this->is_editor_render() ) {
|
||||
$this->render_promotion();
|
||||
} else {
|
||||
$this->render_empty_content();
|
||||
}
|
||||
}
|
||||
|
||||
private function is_editor_render(): bool {
|
||||
return \Elementor\Plugin::$instance->editor->is_edit_mode();
|
||||
}
|
||||
|
||||
private function render_promotion() {
|
||||
?>
|
||||
<div class="e-container">
|
||||
<span class="e-badge"><i class="eicon-lock" aria-hidden="true"></i> <?php echo esc_html__( 'Pro', 'elementor' ); ?></span>
|
||||
<p>
|
||||
<img src="<?php echo esc_url( $this->get_promotion_image_url() ); ?>" loading="lazy" alt="Go Pro">
|
||||
<?php
|
||||
echo sprintf(
|
||||
esc_html__( 'This result includes the Elementor Pro %s widget. Upgrade now to unlock it and grow your web creation toolkit.', 'elementor' ),
|
||||
esc_html( $this->widget_data['widget_title'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<div class="e-actions">
|
||||
<a href="#" class="e-btn e-btn-txt e-promotion-delete"><?php echo esc_html__( 'Remove', 'elementor' ); ?></a>
|
||||
<a href="https://go.elementor.com/go-pro-element-pro/" rel="noreferrer" target="_blank" class="e-btn go-pro elementor-clickable e-promotion-go-pro"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function get_promotion_image_url(): string {
|
||||
return ELEMENTOR_ASSETS_URL . 'images/go-pro.svg';
|
||||
}
|
||||
|
||||
private function render_empty_content() {
|
||||
echo ' ';
|
||||
}
|
||||
|
||||
protected function content_template() {}
|
||||
|
||||
public function __construct( $data = [], $args = null ) {
|
||||
$this->widget_data = [
|
||||
'widget_name' => $args['widget_name'],
|
||||
'widget_title' => $args['widget_title'],
|
||||
];
|
||||
|
||||
parent::__construct( $data, $args );
|
||||
}
|
||||
|
||||
public function render_plain_content( $instance = [] ) {}
|
||||
}
|
||||
Reference in New Issue
Block a user