PluginProbe
Tiered Pricing Table for WooCommerce / 2.1.2
Tiered Pricing Table for WooCommerce v2.1.2
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
← All changes | freemius/templates/connect.php +166 -296 8.0.2 → 2.1.2 View file →
@@ -24,17 +24,8 @@
24 24 $is_freemium = $fs->is_freemium();
25 25
26 26 $fs->_enqueue_connect_essentials();
27 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 28 $current_user = Freemius::_get_current_wp_user();
38 29
39 30 $first_name = $current_user->user_firstname;
40 31 if ( empty( $first_name ) ) {
@@ -40,34 +31,37 @@
40 31 if ( empty( $first_name ) ) {
41 32 $first_name = $current_user->nickname;
42 33 }
43 34
44 - $site_url = Freemius::get_unfiltered_site_url();
35 + $site_url = get_site_url();
45 36 $protocol_pos = strpos( $site_url, '://' );
46 37 if ( false !== $protocol_pos ) {
47 38 $site_url = substr( $site_url, $protocol_pos + 3 );
48 39 }
49 40
50 - $freemius_usage_tracking_url = $fs->get_usage_tracking_terms_url();
51 - $freemius_plugin_terms_url = $fs->get_eula_url();
41 + $freemius_site_www = 'https://freemius.com';
52 42
53 - $error = fs_request_get( 'error' );
43 + $freemius_usage_tracking_url = $freemius_site_www . '/wordpress/usage-tracking/' . $fs->get_id() . "/{$slug}/";
44 + $freemius_plugin_terms_url = $freemius_site_www . '/terms/' . $fs->get_id() . "/{$slug}/";
54 45
55 - $has_release_on_freemius = $fs->has_release_on_freemius();
46 + $freemius_site_url = $fs->is_premium() ?
47 + $freemius_site_www :
48 + $freemius_usage_tracking_url;
56 49
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 - );
50 + if ( $fs->is_premium() ) {
51 + $freemius_site_url .= '?' . http_build_query( array(
52 + 'id' => $fs->get_id(),
53 + 'slug' => $slug,
54 + ) );
55 + }
63 56
64 - $freemius_activation_terms_url = ($fs->is_premium() && $require_license_key) ?
65 - $fs->get_license_activation_terms_url() :
66 - $freemius_usage_tracking_url;
57 + $freemius_link = '<a href="' . $freemius_site_url . '" target="_blank" tabindex="1">freemius.com</a>';
67 58
68 - $freemius_activation_terms_html = '<a href="' . esc_url( $freemius_activation_terms_url ) . '" target="_blank" rel="noopener" tabindex="1">freemius.com</a>';
59 + $error = fs_request_get( 'error' );
69 60
61 + $require_license_key = $is_premium_only ||
62 + ( $is_freemium && $is_premium_code && fs_request_get_bool( 'require_license', true ) );
63 +
70 64 if ( $is_pending_activation ) {
71 65 $require_license_key = false;
72 66 }
73 67
@@ -77,9 +71,9 @@
77 71
78 72 $is_optin_dialog = (
79 73 $fs->is_theme() &&
80 74 $fs->is_themes_page() &&
81 - $fs->show_opt_in_on_themes_page()
75 + ( ! $fs->has_settings_menu() || $fs->is_free_wp_org_theme() )
82 76 );
83 77
84 78 if ( $is_optin_dialog ) {
85 79 $show_close_button = false;
@@ -116,15 +110,15 @@
116 110
117 111 /* translators: %s: name (e.g. Hey John,) */
118 112 $hey_x_text = esc_html( sprintf( fs_text_x_inline( 'Hey %s,', 'greeting', 'hey-x', $slug ), $first_name ) );
119 113
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 - );
114 + $is_gdpr_required = ( ! $is_pending_activation && ! $require_license_key ) ?
115 + FS_GDPR_Manager::instance()->is_required() :
116 + false;
117 +
118 + if ( is_null( $is_gdpr_required ) ) {
119 + $is_gdpr_required = $fs->fetch_and_store_current_user_gdpr_anonymously();
120 + }
127 121 ?>
128 122 <?php
129 123 if ( $is_optin_dialog ) { ?>
130 124 <div id="fs_theme_connect_wrapper">
@@ -136,62 +130,27 @@
136 130 }
137 131 ?>
138 132 <?php
139 133 }
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 - $fs->do_action( 'connect/before', $activation_state );
148 134 ?>
149 135 <div id="fs_connect"
150 136 class="wrap<?php if ( ! fs_is_network_admin() && ( ! $fs->is_enable_anonymous() || $is_pending_activation || $require_license_key ) ) {
151 137 echo ' fs-anonymous-disabled';
152 138 } ?><?php echo $require_license_key ? ' require-license-key' : '' ?>">
153 - <div class="fs-header">
154 - <!-- <b class="fs-site-icon"><i class="dashicons dashicons-wordpress-alt"></i></b>-->
155 - <?php
156 - $size = 50;
157 - $vars = array(
158 - 'id' => $fs->get_id(),
159 - 'size' => $size,
160 - );
161 -
162 - fs_require_once_template( 'plugin-icon.php', $vars );
163 - ?>
164 - </div>
165 - <div class="fs-box-container">
139 + <div class="fs-visual">
140 + <b class="fs-site-icon"><i class="dashicons dashicons-wordpress"></i></b>
141 + <i class="dashicons dashicons-plus fs-first"></i>
142 + <?php
143 + $vars = array( 'id' => $fs->get_id() );
144 + fs_require_once_template( 'plugin-icon.php', $vars );
145 + ?>
146 + <i class="dashicons dashicons-plus fs-second"></i>
147 + <img class="fs-connect-logo" width="80" height="80" src="//img.freemius.com/connect-logo.png"/>
148 + </div>
166 149 <div class="fs-content">
167 - <?php $fs->do_action( 'connect/before_message', $activation_state ) ?>
168 -
169 150 <?php if ( ! empty( $error ) ) : ?>
170 - <div class="fs-error"><?php echo $fs->apply_filters( 'connect_error_esc_html', esc_html( $error ) ) ?></div>
151 + <p class="fs-error"><?php echo esc_html( $error ) ?></p>
171 152 <?php endif ?>
172 - <?php
173 - if ( ! $is_pending_activation && ! $require_license_key ) {
174 - if ( ! $fs->is_plugin_update() ) {
175 - echo $fs->apply_filters( 'connect-header', sprintf(
176 - '<h2 style="text-align: center">%s</h2>',
177 - esc_html( fs_text_inline( 'Never miss an important update', 'connect-header' ) )
178 - ) );
179 - } else {
180 - echo $fs->apply_filters( 'connect-header_on-update', sprintf(
181 - '<h2>%s</h2>',
182 - sprintf(
183 - esc_html(
184 - /* translators: %1$s: plugin name (e.g., "Awesome Plugin"); %2$s: version (e.g., "1.2.3") */
185 - fs_text_inline('Thank you for updating to %1$s v%2$s!', 'connect-header_on-update' )
186 - ),
187 - esc_html( $fs->get_plugin_name() ),
188 - $fs->get_plugin_version()
189 - )
190 - ) );
191 - }
192 - }
193 - ?>
194 153 <p><?php
195 154 $button_label = fs_text_inline( 'Allow & Continue', 'opt-in-connect', $slug );
196 155 $message = '';
197 156
@@ -200,50 +159,46 @@
200 159
201 160 $message = $fs->apply_filters( 'pending_activation_message', sprintf(
202 161 /* translators: %s: name (e.g. Thanks John!) */
203 162 fs_text_inline( 'Thanks %s!', 'thanks-x', $slug ) . '<br>' .
204 - 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 ),
163 + fs_text_inline( 'You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s.', 'pending-activation-message', $slug ),
205 164 $first_name,
206 165 '<b>' . $fs->get_plugin_name() . '</b>',
207 166 '<b>' . $current_user->user_email . '</b>',
208 - fs_text_inline( 'complete the opt-in', 'complete-the-opt-in', $slug )
167 + fs_text_inline( 'complete the install', 'complete-the-install', $slug )
209 168 ) );
210 169 } else if ( $require_license_key ) {
211 - $button_label = fs_text_inline( 'Activate License', 'activate-license', $slug );
170 + $button_label = $is_network_upgrade_mode ?
171 + fs_text_inline( 'Activate License', 'agree-activate-license', $slug ) :
172 + fs_text_inline( 'Agree & Activate License', 'agree-activate-license', $slug );
212 173
213 174 $message = $fs->apply_filters(
214 175 'connect-message_on-premium',
215 - 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>' ),
176 + ($is_network_upgrade_mode ?
177 + '' :
178 + /* translators: %s: name (e.g. Hey John,) */
179 + $hey_x_text . '<br>'
180 + ) .
181 + sprintf( fs_text_inline( 'Thanks for purchasing %s! To get started, please enter your license key:', 'thanks-for-purchasing', $slug ), '<b>' . $fs->get_plugin_name() . '</b>' ),
216 182 $first_name,
217 183 $fs->get_plugin_name()
218 184 );
219 185 } else {
220 - $filter = 'connect_message';
186 + $filter = 'connect_message';
187 + $default_optin_message = $is_gdpr_required ?
188 + fs_text_inline( 'Never miss an important update - opt in to our security & feature updates notifications, educational content, offers, and non-sensitive diagnostic tracking with %4$s.', 'connect-message', $slug) :
189 + fs_text_inline( 'Never miss an important update - opt in to our security and feature updates notifications, and non-sensitive diagnostic tracking with %4$s.', 'connect-message', $slug);
221 190
222 - if ( ! $fs->is_plugin_update() ) {
223 - $default_optin_message = esc_html(
224 - sprintf(
225 - /* translators: %s: module type (plugin, theme, or add-on) */
226 - 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 ),
227 - $fs->get_module_label( true )
228 - )
229 - );
230 - } else {
191 + if ( $fs->is_plugin_update() ) {
231 192 // If Freemius was added on a plugin update, set different
232 193 // opt-in message.
194 + $default_optin_message = $is_gdpr_required ?
195 + fs_text_inline( 'Never miss an important update - opt in to our security & feature updates notifications, educational content, offers, and non-sensitive diagnostic tracking with %4$s. If you skip this, that\'s okay! %1$s will still work just fine.', 'connect-message_on-update', $slug ) :
196 + fs_text_inline( 'Never miss an important update - opt in to our security & feature updates notifications, and non-sensitive diagnostic tracking with %4$s. If you skip this, that\'s okay! %1$s will still work just fine.', 'connect-message_on-update', $slug );
233 197
234 - /* translators: %s: module type (plugin, theme, or add-on) */
235 - $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 ) ) );
236 -
237 - $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 ) );
238 -
239 - if ( $fs->is_enable_anonymous() ) {
240 - $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 ) );
241 - }
242 -
243 - // If user customized the opt-in message on update, use
198 + // If user customized the opt-in message on update, use
244 199 // that message. Otherwise, fallback to regular opt-in
245 - // custom message if exists.
200 + // custom message if exist.
246 201 if ( $fs->has_filter( 'connect_message_on_update' ) ) {
247 202 $filter = 'connect_message_on_update';
248 203 }
249 204 }
@@ -249,21 +204,26 @@
249 204 }
250 205
251 206 $message = $fs->apply_filters(
252 207 $filter,
208 + ($is_network_upgrade_mode ?
209 + '' :
210 + /* translators: %s: name (e.g. Hey John,) */
211 + $hey_x_text . '<br>'
212 + ) .
253 213 sprintf(
254 - $default_optin_message,
214 + esc_html( $default_optin_message ),
255 215 '<b>' . esc_html( $fs->get_plugin_name() ) . '</b>',
256 216 '<b>' . $current_user->user_login . '</b>',
257 - '<a href="' . $site_url . '" target="_blank" rel="noopener noreferrer">' . $site_url . '</a>',
258 - $freemius_activation_terms_html
217 + '<a href="' . $site_url . '" target="_blank">' . $site_url . '</a>',
218 + $freemius_link
259 219 ),
260 220 $first_name,
261 221 $fs->get_plugin_name(),
262 222 $current_user->user_login,
263 - '<a href="' . $site_url . '" target="_blank" rel="noopener noreferrer">' . $site_url . '</a>',
264 - $freemius_activation_terms_html,
265 - true
223 + '<a href="' . $site_url . '" target="_blank">' . $site_url . '</a>',
224 + $freemius_link,
225 + $is_gdpr_required
266 226 );
267 227 }
268 228
269 229 if ( $is_network_upgrade_mode ) {
@@ -302,9 +262,9 @@
302 262 *
303 263 * @author Vova Feldman
304 264 * @since 2.1.2
305 265 */
306 - $fs->do_action( 'connect/after_license_input', $activation_state );
266 + $fs->do_action( 'connect/after_license_input' );
307 267 ?>
308 268
309 269 <?php
310 270 $send_updates_text = sprintf(
@@ -335,11 +295,8 @@
335 295 <span class="fs-input-label"><?php echo $do_not_send_updates_text ?></span>
336 296 </label>
337 297 </div>
338 298 </div>
339 - <div id="fs_orphan_license_message">
340 - <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>
341 - </div>
342 299 <?php endif ?>
343 300 <?php if ( $is_network_level_activation ) : ?>
344 301 <?php
345 302 $vars = array(
@@ -350,28 +307,22 @@
350 307
351 308 echo fs_get_template( 'partials/network-activation.php', $vars );
352 309 ?>
353 310 <?php endif ?>
354 -
355 - <?php $fs->do_action( 'connect/after_message', $activation_state ) ?>
356 311 </div>
357 312 <div class="fs-actions">
358 - <?php $fs->do_action( 'connect/before_actions', $activation_state ) ?>
359 -
360 313 <?php if ( $fs->is_enable_anonymous() && ! $is_pending_activation && ( ! $require_license_key || $is_network_upgrade_mode ) ) : ?>
361 314 <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' ) ?>"
362 315 class="button button-secondary" tabindex="2"><?php fs_esc_html_echo_x_inline( 'Skip', 'verb', 'skip', $slug ) ?></a>
363 316 <?php endif ?>
364 - <?php if ( $is_network_level_activation && $fs->apply_filters( 'show_delegation_option', true ) ) : ?>
317 + <?php if ( $is_network_level_activation ) : ?>
365 318 <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>
366 319 <?php endif ?>
367 320 <?php if ( $activate_with_current_user ) : ?>
368 321 <form action="" method="POST">
369 322 <input type="hidden" name="fs_action"
370 - value="<?php echo esc_attr( $fs->get_unique_affix() . '_activate_existing' ) ?>">
371 - <?php wp_nonce_field( $fs->get_unique_affix() . '_activate_existing' ) ?>
372 - <input type="hidden" name="is_extensions_tracking_allowed" value="1">
373 - <input type="hidden" name="is_diagnostic_tracking_allowed" value="1">
323 + value="<?php echo $fs->get_unique_affix() ?>_activate_existing">
324 + <?php wp_nonce_field( 'activate_existing_' . $fs->get_public_key() ) ?>
374 325 <button class="button button-primary" tabindex="1"
375 326 type="submit"><?php echo esc_html( $button_label ) ?></button>
376 327 </form>
377 328 <?php else : ?>
@@ -377,12 +328,10 @@
377 328 <?php else : ?>
378 329 <form method="post" action="<?php echo WP_FS__ADDRESS ?>/action/service/user/install/">
379 330 <?php unset( $optin_params['sites']); ?>
380 331 <?php foreach ( $optin_params as $name => $value ) : ?>
381 - <input type="hidden" name="<?php echo esc_attr( $name ) ?>" value="<?php echo esc_attr( $value ) ?>">
332 + <input type="hidden" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>">
382 333 <?php endforeach ?>
383 - <input type="hidden" name="is_extensions_tracking_allowed" value="1">
384 - <input type="hidden" name="is_diagnostic_tracking_allowed" value="1">
385 334 <button class="button button-primary" tabindex="1"
386 335 type="submit"<?php if ( $require_license_key ) {
387 336 echo ' disabled="disabled"';
388 337 } ?>><?php echo esc_html( $button_label ) ?></button>
@@ -387,49 +336,79 @@
387 336 echo ' disabled="disabled"';
388 337 } ?>><?php echo esc_html( $button_label ) ?></button>
389 338 </form>
390 339 <?php endif ?>
391 - <?php if ( $require_license_key ) : ?>
392 - <a id="license_issues_link"
393 - href="<?php echo esc_url( $fs->apply_filters( 'known_license_issues_url', 'https://freemius.com/help/documentation/wordpress-sdk/license-activation-issues/' ) ) ?>"
394 - target="_blank"><?php fs_esc_html_echo_inline( 'License issues?', 'license-issues', $slug ) ?></a>
395 - <?php endif ?>
396 -
397 - <?php $fs->do_action( 'connect/after_actions', $activation_state ) ?>
398 340 </div><?php
399 - $permission_manager = FS_Permission_Manager::instance( $fs );
400 341
401 342 // Set core permission list items.
402 - $permissions = array();
343 + $permissions = array(
344 + 'profile' => array(
345 + 'icon-class' => 'dashicons dashicons-admin-users',
346 + 'label' => $fs->get_text_inline( 'Your Profile Overview', 'permissions-profile' ),
347 + 'desc' => $fs->get_text_inline( 'Name and email address', 'permissions-profile_desc' ),
348 + 'priority' => 5,
349 + ),
350 + 'site' => array(
351 + 'icon-class' => 'dashicons dashicons-admin-settings',
352 + 'label' => $fs->get_text_inline( 'Your Site Overview', 'permissions-site' ),
353 + 'desc' => $fs->get_text_inline( 'Site URL, WP version, PHP info, plugins & themes', 'permissions-site_desc' ),
354 + 'priority' => 10,
355 + ),
356 + 'notices' => array(
357 + 'icon-class' => 'dashicons dashicons-testimonial',
358 + 'label' => $fs->get_text_inline( 'Admin Notices', 'permissions-admin-notices' ),
359 + 'desc' => $fs->get_text_inline( 'Updates, announcements, marketing, no spam', 'permissions-newsletter_desc' ),
360 + 'priority' => 13,
361 + ),
362 + 'events' => array(
363 + 'icon-class' => 'dashicons dashicons-admin-plugins',
364 + 'label' => sprintf( $fs->get_text_inline( 'Current %s Events', 'permissions-events' ), ucfirst( $fs->get_module_type() ) ),
365 + 'desc' => $fs->get_text_inline( 'Activation, deactivation and uninstall', 'permissions-events_desc' ),
366 + 'priority' => 20,
367 + ),
368 + );
403 369
404 - // Add newsletter permissions if enabled.
405 - if ( $fs->is_permission_requested( 'newsletter' ) ) {
406 - $permissions[] = $permission_manager->get_newsletter_permission();
407 - }
370 + // Add newsletter permissions if enabled.
371 + if ( $is_gdpr_required || $fs->is_permission_requested( 'newsletter' ) ) {
372 + $permissions['newsletter'] = array(
373 + 'icon-class' => 'dashicons dashicons-email-alt',
374 + 'label' => $fs->get_text_inline( 'Newsletter', 'permissions-newsletter' ),
375 + 'desc' => $fs->get_text_inline( 'Updates, announcements, marketing, no spam', 'permissions-newsletter_desc' ),
376 + 'priority' => 15,
377 + );
378 + }
408 379
409 - $permissions = $permission_manager->get_permissions(
410 - $require_license_key,
411 - $permissions
412 - );
380 + // Allow filtering of the permissions list.
381 + $permissions = $fs->apply_filters( 'permission_list', $permissions );
413 382
383 + // Sort by priority.
384 + uasort( $permissions, 'fs_sort_by_priority' );
385 +
414 386 if ( ! empty( $permissions ) ) : ?>
415 387 <div class="fs-permissions">
416 - <?php if ( $require_license_key ) : ?>
417 - <a class="fs-trigger wp-core-ui" href="#" tabindex="1" style="color: inherit;"><?php echo sprintf(
418 - 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>',
419 - sprintf( '<nobr class="button-link" style="color: inherit;">%s</nobr>', esc_html( $fs->get_plugin_title() ) )
420 - ) ?></a>
421 - <?php else : ?>
422 - <a class="fs-trigger wp-core-ui" href="#" tabindex="1" style="color: inherit;"><?php printf(
423 - fs_esc_html_inline( 'This will allow %s to', 'this-will-allow-x', $slug ) . '<b class="fs-arrow"></b>',
424 - sprintf( '<nobr class="button-link" style="color: inherit;">%s</nobr>', esc_html( $fs->get_plugin_title() ) )
425 - ) ?></a>
426 - <?php endif ?>
388 + <?php if ( $require_license_key ) : ?>
389 + <p class="fs-license-sync-disclaimer"><?php
390 + echo sprintf(
391 + fs_esc_html_inline( 'The %1$s will be periodically sending data to %2$s to check for security and feature updates, and verify the validity of your license.', 'license-sync-disclaimer', $slug ),
392 + $fs->get_module_label( true ),
393 + $freemius_link
394 + ) ?></p>
395 + <?php endif ?>
396 + <a class="fs-trigger" href="#" tabindex="1"><?php fs_esc_html_echo_inline( 'What permissions are being granted?', 'what-permissions', $slug ) ?></a>
427 397 <ul><?php
428 - foreach ( $permissions as $permission ) {
429 - $permission_manager->render_permission( $permission );
430 - }
431 - ?></ul>
398 + foreach ( $permissions as $id => $permission ) : ?>
399 + <li id="fs-permission-<?php echo esc_attr( $id ); ?>"
400 + class="fs-permission fs-<?php echo esc_attr( $id ); ?>">
401 + <i class="<?php echo esc_attr( $permission['icon-class'] ); ?>"></i>
402 +
403 + <div>
404 + <span><?php echo esc_html( $permission['label'] ); ?></span>
405 +
406 + <p><?php echo esc_html( $permission['desc'] ); ?></p>
407 + </div>
408 + </li>
409 + <?php endforeach; ?>
410 + </ul>
432 411 </div>
433 412 <?php endif ?>
434 413 <?php if ( $is_premium_code && $is_freemium ) : ?>
435 414 <div class="fs-freemium-licensing">
@@ -443,31 +422,16 @@
443 422 <?php endif ?>
444 423 </p>
445 424 </div>
446 425 <?php endif ?>
447 - </div>
448 426 <div class="fs-terms">
449 - <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>
450 - &nbsp;&nbsp;-&nbsp;&nbsp;
451 - <a href="https://freemius.com/privacy/" target="_blank" rel="noopener"
427 + <a href="https://freemius.com/privacy/" target="_blank"
452 428 tabindex="1"><?php fs_esc_html_echo_inline( 'Privacy Policy', 'privacy-policy', $slug ) ?></a>
453 429 &nbsp;&nbsp;-&nbsp;&nbsp;
454 - <?php if ($require_license_key) : ?>
455 - <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>
456 - <?php else : ?>
457 - <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>
458 - <?php endif; ?>
430 + <a href="<?php echo $require_license_key ? $freemius_plugin_terms_url : $freemius_usage_tracking_url ?>" target="_blank" tabindex="1"><?php $require_license_key ? fs_echo_inline( 'License Agreement', 'license-agreement', $slug ) : fs_echo_inline( 'Terms of Service', 'tos', $slug ) ?></a>
459 431 </div>
460 432 </div>
461 433 <?php
462 - /**
463 - * Allows developers to include custom HTML after the opt-in content.
464 - *
465 - * @author Vova Feldman
466 - * @since 2.3.2
467 - */
468 - $fs->do_action( 'connect/after', $activation_state );
469 -
470 434 if ( $is_optin_dialog ) { ?>
471 435 </div>
472 436 <?php
473 437 }
@@ -509,9 +473,8 @@
509 473 isNetworkUpgradeMode = <?php echo $is_network_upgrade_mode ? 'true' : 'false' ?>,
510 474 $licenseSecret,
511 475 $licenseKeyInput = $('#fs_license_key'),
512 476 pauseCtaLabelUpdate = false,
513 - isNetworkDelegating = false,
514 477 /**
515 478 * @author Leo Fajardo (@leorw)
516 479 * @since 2.1.0
517 480 */
@@ -518,14 +481,15 @@
518 481 resetLoadingMode = function() {
519 482 // Reset loading mode.
520 483 $primaryCta.html(primaryCtaLabel);
521 484 $primaryCta.prop('disabled', false);
522 - $( '.fs-loading' ).removeClass( 'fs-loading' );
485 + $(document.body).css({'cursor': 'auto'});
486 + $('.fs-loading').removeClass('fs-loading');
523 487
524 488 console.log('resetLoadingMode - Primary button was enabled');
525 489 },
526 490 setLoadingMode = function () {
527 - $( document.body ).addClass( 'fs-loading' );
491 + $(document.body).css({'cursor': 'wait'});
528 492 };
529 493
530 494 $('.fs-actions .button').on('click', function () {
531 495 setLoadingMode();
@@ -540,17 +504,16 @@
540 504 });
541 505
542 506 if ( isNetworkActive ) {
543 507 var
544 - $multisiteOptionsContainer = $( '.fs-multisite-options-container' ),
545 - $allSitesOptions = $( '.fs-all-sites-options' ),
546 - $applyOnAllSites = $( '.fs-apply-on-all-sites-checkbox' ),
547 - $sitesListContainer = $( '.fs-sites-list-container' ),
508 + $multisiteOptionsContainer = $( '#multisite_options_container' ),
509 + $allSitesOptions = $( '#all_sites_options' ),
510 + $applyOnAllSites = $( '#apply_on_all_sites' ),
511 + $sitesListContainer = $( '#sites_list_container' ),
548 512 totalSites = <?php echo count( $sites ) ?>,
549 513 maxSitesListHeight = null,
550 514 $skipActivationButton = $( '#skip_activation' ),
551 - $delegateToSiteAdminsButton = $( '#delegate_to_site_admins' ),
552 - hasAnyInstall = <?php echo ! is_null( $fs->find_first_install() ) ? 'true' : 'false' ?>;
515 + $delegateToSiteAdminsButton = $( '#delegate_to_site_admins' );
553 516
554 517 $applyOnAllSites.click(function() {
555 518 var isChecked = $( this ).is( ':checked' );
556 519
@@ -564,9 +527,9 @@
564 527 $skipActivationButton.toggle();
565 528
566 529 $delegateToSiteAdminsButton.toggle();
567 530
568 - $multisiteOptionsContainer.toggleClass( 'fs-apply-on-all-sites', isChecked );
531 + $multisiteOptionsContainer.toggleClass( 'apply-on-all-sites', isChecked );
569 532
570 533 $sitesListContainer.toggle( ! isChecked );
571 534 if ( ! isChecked && null === maxSitesListHeight ) {
572 535 /**
@@ -587,13 +550,8 @@
587 550
588 551 updatePrimaryCtaText( actionType );
589 552 });
590 553
591 - $sitesListContainer.delegate( 'td:not(:first-child)', 'click', function() {
592 - // If a site row is clicked, trigger a click on the checkbox.
593 - $( this ).parent().find( 'td:first-child input' ).click();
594 - } );
595 -
596 554 $sitesListContainer.delegate( '.action', 'click', function( evt ) {
597 555 var $this = $( evt.target );
598 556 if ( $this.hasClass( 'selected' ) ) {
599 557 return false;
@@ -616,9 +574,9 @@
616 574 updatePrimaryCtaText( 'mixed' );
617 575 }
618 576 });
619 577
620 - if ( isNetworkUpgradeMode || hasAnyInstall ) {
578 + if (isNetworkUpgradeMode) {
621 579 $skipActivationButton.click(function(){
622 580 $delegateToSiteAdminsButton.hide();
623 581
624 582 $skipActivationButton.html('<?php fs_esc_js_echo_inline( 'Skipping, please wait', 'skipping-wait', $slug ) ?>...');
@@ -639,18 +597,8 @@
639 597 $delegateToSiteAdminsButton.html('<?php fs_esc_js_echo_inline( 'Delegating, please wait', 'delegating-wait', $slug ) ?>...');
640 598
641 599 pauseCtaLabelUpdate = true;
642 600
643 - /**
644 - * Set to true so that the form submission handler can differentiate delegation from license
645 - * activation and the proper AJAX action will be used (when delegating, the action should be
646 - * `network_activate` and not `activate_license`).
647 - *
648 - * @author Leo Fajardo (@leorw)
649 - * @since 2.3.0
650 - */
651 - isNetworkDelegating = true;
652 -
653 601 // Check all sites to be skipped.
654 602 $allSitesOptions.find('.action.action-delegate').click();
655 603
656 604 $form.submit();
@@ -656,18 +604,8 @@
656 604 $form.submit();
657 605
658 606 pauseCtaLabelUpdate = false;
659 607
660 - /**
661 - * Set to false so that in case the previous AJAX request has failed, the form submission handler
662 - * can differentiate license activation from delegation and the proper AJAX action will be used
663 - * (when activating a license, the action should be `activate_license` and not `network_activate`).
664 - *
665 - * @author Leo Fajardo (@leorw)
666 - * @since 2.3.0
667 - */
668 - isNetworkDelegating = false;
669 -
670 608 return false;
671 609 });
672 610 }
673 611 }
@@ -698,29 +636,8 @@
698 636
699 637 var ajaxOptin = ( requireLicenseKey || isNetworkActive );
700 638
701 639 $form.on('submit', function () {
702 - var $extensionsPermission = $( '#fs_permission_extensions .fs-switch' ),
703 - isExtensionsTrackingAllowed = ( $extensionsPermission.length > 0 ) ?
704 - $extensionsPermission.hasClass( 'fs-on' ) :
705 - null;
706 -
707 - var $diagnosticPermission = $( '#fs_permission_diagnostic .fs-switch' ),
708 - isDiagnosticTrackingAllowed = ( $diagnosticPermission.length > 0 ) ?
709 - $diagnosticPermission.hasClass( 'fs-on' ) :
710 - null;
711 -
712 - if ( null === isExtensionsTrackingAllowed ) {
713 - $( 'input[name=is_extensions_tracking_allowed]' ).remove();
714 - } else {
715 - $( 'input[name=is_extensions_tracking_allowed]' ).val( isExtensionsTrackingAllowed ? 1 : 0 );
716 - }
717 -
718 - // 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.
719 - if ( null !== isDiagnosticTrackingAllowed ) {
720 - $( 'input[name=is_diagnostic_tracking_allowed]' ).val( isDiagnosticTrackingAllowed ? 1 : 0 );
721 - }
722 -
723 640 /**
724 641 * @author Vova Feldman (@svovaf)
725 642 * @since 1.1.9
726 643 */
@@ -725,34 +642,22 @@
725 642 * @since 1.1.9
726 643 */
727 644 if ( ajaxOptin ) {
728 645 if (!hasContextUser || isNetworkUpgradeMode) {
729 - var action = null,
730 - security = null;
646 + <?php $action = $require_license_key ? 'activate_license' : 'network_activate' ?>
731 647
732 - if ( requireLicenseKey && ! isNetworkDelegating ) {
733 - action = '<?php echo $fs->get_ajax_action( 'activate_license' ) ?>';
734 - security = '<?php echo $fs->get_ajax_security( 'activate_license' ) ?>';
735 - } else {
736 - action = '<?php echo $fs->get_ajax_action( 'network_activate' ) ?>';
737 - security = '<?php echo $fs->get_ajax_security( 'network_activate' ) ?>';
738 - }
739 -
740 648 $('.fs-error').remove();
741 649
742 650 var
743 651 licenseKey = $licenseKeyInput.val(),
744 652 data = {
745 - action : action,
746 - security : security,
747 - license_key : licenseKey,
748 - module_id : '<?php echo $fs->get_id() ?>',
749 - license_owner_id: licenseOwnerIDByLicense[ licenseKey ]
653 + action : '<?php echo $fs->get_ajax_action( $action ) ?>',
654 + security : '<?php echo $fs->get_ajax_security( $action ) ?>',
655 + license_key: licenseKey,
656 + module_id : '<?php echo $fs->get_id() ?>'
750 657 };
751 658
752 - if (
753 - requireLicenseKey &&
754 - ! isNetworkDelegating &&
659 + if (requireLicenseKey &&
755 660 isMarketingAllowedByLicense.hasOwnProperty(licenseKey)
756 661 ) {
757 662 var
758 663 isMarketingAllowed = null,
@@ -772,12 +677,8 @@
772 677 isMarketingAllowed = isMarketingAllowedByLicense[ licenseKey ];
773 678 }
774 679
775 680 data.is_marketing_allowed = isMarketingAllowed;
776 -
777 - data.is_extensions_tracking_allowed = isExtensionsTrackingAllowed;
778 -
779 - data.is_diagnostic_tracking_allowed = isDiagnosticTrackingAllowed;
780 681 }
781 682
782 683 $marketingOptin.removeClass( 'error' );
783 684
@@ -798,15 +699,14 @@
798 699 uid : $this.find( '.uid' ).val(),
799 700 url : $this.find( '.url' ).val(),
800 701 title : $this.find( '.title' ).val(),
801 702 language: $this.find( '.language' ).val(),
703 + charset : $this.find( '.charset' ).val(),
802 704 blog_id : $this.find( '.blog-id' ).find( 'span' ).text()
803 705 };
804 706
805 707 if ( ! requireLicenseKey) {
806 708 site.action = $this.find('.action.selected').data('action-type');
807 - } else if ( isNetworkDelegating ) {
808 - site.action = 'delegate';
809 709 }
810 710
811 711 sites.push( site );
812 712 });
@@ -811,12 +711,8 @@
811 711 sites.push( site );
812 712 });
813 713
814 714 data.sites = sites;
815 -
816 - if ( hasAnyInstall ) {
817 - data.has_any_install = hasAnyInstall;
818 - }
819 715 }
820 716
821 717 /**
822 718 * Use the AJAX opt-in when license key is required to potentially
@@ -825,9 +721,9 @@
825 721 * @author Vova Feldman (@svovaf)
826 722 * @since 1.2.1.5
827 723 */
828 724 $.ajax({
829 - url : <?php echo Freemius::ajax_url() ?>,
725 + url : ajaxurl,
830 726 method : 'POST',
831 727 data : data,
832 728 success: function (result) {
833 729 var resultObj = $.parseJSON(result);
@@ -837,9 +733,9 @@
837 733 } else {
838 734 resetLoadingMode();
839 735
840 736 // Show error.
841 - $('.fs-content').prepend('<div class="fs-error">' + (resultObj.error.message ? resultObj.error.message : resultObj.error) + '</div>');
737 + $('.fs-content').prepend('<p class="fs-error">' + (resultObj.error.message ? resultObj.error.message : resultObj.error) + '</p>');
842 738 }
843 739 },
844 740 error: function () {
845 741 resetLoadingMode();
@@ -861,17 +757,8 @@
861 757
862 758 return true;
863 759 });
864 760
865 - $( '#fs_connect .fs-permissions .fs-switch' ).on( 'click', function () {
866 - $( this )
867 - .toggleClass( 'fs-on' )
868 - .toggleClass( 'fs-off' );
869 -
870 - $( this ).closest( '.fs-permission' )
871 - .toggleClass( 'fs-disabled' );
872 - });
873 -
874 761 $primaryCta.on('click', function () {
875 762 console.log('Primary button was clicked');
876 763
877 764 $(this).addClass('fs-loading');
@@ -918,9 +805,9 @@
918 805 }
919 806
920 807 if ('' === key) {
921 808 $primaryCta.attr('disabled', 'disabled');
922 - hideOptinAndLicenseMessage();
809 + $marketingOptin.hide();
923 810 } else {
924 811 $primaryCta.prop('disabled', false);
925 812
926 813 if (32 <= key.length){
@@ -925,9 +812,9 @@
925 812
926 813 if (32 <= key.length){
927 814 fetchIsMarketingAllowedFlagAndToggleOptin();
928 815 } else {
929 - hideOptinAndLicenseMessage();
816 + $marketingOptin.hide();
930 817 }
931 818 }
932 819
933 820 previousLicenseKey = key;
@@ -961,12 +848,10 @@
961 848 //--------------------------------------------------------------------------------
962 849 //region GDPR
963 850 //--------------------------------------------------------------------------------
964 851 var isMarketingAllowedByLicense = {},
965 - licenseOwnerIDByLicense = {},
966 - $marketingOptin = $( '#fs_marketing_optin' ),
967 - $orphanLicenseMessage = $( '#fs_orphan_license_message' ),
968 - previousLicenseKey = null;
852 + $marketingOptin = $('#fs_marketing_optin'),
853 + previousLicenseKey = null;
969 854
970 855 if (requireLicenseKey) {
971 856
972 857 var
@@ -986,16 +871,8 @@
986 871 } else {
987 872 $marketingOptin.hide();
988 873 $primaryCta.focus();
989 874 }
990 -
991 - $orphanLicenseMessage.toggle( false === licenseOwnerIDByLicense[ licenseKey ] );
992 -
993 - if ( false !== licenseOwnerIDByLicense[ licenseKey ] ) {
994 - $( 'input[name=user_firstname]' ).remove();
995 - $( 'input[name=user_lastname]' ).remove();
996 - $( 'input[name=user_email]' ).remove();
997 - }
998 875 },
999 876 /**
1000 877 * @author Leo Fajardo (@leorw)
1001 878 * @since 2.1.0
@@ -1003,10 +880,9 @@
1003 880 fetchIsMarketingAllowedFlagAndToggleOptin = function () {
1004 881 var licenseKey = $licenseKeyInput.val();
1005 882
1006 883 if (licenseKey.length < 32) {
1007 - hideOptinAndLicenseMessage();
1008 -
884 + $marketingOptin.hide();
1009 885 return;
1010 886 }
1011 887
1012 888 if (isMarketingAllowedByLicense.hasOwnProperty(licenseKey)) {
@@ -1013,9 +889,10 @@
1013 889 afterMarketingFlagLoaded();
1014 890 return;
1015 891 }
1016 892
1017 - hideOptinAndLicenseMessage();
893 + $marketingOptin.hide();
894 +
1018 895 setLoadingMode();
1019 896
1020 897 $primaryCta.addClass('fs-loading');
1021 898 $primaryCta.attr('disabled', 'disabled');
@@ -1021,9 +898,9 @@
1021 898 $primaryCta.attr('disabled', 'disabled');
1022 899 $primaryCta.html('<?php fs_esc_js_echo_inline( 'Please wait', 'please-wait', $slug ) ?>...');
1023 900
1024 901 $.ajax({
1025 - url : <?php echo Freemius::ajax_url() ?>,
902 + url : ajaxurl,
1026 903 method : 'POST',
1027 904 data : {
1028 905 action : '<?php echo $fs->get_ajax_action( 'fetch_is_marketing_required_flag_value' ) ?>',
1029 906 security : '<?php echo $fs->get_ajax_security( 'fetch_is_marketing_required_flag_value' ) ?>',
@@ -1037,18 +914,13 @@
1037 914 result = result.data;
1038 915
1039 916 // Cache result.
1040 917 isMarketingAllowedByLicense[licenseKey] = result.is_marketing_allowed;
1041 - licenseOwnerIDByLicense[ licenseKey ] = result.license_owner_id;
1042 918 }
1043 919
1044 920 afterMarketingFlagLoaded();
1045 921 }
1046 922 });
1047 - },
1048 - hideOptinAndLicenseMessage = function() {
1049 - $marketingOptin.hide();
1050 - $orphanLicenseMessage.hide();
1051 923 };
1052 924
1053 925 $marketingOptin.find( 'input' ).click(function() {
1054 926 $marketingOptin.removeClass( 'error' );
@@ -1056,7 +928,5 @@
1056 928 }
1057 929
1058 930 //endregion
1059 931 })(jQuery);
1060 -</script>
1061 -<?php
1062 - fs_require_once_template( 'api-connectivity-message-js.php' );
932 +</script>