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/account.php +182 -522 8.0.2 → 2.1.2 View file →
@@ -20,11 +20,9 @@
20 20
21 21 /**
22 22 * @var FS_Plugin_Tag $update
23 23 */
24 - $update = $fs->has_release_on_freemius() ?
25 - $fs->get_update( false, false ) :
26 - null;
24 + $update = $fs->get_update( false, false, WP_FS__TIME_24_HOURS_IN_SEC / 24 );
27 25
28 26 if ( is_object($update) ) {
29 27 /**
30 28 * This logic is particularly required for multisite environment.
@@ -45,11 +43,8 @@
45 43 $user = $fs->get_user();
46 44 $site = $fs->get_site();
47 45 $name = $user->get_name();
48 46 $license = $fs->_get_license();
49 - $is_license_foreign = ( is_object( $license ) && $user->id != $license->user_id );
50 - $is_data_debug_mode = $fs->is_data_debug_mode();
51 - $is_whitelabeled = $fs->is_whitelabeled();
52 47 $subscription = ( is_object( $license ) ?
53 48 $fs->_get_subscription( $license->id ) :
54 49 null );
55 50 $plan = $fs->get_plan();
@@ -54,37 +49,16 @@
54 49 null );
55 50 $plan = $fs->get_plan();
56 51 $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
57 52 $is_paid_trial = $fs->is_paid_trial();
58 - $has_paid_plan = $fs->apply_filters( 'has_paid_plan_account', $fs->has_paid_plan() );
59 - $show_upgrade = ( ! $is_whitelabeled && $has_paid_plan && ! $is_paying && ! $is_paid_trial );
53 + $has_paid_plan = $fs->has_paid_plan();
54 + $show_upgrade = ( $has_paid_plan && ! $is_paying && ! $is_paid_trial );
60 55 $trial_plan = $fs->get_trial_plan();
61 56
62 - $is_plan_change_supported = (
63 - ! $fs->is_single_plan() &&
64 - ! $fs->apply_filters( 'hide_plan_change', false )
65 - );
66 -
67 57 if ( $has_paid_plan ) {
68 58 $fs->_add_license_activation_dialog_box();
69 59 }
70 60
71 - if ( $fs->should_handle_user_change() ) {
72 - $fs->_add_email_address_update_dialog_box();
73 - }
74 -
75 - $ids_of_installs_activated_with_foreign_licenses = $fs->should_handle_user_change() ?
76 - $fs->get_installs_ids_with_foreign_licenses() :
77 - array();
78 -
79 - if ( ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) {
80 - $fs->_add_user_change_dialog_box( $ids_of_installs_activated_with_foreign_licenses );
81 - }
82 -
83 - if ( $fs->is_whitelabeled( true ) || $fs->is_data_debug_mode() ) {
84 - $fs->_add_data_debug_mode_dialog_box();
85 - }
86 -
87 61 if ( fs_request_get_bool( 'auto_install' ) ) {
88 62 $fs->_add_auto_installation_dialog_box();
89 63 }
90 64
@@ -95,24 +69,20 @@
95 69 '_open_license_activation_dialog_box'
96 70 ) );
97 71 }
98 72
99 - $show_billing = ( ! $is_whitelabeled && ! $fs->apply_filters( 'hide_billing_and_payments_info', false ) );
100 - if ( $show_billing ) {
101 - $payments = $fs->_fetch_payments();
73 + $has_tabs = $fs->_add_tabs_before_content();
102 74
103 - $show_billing = ( is_array( $payments ) && 0 < count( $payments ) );
104 - }
75 + if ( $has_tabs ) {
76 + $query_params['tabs'] = 'true';
77 + }
105 78
106 -
107 - $has_tabs = $fs->_add_tabs_before_content();
108 -
109 79 // Aliases.
110 80 $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
111 81 $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
112 82 $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
113 - /* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
114 - $downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s.', 'downgrade-x-confirm', $slug );
83 + /* translators: %1s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
84 + $downgrade_x_confirm_text = fs_text_inline( '%1s will immediately stop all future recurring payments and your %s plan license will expire in %s.', 'downgrade-x-confirm', $slug );
115 85 $prices_increase_text = fs_text_inline( 'Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price.', 'pricing-increase-warning', $slug );
116 86 $cancel_trial_confirm_text = fs_text_inline( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'cancel-trial-confirm', $slug );
117 87 $after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support.', 'after-downgrade-non-blocking', $slug );
118 88 $after_downgrade_blocking_text = fs_text_inline( 'Once your license expires you can still use the Free version but you will NOT have access to the %s features.', 'after-downgrade-blocking', $slug );
@@ -132,9 +102,8 @@
132 102 $trial_text = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
133 103 $free_text = fs_text_inline( 'Free', 'free', $slug );
134 104 $activate_text = fs_text_inline( 'Activate', 'activate', $slug );
135 105 $plan_text = fs_text_x_inline( 'Plan', 'as product pricing plan', 'plan', $slug );
136 - $bundle_plan_text = fs_text_inline( 'Bundle Plan', 'bundle-plan', $slug );
137 106
138 107 $show_plan_row = true;
139 108 $show_license_row = is_object( $license );
140 109
@@ -148,9 +117,8 @@
148 117 $site_info = $fs->get_site_info( $s );
149 118 $install = $fs->get_install_by_blog_id( $site_info['blog_id'] );
150 119 $view_params = array(
151 120 'freemius' => $fs,
152 - 'user' => $fs->get_user(),
153 121 'license' => $license,
154 122 'site' => $site_info,
155 123 'install' => $install,
156 124 );
@@ -173,102 +141,22 @@
173 141 $show_license_row = false;
174 142 }
175 143 }
176 144 }
177 -
178 - $has_bundle_license = false;
179 -
180 - if ( is_object( $license ) &&
181 - FS_Plugin_License::is_valid_id( $license->parent_license_id )
182 - ) {
183 - // Context license has a parent license, therefore, the account has a bundle license.
184 - $has_bundle_license = true;
185 - }
186 -
187 - $bundle_subscription = null;
188 - $is_bundle_first_payment_pending = false;
189 -
190 - if (
191 - $show_plan_row &&
192 - is_object( $license ) &&
193 - $has_bundle_license
194 - ) {
195 - $bundle_plan_title = strtoupper( $license->parent_plan_title );
196 - $bundle_subscription = $fs->_get_subscription( $license->parent_license_id );
197 - $is_bundle_first_payment_pending = $license->is_first_payment_pending();
198 - }
199 -
200 - $fs_blog_id = ( is_multisite() && ! is_network_admin() ) ?
201 - get_current_blog_id() :
202 - 0;
203 -
204 - $active_plugins_directories_map = Freemius::get_active_plugins_directories_map( $fs_blog_id );
205 -
206 - $is_premium = $fs->is_premium();
207 -
208 - $account_addons = $fs->get_updated_account_addons();
209 - $installed_addons = $fs->get_installed_addons();
210 - $installed_addons_ids = array();
211 -
212 - /**
213 - * Store the installed add-ons' IDs into a collection which will be used in determining the add-ons to show on the "Account" page, and at the same time try to find an add-on that is activated with a bundle license if the core product is not.
214 - *
215 - * @author Leo Fajardo
216 - *
217 - * @since 2.4.0
218 - */
219 - foreach ( $installed_addons as $fs_addon ) {
220 - $installed_addons_ids[] = $fs_addon->get_id();
221 -
222 - if ( $has_bundle_license ) {
223 - // We already have the context bundle license details, skip.
224 - continue;
225 - }
226 -
227 - if (
228 - $show_plan_row &&
229 - $fs_addon->has_active_valid_license()
230 - ) {
231 - $addon_license = $fs_addon->_get_license();
232 -
233 - if ( FS_Plugin_License::is_valid_id( $addon_license->parent_license_id ) ) {
234 - // Add-on's license is associated with a parent/bundle license.
235 - $has_bundle_license = true;
236 -
237 - $bundle_plan_title = strtoupper( $addon_license->parent_plan_title );
238 - $bundle_subscription = $fs_addon->_get_subscription( $addon_license->parent_license_id );
239 - $is_bundle_first_payment_pending = $addon_license->is_first_payment_pending();
240 - }
241 - }
242 - }
243 -
244 - $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
245 -
246 - $is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() );
247 -
248 - $available_license = ( $fs->is_free_plan() && ! fs_is_network_admin() ) ?
249 - $fs->_get_available_premium_license( $site->is_localhost() ) :
250 - null;
251 -
252 - $available_license_paid_plan = is_object( $available_license ) ?
253 - $fs->_get_plan_by_id( $available_license->plan_id ) :
254 - null;
255 -
256 - $is_dev_mode = ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE );
257 145 ?>
258 146 <div class="wrap fs-section">
259 147 <?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
260 148 <h2 class="nav-tab-wrapper">
261 - <a href="<?php echo esc_url( $fs->get_account_url() ) ?>"
149 + <a href="<?php echo $fs->get_account_url() ?>"
262 150 class="nav-tab nav-tab-active"><?php fs_esc_html_echo_inline( 'Account', 'account', $slug ) ?></a>
263 151 <?php if ( $fs->has_addons() ) : ?>
264 - <a href="<?php echo esc_url( $fs->_get_admin_page_url( 'addons' ) ) ?>"
152 + <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
265 153 class="nav-tab"><?php echo esc_html( $addons_text ) ?></a>
266 154 <?php endif ?>
267 155 <?php if ( $show_upgrade ) : ?>
268 - <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a>
156 + <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a>
269 157 <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
270 - <a href="<?php echo esc_url( $fs->get_trial_url() ) ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a>
158 + <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a>
271 159 <?php endif ?>
272 160 <?php endif ?>
273 161 </h2>
274 162 <?php endif ?>
@@ -280,99 +168,87 @@
280 168 <div class="postbox">
281 169 <h3><span class="dashicons dashicons-businessman"></span> <?php fs_esc_html_echo_inline( 'Account Details', 'account-details', $slug ) ?></h3>
282 170 <div class="fs-header-actions">
283 171 <ul>
284 - <?php if ( $fs->is_whitelabeled( true ) ) : ?>
285 - <li>
286 - <a href="#" class="debug-license-trigger"><i class="dashicons dashicons-<?php echo $is_whitelabeled ? 'editor-code' : 'controls-pause' ?>"></i> <span><?php
287 - if ( $is_whitelabeled ) {
288 - fs_esc_html_echo_inline( 'Start Debug', 'start-debug-license', $slug );
289 - } else {
290 - fs_esc_html_echo_inline( 'Stop Debug', 'stop-debug-license', $slug );
291 - }
292 - ?></span></a>
293 - </li>
294 - <li>&nbsp;&bull;&nbsp;</li>
295 - <?php endif ?>
296 - <?php if ( $show_billing ) : ?>
297 - <li><a href="#fs_billing"><i class="dashicons dashicons-portfolio"></i> <?php fs_esc_html_echo_inline( 'Billing & Invoices', 'billing-invoices', $slug ) ?></a></li>
172 + <?php if ( ! $is_paying ) : ?>
173 + <li>
174 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
175 + <input type="hidden" name="fs_action" value="delete_account">
176 + <?php wp_nonce_field( 'delete_account' ) ?>
177 + <a class="fs-delete-account" href="#" onclick="if (confirm('<?php
178 + if ( $is_active_subscription ) {
179 + echo esc_attr( sprintf( fs_text_inline( 'Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the "Cancel" button, and first "Downgrade" your account. Are you sure you would like to continue with the deletion?', 'delete-account-x-confirm', $slug ), $plan->title ) );
180 + } else {
181 + echo esc_attr( sprintf( fs_text_inline( 'Deletion is not temporary. Only delete if you no longer want to use this %s anymore. Are you sure you would like to continue with the deletion?', 'delete-account-confirm', $slug ), $fs->get_module_label( true ) ) );
182 + }
183 + ?>')) this.parentNode.submit(); return false;"><i
184 + class="dashicons dashicons-no"></i> <?php fs_esc_html_echo_inline( 'Delete Account', 'delete-account', $slug ) ?></a>
185 + </form>
186 + </li>
298 187 <li>&nbsp;&bull;&nbsp;</li>
299 188 <?php endif ?>
300 - <?php if ( ! $is_whitelabeled ) : ?>
301 - <?php if ( ! $is_paying ) : ?>
302 - <li>
303 - <?php
304 - $view_params = array(
305 - 'freemius' => $fs,
306 - 'license' => $available_license,
307 - 'license_paid_plan' => $available_license_paid_plan,
308 - );
309 - fs_require_template( 'account/partials/disconnect-button.php', $view_params ); ?>
310 - </li>
311 - <li>&nbsp;&bull;&nbsp;</li>
189 + <?php if ( $is_paying ) : ?>
190 + <?php if ( ! fs_is_network_admin() ) : ?>
191 + <li>
192 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
193 + <input type="hidden" name="fs_action" value="deactivate_license">
194 + <?php wp_nonce_field( 'deactivate_license' ) ?>
195 + <a href="#" class="fs-deactivate-license"><i
196 + class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?>
197 + </a>
198 + </form>
199 + </li>
200 + <li>&nbsp;&bull;&nbsp;</li>
312 201 <?php endif ?>
313 - <?php if ( $is_paying ) : ?>
314 - <?php if ( ! fs_is_network_admin() ) : ?>
315 - <li>
316 - <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
317 - <input type="hidden" name="fs_action" value="deactivate_license">
318 - <?php wp_nonce_field( 'deactivate_license' ) ?>
319 - <a href="#" class="fs-deactivate-license"><i
320 - class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?>
321 - </a>
322 - </form>
323 - </li>
324 - <li>&nbsp;&bull;&nbsp;</li>
325 - <?php endif ?>
326 - <?php if ( ! $license->is_lifetime() &&
327 - $is_active_subscription
328 - ) : ?>
329 - <li>
330 - <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
331 - <input type="hidden" name="fs_action" value="downgrade_account">
332 - <?php wp_nonce_field( 'downgrade_account' ) ?>
333 - <a href="#"
334 - onclick="if ( confirm('<?php echo esc_attr( sprintf(
335 - $downgrade_x_confirm_text,
336 - ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
337 - $plan->title,
338 - human_time_diff( time(), strtotime( $license->expiration ) )
339 - ) ) ?> <?php if ( ! $license->is_block_features ) {
340 - echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) );
341 - } else {
342 - echo esc_attr( sprintf( $after_downgrade_blocking_text, $plan->title ) );
343 - }?> <?php echo esc_attr( $prices_increase_text ) ?> <?php fs_esc_attr_echo_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug ) ?>') ) this.parentNode.submit(); return false;"><i class="dashicons dashicons-download"></i> <?php echo esc_html( $fs->is_only_premium() ? fs_text_inline( 'Cancel Subscription', 'cancel-subscription', $slug ) : $downgrade_text ) ?></a>
344 - </form>
345 - </li>
346 - <li>&nbsp;&bull;&nbsp;</li>
347 - <?php endif ?>
348 - <?php if ( $is_plan_change_supported ) : ?>
349 - <li>
350 - <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>"><i
351 - class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a>
352 - </li>
353 - <li>&nbsp;&bull;&nbsp;</li>
354 - <?php endif ?>
355 - <?php elseif ( $is_paid_trial ) : ?>
356 - <li>
357 - <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
358 - <input type="hidden" name="fs_action" value="cancel_trial">
359 - <?php wp_nonce_field( 'cancel_trial' ) ?>
360 - <a href="#" class="fs-cancel-trial"><i
361 - class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a>
362 - </form>
363 - </li>
364 - <li>&nbsp;&bull;&nbsp;</li>
365 - <?php endif ?>
366 - <?php endif ?>
367 - <li>
368 - <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
369 - <input type="hidden" name="fs_action" value="<?php echo esc_attr( $fs->get_unique_affix() ) ?>_sync_license">
370 - <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
371 - <a href="#" onclick="this.parentNode.submit(); return false;"><i
372 - class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a>
373 - </form>
374 - </li>
202 + <?php if ( ! $license->is_lifetime() &&
203 + $is_active_subscription
204 + ) : ?>
205 + <li>
206 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
207 + <input type="hidden" name="fs_action" value="downgrade_account">
208 + <?php wp_nonce_field( 'downgrade_account' ) ?>
209 + <a href="#"
210 + onclick="if ( confirm('<?php echo esc_attr( sprintf(
211 + $downgrade_x_confirm_text,
212 + ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
213 + $plan->title,
214 + human_time_diff( time(), strtotime( $license->expiration ) )
215 + ) ) ?> <?php if ( ! $license->is_block_features ) {
216 + echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) );
217 + } else {
218 + echo esc_attr( sprintf( $after_downgrade_blocking_text, $plan->title ) );
219 + }?> <?php echo esc_attr( $prices_increase_text ) ?> <?php fs_esc_attr_echo_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug ) ?>') ) this.parentNode.submit(); return false;"><i class="dashicons dashicons-download"></i> <?php echo esc_html( $fs->is_only_premium() ? fs_text_inline( 'Cancel Subscription', 'cancel-subscription', $slug ) : $downgrade_text ) ?></a>
220 + </form>
221 + </li>
222 + <li>&nbsp;&bull;&nbsp;</li>
223 + <?php endif ?>
224 + <?php if ( ! $fs->is_single_plan() ) : ?>
225 + <li>
226 + <a href="<?php echo $fs->get_upgrade_url() ?>"><i
227 + class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a>
228 + </li>
229 + <li>&nbsp;&bull;&nbsp;</li>
230 + <?php endif ?>
231 + <?php elseif ( $is_paid_trial ) : ?>
232 + <li>
233 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
234 + <input type="hidden" name="fs_action" value="cancel_trial">
235 + <?php wp_nonce_field( 'cancel_trial' ) ?>
236 + <a href="#" class="fs-cancel-trial"><i
237 + class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a>
238 + </form>
239 + </li>
240 + <li>&nbsp;&bull;&nbsp;</li>
241 + <?php endif ?>
242 + <li>
243 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
244 + <input type="hidden" name="fs_action" value="<?php echo $fs->get_unique_affix() ?>_sync_license">
245 + <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
246 + <a href="#" onclick="this.parentNode.submit(); return false;"><i
247 + class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a>
248 + </form>
249 + </li>
250 +
375 251 </ul>
376 252 </div>
377 253 <div class="inside">
378 254 <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
@@ -379,47 +255,28 @@
379 255 <?php
380 256 $hide_license_key = ( ! $show_license_row || $fs->apply_filters( 'hide_license_key', false ) );
381 257
382 258 $profile = array();
383 -
384 - if ( ! $is_whitelabeled ) {
385 - $profile[] = array(
386 - 'id' => 'user_name',
387 - 'title' => fs_text_inline( 'Name', 'name', $slug ),
388 - 'value' => $name
389 - );
390 - // if (isset($user->email) && false !== strpos($user->email, '@'))
391 - $profile[] = array(
392 - 'id' => 'email',
393 - 'title' => fs_text_inline( 'Email', 'email', $slug ),
394 - 'value' => $user->email
395 - );
396 -
397 - if ( is_numeric( $user->id ) ) {
398 - $profile[] = array(
399 - 'id' => 'user_id',
400 - 'title' => fs_text_inline( 'User ID', 'user-id', $slug ),
401 - 'value' => $user->id
402 - );
403 - }
404 - }
405 -
406 259 $profile[] = array(
407 - 'id' => 'product',
408 - 'title' => ( $fs->is_plugin() ?
409 - fs_text_inline( 'Plugin', 'plugin', $slug ) :
410 - fs_text_inline( 'Theme', 'theme', $slug ) ),
411 - 'value' => $fs->get_plugin_title()
260 + 'id' => 'user_name',
261 + 'title' => fs_text_inline( 'Name', 'name', $slug ),
262 + 'value' => $name
412 263 );
413 -
264 + // if (isset($user->email) && false !== strpos($user->email, '@'))
414 265 $profile[] = array(
415 - 'id' => 'product_id',
416 - 'title' => ( $fs->is_plugin() ?
417 - fs_text_inline( 'Plugin', 'plugin', $slug ) :
418 - fs_text_inline( 'Theme', 'theme', $slug ) ) . ' ' . fs_text_inline( 'ID', 'id', $slug ),
419 - 'value' => $fs->get_id()
266 + 'id' => 'email',
267 + 'title' => fs_text_inline( 'Email', 'email', $slug ),
268 + 'value' => $user->email
420 269 );
421 270
271 + if ( is_numeric( $user->id ) ) {
272 + $profile[] = array(
273 + 'id' => 'user_id',
274 + 'title' => fs_text_inline( 'User ID', 'user-id', $slug ),
275 + 'value' => $user->id
276 + );
277 + }
278 +
422 279 if ( ! fs_is_network_admin()) {
423 280 $profile[] = array(
424 281 'id' => 'site_id',
425 282 'title' => fs_text_inline( 'Site ID', 'site-id', $slug ),
@@ -449,17 +306,9 @@
449 306 'title' => $version_text,
450 307 'value' => $fs->get_plugin_version()
451 308 );
452 309
453 - if ( ! fs_is_network_admin() && $is_premium ) {
454 - $profile[] = array(
455 - 'id' => 'beta_program',
456 - 'title' => '',
457 - 'value' => $site->is_beta
458 - );
459 - }
460 -
461 - if ( $has_paid_plan || $has_bundle_license ) {
310 + if ( $has_paid_plan ) {
462 311 if ( $fs->is_trial() ) {
463 312 if ( $show_plan_row ) {
464 313 $profile[] = array(
465 314 'id' => 'plan',
@@ -472,22 +321,14 @@
472 321 } else {
473 322 if ( $show_plan_row ) {
474 323 $profile[] = array(
475 324 'id' => 'plan',
476 - 'title' => ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
325 + 'title' => $plan_text,
477 326 'value' => strtoupper( is_string( $plan->name ) ?
478 327 $plan->title :
479 328 strtoupper( $free_text )
480 329 )
481 330 );
482 -
483 - if ( $has_bundle_license ) {
484 - $profile[] = array(
485 - 'id' => 'bundle_plan',
486 - 'title' => $bundle_plan_text,
487 - 'value' => $bundle_plan_title
488 - );
489 - }
490 331 }
491 332
492 333 if ( is_object( $license ) ) {
493 334 if ( ! $hide_license_key ) {
@@ -509,24 +350,17 @@
509 350 // to show current plan.
510 351 continue;
511 352 }
512 353 ?>
513 - <tr class="fs-field-<?php echo esc_attr( $p['id'] ) ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
354 + <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
514 355 <td>
515 - <nobr><?php echo esc_html( $p['title'] ) ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr>
356 + <nobr><?php echo $p['title'] ?>:</nobr>
516 357 </td>
517 - <td<?php if ( 'plan' === $p['id'] || 'bundle_plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
358 + <td<?php if ( 'plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
518 359 <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
519 - <code><?php echo FS_Plugin_License::mask_secret_key_for_html( $p['value'] ) ?></code>
520 - <?php if ( ! $is_whitelabeled ) : ?>
521 - <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
360 + <code><?php echo htmlspecialchars( substr( $p['value'], 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $p['value'], - 3 ) ) ?></code>
361 + <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
522 362 readonly/>
523 - <?php endif ?>
524 - <?php elseif ( 'beta_program' === $p['id'] ) : ?>
525 - <label>
526 - <input type="checkbox" class="fs-toggle-beta-mode" <?php checked( true, $p['value'] ) ?>/><span><?php
527 - fs_esc_html_echo_inline( 'Join the Beta program', 'join-beta', $slug )
528 - ?></span></label>
529 363 <?php else : ?>
530 364 <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
531 365 <?php endif ?>
532 366 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
@@ -536,9 +370,9 @@
536 370 <?php if ( $fs->is_trial() ) : ?>
537 371 <label class="fs-tag fs-success"><?php echo esc_html( $trial_text ) ?></label>
538 372 <?php endif ?>
539 373 <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
540 - <?php if ( ! $is_active_subscription && ! $is_active_bundle_subscription && ! $license->is_first_payment_pending() ) : ?>
374 + <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
541 375 <?php $is_license_expired = $license->is_expired() ?>
542 376 <?php $expired_ago_text = ( fs_text_inline( 'Expired', 'expired', $slug ) . ' ' . fs_text_x_inline( '%s ago', 'x-ago', $slug ) ) ?>
543 377 <label
544 378 class="fs-tag <?php echo $is_license_expired ? 'fs-error' : 'fs-warn' ?>"><?php
@@ -549,17 +383,18 @@
549 383 <?php endif ?>
550 384 <?php elseif ( $fs->is_trial() ) : ?>
551 385 <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ) ?></label>
552 386 <?php endif ?>
553 - <?php if ( ! $is_whitelabeled ) : ?>
554 387 <div class="button-group">
388 + <?php $available_license = $fs->is_free_plan() && ! fs_is_network_admin() ? $fs->_get_available_premium_license( $site->is_localhost() ) : false ?>
555 389 <?php if ( is_object( $available_license ) ) : ?>
390 + <?php $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ) ?>
556 391 <?php
557 392 $view_params = array(
558 393 'freemius' => $fs,
559 394 'slug' => $slug,
560 395 'license' => $available_license,
561 - 'plan' => $available_license_paid_plan,
396 + 'plan' => $premium_plan,
562 397 'is_localhost' => $site->is_localhost(),
563 398 'install_id' => $site->id,
564 399 'class' => 'button-primary',
565 400 );
@@ -564,20 +399,20 @@
564 399 'class' => 'button-primary',
565 400 );
566 401 fs_require_template( 'account/partials/activate-license-button.php', $view_params ); ?>
567 402 <?php else : ?>
568 - <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>"
403 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
569 404 method="POST" class="button-group">
570 - <?php if ( $show_upgrade && $is_premium ) : ?>
571 - <a class="button activate-license-trigger <?php echo esc_attr( $fs->get_unique_affix() ) ?>" href="#"><?php fs_esc_html_echo_inline( 'Activate License', 'activate-license', $slug ) ?></a>
405 + <?php if ( $show_upgrade && $fs->is_premium() ) : ?>
406 + <a class="button activate-license-trigger <?php echo $fs->get_unique_affix() ?>" href="#"><?php fs_esc_html_echo_inline( 'Activate License', 'activate-license', $slug ) ?></a>
572 407 <?php endif ?>
573 408 <input type="submit" class="button"
574 409 value="<?php echo esc_attr( $sync_license_text ) ?>">
575 410 <input type="hidden" name="fs_action"
576 - value="<?php echo esc_attr( $fs->get_unique_affix() ) ?>_sync_license">
411 + value="<?php echo $fs->get_unique_affix() ?>_sync_license">
577 412 <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
578 - <?php if ( $show_upgrade || $is_plan_change_supported ) : ?>
579 - <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>"
413 + <?php if ( $show_upgrade || ! $fs->is_single_plan() ) : ?>
414 + <a href="<?php echo $fs->get_upgrade_url() ?>"
580 415 class="button<?php
581 416 echo $show_upgrade ?
582 417 ' button-primary fs-upgrade' :
583 418 ' fs-change-plan'; ?> button-upgrade"><i
@@ -585,18 +420,11 @@
585 420 <?php endif ?>
586 421 </form>
587 422 <?php endif ?>
588 423 </div>
589 - <?php endif ?>
590 - <?php elseif ( 'bundle_plan' === $p['id'] ) : ?>
591 - <?php if ( is_object( $bundle_subscription ) ) : ?>
592 - <?php if ( $is_active_bundle_subscription && ! $is_bundle_first_payment_pending ) : ?>
593 - <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $bundle_subscription->next_payment ) ) ) ) ?></label>
594 - <?php endif ?>
595 - <?php endif ?>
596 424 <?php elseif ( 'version' === $p['id'] && $has_paid_plan ) : ?>
597 425 <?php if ( $fs->has_premium_version() ) : ?>
598 - <?php if ( $is_premium ) : ?>
426 + <?php if ( $fs->is_premium() ) : ?>
599 427 <label
600 428 class="fs-tag fs-<?php echo $fs->can_use_premium_code() ? 'success' : 'warn' ?>"><?php fs_esc_html_echo_inline( 'Premium version', 'premium-version', $slug ) ?></label>
601 429 <?php elseif ( $fs->can_use_premium_code() ) : ?>
602 430 <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'Free version', 'free-version', $slug ) ?></label>
@@ -603,9 +431,9 @@
603 431 <?php endif ?>
604 432 <?php endif ?>
605 433 <?php endif ?>
606 434 </td>
607 - <?php if ( 'plan' !== $p['id'] && 'bundle_plan' !== $p['id'] ) : ?>
435 + <?php if ( 'plan' !== $p['id'] ) : ?>
608 436 <td class="fs-right">
609 437 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
610 438 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
611 439 <input type="hidden" name="fs_action" value="verify_email">
@@ -618,35 +446,13 @@
618 446 <?php if ( $fs->has_release_on_freemius() ) : ?>
619 447 <div class="button-group">
620 448 <?php if ( $is_paying || $fs->is_trial() ) : ?>
621 449 <?php if ( ! $fs->is_allowed_to_install() ) : ?>
622 - <a target="_blank" rel="noopener" class="button button-primary"
623 - href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php
624 - $download_version_text_suffix = ( is_object( $update ) ? ' [' . $update->version . ']' : '' );
625 -
626 - $download_version_text = sprintf(
627 - /* translators: %s: plan name (e.g. Download "Professional" Version) */
628 - fs_text_inline( 'Download %s Version', 'download-x-version', $slug ),
629 - ( $fs->is_trial() ? $trial_plan->title : $plan->title )
630 - ) .
631 - $download_version_text_suffix;
632 -
633 - $download_version_text_length = function_exists( 'mb_strlen' ) ?
634 - mb_strlen( $download_version_text ) :
635 - strlen( $download_version_text );
636 -
637 - if ( $download_version_text_length > 31 ) {
638 - /**
639 - * Try to limit the number of characters to 31 for now.
640 - *
641 - * @author Leo Fajardo (@leorw)
642 - * @aince 2.3.2
643 - */
644 - $download_version_text = fs_text_inline( 'Download Paid Version', 'download-paid-version', $slug ) . $download_version_text_suffix;
645 - }
646 -
647 - echo $download_version_text;
648 - ?></a>
450 + <a target="_blank" class="button button-primary"
451 + href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php echo sprintf(
452 + /* translators: %s: plan name (e.g. Download "Professional" Version) */
453 + fs_text_inline( 'Download %s Version', 'download-x-version', $slug ),
454 + ( $fs->is_trial() ? $trial_plan->title : $plan->title ) ) . ( is_object( $update ) ? ' [' . $update->version . ']' : '' ) ?></a>
649 455 <?php elseif ( is_object( $update ) ) : ?>
650 456 <?php
651 457 $module_type = $fs->get_module_type();
652 458 ?>
@@ -657,14 +463,12 @@
657 463 </div>
658 464 <?php endif ?>
659 465 <?php
660 466 elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
661 - <?php if ( ! $is_whitelabeled && ( 'site_secret_key' === $p['id'] || ! $is_license_foreign ) ) : ?>
662 - <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
663 - <?php endif ?>
664 - <?php if ('license_key' === $p['id']) : ?>
665 - <button class="button button-small activate-license-trigger <?php echo $fs->get_unique_affix() ?>"><?php fs_esc_html_echo_inline( 'Change License', 'change-license', $slug ) ?></button>
666 - <?php endif ?>
467 + <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
468 + <?php if ('license_key' === $p['id']) : ?>
469 + <button class="button button-small activate-license-trigger <?php echo $fs->get_unique_affix() ?>"><?php fs_esc_html_echo_inline( 'Change License', 'change-license', $slug ) ?></button>
470 + <?php endif ?>
667 471 <?php
668 472 elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
669 473 ( is_string( $user->secret_key ) && in_array( $p['id'], array(
670 474 'email',
@@ -670,9 +474,8 @@
670 474 'email',
671 475 'user_name'
672 476 ) ) )
673 477 ) : ?>
674 - <?php if ( 'email' !== $p['id'] || ! fs_is_network_admin() ) : ?>
675 478 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
676 479 onsubmit="var val = prompt('<?php echo esc_attr( sprintf(
677 480 /* translators: %s: User's account property (e.g. name, email) */
678 481 fs_text_inline( 'What is your %s?', 'what-is-your-x', $slug ),
@@ -681,33 +484,17 @@
681 484 <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
682 485 <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>"
683 486 value="">
684 487 <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
685 - <input type="submit" class="button button-small <?php if ( 'email' === $p['id'] ) echo 'button-edit-email-address' ?>"
488 + <input type="submit" class="button button-small"
686 489 value="<?php echo fs_esc_attr_x_inline( 'Edit', 'verb', 'edit', $slug ) ?>">
687 490 </form>
688 - <?php endif ?>
689 - <?php elseif ( 'user_id' === $p['id'] && ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) : ?>
690 - <input id="fs_change_user" type="submit" class="button button-small"
691 - value="<?php echo fs_esc_attr_inline( 'Change User', 'change-user', $slug ) ?>">
692 491 <?php endif ?>
693 492 </td>
694 493 <?php endif ?>
695 494 </tr>
696 - <?php
697 - if ( 'version' === $p['id'] && $is_premium ) {
698 - /**
699 - * If there's a row for the beta program, keep its background color
700 - * the same as the version info row.
701 - *
702 - * @author Leo Fajardo (@leorw)
703 - * @since 2.3.0
704 - */
705 - continue;
706 - }
707 -
708 - $odd = ! $odd;
709 - endforeach ?>
495 + <?php $odd = ! $odd;
496 + endforeach ?>
710 497 </table>
711 498 </div>
712 499 </div>
713 500 <?php if ( fs_is_network_admin() ) : ?>
@@ -713,21 +500,20 @@
713 500 <?php if ( fs_is_network_admin() ) : ?>
714 501 <div id="fs_sites" class="postbox">
715 502 <h3><span class="dashicons dashicons-networking"></span> <?php fs_esc_html_echo_inline( 'Sites', 'sites', $slug ) ?></h3>
716 503 <div class="fs-header-actions">
717 - <?php if ( ! $is_whitelabeled ) : ?>
718 - <?php $has_license = is_object( $license ) ?>
719 - <?php if ( $has_license || ( $show_upgrade && $is_premium ) ) : ?>
720 - <?php
721 - $activate_license_button_text = $has_license ?
722 - fs_esc_html_inline( 'Change License', 'change-license', $slug ) :
723 - fs_esc_html_inline( 'Activate License', 'activate-license', $slug );
724 - ?>
725 - <a class="button<?php echo ( ! $has_license ? ' button-primary' : '' ) ?> activate-license-trigger <?php echo $fs->get_unique_affix() ?>" href="#"><?php echo $activate_license_button_text ?></a>
726 - <?php endif ?>
504 + <?php $has_license = is_object( $license ) ?>
505 + <?php if ( $has_license || ( $show_upgrade && $fs->is_premium() ) ) : ?>
506 + <?php
507 + $activate_license_button_text = $has_license ?
508 + fs_esc_html_inline( 'Change License', 'change-license', $slug ) :
509 + fs_esc_html_inline( 'Activate License', 'activate-license', $slug );
510 + ?>
511 + <a class="button<?php echo ( ! $has_license ? ' button-primary' : '' ) ?> activate-license-trigger <?php echo $fs->get_unique_affix() ?>" href="#"><?php echo $activate_license_button_text ?></a>
727 512 <?php endif ?>
728 513 <input class="fs-search" type="text" placeholder="<?php fs_esc_attr_echo_inline( 'Search by address', 'search-by-address', $slug ) ?>..."><span class="dashicons dashicons-search"></span>
729 514 </div>
515 +
730 516 <div class="inside">
731 517 <div id="" class="fs-scrollable-table">
732 518 <div class="fs-table-head">
733 519 <table class="widefat">
@@ -744,32 +530,14 @@
744 530 </div>
745 531 <div class="fs-table-body">
746 532 <table class="widefat">
747 533 <?php
748 - $current_blog_id = get_current_blog_id();
749 -
750 534 foreach ( $site_view_params as $view_params ) {
751 535 fs_require_template(
752 536 'account/partials/site.php',
753 537 $view_params
754 538 );
755 - }
756 -
757 - /**
758 - * It's possible for the `Freemius::switch_to_blog()` method to be called within the `site.php` template and this changes the Freemius instance's context, so this check is for restoring the previous context based on the previously retrieved site.
759 - *
760 - * @author Leo Fajardo (@leorw)
761 - * @since 2.5.0
762 - */
763 - $current_install = $fs->get_site();
764 -
765 - if (
766 - is_object( $site ) &&
767 - ( ! is_object( $current_install ) || $current_install->id != $site->id )
768 - ) {
769 - $fs->switch_to_blog( $current_blog_id, $site, true );
770 - }
771 - ?>
539 + } ?>
772 540 </table>
773 541 </div>
774 542 </div>
775 543 </div>
@@ -774,8 +542,23 @@
774 542 </div>
775 543 </div>
776 544 </div>
777 545 <?php endif ?>
546 +
547 + <?php
548 + $account_addons = $fs->get_account_addons();
549 + if ( ! is_array( $account_addons ) ) {
550 + $account_addons = array();
551 + }
552 +
553 + $installed_addons = $fs->get_installed_addons();
554 + $installed_addons_ids = array();
555 + foreach ( $installed_addons as $fs_addon ) {
556 + $installed_addons_ids[] = $fs_addon->get_id();
557 + }
558 +
559 + $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
560 + ?>
778 561 <?php if ( 0 < count( $addons_to_show ) ) : ?>
779 562 <!-- Add-Ons -->
780 563 <div class="postbox">
781 564 <div class="">
@@ -788,88 +571,26 @@
788 571 <th><?php echo esc_html( $version_text ) ?></th>
789 572 <th><?php echo esc_html( $plan_text ) ?></th>
790 573 <th><?php fs_esc_html_echo_x_inline( 'License', 'as software license', 'license', $slug ) ?></th>
791 574 <th></th>
792 - <?php if ( $is_dev_mode ) : ?>
575 + <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
793 576 <th></th>
794 577 <?php endif ?>
795 578 </tr>
796 579 </thead>
797 580 <tbody>
798 - <?php
799 - $odd = true;
800 -
801 - $installed_addons_ids_map = array_flip( $installed_addons_ids );
802 -
803 - $addon_info_by_id = array();
804 - $hide_all_addons_data = false;
805 -
806 - if ( $fs->is_whitelabeled_by_flag() ) {
807 - $hide_all_addons_data = true;
808 -
809 - foreach ( $addons_to_show as $addon_id ) {
810 - $is_addon_installed = isset( $installed_addons_ids_map[ $addon_id ] );
811 - $addon_info = $fs->_get_addon_info( $addon_id, $is_addon_installed );
812 - $is_addon_connected = $addon_info['is_connected'];
813 -
814 - $fs_addon = ( $is_addon_connected && $is_addon_installed ) ?
815 - freemius( $addon_id ) :
816 - null;
817 -
818 - $is_whitelabeled = is_object( $fs_addon ) ?
819 - $fs_addon->is_whitelabeled( true ) :
820 - $addon_info['is_whitelabeled'];
821 -
822 - if ( ! $is_whitelabeled ) {
823 - $hide_all_addons_data = false;
824 - }
825 -
826 - if ( $is_data_debug_mode ) {
827 - $is_whitelabeled = false;
828 - }
829 -
830 - $addon_info_by_id[ $addon_id ] = $addon_info;
831 - }
832 - }
833 -
581 + <?php $odd = true;
834 582 foreach ( $addons_to_show as $addon_id ) {
835 - $is_addon_installed = isset( $installed_addons_ids_map[ $addon_id ] );
836 -
837 - if (
838 - $hide_all_addons_data &&
839 - ! $is_addon_installed &&
840 - ! file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $fs->get_addon_basename( $addon_id ) ) )
841 - ) {
842 - continue;
843 - }
844 -
845 583 $addon_view_params = array(
846 - 'parent_fs' => $fs,
847 - 'addon_id' => $addon_id,
848 - 'odd' => $odd,
849 - 'fs_blog_id' => $fs_blog_id,
850 - 'active_plugins_directories_map' => &$active_plugins_directories_map,
851 - 'is_addon_installed' => $is_addon_installed,
852 - 'addon_info' => isset( $addon_info_by_id[ $addon_id ] ) ?
853 - $addon_info_by_id[ $addon_id ] :
854 - $fs->_get_addon_info( $addon_id, $is_addon_installed ),
855 - 'is_whitelabeled' => ( $is_whitelabeled && ! $is_data_debug_mode )
584 + 'parent_fs' => $fs,
585 + 'addon_id' => $addon_id,
586 + 'odd' => $odd,
856 587 );
857 588
858 - if ( ! empty($addon_view_params['addon_info'] ) ) {
859 - fs_require_template(
860 - 'account/partials/addon.php',
861 - $addon_view_params
862 - );
863 - } else {
864 - // If we are here it means there is an activation of an unreleased add-on and yet the SDK is not in development mode.
865 - echo '<tr>';
866 - echo '<td style="text-align: right;">' . esc_html( $addon_id ) . '</td>';
867 - echo '<td colspan="' . ( $is_dev_mode ? 6 : 5 ) . '" style="text-align: left;">';
868 - echo 'The add-on you have activated is no longer <a href="https://freemius.com/help/documentation/wordpress/selling-add-ons-extensions/#preparing-the-add-on-for-sale" rel="noreferrer noopener" target="_blank">listed</a> by the product owner, or the SDK is not running in <a href="https://freemius.com/help/documentation/wordpress-sdk/testing/" rel="noreferrer noopener" target="_blank">test mode</a>. Please <a href="' . esc_url( $fs->contact_url() ) . '">contact support</a> if you need further assistance.';
869 - echo '</td>';
870 - echo '</tr>';
871 - }
589 + fs_require_template(
590 + 'account/partials/addon.php',
591 + $addon_view_params
592 + );
872 593
873 594 $odd = ! $odd;
874 595 } ?>
875 596 </tbody>
@@ -880,13 +601,11 @@
880 601
881 602 <?php $fs->do_action( 'after_account_details' ) ?>
882 603
883 604 <?php
884 - if ( $show_billing ) {
885 - $view_params = array( 'id' => $VARS['id'], 'payments' => $payments );
886 - fs_require_once_template( 'account/billing.php', $view_params );
887 - fs_require_once_template( 'account/payments.php', $view_params );
888 - }
605 + $view_params = array( 'id' => $VARS['id'] );
606 + fs_require_once_template( 'account/billing.php', $view_params );
607 + fs_require_once_template( 'account/payments.php', $view_params );
889 608 ?>
890 609 </div>
891 610 </div>
892 611 </div>
@@ -891,14 +610,9 @@
891 610 </div>
892 611 </div>
893 612 </div>
894 613 </div>
895 - <?php
896 - $subscription_cancellation_dialog_box_template_params = $fs->_get_subscription_cancellation_dialog_box_template_params( true );
897 - if ( ! empty( $subscription_cancellation_dialog_box_template_params ) ) {
898 - fs_require_template( 'forms/subscription-cancellation.php', $subscription_cancellation_dialog_box_template_params );
899 - }
900 - ?>
614 + <?php $fs->_maybe_add_subscription_cancellation_dialog_box( true ) ?>
901 615 <script type="text/javascript">
902 616 (function ($) {
903 617 var setLoading = function ($this, label) {
904 618 // Set loading mode.
@@ -945,48 +659,8 @@
945 659 '...'
946 660 );
947 661 });
948 662
949 - <?php
950 - $plugin_title = $fs->get_plugin_title();
951 - $processing_text = fs_esc_js_inline( 'Processing', 'processing' );
952 - $confirmation_message = sprintf(
953 - '%s %s',
954 - sprintf( fs_esc_attr_inline( 'Get updates for bleeding edge Beta versions of %s.', 'get-beta-versions', $slug ), $plugin_title ),
955 - sprintf( fs_esc_attr_inline( 'An update to a Beta version will replace your installed version of %s with the latest Beta release - use with caution, and not on production sites. You have been warned.', 'beta-version-update-caution', $slug ), $plugin_title )
956 - );
957 - ?>
958 -
959 - $( '.fs-toggle-beta-mode' ).click( function () {
960 - var $checkbox = $( this ),
961 - isChecked = $checkbox.is( ':checked' );
962 -
963 - if ( ! isChecked || confirm( '<?php echo $confirmation_message ?>' ) ) {
964 - $.ajax( {
965 - url : <?php echo Freemius::ajax_url() ?>,
966 - method: 'POST',
967 - data : {
968 - action : '<?php echo $fs->get_ajax_action( 'set_beta_mode' ) ?>',
969 - security : '<?php echo $fs->get_ajax_security( 'set_beta_mode' ) ?>',
970 - is_beta : isChecked,
971 - module_id: <?php echo $fs->get_id() ?>
972 - },
973 - beforeSend: function () {
974 - $checkbox.prop( 'disabled', true );
975 - $checkbox.parent().find( 'span' ).text( '<?php echo $processing_text ?>' + '...' );
976 - },
977 - complete: function () {
978 - $checkbox.prop( 'disabled', false );
979 - $checkbox.parent().find( 'span' ).text( '<?php fs_esc_js_echo_inline( 'Join the Beta Program', 'join-beta', $slug ) ?>' );
980 - }
981 - } );
982 -
983 - return true;
984 - }
985 -
986 - return false;
987 - });
988 -
989 663 $('.fs-opt-in').click(function () {
990 664 setLoading($(this), '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>...');
991 665 });
992 666
@@ -1100,31 +774,8 @@
1100 774 }
1101 775 });
1102 776 });
1103 777
1104 - $( '.fs-toggle-whitelabel-mode' ).click( function () {
1105 - var $toggleLink = $( this );
1106 -
1107 - $.ajax( {
1108 - url : <?php echo Freemius::ajax_url() ?>,
1109 - method: 'POST',
1110 - data : {
1111 - action : '<?php echo $fs->get_ajax_action( 'toggle_whitelabel_mode' ) ?>',
1112 - security : '<?php echo $fs->get_ajax_security( 'toggle_whitelabel_mode' ) ?>',
1113 - module_id: <?php echo $fs->get_id() ?>
1114 - },
1115 - beforeSend: function () {
1116 - $toggleLink.parent().text( '<?php
1117 - $is_whitelabeled ?
1118 - fs_esc_html_echo_inline( 'Disabling white-label mode', 'disabling-whitelabel-mode' ) :
1119 - fs_esc_html_echo_inline( 'Enabling white-label mode', 'enabling-whitelabel-mode' )
1120 - ?>' + '...' );
1121 - },
1122 - complete: function () {
1123 - location.reload();
1124 - }
1125 - } );
1126 - });
1127 778 })(jQuery);
1128 779 </script>
1129 780 <?php
1130 781 if ( $has_tabs ) {
@@ -1129,4 +780,13 @@
1129 780 <?php
1130 781 if ( $has_tabs ) {
1131 782 $fs->_add_tabs_after_content();
1132 783 }
784 +
785 + $params = array(
786 + 'page' => 'account',
787 + 'module_id' => $fs->get_id(),
788 + 'module_type' => $fs->get_module_type(),
789 + 'module_slug' => $slug,
790 + 'module_version' => $fs->get_plugin_version(),
791 + );
792 + fs_require_template( 'powered-by.php', $params );