PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev2
Elementor Website Builder – more than just a page builder v3.35.0-dev2
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 / modules / pro-install / connect-page-renderer.php

connect-page-renderer.php in Elementor Website Builder – more than just a page builder 3.35.0-dev2, at modules/pro-install/connect-page-renderer.php

187 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\ProInstall;
3
4 use Elementor\Plugin;
5 use Elementor\Utils;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit;
9 }
10
11 class Connect_Page_Renderer {
12
13 private Connect $connect;
14
15 private string $page_url;
16
17 private ?array $script_config;
18
19 public function __construct( Connect $connect, string $page_url, ?array $script_config = null ) {
20 $this->connect = $connect;
21 $this->page_url = $page_url;
22 $this->script_config = $script_config;
23 }
24
25 public function render() {
26 if ( $this->script_config ) {
27 wp_enqueue_script( ...$this->script_config );
28 }
29 ?>
30 <div class="wrap elementor-admin-page-license">
31 <h2 class="wp-heading-inline"><?php echo esc_html__( 'Connect Settings', 'elementor' ); ?></h2>
32 <?php
33 if ( ! $this->connect->is_connected() ) {
34 $this->render_connect_box();
35 } else {
36 $this->render_license_box();
37 }
38 ?>
39 </div>
40 <?php
41 }
42
43 private function render_connect_box() {
44 $connect_url = $this->connect->get_admin_url( 'authorize', [
45 'utm_source' => 'license-page-connect-free',
46 'utm_medium' => 'wp-dash',
47 'utm_campaign' => 'connect-and-activate-license',
48 'redirect_to' => $this->page_url,
49 ] );
50
51 ?>
52 <div class="<?php echo esc_attr( $this->get_license_box_classes() ); ?>">
53 <h3><?php echo esc_html__( 'Connect your Elementor Account', 'elementor' ); ?></h3>
54
55 <p>
56 <?php echo esc_html__( 'Gain access to dozens of professionally designed templates, and connect your site to your My Elementor Dashboard.', 'elementor' ); ?>
57 </p>
58
59 <div class="elementor-box-action">
60 <a id="elementor-connect-license" class="button button-primary" href="<?php echo esc_url( $connect_url ); ?>">
61 <?php echo esc_html__( 'Connect to Elementor', 'elementor' ); ?>
62 </a>
63 </div>
64 </div>
65 <?php
66 }
67
68 private function render_license_box() {
69 $disconnect_url = $this->connect->get_admin_url( 'disconnect', [
70 'redirect_to' => $this->page_url,
71 ] );
72 $download_link = $this->connect->get_download_link();
73
74 ?>
75 <div class="<?php echo esc_attr( $this->get_license_box_classes() ); ?>">
76 <h3>
77 <?php echo esc_html__( 'Status', 'elementor' ); ?>:
78 <span style="color: #008000; font-style: italic;"><?php echo esc_html__( 'Connected', 'elementor' ); ?></span>
79 <small>
80 <a class="button" href="https://go.elementor.com/my-account/" target="_blank">
81 <?php echo esc_html__( 'My Account', 'elementor' ); ?>
82 </a>
83 </small>
84 </h3>
85
86 <p class="e-row-stretch e-row-divider-bottom">
87 <span>
88 <?php
89 $connected_user = $this->get_connected_account();
90
91 if ( $connected_user ) :
92 printf(
93 /* translators: %s: Connected user. */
94 esc_html__( 'You\'re connected as %s.', 'elementor' ),
95 '<strong>' . esc_html( $connected_user ) . '</strong>'
96 );
97 endif;
98 ?>
99 </span>
100 </p>
101
102 <p class="e-row-stretch">
103 <span><?php echo esc_html__( 'Want to disconnect for any reason?', 'elementor' ); ?></span>
104 <a class="button" href="<?php echo esc_url( $disconnect_url ); ?>">
105 <?php echo esc_html__( 'Disconnect', 'elementor' ); ?>
106 </a>
107 </p>
108 </div>
109 <?php
110 if ( empty( $download_link ) ) {
111 $this->render_promotion_box();
112 } else {
113 $this->render_install_or_activate_box();
114 }
115 }
116
117 private function get_connected_account() {
118 $user = $this->connect->get( 'user' );
119
120 $email = '';
121 if ( $user ) {
122 $email = $user->email;
123 }
124
125 return $email;
126 }
127
128 private function render_promotion_box() {
129 ?>
130 <div class="<?php echo esc_attr( $this->get_license_box_classes( 'elementor-pro-connect-promotion' ) ); ?>">
131 <div>
132 <h2><?php echo esc_html__( 'Upgrade to Pro to unlock powerful design tools and advanced features.', 'elementor' ); ?></h2>
133 <p><?php echo esc_html__( 'Build custom headers, footers, forms, popups, and WooCommerce stores.', 'elementor' ); ?></p>
134 <div class="elementor-box-action">
135 <a class="button button-upgrade" href="https://go.elementor.com/go-pro-connect-account-screen" target="_blank">
136 <i class="eicon-upgrade-crown" aria-hidden="true"></i>
137 <?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?>
138 </a>
139 </div>
140 </div>
141 <img src="https://assets.elementor.com/free-to-pro-upsell/v1/images/connect-pro-upgrade.jpg" alt="<?php echo esc_attr__( 'Pro Upgrade', 'elementor' ); ?>" />
142 </div>
143 <?php
144 }
145
146 private function render_install_or_activate_box() {
147 $cta_data = $this->get_cta_data();
148 $cta_url = wp_nonce_url( admin_url( 'admin-post.php?action=elementor_do_pro_install' ), 'elementor_do_pro_install' );
149 $cta_id = Utils::is_pro_installed_and_not_active() ? 'elementor-connect-activate-pro' : 'elementor-connect-install-pro';
150
151 ?>
152 <div class="<?php echo esc_attr( $this->get_license_box_classes() ); ?>">
153 <h3><?php echo esc_html__( 'You\'ve got Elementor Pro', 'elementor' ); ?></h3>
154
155 <p><?php echo esc_html( $cta_data['description'] ); ?></p>
156 <p class="elementor-box-action">
157 <a id="<?php echo esc_attr( $cta_id ); ?>" class="button button-primary" href="<?php echo esc_url( $cta_url ); ?>">
158 <?php echo esc_html( $cta_data['button_text'] ); ?>
159 </a>
160 </p>
161 </div>
162 <?php
163 }
164
165 private function get_cta_data(): array {
166 return [
167 'description' => esc_html__( 'Enjoy full access to powerful design tools, advanced widgets, and everything you need to create next-level websites.', 'elementor' ),
168 'button_text' => Utils::is_pro_installed_and_not_active() ? esc_html__( 'Activate Elementor Pro', 'elementor' ) : esc_html__( 'Install & Activate', 'elementor' ),
169 ];
170 }
171
172 private function get_license_box_classes( string $additional_classes = '' ): string {
173 $classes = [ 'elementor-license-box' ];
174
175 if ( $additional_classes ) {
176 $classes[] = $additional_classes;
177 }
178
179 if ( Plugin::$instance->experiments->is_feature_active( 'e_editor_one' ) ) {
180 $classes[] = 'e-one-section-outlined';
181 }
182
183 return implode( ' ', $classes );
184 }
185 }
186
187