PluginProbe ʕ •ᴥ•ʔ
Royal Addons for Elementor – Addons and Templates Kit for Elementor / 1.7.1064
Royal Addons for Elementor – Addons and Templates Kit for Elementor v1.7.1064
1.7.1064 1.7.1063 1.7.1062 1.7.1061 1.7.1060 1.7.1059 1.7.1058 trunk 1.0.0 1.1.0 1.2 1.3 1.3.1 1.3.2 1.3.21 1.3.22 1.3.23 1.3.24 1.3.25 1.3.26 1.3.27 1.3.28 1.3.29 1.3.30 1.3.31 1.3.32 1.3.33 1.3.34 1.3.35 1.3.36 1.3.37 1.3.38 1.3.39 1.3.40 1.3.41 1.3.42 1.3.43 1.3.44 1.3.45 1.3.46 1.3.47 1.3.48 1.3.49 1.3.50 1.3.51 1.3.52 1.3.53 1.3.54 1.3.55 1.3.56 1.3.57 1.3.58 1.3.59 1.3.60 1.3.61 1.3.62 1.3.63 1.3.64 1.3.65 1.3.66 1.3.67 1.3.68 1.3.69 1.3.70 1.3.71 1.3.72 1.3.73 1.3.74 1.3.75 1.3.76 1.3.77 1.3.78 1.3.79 1.3.80 1.3.81 1.3.82 1.3.83 1.3.84 1.3.85 1.3.86 1.3.87 1.3.88 1.3.89 1.3.90 1.3.91 1.3.92 1.3.93 1.3.94 1.3.95 1.3.96 1.3.97 1.3.971 1.3.972 1.3.973 1.3.974 1.3.975 1.3.976 1.3.977 1.3.978 1.3.979 1.3.980 1.3.981 1.3.982 1.3.983 1.3.984 1.3.985 1.3.986 1.3.987 1.7.1 1.7.1001 1.7.1002 1.7.1003 1.7.1004 1.7.1005 1.7.1006 1.7.1007 1.7.1008 1.7.1009 1.7.1010 1.7.1011 1.7.1012 1.7.1013 1.7.1014 1.7.1015 1.7.1016 1.7.1017 1.7.1018 1.7.1019 1.7.1020 1.7.1021 1.7.1022 1.7.1023 1.7.1024 1.7.1025 1.7.1026 1.7.1027 1.7.1028 1.7.1029 1.7.1030 1.7.1031 1.7.1032 1.7.1033 1.7.1034 1.7.1035 1.7.1036 1.7.1037 1.7.1038 1.7.1039 1.7.1040 1.7.1041 1.7.1042 1.7.1043 1.7.1044 1.7.1045 1.7.1046 1.7.1047 1.7.1048 1.7.1049 1.7.1050 1.7.1051 1.7.1052 1.7.1053 1.7.1054 1.7.1055 1.7.1056 1.7.1057
royal-elementor-addons / freemius / templates / connect.php
royal-elementor-addons / freemius / templates Last commit date
account 5 days ago checkout 5 days ago connect 5 days ago debug 5 days ago forms 5 days ago js 5 days ago partials 5 days ago plugin-info 5 days ago account.php 5 days ago add-ons.php 5 days ago add-trial-to-pricing.php 5 days ago admin-notice.php 5 days ago ajax-loader.php 5 days ago api-connectivity-message-js.php 5 days ago auto-installation.php 5 days ago checkout.php 5 days ago clone-resolution-js.php 5 days ago connect.php 5 days ago contact.php 5 days ago debug.php 5 days ago email.php 5 days ago gdpr-optin-js.php 5 days ago index.php 5 days ago plugin-icon.php 5 days ago pricing.php 5 days ago secure-https-header.php 5 days ago sticky-admin-notice-js.php 5 days ago tabs-capture-js.php 5 days ago tabs.php 5 days ago
connect.php
1080 lines
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.7
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 * @var Freemius $fs
16 */
17 $fs = freemius( $VARS['id'] );
18 $slug = $fs->get_slug();
19
20 $is_pending_activation = $fs->is_pending_activation();
21 $is_premium_only = $fs->is_only_premium();
22 $has_paid_plans = $fs->has_paid_plan();
23 $is_premium_code = $fs->is_premium();
24 $is_freemium = $fs->is_freemium();
25
26 $fs->_enqueue_connect_essentials();
27
28 /**
29 * Enqueueing the styles in `_enqueue_connect_essentials()` is too late, as we need them in the HEADER. Therefore, inject the styles inline to avoid FOUC.
30 *
31 * @author Vova Feldman (@svovaf)
32 */
33 echo "<style>\n";
34 include WP_FS__DIR_CSS . '/admin/connect.css';
35 echo "</style>\n";
36
37 $current_user = Freemius::_get_current_wp_user();
38
39 $first_name = $current_user->user_firstname;
40 if ( empty( $first_name ) ) {
41 $first_name = $current_user->nickname;
42 }
43
44 $site_url = Freemius::get_unfiltered_site_url();
45 $protocol_pos = strpos( $site_url, '://' );
46 if ( false !== $protocol_pos ) {
47 $site_url = substr( $site_url, $protocol_pos + 3 );
48 }
49
50 $freemius_usage_tracking_url = $fs->get_usage_tracking_terms_url();
51 $freemius_plugin_terms_url = $fs->get_eula_url();
52
53 $error = fs_request_get( 'error' );
54
55 $has_release_on_freemius = $fs->has_release_on_freemius();
56
57 $require_license_key = $is_premium_only ||
58 (
59 $is_freemium &&
60 ( $is_premium_code || ! $has_release_on_freemius ) &&
61 fs_request_get_bool( 'require_license', ( $is_premium_code || $has_release_on_freemius ) )
62 );
63
64 $freemius_activation_terms_url = ($fs->is_premium() && $require_license_key) ?
65 $fs->get_license_activation_terms_url() :
66 $freemius_usage_tracking_url;
67
68 $freemius_activation_terms_html = '<a href="' . esc_url( $freemius_activation_terms_url ) . '" target="_blank" rel="noopener" tabindex="1">freemius.com</a>';
69
70 if ( $is_pending_activation ) {
71 $require_license_key = false;
72 }
73
74 if ( $require_license_key ) {
75 $fs->_add_license_activation_dialog_box();
76 }
77
78 $is_optin_dialog = (
79 $fs->is_theme() &&
80 $fs->is_themes_page() &&
81 $fs->show_opt_in_on_themes_page()
82 );
83
84 if ( $is_optin_dialog ) {
85 $show_close_button = false;
86 $previous_theme_activation_url = '';
87
88 if ( ! $is_premium_code ) {
89 $show_close_button = true;
90 } else if ( $is_premium_only ) {
91 $previous_theme_activation_url = $fs->get_previous_theme_activation_url();
92 $show_close_button = ( ! empty( $previous_theme_activation_url ) );
93 }
94 }
95
96 $is_network_level_activation = (
97 fs_is_network_admin() &&
98 $fs->is_network_active() &&
99 ! $fs->is_network_delegated_connection()
100 );
101
102 $fs_user = Freemius::_get_user_by_email( $current_user->user_email );
103
104 $activate_with_current_user = (
105 is_object( $fs_user ) &&
106 ! $is_pending_activation &&
107 // If requires a license for activation, use the user associated with the license for the opt-in.
108 ! $require_license_key &&
109 ! $is_network_level_activation
110 );
111
112 $optin_params = $fs->get_opt_in_params( array(), $is_network_level_activation );
113 $sites = isset( $optin_params['sites'] ) ? $optin_params['sites'] : array();
114
115 $is_network_upgrade_mode = ( fs_is_network_admin() && $fs->is_network_upgrade_mode() );
116
117 /* translators: %s: name (e.g. Hey John,) */
118 $hey_x_text = esc_html( sprintf( fs_text_x_inline( 'Hey %s,', 'greeting', 'hey-x', $slug ), $first_name ) );
119
120 $activation_state = array(
121 'is_license_activation' => $require_license_key,
122 'is_pending_activation' => $is_pending_activation,
123 'is_gdpr_required' => true,
124 'is_network_level_activation' => $is_network_level_activation,
125 'is_dialog' => $is_optin_dialog,
126 );
127 ?>
128 <?php
129 if ( $is_optin_dialog ) { ?>
130 <div id="fs_theme_connect_wrapper">
131 <?php
132 if ( $show_close_button ) { ?>
133 <button class="close dashicons dashicons-no"><span class="screen-reader-text">Close connect dialog</span>
134 </button>
135 <?php
136 }
137 ?>
138 <?php
139 }
140
141 /**
142 * Allows developers to include custom HTML before the opt-in content.
143 *
144 * @author Vova Feldman
145 * @since 2.3.2
146 */
147
148 // Note: Added by GOGA
149 if ( ! did_action( 'elementor/loaded' ) ) {
150 wpr_addons_fail_load();
151 } else {
152
153 $fs->do_action( 'connect/before', $activation_state );
154 ?>
155 <div id="fs_connect"
156 class="wrap<?php if ( ! fs_is_network_admin() && ( ! $fs->is_enable_anonymous() || $is_pending_activation || $require_license_key ) ) {
157 echo ' fs-anonymous-disabled';
158 } ?><?php echo $require_license_key ? ' require-license-key' : '' ?>">
159 <div class="fs-header">
160 <!-- <b class="fs-site-icon"><i class="dashicons dashicons-wordpress-alt"></i></b>-->
161 <?php
162 $size = 50;
163 $vars = array(
164 'id' => $fs->get_id(),
165 'size' => $size,
166 );
167
168 fs_require_once_template( 'plugin-icon.php', $vars );
169 ?>
170 </div>
171 <div class="fs-box-container">
172 <div class="fs-content">
173 <?php $fs->do_action( 'connect/before_message', $activation_state ) ?>
174
175 <?php if ( ! empty( $error ) ) : ?>
176 <div class="fs-error"><?php echo $fs->apply_filters( 'connect_error_esc_html', esc_html( $error ) ) ?></div>
177 <?php endif ?>
178 <?php
179 if ( ! $is_pending_activation && ! $require_license_key ) {
180 if ( ! $fs->is_plugin_update() ) {
181 echo $fs->apply_filters( 'connect-header', sprintf(
182 '<h2 style="text-align: center">%s</h2>',
183 esc_html( fs_text_inline( 'Never miss an important update', 'connect-header' ) )
184 ) );
185 } else {
186 echo $fs->apply_filters( 'connect-header_on-update', sprintf(
187 '<h2>%s</h2>',
188 sprintf(
189 esc_html(
190 /* translators: %1$s: plugin name (e.g., "Awesome Plugin"); %2$s: version (e.g., "1.2.3") */
191 fs_text_inline('Thank you for updating to %1$s v%2$s!', 'connect-header_on-update' )
192 ),
193 esc_html( $fs->get_plugin_name() ),
194 $fs->get_plugin_version()
195 )
196 ) );
197 }
198 }
199 ?>
200 <p><?php
201 $button_label = fs_text_inline( 'Allow & Continue', 'opt-in-connect', $slug );
202 $message = '';
203
204 if ( $is_pending_activation ) {
205 $button_label = fs_text_inline( 'Re-send activation email', 'resend-activation-email', $slug );
206
207 $message = $fs->apply_filters( 'pending_activation_message', sprintf(
208 /* translators: %s: name (e.g. Thanks John!) */
209 fs_text_inline( 'Thanks %s!', 'thanks-x', $slug ) . '<br>' .
210 fs_text_inline( 'You should receive a confirmation email for %s to your mailbox at %s. Please make sure you click the button in that email to %s.', 'pending-activation-message', $slug ),
211 $first_name,
212 '<b>' . $fs->get_plugin_name() . '</b>',
213 '<b>' . $current_user->user_email . '</b>',
214 fs_text_inline( 'complete the opt-in', 'complete-the-opt-in', $slug )
215 ) );
216 } else if ( $require_license_key ) {
217 $button_label = fs_text_inline( 'Activate License', 'activate-license', $slug );
218
219 $message = $fs->apply_filters(
220 'connect-message_on-premium',
221 sprintf( fs_text_inline( 'Welcome to %s! To get started, please enter your license key:', 'thanks-for-purchasing', $slug ), '<b>' . $fs->get_plugin_name() . '</b>' ),
222 $first_name,
223 $fs->get_plugin_name()
224 );
225 } else {
226 $filter = 'connect_message';
227
228 if ( ! $fs->is_plugin_update() ) {
229 $default_optin_message = esc_html(
230 sprintf(
231 /* translators: %s: module type (plugin, theme, or add-on) */
232 fs_text_inline( 'Opt in to get email notifications for security & feature updates, educational content, and occasional offers, and to share some basic WordPress environment info. This will help us make the %s more compatible with your site and better at doing what you need it to.', 'connect-message', $slug ),
233 $fs->get_module_label( true )
234 )
235 );
236 } else {
237 // If Freemius was added on a plugin update, set different
238 // opt-in message.
239
240 /* translators: %s: module type (plugin, theme, or add-on) */
241 $default_optin_message = esc_html( sprintf( fs_text_inline( 'We have introduced this opt-in so you never miss an important update and help us make the %s more compatible with your site and better at doing what you need it to.', 'connect-message_on-update_why' ), $fs->get_module_label( true ) ) );
242
243 $default_optin_message .= '<br><br>' . esc_html( fs_text_inline( 'Opt in to get email notifications for security & feature updates, educational content, and occasional offers, and to share some basic WordPress environment info.', 'connect-message_on-update', $slug ) );
244
245 if ( $fs->is_enable_anonymous() ) {
246 $default_optin_message .= ' ' . esc_html( fs_text_inline( 'If you skip this, that\'s okay! %1$s will still work just fine.', 'connect-message_on-update_skip', $slug ) );
247 }
248
249 // If user customized the opt-in message on update, use
250 // that message. Otherwise, fallback to regular opt-in
251 // custom message if exists.
252 if ( $fs->has_filter( 'connect_message_on_update' ) ) {
253 $filter = 'connect_message_on_update';
254 }
255 }
256
257 $message = $fs->apply_filters(
258 $filter,
259 sprintf(
260 $default_optin_message,
261 '<b>' . esc_html( $fs->get_plugin_name() ) . '</b>',
262 '<b>' . $current_user->user_login . '</b>',
263 '<a href="' . $site_url . '" target="_blank" rel="noopener noreferrer">' . $site_url . '</a>',
264 $freemius_activation_terms_html
265 ),
266 $first_name,
267 $fs->get_plugin_name(),
268 $current_user->user_login,
269 '<a href="' . $site_url . '" target="_blank" rel="noopener noreferrer">' . $site_url . '</a>',
270 $freemius_activation_terms_html,
271 true
272 );
273 }
274
275 if ( $is_network_upgrade_mode ) {
276 $network_integration_text = esc_html( fs_text_inline( 'We\'re excited to introduce the Freemius network-level integration.', 'connect_message_network_upgrade', $slug ) );
277
278 if ($is_premium_code){
279 $message = $network_integration_text . ' ' . sprintf( fs_text_inline( 'During the update process we detected %d site(s) that are still pending license activation.', 'connect_message_network_upgrade-premium', $slug ), count( $sites ) );
280
281 $message .= '<br><br>' . sprintf( fs_text_inline( 'If you\'d like to use the %s on those sites, please enter your license key below and click the activation button.', 'connect_message_network_upgrade-premium-activate-license', $slug ), $is_premium_only ? $fs->get_module_label( true ) : sprintf(
282 /* translators: %s: module type (plugin, theme, or add-on) */
283 fs_text_inline( "%s's paid features", 'x-paid-features', $slug ),
284 $fs->get_module_label( true )
285 ) );
286
287 /* translators: %s: module type (plugin, theme, or add-on) */
288 $message .= ' ' . sprintf( fs_text_inline( 'Alternatively, you can skip it for now and activate the license later, in your %s\'s network-level Account page.', 'connect_message_network_upgrade-premium-skip-license', $slug ), $fs->get_module_label( true ) );
289 }else {
290 $message = $network_integration_text . ' ' . sprintf( fs_text_inline( 'During the update process we detected %s site(s) in the network that are still pending your attention.', 'connect_message_network_upgrade-free', $slug ), count( $sites ) ) . '<br><br>' . ( fs_starts_with( $message, $hey_x_text . '<br>' ) ? substr( $message, strlen( $hey_x_text . '<br>' ) ) : $message );
291 }
292 }
293
294 echo $message;
295 ?></p>
296 <?php if ( $require_license_key ) : ?>
297 <div class="fs-license-key-container">
298 <input id="fs_license_key" name="fs_key" type="text" required maxlength="<?php echo $fs->apply_filters('license_key_maxlength', 32) ?>"
299 placeholder="<?php fs_esc_attr_echo_inline( 'License key', 'license-key', $slug ) ?>" tabindex="1"/>
300 <i class="dashicons dashicons-admin-network"></i>
301 <a class="show-license-resend-modal show-license-resend-modal-<?php echo $fs->get_unique_affix() ?>"
302 href="#"><?php fs_esc_html_echo_inline( "Can't find your license key?", 'cant-find-license-key', $slug ); ?></a>
303 </div>
304
305 <?php
306 /**
307 * Allows developers to include custom HTML after the license input container.
308 *
309 * @author Vova Feldman
310 * @since 2.1.2
311 */
312 $fs->do_action( 'connect/after_license_input', $activation_state );
313 ?>
314
315 <?php
316 $send_updates_text = sprintf(
317 '%s<span class="action-description"> - %s</span>',
318 $fs->get_text_inline( 'Yes', 'yes' ),
319 $fs->get_text_inline( 'send me security & feature updates, educational content and offers.', 'send-updates' )
320 );
321
322 $do_not_send_updates_text = sprintf(
323 '%s<span class="action-description"> - %s</span>',
324 $fs->get_text_inline( 'No', 'no' ),
325 sprintf(
326 $fs->get_text_inline( 'do %sNOT%s send me security & feature updates, educational content and offers.', 'do-not-send-updates' ),
327 '<span class="underlined">',
328 '</span>'
329 )
330 );
331 ?>
332 <div id="fs_marketing_optin">
333 <span class="fs-message"><?php fs_echo_inline( "Please let us know if you'd like us to contact you for security & feature updates, educational content, and occasional offers:", 'contact-for-updates' ) ?></span>
334 <div class="fs-input-container">
335 <label>
336 <input type="radio" name="allow-marketing" value="true" tabindex="1" />
337 <span class="fs-input-label"><?php echo $send_updates_text ?></span>
338 </label>
339 <label>
340 <input type="radio" name="allow-marketing" value="false" tabindex="1" />
341 <span class="fs-input-label"><?php echo $do_not_send_updates_text ?></span>
342 </label>
343 </div>
344 </div>
345 <div id="fs_orphan_license_message">
346 <span class="fs-message"><?php fs_echo_inline( "A user has not yet been associated with the license, which is necessary to prevent unauthorized activation. To assign the license to your user, you agree to share your WordPress user's full name and email address." ) ?></span>
347 </div>
348 <?php endif ?>
349 <?php if ( $is_network_level_activation ) : ?>
350 <?php
351 $vars = array(
352 'id' => $fs->get_id(),
353 'sites' => $sites,
354 'require_license_key' => $require_license_key
355 );
356
357 echo fs_get_template( 'partials/network-activation.php', $vars );
358 ?>
359 <?php endif ?>
360
361 <?php $fs->do_action( 'connect/after_message', $activation_state ) ?>
362 </div>
363 <div class="fs-actions">
364 <?php $fs->do_action( 'connect/before_actions', $activation_state ) ?>
365
366 <?php if ( $fs->is_enable_anonymous() && ! $is_pending_activation && ( ! $require_license_key || $is_network_upgrade_mode ) ) : ?>
367 <a id="skip_activation" href="<?php echo fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_skip_activation' ), $is_network_level_activation ), $fs->get_unique_affix() . '_skip_activation' ) ?>"
368 class="button button-secondary" tabindex="2"><?php fs_esc_html_echo_x_inline( 'Skip', 'verb', 'skip', $slug ) ?></a>
369 <?php endif ?>
370 <?php if ( $is_network_level_activation && $fs->apply_filters( 'show_delegation_option', true ) ) : ?>
371 <a id="delegate_to_site_admins" class="fs-tooltip-trigger <?php echo is_rtl() ? ' rtl' : '' ?>" href="<?php echo fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_delegate_activation' ) ), $fs->get_unique_affix() . '_delegate_activation' ) ?>"><?php fs_esc_html_echo_inline( 'Delegate to Site Admins', 'delegate-to-site-admins', $slug ) ?><span class="fs-tooltip"><?php fs_esc_html_echo_inline( 'If you click it, this decision will be delegated to the sites administrators.', 'delegate-sites-tooltip', $slug ) ?></span></a>
372 <?php endif ?>
373 <?php if ( $activate_with_current_user ) : ?>
374 <form action="" method="POST">
375 <input type="hidden" name="fs_action"
376 value="<?php echo esc_attr( $fs->get_unique_affix() . '_activate_existing' ) ?>">
377 <?php wp_nonce_field( $fs->get_unique_affix() . '_activate_existing' ) ?>
378 <input type="hidden" name="is_extensions_tracking_allowed" value="1">
379 <input type="hidden" name="is_diagnostic_tracking_allowed" value="1">
380 <button class="button button-primary" tabindex="1"
381 type="submit"><?php echo esc_html( $button_label ) ?></button>
382 </form>
383 <?php else : ?>
384 <form method="post" action="<?php echo WP_FS__ADDRESS ?>/action/service/user/install/">
385 <?php unset( $optin_params['sites']); ?>
386 <?php foreach ( $optin_params as $name => $value ) : ?>
387 <input type="hidden" name="<?php echo esc_attr( $name ) ?>" value="<?php echo esc_attr( $value ) ?>">
388 <?php endforeach ?>
389 <input type="hidden" name="is_extensions_tracking_allowed" value="1">
390 <input type="hidden" name="is_diagnostic_tracking_allowed" value="1">
391 <button class="button button-primary" tabindex="1"
392 type="submit"<?php if ( $require_license_key ) {
393 echo ' disabled="disabled"';
394 } ?>><?php echo esc_html( $button_label ) ?></button>
395 </form>
396 <?php endif ?>
397 <?php if ( $require_license_key ) : ?>
398 <a id="license_issues_link"
399 href="<?php echo esc_url( $fs->apply_filters( 'known_license_issues_url', 'https://freemius.com/help/documentation/wordpress-sdk/license-activation-issues/' ) ) ?>"
400 target="_blank"><?php fs_esc_html_echo_inline( 'License issues?', 'license-issues', $slug ) ?></a>
401 <?php endif ?>
402
403 <?php $fs->do_action( 'connect/after_actions', $activation_state ) ?>
404 </div><?php
405 $permission_manager = FS_Permission_Manager::instance( $fs );
406
407 // Set core permission list items.
408 $permissions = array();
409
410 // Add newsletter permissions if enabled.
411 if ( $fs->is_permission_requested( 'newsletter' ) ) {
412 $permissions[] = $permission_manager->get_newsletter_permission();
413 }
414
415 // Note: Added by Duke
416 $permissions[] = array(
417 'id' => 'royaladdons',
418 'icon-class' => 'dashicons dashicons-search',
419 'label' => 'Templates Kit & Elementor Search',
420 'tooltip' => 'Templates Kit & Elementor Search Data.',
421 'desc' => 'Searched query of Templates Kit and Elmenetor Widgets Panel.',
422 'priority' => 25,
423 );
424
425 $permissions = $permission_manager->get_permissions(
426 $require_license_key,
427 $permissions
428 );
429
430 if ( ! empty( $permissions ) ) : ?>
431 <div class="fs-permissions">
432 <?php if ( $require_license_key ) : ?>
433 <a class="fs-trigger wp-core-ui" href="#" tabindex="1" style="color: inherit;"><?php echo sprintf(
434 fs_esc_html_inline( 'For delivery of security & feature updates, and license management, %s needs to', 'license-sync-disclaimer', $slug ) . '<b class="fs-arrow"></b>',
435 sprintf( '<nobr class="button-link" style="color: inherit;">%s</nobr>', esc_html( $fs->get_plugin_title() ) )
436 ) ?></a>
437 <?php else : ?>
438 <a class="fs-trigger wp-core-ui" href="#" tabindex="1" style="color: inherit;"><?php printf(
439 fs_esc_html_inline( 'This will allow %s to', 'this-will-allow-x', $slug ) . '<b class="fs-arrow"></b>',
440 sprintf( '<nobr class="button-link" style="color: inherit;">%s</nobr>', esc_html( $fs->get_plugin_title() ) )
441 ) ?></a>
442 <?php endif ?>
443 <ul><?php
444 foreach ( $permissions as $permission ) {
445 $permission_manager->render_permission( $permission );
446 }
447 ?></ul>
448 </div>
449 <?php endif ?>
450 <?php if ( $is_premium_code && $is_freemium ) : ?>
451 <div class="fs-freemium-licensing">
452 <p>
453 <?php if ( $require_license_key ) : ?>
454 <?php fs_esc_html_echo_inline( 'Don\'t have a license key?', 'dont-have-license-key', $slug ) ?>
455 <a data-require-license="false" tabindex="1"><?php fs_esc_html_echo_inline( 'Activate Free Version', 'activate-free-version', $slug ) ?></a>
456 <?php else : ?>
457 <?php fs_echo_inline( 'Have a license key?', 'have-license-key', $slug ) ?>
458 <a data-require-license="true" tabindex="1"><?php fs_esc_html_echo_inline( 'Activate License', 'activate-license', $slug ) ?></a>
459 <?php endif ?>
460 </p>
461 </div>
462 <?php endif ?>
463 </div>
464 <div class="fs-terms">
465 <a class="fs-tooltip-trigger<?php echo is_rtl() ? ' rtl' : '' ?>" href="<?php echo esc_url( $freemius_activation_terms_url ) ?>" target="_blank" rel="noopener" tabindex="1">Powered by Freemius<?php if ( $require_license_key ) : ?> <span class="fs-tooltip" style="width: 170px"><?php echo esc_html( $fs->get_text_inline( 'Freemius is our licensing and software updates engine', 'permissions-extensions_desc' ) ) ?></span><?php endif ?></a>
466 &nbsp;&nbsp;-&nbsp;&nbsp;
467 <a href="https://freemius.com/privacy/" target="_blank" rel="noopener"
468 tabindex="1"><?php fs_esc_html_echo_inline( 'Privacy Policy', 'privacy-policy', $slug ) ?></a>
469 &nbsp;&nbsp;-&nbsp;&nbsp;
470 <?php if ($require_license_key) : ?>
471 <a href="<?php echo esc_url( $freemius_plugin_terms_url ) ?>" target="_blank" rel="noopener" tabindex="1"><?php fs_echo_inline( 'License Agreement', 'license-agreement', $slug ) ?></a>
472 <?php else : ?>
473 <a href="<?php echo esc_url( $freemius_usage_tracking_url ) ?>" target="_blank" rel="noopener" tabindex="1"><?php fs_echo_inline( 'Terms of Service', 'tos', $slug ) ?></a>
474 <?php endif; ?>
475 </div>
476 </div>
477 <?php
478 /**
479 * Allows developers to include custom HTML after the opt-in content.
480 *
481 * @author Vova Feldman
482 * @since 2.3.2
483 */
484 $fs->do_action( 'connect/after', $activation_state );
485
486 if ( $is_optin_dialog ) { ?>
487 </div>
488 <?php
489 }
490 ?>
491 <script type="text/javascript">
492 (function ($) {
493 var $html = $('html');
494
495 <?php
496 if ( $is_optin_dialog ) {
497 if ( $show_close_button ) { ?>
498 var $themeConnectWrapper = $('#fs_theme_connect_wrapper');
499
500 $themeConnectWrapper.find('button.close').on('click', function () {
501 <?php if ( ! empty( $previous_theme_activation_url ) ) { ?>
502 location.href = '<?php echo html_entity_decode( $previous_theme_activation_url ); ?>';
503 <?php } else { ?>
504 $themeConnectWrapper.remove();
505 $html.css({overflow: $html.attr('fs-optin-overflow')});
506 <?php } ?>
507 });
508 <?php
509 }
510 ?>
511
512 $html.attr('fs-optin-overflow', $html.css('overflow'));
513 $html.css({overflow: 'hidden'});
514
515 <?php
516 }
517 ?>
518
519 var $primaryCta = $('.fs-actions .button.button-primary'),
520 primaryCtaLabel = $primaryCta.html(),
521 $form = $('.fs-actions form'),
522 isNetworkActive = <?php echo $is_network_level_activation ? 'true' : 'false' ?>,
523 requireLicenseKey = <?php echo $require_license_key ? 'true' : 'false' ?>,
524 hasContextUser = <?php echo $activate_with_current_user ? 'true' : 'false' ?>,
525 isNetworkUpgradeMode = <?php echo $is_network_upgrade_mode ? 'true' : 'false' ?>,
526 $licenseSecret,
527 $licenseKeyInput = $('#fs_license_key'),
528 pauseCtaLabelUpdate = false,
529 isNetworkDelegating = false,
530 /**
531 * @author Leo Fajardo (@leorw)
532 * @since 2.1.0
533 */
534 resetLoadingMode = function() {
535 // Reset loading mode.
536 $primaryCta.html(primaryCtaLabel);
537 $primaryCta.prop('disabled', false);
538 $( '.fs-loading' ).removeClass( 'fs-loading' );
539
540 console.log('resetLoadingMode - Primary button was enabled');
541 },
542 setLoadingMode = function () {
543 $( document.body ).addClass( 'fs-loading' );
544 };
545
546 $('.fs-actions .button').on('click', function () {
547 setLoadingMode();
548
549 var $this = $(this);
550
551 setTimeout(function () {
552 if ( ! requireLicenseKey || ! $marketingOptin.hasClass( 'error' ) ) {
553 $this.attr('disabled', 'disabled');
554 }
555 }, 200);
556 });
557
558 if ( isNetworkActive ) {
559 var
560 $multisiteOptionsContainer = $( '.fs-multisite-options-container' ),
561 $allSitesOptions = $( '.fs-all-sites-options' ),
562 $applyOnAllSites = $( '.fs-apply-on-all-sites-checkbox' ),
563 $sitesListContainer = $( '.fs-sites-list-container' ),
564 totalSites = <?php echo count( $sites ) ?>,
565 maxSitesListHeight = null,
566 $skipActivationButton = $( '#skip_activation' ),
567 $delegateToSiteAdminsButton = $( '#delegate_to_site_admins' ),
568 hasAnyInstall = <?php echo ! is_null( $fs->find_first_install() ) ? 'true' : 'false' ?>;
569
570 $applyOnAllSites.click(function() {
571 var isChecked = $( this ).is( ':checked' );
572
573 if ( isChecked ) {
574 $multisiteOptionsContainer.find( '.action' ).removeClass( 'selected' );
575 updatePrimaryCtaText( 'allow' );
576 }
577
578 $multisiteOptionsContainer.find( '.action-allow' ).addClass( 'selected' );
579
580 $skipActivationButton.toggle();
581
582 $delegateToSiteAdminsButton.toggle();
583
584 $multisiteOptionsContainer.toggleClass( 'fs-apply-on-all-sites', isChecked );
585
586 $sitesListContainer.toggle( ! isChecked );
587 if ( ! isChecked && null === maxSitesListHeight ) {
588 /**
589 * Set the visible number of rows to 5 (5 * height of the first row).
590 *
591 * @author Leo Fajardo (@leorw)
592 */
593 maxSitesListHeight = ( 5 * $sitesListContainer.find( 'tr:first' ).height() );
594 $sitesListContainer.css( 'max-height', maxSitesListHeight );
595 }
596 });
597
598 $allSitesOptions.find( '.action' ).click(function( evt ) {
599 var actionType = $( evt.target ).data( 'action-type' );
600
601 $multisiteOptionsContainer.find( '.action' ).removeClass( 'selected' );
602 $multisiteOptionsContainer.find( '.action-' + actionType ).toggleClass( 'selected' );
603
604 updatePrimaryCtaText( actionType );
605 });
606
607 $sitesListContainer.delegate( 'td:not(:first-child)', 'click', function() {
608 // If a site row is clicked, trigger a click on the checkbox.
609 $( this ).parent().find( 'td:first-child input' ).click();
610 } );
611
612 $sitesListContainer.delegate( '.action', 'click', function( evt ) {
613 var $this = $( evt.target );
614 if ( $this.hasClass( 'selected' ) ) {
615 return false;
616 }
617
618 $this.parents( 'tr:first' ).find( '.action' ).removeClass( 'selected' );
619 $this.toggleClass( 'selected' );
620
621 var
622 singleSiteActionType = $this.data( 'action-type' ),
623 totalSelected = $sitesListContainer.find( '.action-' + singleSiteActionType + '.selected' ).length;
624
625 $allSitesOptions.find( '.action.selected' ).removeClass( 'selected' );
626
627 if ( totalSelected === totalSites ) {
628 $allSitesOptions.find( '.action-' + singleSiteActionType ).addClass( 'selected' );
629
630 updatePrimaryCtaText( singleSiteActionType );
631 } else {
632 updatePrimaryCtaText( 'mixed' );
633 }
634 });
635
636 if ( isNetworkUpgradeMode || hasAnyInstall ) {
637 $skipActivationButton.click(function(){
638 $delegateToSiteAdminsButton.hide();
639
640 $skipActivationButton.html('<?php fs_esc_js_echo_inline( 'Skipping, please wait', 'skipping-wait', $slug ) ?>...');
641
642 pauseCtaLabelUpdate = true;
643
644 // Check all sites to be skipped.
645 $allSitesOptions.find('.action.action-skip').click();
646
647 $form.submit();
648
649 pauseCtaLabelUpdate = false;
650
651 return false;
652 });
653
654 $delegateToSiteAdminsButton.click(function(){
655 $delegateToSiteAdminsButton.html('<?php fs_esc_js_echo_inline( 'Delegating, please wait', 'delegating-wait', $slug ) ?>...');
656
657 pauseCtaLabelUpdate = true;
658
659 /**
660 * Set to true so that the form submission handler can differentiate delegation from license
661 * activation and the proper AJAX action will be used (when delegating, the action should be
662 * `network_activate` and not `activate_license`).
663 *
664 * @author Leo Fajardo (@leorw)
665 * @since 2.3.0
666 */
667 isNetworkDelegating = true;
668
669 // Check all sites to be skipped.
670 $allSitesOptions.find('.action.action-delegate').click();
671
672 $form.submit();
673
674 pauseCtaLabelUpdate = false;
675
676 /**
677 * Set to false so that in case the previous AJAX request has failed, the form submission handler
678 * can differentiate license activation from delegation and the proper AJAX action will be used
679 * (when activating a license, the action should be `activate_license` and not `network_activate`).
680 *
681 * @author Leo Fajardo (@leorw)
682 * @since 2.3.0
683 */
684 isNetworkDelegating = false;
685
686 return false;
687 });
688 }
689 }
690
691 /**
692 * @author Leo Fajardo (@leorw)
693 */
694 function updatePrimaryCtaText( actionType ) {
695 if (pauseCtaLabelUpdate)
696 return;
697
698 var text = '<?php fs_esc_js_echo_inline( 'Continue', 'continue', $slug ) ?>';
699
700 switch ( actionType ) {
701 case 'allow':
702 text = '<?php fs_esc_js_echo_inline( 'Allow & Continue', 'opt-in-connect', $slug ) ?>';
703 break;
704 case 'delegate':
705 text = '<?php fs_esc_js_echo_inline( 'Delegate to Site Admins & Continue', 'delegate-to-site-admins-and-continue', $slug ) ?>';
706 break;
707 case 'skip':
708 text = '<?php fs_esc_js_echo_x_inline( 'Skip', 'verb', 'skip', $slug ) ?>';
709 break;
710 }
711
712 $primaryCta.html( text );
713 }
714
715 var ajaxOptin = ( requireLicenseKey || isNetworkActive );
716
717 $form.on('submit', function () {
718 var $extensionsPermission = $( '#fs_permission_extensions .fs-switch' ),
719 isExtensionsTrackingAllowed = ( $extensionsPermission.length > 0 ) ?
720 $extensionsPermission.hasClass( 'fs-on' ) :
721 null;
722
723 var $diagnosticPermission = $( '#fs_permission_diagnostic .fs-switch' ),
724 isDiagnosticTrackingAllowed = ( $diagnosticPermission.length > 0 ) ?
725 $diagnosticPermission.hasClass( 'fs-on' ) :
726 null;
727
728 if ( null === isExtensionsTrackingAllowed ) {
729 $( 'input[name=is_extensions_tracking_allowed]' ).remove();
730 } else {
731 $( 'input[name=is_extensions_tracking_allowed]' ).val( isExtensionsTrackingAllowed ? 1 : 0 );
732 }
733
734 // We are not showing switch to enable/disable diagnostic tracking while activating free version. So, don't remove hidden `is_diagnostic_tracking_allowed` element from DOM and change the value only if switch is available.
735 if ( null !== isDiagnosticTrackingAllowed ) {
736 $( 'input[name=is_diagnostic_tracking_allowed]' ).val( isDiagnosticTrackingAllowed ? 1 : 0 );
737 }
738
739 /**
740 * @author Vova Feldman (@svovaf)
741 * @since 1.1.9
742 */
743 if ( ajaxOptin ) {
744 if (!hasContextUser || isNetworkUpgradeMode) {
745 var action = null,
746 security = null;
747
748 if ( requireLicenseKey && ! isNetworkDelegating ) {
749 action = '<?php echo $fs->get_ajax_action( 'activate_license' ) ?>';
750 security = '<?php echo $fs->get_ajax_security( 'activate_license' ) ?>';
751 } else {
752 action = '<?php echo $fs->get_ajax_action( 'network_activate' ) ?>';
753 security = '<?php echo $fs->get_ajax_security( 'network_activate' ) ?>';
754 }
755
756 $('.fs-error').remove();
757
758 var
759 licenseKey = $licenseKeyInput.val(),
760 data = {
761 action : action,
762 security : security,
763 license_key : licenseKey,
764 module_id : '<?php echo $fs->get_id() ?>',
765 license_owner_id: licenseOwnerIDByLicense[ licenseKey ]
766 };
767
768 if (
769 requireLicenseKey &&
770 ! isNetworkDelegating &&
771 isMarketingAllowedByLicense.hasOwnProperty(licenseKey)
772 ) {
773 var
774 isMarketingAllowed = null,
775 $isMarketingAllowed = $marketingOptin.find( 'input[type="radio"][name="allow-marketing"]:checked');
776
777
778 if ($isMarketingAllowed.length > 0)
779 isMarketingAllowed = ('true' == $isMarketingAllowed.val());
780
781 if ( null == isMarketingAllowedByLicense[ licenseKey ] &&
782 null == isMarketingAllowed
783 ) {
784 $marketingOptin.addClass( 'error' ).show();
785 resetLoadingMode();
786 return false;
787 } else if ( null == isMarketingAllowed ) {
788 isMarketingAllowed = isMarketingAllowedByLicense[ licenseKey ];
789 }
790
791 data.is_marketing_allowed = isMarketingAllowed;
792
793 data.is_extensions_tracking_allowed = isExtensionsTrackingAllowed;
794
795 data.is_diagnostic_tracking_allowed = isDiagnosticTrackingAllowed;
796 }
797
798 $marketingOptin.removeClass( 'error' );
799
800 if ( isNetworkActive ) {
801 var
802 sites = [],
803 applyOnAllSites = $applyOnAllSites.is( ':checked' );
804
805 $sitesListContainer.find( 'tr' ).each(function() {
806 var
807 $this = $( this ),
808 includeSite = ( ! requireLicenseKey || applyOnAllSites || $this.find( 'input' ).is( ':checked' ) );
809
810 if ( ! includeSite )
811 return;
812
813 var site = {
814 uid : $this.find( '.uid' ).val(),
815 url : $this.find( '.url' ).val(),
816 title : $this.find( '.title' ).val(),
817 language: $this.find( '.language' ).val(),
818 blog_id : $this.find( '.blog-id' ).find( 'span' ).text()
819 };
820
821 if ( ! requireLicenseKey) {
822 site.action = $this.find('.action.selected').data('action-type');
823 } else if ( isNetworkDelegating ) {
824 site.action = 'delegate';
825 }
826
827 sites.push( site );
828 });
829
830 data.sites = sites;
831
832 if ( hasAnyInstall ) {
833 data.has_any_install = hasAnyInstall;
834 }
835 }
836
837 /**
838 * Use the AJAX opt-in when license key is required to potentially
839 * process the after install failure hook.
840 *
841 * @author Vova Feldman (@svovaf)
842 * @since 1.2.1.5
843 */
844 $.ajax({
845 url : <?php echo Freemius::ajax_url() ?>,
846 method : 'POST',
847 data : data,
848 success: function (result) {
849 var resultObj = $.parseJSON(result);
850 if (resultObj.success) {
851 // Redirect to the "Account" page and sync the license.
852 window.location.href = resultObj.next_page;
853 } else {
854 resetLoadingMode();
855
856 // Show error.
857 $('.fs-content').prepend('<div class="fs-error">' + (resultObj.error.message ? resultObj.error.message : resultObj.error) + '</div>');
858 }
859 },
860 error: function () {
861 resetLoadingMode();
862 }
863 });
864
865 return false;
866 }
867 else {
868 if (null == $licenseSecret) {
869 $licenseSecret = $('<input type="hidden" name="license_secret_key" value="" />');
870 $form.append($licenseSecret);
871 }
872
873 // Update secret key if premium only plugin.
874 $licenseSecret.val($licenseKeyInput.val());
875 }
876 }
877
878 return true;
879 });
880
881 $( '#fs_connect .fs-permissions .fs-switch' ).on( 'click', function () {
882 $( this )
883 .toggleClass( 'fs-on' )
884 .toggleClass( 'fs-off' );
885
886 $( this ).closest( '.fs-permission' )
887 .toggleClass( 'fs-disabled' );
888 });
889
890 $primaryCta.on('click', function () {
891 console.log('Primary button was clicked');
892
893 $(this).addClass('fs-loading');
894 $(this).html('<?php echo esc_js( $is_pending_activation ?
895 fs_text_x_inline( 'Sending email', 'as in the process of sending an email', 'sending-email', $slug ) :
896 fs_text_x_inline( 'Activating', 'as activating plugin', 'activating', $slug )
897 ) ?>...');
898 });
899
900 $('.fs-permissions .fs-trigger').on('click', function () {
901 $('.fs-permissions').toggleClass('fs-open');
902
903 return false;
904 });
905
906 if (requireLicenseKey) {
907 /**
908 * Submit license key on enter.
909 *
910 * @author Vova Feldman (@svovaf)
911 * @since 1.1.9
912 */
913 $licenseKeyInput.keypress(function (e) {
914 if (e.which == 13) {
915 if ('' !== $(this).val()) {
916 $primaryCta.click();
917 return false;
918 }
919 }
920 });
921
922 /**
923 * Disable activation button when empty license key.
924 *
925 * @author Vova Feldman (@svovaf)
926 * @since 1.1.9
927 */
928 $licenseKeyInput.on('keyup paste delete cut', function () {
929 setTimeout(function () {
930 var key = $licenseKeyInput.val();
931
932 if (key == previousLicenseKey){
933 return;
934 }
935
936 if ('' === key) {
937 $primaryCta.attr('disabled', 'disabled');
938 hideOptinAndLicenseMessage();
939 } else {
940 $primaryCta.prop('disabled', false);
941
942 if (32 <= key.length){
943 fetchIsMarketingAllowedFlagAndToggleOptin();
944 } else {
945 hideOptinAndLicenseMessage();
946 }
947 }
948
949 previousLicenseKey = key;
950 }, 100);
951 }).focus();
952 }
953
954 /**
955 * Set license mode trigger URL.
956 *
957 * @author Vova Feldman (@svovaf)
958 * @since 1.1.9
959 */
960 var
961 $connectLicenseModeTrigger = $('#fs_connect .fs-freemium-licensing a'),
962 href = window.location.href;
963
964 if (href.indexOf('?') > 0) {
965 href += '&';
966 } else {
967 href += '?';
968 }
969
970 if ($connectLicenseModeTrigger.length > 0) {
971 $connectLicenseModeTrigger.attr(
972 'href',
973 href + 'require_license=' + $connectLicenseModeTrigger.attr('data-require-license')
974 );
975 }
976
977 //--------------------------------------------------------------------------------
978 //region GDPR
979 //--------------------------------------------------------------------------------
980 var isMarketingAllowedByLicense = {},
981 licenseOwnerIDByLicense = {},
982 $marketingOptin = $( '#fs_marketing_optin' ),
983 $orphanLicenseMessage = $( '#fs_orphan_license_message' ),
984 previousLicenseKey = null;
985
986 if (requireLicenseKey) {
987
988 var
989 afterMarketingFlagLoaded = function () {
990 var licenseKey = $licenseKeyInput.val();
991
992 if (null == isMarketingAllowedByLicense[licenseKey]) {
993 $marketingOptin.show();
994
995 if ($marketingOptin.find('input[type=radio]:checked').length > 0){
996 // Focus on button if GDPR opt-in already selected is already selected.
997 $primaryCta.focus();
998 } else {
999 // Focus on the GDPR opt-in radio button.
1000 $($marketingOptin.find('input[type=radio]')[0]).focus();
1001 }
1002 } else {
1003 $marketingOptin.hide();
1004 $primaryCta.focus();
1005 }
1006
1007 $orphanLicenseMessage.toggle( false === licenseOwnerIDByLicense[ licenseKey ] );
1008
1009 if ( false !== licenseOwnerIDByLicense[ licenseKey ] ) {
1010 $( 'input[name=user_firstname]' ).remove();
1011 $( 'input[name=user_lastname]' ).remove();
1012 $( 'input[name=user_email]' ).remove();
1013 }
1014 },
1015 /**
1016 * @author Leo Fajardo (@leorw)
1017 * @since 2.1.0
1018 */
1019 fetchIsMarketingAllowedFlagAndToggleOptin = function () {
1020 var licenseKey = $licenseKeyInput.val();
1021
1022 if (licenseKey.length < 32) {
1023 hideOptinAndLicenseMessage();
1024
1025 return;
1026 }
1027
1028 if (isMarketingAllowedByLicense.hasOwnProperty(licenseKey)) {
1029 afterMarketingFlagLoaded();
1030 return;
1031 }
1032
1033 hideOptinAndLicenseMessage();
1034 setLoadingMode();
1035
1036 $primaryCta.addClass('fs-loading');
1037 $primaryCta.attr('disabled', 'disabled');
1038 $primaryCta.html('<?php fs_esc_js_echo_inline( 'Please wait', 'please-wait', $slug ) ?>...');
1039
1040 $.ajax({
1041 url : <?php echo Freemius::ajax_url() ?>,
1042 method : 'POST',
1043 data : {
1044 action : '<?php echo $fs->get_ajax_action( 'fetch_is_marketing_required_flag_value' ) ?>',
1045 security : '<?php echo $fs->get_ajax_security( 'fetch_is_marketing_required_flag_value' ) ?>',
1046 license_key: licenseKey,
1047 module_id : '<?php echo $fs->get_id() ?>'
1048 },
1049 success: function (result) {
1050 resetLoadingMode();
1051
1052 if (result.success) {
1053 result = result.data;
1054
1055 // Cache result.
1056 isMarketingAllowedByLicense[licenseKey] = result.is_marketing_allowed;
1057 licenseOwnerIDByLicense[ licenseKey ] = result.license_owner_id;
1058 }
1059
1060 afterMarketingFlagLoaded();
1061 }
1062 });
1063 },
1064 hideOptinAndLicenseMessage = function() {
1065 $marketingOptin.hide();
1066 $orphanLicenseMessage.hide();
1067 };
1068
1069 $marketingOptin.find( 'input' ).click(function() {
1070 $marketingOptin.removeClass( 'error' );
1071 });
1072 }
1073
1074 //endregion
1075 })(jQuery);
1076 </script>
1077 <?php
1078 fs_require_once_template( 'api-connectivity-message-js.php' );
1079
1080 } // if ( ! did_action( 'elementor/loaded' ) )