PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.0-dev2
Elementor Website Builder – more than just a page builder v3.32.0-dev2
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 | modules/pro-install/pro-install-menu-item.php +157 -5 4.2.13.32.0-dev2 View file →
@@ -9,13 +9,15 @@
9 9 }
10 10
11 11 class Pro_Install_Menu_Item implements Admin_Menu_Item_With_Page {
12 12
13 - private Connect_Page_Renderer $renderer;
13 + private Connect $connect;
14 14
15 - public function __construct( Connect $connect, array $script_config ) {
16 - $page_url = admin_url( 'admin.php?page=elementor-connect-account' );
17 - $this->renderer = new Connect_Page_Renderer( $connect, $page_url, $script_config );
15 + private string $page_url;
16 +
17 + public function __construct( Connect $connect ) {
18 + $this->connect = $connect;
19 + $this->page_url = admin_url( 'admin.php?page=elementor-connect-account' );
18 20 }
19 21
20 22 public function get_label(): string {
21 23 return esc_html__( 'Connect Account', 'elementor' );
@@ -37,7 +39,157 @@
37 39 return true;
38 40 }
39 41
40 42 public function render() {
41 - $this->renderer->render();
43 + ?>
44 + <div class="wrap elementor-admin-page-license">
45 + <h2 class="wp-heading-inline"><?php echo esc_html( $this->get_page_title() ); ?></h2>
46 + <?php
47 + if ( ! $this->connect->is_connected() ) {
48 + $this->render_connect_box();
49 + } else {
50 + $this->render_license_box();
51 + }
52 + ?>
53 + </div>
54 + <?php
55 + }
56 +
57 + private function render_connect_box() {
58 + $connect_url = $this->connect->get_admin_url( 'authorize', [
59 + 'utm_source' => 'license-page-connect-free',
60 + 'utm_medium' => 'wp-dash',
61 + 'utm_campaign' => 'connect-and-activate-license',
62 + 'redirect_to' => $this->page_url,
63 + ] );
64 +
65 + ?>
66 + <div class="elementor-license-box">
67 + <h3><?php echo esc_html__( 'Connect your Elementor Account', 'elementor' ); ?></h3>
68 +
69 + <p>
70 + <?php echo esc_html__( 'Gain access to dozens of professionally designed templates, and connect your site to your My Elementor Dashboard.', 'elementor' ); ?>
71 + </p>
72 +
73 + <div class="elementor-box-action">
74 + <a class="button button-primary" href="<?php echo esc_url( $connect_url ); ?>">
75 + <?php echo esc_html__( 'Connect to Elementor', 'elementor' ); ?>
76 + </a>
77 + </div>
78 + </div>
79 + <?php
80 + }
81 +
82 + private function render_license_box() {
83 + $disconnect_url = $this->connect->get_admin_url( 'disconnect', [
84 + 'redirect_to' => $this->page_url,
85 + ] );
86 + $download_link = $this->connect->get_download_link();
87 +
88 + ?>
89 + <div class="elementor-license-box">
90 + <h3>
91 + <?php echo esc_html__( 'Status', 'elementor' ); ?>:
92 + <span style="color: #008000; font-style: italic;"><?php echo esc_html__( 'Connected', 'elementor' ); ?></span>
93 + <small>
94 + <a class="button" href="https://go.elementor.com/my-account/" target="_blank">
95 + <?php echo esc_html__( 'My Account', 'elementor' ); ?>
96 + </a>
97 + </small>
98 + </h3>
99 +
100 + <p class="e-row-stretch e-row-divider-bottom">
101 + <span>
102 + <?php
103 + $connected_user = $this->get_connected_account();
104 +
105 + if ( $connected_user ) :
106 + printf(
107 + /* translators: %s: Connected user. */
108 + esc_html__( 'You\'re connected as %s.', 'elementor' ),
109 + '<strong>' . esc_html( $connected_user ) . '</strong>'
110 + );
111 + endif;
112 + ?>
113 + </span>
114 + </p>
115 +
116 + <p class="e-row-stretch">
117 + <span><?php echo esc_html__( 'Want to disconnect for any reason?', 'elementor' ); ?></span>
118 + <a class="button" href="<?php echo esc_url( $disconnect_url ); ?>">
119 + <?php echo esc_html__( 'Disconnect', 'elementor' ); ?>
120 + </a>
121 + </p>
122 + </div>
123 + <?php
124 + if ( empty( $download_link ) ) {
125 + $this->render_promotion_box();
126 + } else {
127 + $this->render_install_or_activate_box();
128 + }
129 + }
130 +
131 + private function get_connected_account() {
132 + $user = $this->connect->get( 'user' );
133 +
134 + $email = '';
135 + if ( $user ) {
136 + $email = $user->email;
137 + }
138 +
139 + return $email;
140 + }
141 +
142 + private function render_promotion_box() {
143 + ?>
144 + <div class="elementor-license-box elementor-pro-connect-promotion">
145 + <div>
146 + <h2><?php echo esc_html__( 'Upgrade to Pro to unlock powerful design tools and advanced features.', 'elementor' ); ?></h2>
147 + <p><?php echo esc_html__( 'Build custom headers, footers, forms, popups, and WooCommerce stores.', 'elementor' ); ?></p>
148 + <div class="elementor-box-action">
149 + <a class="button button-upgrade" href="https://go.elementor.com/go-pro-connect-account-screen" target="_blank">
150 + <i class="eicon-upgrade-crown" aria-hidden="true"></i>
151 + <?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?>
152 + </a>
153 + </div>
154 + </div>
155 + <img src="https://assets.elementor.com/free-to-pro-upsell/v1/images/connect-pro-upgrade.jpg" alt="<?php echo esc_attr__( 'Pro Upgrade', 'elementor' ); ?>" />
156 + </div>
157 + <?php
158 + }
159 +
160 + private function render_install_or_activate_box() {
161 + $cta_data = $this->get_cta_data();
162 + $ctr_url = wp_nonce_url( admin_url( 'admin-post.php?action=elementor_do_pro_install' ), 'elementor_do_pro_install' );
163 +
164 + ?>
165 + <div class="elementor-license-box">
166 + <h3><?php echo esc_html__( 'You\'ve got Elementor Pro', 'elementor' ); ?></h3>
167 +
168 + <p><?php echo esc_html( $cta_data['description'] ); ?></p>
169 + <p class="elementor-box-action">
170 + <a class="button button-primary" href="<?php echo esc_url( $ctr_url ); ?>">
171 + <?php echo esc_html( $cta_data['button_text'] ); ?>
172 + </a>
173 + </p>
174 + </div>
175 + <?php
176 + }
177 +
178 + private function get_cta_data(): array {
179 + return [
180 + 'description' => esc_html__( 'Enjoy full access to powerful design tools, advanced widgets, and everything you need to create next-level websites.', 'elementor' ),
181 + 'button_text' => $this->is_pro_installed() ? esc_html__( 'Activate Elementor Pro', 'elementor' ) : esc_html__( 'Install & Activate', 'elementor' ),
182 + ];
183 + }
184 +
185 + private function is_pro_installed(): bool {
186 + $file_path = $this->get_elementor_pro_file_path();
187 + $installed_plugins = get_plugins();
188 +
189 + return isset( $installed_plugins[ $file_path ] );
190 + }
191 +
192 + private function get_elementor_pro_file_path(): string {
193 + return 'elementor-pro/elementor-pro.php';
42 194 }
43 195 }