PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.0
Elementor Website Builder – more than just a page builder v3.2.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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | core/editor/notice-bar.php +8 -92 4.1.53.2.0 View file →
@@ -2,52 +2,33 @@
2 2 namespace Elementor\Core\Editor;
3 3
4 4 use Elementor\Core\Base\Base_Object;
5 5 use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
6 -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
7 6 use Elementor\Plugin;
8 7 use Elementor\Utils;
9 8
10 9 if ( ! defined( 'ABSPATH' ) ) {
11 - exit; // Exit if accessed directly.
10 + exit; // Exit if accessed directly
12 11 }
13 12
14 13 class Notice_Bar extends Base_Object {
15 14
16 15 protected function get_init_settings() {
17 - if ( Plugin::$instance->get_install_time() > strtotime( '-1 days' ) ) {
16 + if ( Plugin::$instance->get_install_time() > strtotime( '-30 days' ) ) {
18 17 return [];
19 18 }
20 19
21 - $upgrade_url = 'https://go.elementor.com/go-pro-editor-notice-bar/';
22 -
23 - $config = [
24 - 'description' => $this->get_description(),
25 - 'upgrade_text' => $this->get_upgrade_text(),
26 - 'upgrade_url' => $upgrade_url,
27 - ];
28 -
29 - $config = Filtered_Promotions_Manager::get_filtered_promotion_data( $config, 'elementor/notice-bar/custom_promotion', 'upgrade_url' );
30 -
31 20 return [
32 - 'muted_period' => 14,
21 + 'muted_period' => 90,
33 22 'option_key' => '_elementor_editor_upgrade_notice_dismissed',
34 - 'message' => $config['description'] ?? $this->get_description(),
35 - 'action_title' => $config['upgrade_text'] ?? $this->get_upgrade_text(),
36 - 'action_url' => $config['upgrade_url'] ?? $upgrade_url,
23 + 'message' => __( 'Love using Elementor? <a href="%s">Learn how you can build better sites with Elementor Pro.</a>', 'elementor' ),
24 + 'action_title' => __( 'Go Pro', 'elementor' ),
25 + 'action_url' => Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=editor-notice-bar&utm_campaign=gopro&utm_medium=wp-dash' ),
37 26 ];
38 27 }
39 28
40 - public function get_upgrade_text() {
41 - return esc_html__( 'Upgrade Now', 'elementor' );
42 - }
43 -
44 - public function get_description() {
45 - return esc_html__( 'Unleash the full power of Elementor\'s features and web creation tools.', 'elementor' );
46 - }
47 -
48 29 final public function get_notice() {
49 - if ( ! $this->has_access_to_notice() ) {
30 + if ( ! current_user_can( 'manage_options' ) ) {
50 31 return null;
51 32 }
52 33
53 34 $settings = $this->get_settings();
@@ -65,84 +46,19 @@
65 46
66 47 $this->set_notice_dismissed();
67 48 }
68 49
69 - return $this;
50 + return $settings;
70 51 }
71 52
72 - protected function render_action( $type ) {
73 - $settings = $this->get_settings();
74 -
75 - // TODO: Make the API better. The bad naming is because of BC.
76 - $prefix_map = [
77 - 'primary' => '',
78 - 'secondary' => 'secondary_',
79 - ];
80 -
81 - $prefix = $prefix_map[ $type ];
82 -
83 - $action_title = "{$prefix}action_title";
84 - $action_url = "{$prefix}action_url";
85 - $action_message = "{$prefix}message";
86 - $action_target = "{$prefix}action_target";
87 -
88 - if ( empty( $settings[ $action_title ] ) || empty( $settings[ $action_url ] ) || empty( $settings[ $action_message ] ) ) {
89 - return;
90 -
91 - }
92 -
93 - ?>
94 - <div class="e-notice-bar__message <?php echo esc_attr( "e-notice-bar__{$type}_message" ); ?>">
95 - <?php Utils::print_unescaped_internal_string( sprintf( $settings[ $action_message ], $settings[ $action_url ] ) ); ?>
96 - </div>
97 -
98 - <div class="e-notice-bar__action <?php echo esc_attr( "e-notice-bar__{$type}_action" ); ?>">
99 - <a href="<?php Utils::print_unescaped_internal_string( $settings[ $action_url ] ); ?>"
100 - target="<?php echo empty( $settings[ $action_target ] ) ? '_blank' : esc_attr( $settings[ $action_target ] ); ?>"
101 - >
102 - <?php Utils::print_unescaped_internal_string( $settings[ $action_title ] ); ?>
103 - </a>
104 - </div>
105 - <?php
106 - }
107 -
108 - public function render() {
109 - $settings = $this->get_settings();
110 -
111 - $icon = empty( $settings['icon'] )
112 - ? 'eicon-elementor-square'
113 - : esc_attr( $settings['icon'] );
114 -
115 - ?>
116 - <div id="e-notice-bar" class="e-notice-bar">
117 - <i class="e-notice-bar__icon <?php echo esc_attr( $icon ); ?>"></i>
118 -
119 - <?php
120 - $this->render_action( 'primary' );
121 - $this->render_action( 'secondary' );
122 - ?>
123 -
124 - <i id="e-notice-bar__close" class="e-notice-bar__close eicon-close"></i>
125 - </div>
126 - <?php
127 - }
128 -
129 53 public function __construct() {
130 54 add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] );
131 55 }
132 56
133 57 public function set_notice_dismissed() {
134 - if ( ! $this->has_access_to_notice() ) {
135 - throw new \Exception( 'Access denied' );
136 - }
137 -
138 58 update_option( $this->get_settings( 'option_key' ), time() );
139 59 }
140 60
141 61 public function register_ajax_actions( Ajax $ajax ) {
142 62 $ajax->register_ajax_action( 'notice_bar_dismiss', [ $this, 'set_notice_dismissed' ] );
143 - }
144 -
145 - private function has_access_to_notice() {
146 - return current_user_can( 'manage_options' );
147 63 }
148 64 }