PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 1.5
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v1.5
3.6.0 3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 All 110 releases
buttonizer-multifunctional-button / freemius / templates / account.php

account.php in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder 1.5, at freemius/templates/account.php

735 lines 37.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.3
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
19 $slug = $fs->get_slug();
20
21 /**
22 * @var FS_Plugin_Tag $update
23 */
24 $update = $fs->get_update( false, false, WP_FS__TIME_24_HOURS_IN_SEC / 24 );
25
26 if ( is_object($update) ) {
27 /**
28 * This logic is particularly required for multisite environment.
29 * If a module is site activated (not network) and not on the main site,
30 * the module will NOT be executed on the network level, therefore, the
31 * custom updates logic will not be executed as well, so unless we force
32 * the injection of the update into the updates transient, premium updates
33 * will not work.
34 *
35 * @author Vova Feldman (@svovaf)
36 * @since 2.0.0
37 */
38 $updater = FS_Plugin_Updater::instance( $fs );
39 $updater->set_update_data( $update );
40 }
41
42 $is_paying = $fs->is_paying();
43 $user = $fs->get_user();
44 $site = $fs->get_site();
45 $name = $user->get_name();
46 $license = $fs->_get_license();
47 $subscription = ( is_object( $license ) ?
48 $fs->_get_subscription( $license->id ) :
49 null );
50 $plan = $fs->get_plan();
51 $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
52 $is_paid_trial = $fs->is_paid_trial();
53 $has_paid_plan = $fs->has_paid_plan();
54 $show_upgrade = ( $has_paid_plan && ! $is_paying && ! $is_paid_trial );
55 $trial_plan = $fs->get_trial_plan();
56
57 if ( $has_paid_plan ) {
58 $fs->_add_license_activation_dialog_box();
59 }
60
61 if ( fs_request_get_bool( 'auto_install' ) ) {
62 $fs->_add_auto_installation_dialog_box();
63 }
64
65 if ( fs_request_get_bool( 'activate_license' ) ) {
66 // Open the license activation dialog box on the account page.
67 add_action( 'admin_footer', array(
68 &$fs,
69 '_open_license_activation_dialog_box'
70 ) );
71 }
72
73 $has_tabs = $fs->_add_tabs_before_content();
74
75 if ( $has_tabs ) {
76 $query_params['tabs'] = 'true';
77 }
78
79 // Aliases.
80 $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
81 $downgrade_x_confirm_text = fs_text_inline( 'Downgrading your plan will immediately stop all future recurring payments and your %s plan license will expire in %s.', 'downgrade-x-confirm', $slug );
82 $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 );
83 $after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s updates and support.', 'after-downgrade-non-blocking', $slug );
84 $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 );
85 /* translators: %s: Plan title (e.g. "Professional") */
86 $activate_plan_text = fs_text_inline( 'Activate %s Plan', 'activate-x-plan', $slug );
87 $version_text = fs_text_x_inline( 'Version', 'product version', 'version', $slug );
88 /* translators: %s: Time period (e.g. Auto renews in "2 months") */
89 $renews_in_text = fs_text_inline( 'Auto renews in %s', 'renews-in', $slug );
90 /* translators: %s: Time period (e.g. Expires in "2 months") */
91 $expires_in_text = fs_text_inline( 'Expires in %s', 'expires-in', $slug );
92 $sync_license_text = fs_text_x_inline( 'Sync License', 'as synchronize license', 'sync-license', $slug );
93 $cancel_trial_text = fs_text_inline( 'Cancel Trial', 'cancel-trial', $slug );
94 $change_plan_text = fs_text_inline( 'Change Plan', 'change-plan', $slug );
95 $upgrade_text = fs_text_x_inline( 'Upgrade', 'verb', 'upgrade', $slug );
96 $addons_text = fs_text_inline( 'Add-Ons', 'add-ons', $slug );
97 $downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug );
98 $trial_text = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
99 $free_text = fs_text_inline( 'Free', 'free', $slug );
100 $activate_text = fs_text_inline( 'Activate', 'activate', $slug );
101 $plan_text = fs_text_x_inline( 'Plan', 'as product pricing plan', 'plan', $slug );
102
103 $show_plan_row = true;
104 $show_license_row = is_object( $license );
105
106 $site_view_params = array();
107
108 if ( fs_is_network_admin() ) {
109 $sites = Freemius::get_sites();
110 $all_installs_plan_id = null;
111 $all_installs_license_id = ( $show_license_row ? $license->id : null );
112 foreach ( $sites as $s ) {
113 $site_info = $fs->get_site_info( $s );
114 $install = $fs->get_install_by_blog_id( $site_info['blog_id'] );
115 $view_params = array(
116 'freemius' => $fs,
117 'license' => $license,
118 'site' => $site_info,
119 'install' => $install,
120 );
121
122 $site_view_params[] = $view_params;
123
124 if ( empty( $install ) ) {
125 continue;
126 }
127
128 if ( $show_plan_row ) {
129 if ( is_null( $all_installs_plan_id ) ) {
130 $all_installs_plan_id = $install->plan_id;
131 } else if ( $all_installs_plan_id != $install->plan_id ) {
132 $show_plan_row = false;
133 }
134 }
135
136 if ( $show_license_row && $all_installs_license_id != $install->license_id ) {
137 $show_license_row = false;
138 }
139 }
140 }
141 ?>
142 <div class="wrap fs-section">
143 <?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
144 <h2 class="nav-tab-wrapper">
145 <a href="<?php echo $fs->get_account_url() ?>"
146 class="nav-tab nav-tab-active"><?php fs_esc_html_echo_inline( 'Account', 'account', $slug ) ?></a>
147 <?php if ( $fs->has_addons() ) : ?>
148 <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
149 class="nav-tab"><?php echo esc_html( $addons_text ) ?></a>
150 <?php endif ?>
151 <?php if ( $show_upgrade ) : ?>
152 <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a>
153 <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
154 <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a>
155 <?php endif ?>
156 <?php endif ?>
157 </h2>
158 <?php endif ?>
159
160 <div id="poststuff">
161 <div id="fs_account">
162 <div class="has-sidebar has-right-sidebar">
163 <div class="has-sidebar-content">
164 <div class="postbox">
165 <h3><span class="dashicons dashicons-businessman"></span> <?php fs_esc_html_echo_inline( 'Account Details', 'account-details', $slug ) ?></h3>
166 <div class="fs-header-actions">
167 <ul>
168 <?php if ( ! $is_paying ) : ?>
169 <li>
170 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
171 <input type="hidden" name="fs_action" value="delete_account">
172 <?php wp_nonce_field( 'delete_account' ) ?>
173 <a class="fs-delete-account" href="#" onclick="if (confirm('<?php
174 if ( $is_active_subscription ) {
175 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 ) );
176 } else {
177 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 ) ) );
178 }
179 ?>')) this.parentNode.submit(); return false;"><i
180 class="dashicons dashicons-no"></i> <?php fs_esc_html_echo_inline( 'Delete Account', 'delete-account', $slug ) ?></a>
181 </form>
182 </li>
183 <li>&nbsp;&bull;&nbsp;</li>
184 <?php endif ?>
185 <?php if ( $is_paying ) : ?>
186 <?php if ( ! fs_is_network_admin() ) : ?>
187 <li>
188 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
189 <input type="hidden" name="fs_action" value="deactivate_license">
190 <?php wp_nonce_field( 'deactivate_license' ) ?>
191 <a href="#" class="fs-deactivate-license"><i
192 class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?>
193 </a>
194 </form>
195 </li>
196 <li>&nbsp;&bull;&nbsp;</li>
197 <?php endif ?>
198 <?php if ( ! $license->is_lifetime() &&
199 $is_active_subscription
200 ) : ?>
201 <li>
202 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
203 <input type="hidden" name="fs_action" value="downgrade_account">
204 <?php wp_nonce_field( 'downgrade_account' ) ?>
205 <a href="#"
206 onclick="if ( confirm('<?php echo esc_attr( sprintf( $downgrade_x_confirm_text, $plan->title, human_time_diff( time(), strtotime( $license->expiration ) ) ) ) ?> <?php if ( ! $license->is_block_features ) {
207 echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) );
208 } else {
209 echo esc_attr( sprintf( $after_downgrade_blocking_text, $plan->title ) );
210 }?> <?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>
211 </form>
212 </li>
213 <li>&nbsp;&bull;&nbsp;</li>
214 <?php endif ?>
215 <?php if ( ! $fs->is_single_plan() ) : ?>
216 <li>
217 <a href="<?php echo $fs->get_upgrade_url() ?>"><i
218 class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a>
219 </li>
220 <li>&nbsp;&bull;&nbsp;</li>
221 <?php endif ?>
222 <?php elseif ( $is_paid_trial ) : ?>
223 <li>
224 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
225 <input type="hidden" name="fs_action" value="cancel_trial">
226 <?php wp_nonce_field( 'cancel_trial' ) ?>
227 <a href="#"
228 onclick="if (confirm('<?php echo esc_attr( $cancel_trial_confirm_text ) ?>')) this.parentNode.submit(); return false;"><i
229 class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a>
230 </form>
231 </li>
232 <li>&nbsp;&bull;&nbsp;</li>
233 <?php endif ?>
234 <li>
235 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
236 <input type="hidden" name="fs_action" value="<?php echo $fs->get_unique_affix() ?>_sync_license">
237 <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
238 <a href="#" onclick="this.parentNode.submit(); return false;"><i
239 class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a>
240 </form>
241 </li>
242
243 </ul>
244 </div>
245 <div class="inside">
246 <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
247 <?php
248 $hide_license_key = ( ! $show_license_row || $fs->apply_filters( 'hide_license_key', false ) );
249
250 $profile = array();
251 $profile[] = array(
252 'id' => 'user_name',
253 'title' => fs_text_inline( 'Name', 'name', $slug ),
254 'value' => $name
255 );
256 // if (isset($user->email) && false !== strpos($user->email, '@'))
257 $profile[] = array(
258 'id' => 'email',
259 'title' => fs_text_inline( 'Email', 'email', $slug ),
260 'value' => $user->email
261 );
262
263 if ( is_numeric( $user->id ) ) {
264 $profile[] = array(
265 'id' => 'user_id',
266 'title' => fs_text_inline( 'User ID', 'user-id', $slug ),
267 'value' => $user->id
268 );
269 }
270
271 if ( ! fs_is_network_admin()) {
272 $profile[] = array(
273 'id' => 'site_id',
274 'title' => fs_text_inline( 'Site ID', 'site-id', $slug ),
275 'value' => is_string( $site->id ) ?
276 $site->id :
277 fs_text_inline( 'No ID', 'no-id', $slug )
278 );
279
280 $profile[] = array(
281 'id' => 'site_public_key',
282 'title' => fs_text_inline( 'Public Key', 'public-key', $slug ),
283 'value' => $site->public_key
284 );
285
286 $profile[] = array(
287 'id' => 'site_secret_key',
288 'title' => fs_text_inline( 'Secret Key', 'secret-key', $slug ),
289 'value' => ( ( is_string( $site->secret_key ) ) ?
290 $site->secret_key :
291 fs_text_x_inline( 'No Secret', 'as secret encryption key missing', 'no-secret', $slug )
292 )
293 );
294 }
295
296 $profile[] = array(
297 'id' => 'version',
298 'title' => $version_text,
299 'value' => $fs->get_plugin_version()
300 );
301
302 if ( $has_paid_plan ) {
303 if ( $fs->is_trial() ) {
304 if ( $show_plan_row ) {
305 $profile[] = array(
306 'id' => 'plan',
307 'title' => $plan_text,
308 'value' => ( is_string( $trial_plan->name ) ?
309 strtoupper( $trial_plan->title ) :
310 fs_text_inline( 'Trial', 'trial', $slug ) )
311 );
312 }
313 } else {
314 if ( $show_plan_row ) {
315 $profile[] = array(
316 'id' => 'plan',
317 'title' => $plan_text,
318 'value' => strtoupper( is_string( $plan->name ) ?
319 $plan->title :
320 strtoupper( $free_text )
321 )
322 );
323 }
324
325 if ( is_object( $license ) ) {
326 if ( ! $hide_license_key ) {
327 $profile[] = array(
328 'id' => 'license_key',
329 'title' => fs_text_inline( 'License Key', $slug ),
330 'value' => $license->secret_key,
331 );
332 }
333 }
334 }
335 }
336 ?>
337 <?php $odd = true;
338 foreach ( $profile as $p ) : ?>
339 <?php
340 if ( 'plan' === $p['id'] && ! $has_paid_plan ) {
341 // If plugin don't have any paid plans, there's no reason
342 // to show current plan.
343 continue;
344 }
345 ?>
346 <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
347 <td>
348 <nobr><?php echo $p['title'] ?>:</nobr>
349 </td>
350 <td<?php if ( 'plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
351 <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
352 <code><?php echo htmlspecialchars( substr( $p['value'], 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $p['value'], - 3 ) ) ?></code>
353 <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
354 readonly/>
355 <?php else : ?>
356 <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
357 <?php endif ?>
358 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
359 <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'not verified', 'not-verified', $slug ) ?></label>
360 <?php endif ?>
361 <?php if ( 'plan' === $p['id'] ) : ?>
362 <?php if ( $fs->is_trial() ) : ?>
363 <label class="fs-tag fs-success"><?php echo esc_html( $trial_text ) ?></label>
364 <?php endif ?>
365 <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
366 <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
367 <label
368 class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $license->expiration ) ) ) ) ?></label>
369 <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
370 <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ) ?></label>
371 <?php endif ?>
372 <?php elseif ( $fs->is_trial() ) : ?>
373 <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ) ?></label>
374 <?php endif ?>
375 <div class="button-group">
376 <?php $available_license = $fs->is_free_plan() && ! fs_is_network_admin() ? $fs->_get_available_premium_license( $site->is_localhost() ) : false ?>
377 <?php if ( is_object( $available_license ) ) : ?>
378 <?php $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ) ?>
379 <?php
380 $view_params = array(
381 'freemius' => $fs,
382 'slug' => $slug,
383 'license' => $available_license,
384 'plan' => $premium_plan,
385 'is_localhost' => $site->is_localhost(),
386 'install_id' => $site->id,
387 'class' => 'button-primary',
388 );
389 fs_require_template( 'account/partials/activate-license-button.php', $view_params ); ?>
390 <?php else : ?>
391 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
392 method="POST" class="button-group">
393 <?php if ( $show_upgrade && $fs->is_premium() ) : ?>
394 <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>
395 <?php endif ?>
396 <input type="submit" class="button"
397 value="<?php echo esc_attr( $sync_license_text ) ?>">
398 <input type="hidden" name="fs_action"
399 value="<?php echo $fs->get_unique_affix() ?>_sync_license">
400 <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
401 <?php if ( $show_upgrade || ! $fs->is_single_plan() ) : ?>
402 <a href="<?php echo $fs->get_upgrade_url() ?>"
403 class="button<?php
404 echo $show_upgrade ?
405 ' button-primary fs-upgrade' :
406 ' fs-change-plan'; ?> button-upgrade"><i
407 class="dashicons dashicons-cart"></i> <?php echo esc_html( $show_upgrade ? $upgrade_text : $change_plan_text ) ?></a>
408 <?php endif ?>
409 </form>
410 <?php endif ?>
411 </div>
412 <?php elseif ( 'version' === $p['id'] && $has_paid_plan ) : ?>
413 <?php if ( $fs->has_premium_version() ) : ?>
414 <?php if ( $fs->is_premium() ) : ?>
415 <label
416 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>
417 <?php elseif ( $fs->can_use_premium_code() ) : ?>
418 <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'Free version', 'free-version', $slug ) ?></label>
419 <?php endif ?>
420 <?php endif ?>
421 <?php endif ?>
422 </td>
423 <?php if ( 'plan' !== $p['id'] ) : ?>
424 <td class="fs-right">
425 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
426 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
427 <input type="hidden" name="fs_action" value="verify_email">
428 <?php wp_nonce_field( 'verify_email' ) ?>
429 <input type="submit" class="button button-small"
430 value="<?php fs_esc_attr_echo_inline( 'Verify Email', 'verify-email', $slug ) ?>">
431 </form>
432 <?php endif ?>
433 <?php if ( 'version' === $p['id'] ) : ?>
434 <?php if ( $fs->has_release_on_freemius() ) : ?>
435 <div class="button-group">
436 <?php if ( $is_paying || $fs->is_trial() ) : ?>
437 <?php if ( ! $fs->is_allowed_to_install() ) : ?>
438 <a target="_blank" class="button button-primary"
439 href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php echo sprintf(
440 /* translators: %s: plan name (e.g. Download "Professional" Version) */
441 fs_text_inline( 'Download %s Version', 'download-x-version', $slug ),
442 ( $fs->is_trial() ? $trial_plan->title : $plan->title ) ) . ( is_object( $update ) ? ' [' . $update->version . ']' : '' ) ?></a>
443 <?php elseif ( is_object( $update ) ) : ?>
444 <?php
445 $module_type = $fs->get_module_type();
446 ?>
447 <a class="button button-primary"
448 href="<?php echo wp_nonce_url( self_admin_url( "update.php?action=upgrade-{$module_type}&{$module_type}=" . $fs->get_plugin_basename() ), "upgrade-{$module_type}_" . $fs->get_plugin_basename() ) ?>"><?php echo fs_esc_html_inline( 'Install Update Now', 'install-update-now', $slug ) . ' [' . $update->version . ']' ?></a>
449 <?php endif ?>
450 <?php endif; ?>
451 </div>
452 <?php endif ?>
453 <?php
454 elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
455 <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
456 <?php if ('license_key' === $p['id']) : ?>
457 <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>
458 <?php endif ?>
459 <?php
460 elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
461 ( is_string( $user->secret_key ) && in_array( $p['id'], array(
462 'email',
463 'user_name'
464 ) ) )
465 ) : ?>
466 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
467 onsubmit="var val = prompt('<?php echo esc_attr( sprintf(
468 /* translators: %s: User's account property (e.g. name, email) */
469 fs_text_inline( 'What is your %s?', 'what-is-your-x', $slug ),
470 $p['title']
471 ) ) ?>', '<?php echo $p['value'] ?>'); if (null == val || '' === val) return false; jQuery('input[name=fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>]').val(val); return true;">
472 <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
473 <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>"
474 value="">
475 <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
476 <input type="submit" class="button button-small"
477 value="<?php echo fs_esc_attr_x_inline( 'Edit', 'verb', 'edit', $slug ) ?>">
478 </form>
479 <?php endif ?>
480 </td>
481 <?php endif ?>
482 </tr>
483 <?php $odd = ! $odd;
484 endforeach ?>
485 </table>
486 </div>
487 </div>
488 <?php if ( fs_is_network_admin() ) : ?>
489 <div id="fs_sites" class="postbox">
490 <h3><span class="dashicons dashicons-networking"></span> <?php fs_esc_html_echo_inline( 'Sites', 'sites', $slug ) ?></h3>
491 <div class="fs-header-actions">
492 <?php $has_license = is_object( $license ) ?>
493 <?php if ( $has_license || ( $show_upgrade && $fs->is_premium() ) ) : ?>
494 <?php
495 $activate_license_button_text = $has_license ?
496 fs_esc_html_inline( 'Change License', 'change-license', $slug ) :
497 fs_esc_html_inline( 'Activate License', 'activate-license', $slug );
498 ?>
499 <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>
500 <?php endif ?>
501 <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>
502 </div>
503
504 <div class="inside">
505 <div id="" class="fs-scrollable-table">
506 <div class="fs-table-head">
507 <table class="widefat">
508 <thead>
509 <tr>
510 <td><?php fs_esc_html_echo_inline('ID', 'id', $slug) ?></td>
511 <td><?php fs_esc_html_echo_inline('Address', 'address', $slug) ?></td>
512 <td><?php fs_esc_html_echo_inline('License', 'license', $slug) ?></td>
513 <td><?php fs_esc_html_echo_inline('Plan', 'plan', $slug) ?></td>
514 <td></td>
515 </tr>
516 </thead>
517 </table>
518 </div>
519 <div class="fs-table-body">
520 <table class="widefat">
521 <?php
522 foreach ( $site_view_params as $view_params ) {
523 fs_require_template(
524 'account/partials/site.php',
525 $view_params
526 );
527 } ?>
528 </table>
529 </div>
530 </div>
531 </div>
532 </div>
533 <?php endif ?>
534
535 <?php
536 $account_addons = $fs->get_account_addons();
537 if ( ! is_array( $account_addons ) ) {
538 $account_addons = array();
539 }
540
541 $installed_addons = $fs->get_installed_addons();
542 $installed_addons_ids = array();
543 foreach ( $installed_addons as $fs_addon ) {
544 $installed_addons_ids[] = $fs_addon->get_id();
545 }
546
547 $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
548 ?>
549 <?php if ( 0 < count( $addons_to_show ) ) : ?>
550 <!-- Add-Ons -->
551 <div class="postbox">
552 <div class="">
553 <!-- <div class="inside">-->
554 <table id="fs_addons" class="widefat">
555 <thead>
556 <tr>
557 <th><h3><?php echo esc_html( $addons_text ) ?></h3></th>
558 <th><?php fs_esc_html_echo_inline( 'ID', 'id', $slug ) ?></th>
559 <th><?php echo esc_html( $version_text ) ?></th>
560 <th><?php echo esc_html( $plan_text ) ?></th>
561 <th><?php fs_esc_html_echo_x_inline( 'License', 'as software license', 'license', $slug ) ?></th>
562 <th></th>
563 <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
564 <th></th>
565 <?php endif ?>
566 </tr>
567 </thead>
568 <tbody>
569 <?php $odd = true;
570 foreach ( $addons_to_show as $addon_id ) {
571 $addon_view_params = array(
572 'parent_fs' => $fs,
573 'addon_id' => $addon_id,
574 'odd' => $odd,
575 );
576
577 fs_require_template(
578 'account/partials/addon.php',
579 $addon_view_params
580 );
581
582 $odd = ! $odd;
583 } ?>
584 </tbody>
585 </table>
586 </div>
587 </div>
588 <?php endif ?>
589
590 <?php $fs->do_action( 'after_account_details' ) ?>
591
592 <?php
593 $view_params = array( 'id' => $VARS['id'] );
594 fs_require_once_template( 'account/billing.php', $view_params );
595 fs_require_once_template( 'account/payments.php', $view_params );
596 ?>
597 </div>
598 </div>
599 </div>
600 </div>
601 </div>
602 <script type="text/javascript">
603 (function ($) {
604 var setLoading = function ($this, label) {
605 // Set loading mode.
606 $(document.body).css({'cursor': 'wait'});
607
608 $this.css({'cursor': 'wait'});
609
610 if ($this.is('input'))
611 $this.val(label);
612 else
613 $this.html(label);
614
615 setTimeout(function () {
616 $this.attr('disabled', 'disabled');
617 }, 200);
618 };
619
620 $('.fs-toggle-visibility').click(function () {
621 var
622 $this = $(this),
623 $parent = $this.closest('tr'),
624 $input = $parent.find('input');
625
626 $parent.find('code').toggle();
627 $input.toggle();
628
629 if ($input.is(':visible')) {
630 $this.html('<?php fs_esc_js_echo_x_inline( 'Hide', 'verb', 'hide', $slug ) ?>');
631 setTimeout(function () {
632 $input.select().focus();
633 }, 100);
634 }
635 else {
636 $this.html( '<?php fs_esc_js_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?>' );
637 }
638 });
639
640 $('.fs-toggle-tracking').click(function () {
641 setLoading(
642 $(this),
643 ($(this).data('is-disconnected') ?
644 '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>' :
645 '<?php fs_esc_js_echo_inline('Opting out', 'opting-out' ) ?>') +
646 '...'
647 );
648 });
649
650 $('.fs-opt-in').click(function () {
651 setLoading($(this), '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>...');
652 });
653
654 $( '#fs_downgrade' ).submit(function( event ) {
655 event.preventDefault();
656
657 setLoading( $( this ).find( '.button' ), '<?php fs_esc_js_echo_inline( 'Downgrading', 'downgrading' ) ?>...' );
658 });
659
660 $('.fs-activate-license').click(function () {
661 setLoading($(this), '<?php fs_esc_js_echo_inline('Activating', 'activating' ) ?>...');
662 });
663
664 $('.fs-deactivate-license').click(function () {
665 if (confirm('<?php fs_esc_attr_echo_inline( 'Deactivating your license will block all premium features, but will enable activating the license on another site. Are you sure you want to proceed?', 'deactivate-license-confirm', $slug ) ?>')) {
666 var $this = $(this);
667
668 setLoading($this, '<?php fs_esc_js_echo_inline('Deactivating', 'deactivating' ) ?>...');
669 $this[0].parentNode.submit();
670 }
671
672 return false;
673 });
674
675 var $sitesSection = $('#fs_sites'),
676 $sitesTable = $sitesSection.find('.fs-scrollable-table'),
677 $sitesTableRows = $sitesTable.find('.fs-site-details');
678
679 $('.fs-show-install-details').click(function(){
680 var installID = $(this).parents('.fs-site-details').attr('data-install-id');
681 $sitesSection.find('.fs-install-details[data-install-id=' + installID + ']').toggle();
682 });
683
684
685 var adjustColumnWidth = function($table) {
686 var $headerColumns = $table.find('.fs-table-head td'),
687 $bodyColumns = $table.find('.fs-table-body tr:first > td');
688
689 for (var i = 0, len = $headerColumns.length; i < len; i++) {
690 $($headerColumns[i]).width($($bodyColumns[i]).width());
691 }
692 for (i = 0, len = $headerColumns.length; i < len; i++) {
693 $($bodyColumns[i]).width($($headerColumns[i]).width());
694 }
695 };
696
697 adjustColumnWidth($sitesTable);
698
699 $sitesSection.find('.fs-search').keyup(function(){
700 var search = $(this).val().trim();
701
702 if ('' === search){
703 // Show all.
704 $sitesTableRows.show();
705 return;
706 }
707
708 var url;
709
710 $sitesTableRows.each(function(index){
711 url = $(this).find('.fs-field-url').html();
712
713 if (-1 < url.indexOf(search)){
714 $(this).show();
715 } else {
716 $(this).hide();
717 }
718 });
719 });
720
721 })(jQuery);
722 </script>
723 <?php
724 if ( $has_tabs ) {
725 $fs->_add_tabs_after_content();
726 }
727
728 $params = array(
729 'page' => 'account',
730 'module_id' => $fs->get_id(),
731 'module_type' => $fs->get_module_type(),
732 'module_slug' => $slug,
733 'module_version' => $fs->get_plugin_version(),
734 );
735 fs_require_template( 'powered-by.php', $params );