PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.7
Elementor Website Builder – more than just a page builder v3.0.7
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 4.0.7 All 451 releases
elementor / core / editor / notice-bar.php

notice-bar.php in Elementor Website Builder – more than just a page builder 3.0.7, at core/editor/notice-bar.php

65 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Editor;
3
4 use Elementor\Core\Base\Base_Object;
5 use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
6 use Elementor\Plugin;
7 use Elementor\Utils;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly
11 }
12
13 class Notice_Bar extends Base_Object {
14
15 protected function get_init_settings() {
16 if ( Plugin::$instance->get_install_time() > strtotime( '-30 days' ) ) {
17 return [];
18 }
19
20 return [
21 'muted_period' => 90,
22 'option_key' => '_elementor_editor_upgrade_notice_dismissed',
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' ),
26 ];
27 }
28
29 final public function get_notice() {
30 if ( ! current_user_can( 'manage_options' ) ) {
31 return null;
32 }
33
34 $settings = $this->get_settings();
35
36 if ( empty( $settings['option_key'] ) ) {
37 return null;
38 }
39
40 $dismissed_time = get_option( $settings['option_key'] );
41
42 if ( $dismissed_time ) {
43 if ( $dismissed_time > strtotime( '-' . $settings['muted_period'] . ' days' ) ) {
44 return null;
45 }
46
47 $this->set_notice_dismissed();
48 }
49
50 return $settings;
51 }
52
53 public function __construct() {
54 add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] );
55 }
56
57 public function set_notice_dismissed() {
58 update_option( $this->get_settings( 'option_key' ), time() );
59 }
60
61 public function register_ajax_actions( Ajax $ajax ) {
62 $ajax->register_ajax_action( 'notice_bar_dismiss', [ $this, 'set_notice_dismissed' ] );
63 }
64 }
65