PluginProbe
Elementor Website Builder – more than just a page builder / 3.25.1
Elementor Website Builder – more than just a page builder v3.25.1
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
elementor / modules / promotions / widgets / pro-widget-promotion.php

pro-widget-promotion.php in Elementor Website Builder – more than just a page builder 3.25.1, at modules/promotions/widgets/pro-widget-promotion.php

102 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\Promotions\Widgets;
3
4 use Elementor\Widget_Base;
5 use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 class Pro_Widget_Promotion extends Widget_Base {
12
13 private $widget_data;
14
15 public function hide_on_search() {
16 return true;
17 }
18
19 public function show_in_panel() {
20 return false;
21 }
22
23 public function get_name() {
24 return $this->widget_data['widget_name'];
25 }
26
27 public function get_title() {
28 return $this->widget_data['widget_title'];
29 }
30
31 public function on_import( $element ) {
32 $element['settings']['__should_import'] = true;
33
34 return $element;
35 }
36
37 protected function register_controls() {}
38
39 protected function render() {
40 if ( $this->is_editor_render() ) {
41 $this->render_promotion();
42 } else {
43 $this->render_empty_content();
44 }
45 }
46
47 private function is_editor_render(): bool {
48 return \Elementor\Plugin::$instance->editor->is_edit_mode();
49 }
50
51 private function render_promotion() {
52 $promotion = Filtered_Promotions_Manager::get_filtered_promotion_data(
53 [
54 'image_url' => esc_url( $this->get_promotion_image_url() ),
55 'text' => sprintf(
56 esc_html__( 'This result includes the Elementor Pro %s widget. Upgrade now to unlock it and grow your web creation toolkit.', 'elementor' ),
57 esc_html( $this->widget_data['widget_title'] )
58 ),
59 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-element-pro/' ),
60 ],
61 'elementor/pro-widget/promotion',
62 'upgrade_url'
63 );
64 ?>
65 <div class="e-container">
66 <span class="e-badge"><i class="eicon-lock" aria-hidden="true"></i> <?php echo esc_html__( 'Pro', 'elementor' ); ?></span>
67 <p>
68 <img src="<?php echo esc_url( $promotion['image_url'] ); ?>" loading="lazy" alt="Go Pro">
69 <?php
70 echo esc_html( $promotion['text'] );
71 ?>
72 </p>
73 <div class="e-actions">
74 <a href="#" class="e-btn e-btn-txt e-promotion-delete"><?php echo esc_html__( 'Remove', 'elementor' ); ?></a>
75 <a href="<?php echo esc_url( $promotion['upgrade_url'] ); ?>" rel="noreferrer" target="_blank" class="e-btn go-pro elementor-clickable e-promotion-go-pro"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
76 </div>
77 </div>
78 <?php
79 }
80
81 private function get_promotion_image_url(): string {
82 return ELEMENTOR_ASSETS_URL . 'images/go-pro.svg';
83 }
84
85 private function render_empty_content() {
86 echo ' ';
87 }
88
89 protected function content_template() {}
90
91 public function __construct( $data = [], $args = null ) {
92 $this->widget_data = [
93 'widget_name' => $args['widget_name'],
94 'widget_title' => $args['widget_title'],
95 ];
96
97 parent::__construct( $data, $args );
98 }
99
100 public function render_plain_content( $instance = [] ) {}
101 }
102