PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 1.7.3
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v1.7.3
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / freemius / templates / account.php
embedpress / freemius / templates Last commit date
debug 9 years ago forms 9 years ago plugin-info 9 years ago account.php 9 years ago add-ons.php 9 years ago add-trial-to-pricing.php 9 years ago admin-notice.php 9 years ago all-admin-notice.php 9 years ago billing.php 9 years ago checkout-legacy.php 9 years ago checkout.php 9 years ago connect.php 9 years ago contact.php 9 years ago debug.php 9 years ago email.php 9 years ago firewall-issues-js.php 9 years ago index.php 9 years ago plugin-icon.php 9 years ago powered-by.php 9 years ago pricing.php 9 years ago sticky-admin-notice-js.php 9 years ago
account.php
723 lines
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 */
16 $slug = $VARS['slug'];
17 /**
18 * @var Freemius $fs
19 */
20 $fs = freemius( $slug );
21
22 /**
23 * @var FS_Plugin_Tag $update
24 */
25 $update = $fs->get_update( false, false );
26
27 $is_paying = $fs->is_paying();
28 $user = $fs->get_user();
29 $site = $fs->get_site();
30 $name = $user->get_name();
31 $license = $fs->_get_license();
32 $subscription = $fs->_get_subscription();
33 $plan = $fs->get_plan();
34 $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
35 $is_paid_trial = $fs->is_paid_trial();
36 $show_upgrade = ( $fs->has_paid_plan() && ! $is_paying && ! $is_paid_trial );
37
38 if ( $fs->has_paid_plan() ) {
39 $fs->_add_license_activation_dialog_box();
40 }
41 ?>
42 <div class="wrap">
43 <h2 class="nav-tab-wrapper">
44 <a href="<?php echo $fs->get_account_url() ?>"
45 class="nav-tab nav-tab-active"><?php _efs( 'account', $slug ) ?></a>
46 <?php if ( $fs->has_addons() ) : ?>
47 <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
48 class="nav-tab"><?php _efs( 'add-ons', $slug ) ?></a>
49 <?php endif ?>
50 <?php if ( $show_upgrade ) : ?>
51 <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php _efs( 'upgrade', $slug ) ?></a>
52 <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
53 <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php _efs( 'free-trial', $slug ) ?></a>
54 <?php endif ?>
55 <?php endif ?>
56 <?php if ( ! $plan->is_free() ) : ?>
57 <a href="<?php echo $fs->get_account_tab_url( 'billing' ) ?>"
58 class="nav-tab"><?php _efs( 'billing', $slug ) ?></a>
59 <?php endif ?>
60 </h2>
61
62 <div id="poststuff">
63 <div id="fs_account">
64 <div class="has-sidebar has-right-sidebar">
65 <div class="has-sidebar-content">
66 <div class="postbox">
67 <h3><?php _efs( 'account-details', $slug ) ?></h3>
68
69 <div class="fs-header-actions">
70 <ul>
71 <li>
72 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
73 <input type="hidden" name="fs_action" value="delete_account">
74 <?php wp_nonce_field( 'delete_account' ) ?>
75 <a href="#" onclick="if (confirm('<?php
76 if ( $is_active_subscription ) {
77 echo esc_attr( sprintf( __fs( 'delete-account-x-confirm', $slug ), $plan->title ) );
78 } else {
79 _efs( 'delete-account-confirm', $slug );
80 }
81 ?>')) this.parentNode.submit(); return false;"><i
82 class="dashicons dashicons-no"></i> <?php _efs( 'delete-account', $slug ) ?></a>
83 </form>
84 </li>
85 <?php if ( $is_paying ) : ?>
86 <li>
87 &nbsp;&bull;&nbsp;
88 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
89 <input type="hidden" name="fs_action" value="deactivate_license">
90 <?php wp_nonce_field( 'deactivate_license' ) ?>
91 <a href="#"
92 onclick="if (confirm('<?php _efs( 'deactivate-license-confirm', $slug ) ?>')) this.parentNode.submit(); return false;"><i
93 class="dashicons dashicons-admin-network"></i> <?php _efs( 'deactivate-license', $slug ) ?>
94 </a>
95 </form>
96 </li>
97 <?php if ( ! $license->is_lifetime() &&
98 $is_active_subscription
99 ) : ?>
100 <li>
101 &nbsp;&bull;&nbsp;
102 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
103 <input type="hidden" name="fs_action" value="downgrade_account">
104 <?php wp_nonce_field( 'downgrade_account' ) ?>
105 <a href="#"
106 onclick="if (confirm('<?php printf( __fs( 'downgrade-x-confirm', $slug ), $plan->title, human_time_diff( time(), strtotime( $license->expiration ) ) ) ?> <?php if ( ! $license->is_block_features ) {
107 printf( __fs( 'after-downgrade-non-blocking', $slug ), $plan->title );
108 } else {
109 printf( __fs( 'after-downgrade-blocking', $slug ), $plan->title );
110 }?> <?php _efs( 'proceed-confirmation', $slug ) ?>')) this.parentNode.submit(); return false;"><i
111 class="dashicons dashicons-download"></i> <?php _efs( 'downgrade', $slug ) ?></a>
112 </form>
113 </li>
114 <?php endif ?>
115 <li>
116 &nbsp;&bull;&nbsp;
117 <a href="<?php echo $fs->get_upgrade_url() ?>"><i
118 class="dashicons dashicons-grid-view"></i> <?php _efs( 'change-plan', $slug ) ?></a>
119 </li>
120 <?php elseif ( $is_paid_trial ) : ?>
121 <li>
122 &nbsp;&bull;&nbsp;
123 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
124 <input type="hidden" name="fs_action" value="cancel_trial">
125 <?php wp_nonce_field( 'cancel_trial' ) ?>
126 <a href="#"
127 onclick="if (confirm('<?php _efs( 'cancel-trial-confirm' ) ?>')) this.parentNode.submit(); return false;"><i
128 class="dashicons dashicons-download"></i> <?php _efs( 'cancel-trial', $slug ) ?></a>
129 </form>
130 </li>
131 <?php endif ?>
132 <li>
133 &nbsp;&bull;&nbsp;
134 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
135 <input type="hidden" name="fs_action" value="<?php echo $slug ?>_sync_license">
136 <?php wp_nonce_field( $slug . '_sync_license' ) ?>
137 <a href="#" onclick="this.parentNode.submit(); return false;"><i
138 class="dashicons dashicons-image-rotate"></i> <?php _efs( 'sync', $slug ) ?></a>
139 </form>
140 </li>
141
142 </ul>
143 </div>
144 <div class="inside">
145 <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
146 <?php
147 $hide_license_key = $fs->apply_filters( 'hide_license_key', false );
148
149 $profile = array();
150 $profile[] = array(
151 'id' => 'user_name',
152 'title' => __fs( 'name', $slug ),
153 'value' => $name
154 );
155 // if (isset($user->email) && false !== strpos($user->email, '@'))
156 $profile[] = array(
157 'id' => 'email',
158 'title' => __fs( 'email', $slug ),
159 'value' => $user->email
160 );
161
162 if ( is_numeric( $user->id ) ) {
163 $profile[] = array(
164 'id' => 'user_id',
165 'title' => __fs( 'user-id', $slug ),
166 'value' => $user->id
167 );
168 }
169
170 $profile[] = array(
171 'id' => 'site_id',
172 'title' => __fs( 'site-id', $slug ),
173 'value' => is_string( $site->id ) ?
174 $site->id :
175 __fs( 'no-id', $slug )
176 );
177
178 $profile[] = array(
179 'id' => 'site_public_key',
180 'title' => __fs( 'public-key', $slug ),
181 'value' => $site->public_key
182 );
183
184 $profile[] = array(
185 'id' => 'site_secret_key',
186 'title' => __fs( 'secret-key', $slug ),
187 'value' => ( ( is_string( $site->secret_key ) ) ?
188 $site->secret_key :
189 __fs( 'no-secret', $slug )
190 )
191 );
192
193 $profile[] = array(
194 'id' => 'version',
195 'title' => __fs( 'version', $slug ),
196 'value' => $fs->get_plugin_version()
197 );
198
199 if ( $fs->has_paid_plan() ) {
200 if ( $fs->is_trial() ) {
201 $trial_plan = $fs->get_trial_plan();
202
203 $profile[] = array(
204 'id' => 'plan',
205 'title' => __fs( 'plan', $slug ),
206 'value' => ( is_string( $trial_plan->name ) ?
207 strtoupper( $trial_plan->title ) :
208 __fs( 'trial', $slug ) )
209 );
210 } else {
211 $profile[] = array(
212 'id' => 'plan',
213 'title' => __fs( 'plan', $slug ),
214 'value' => is_string( $site->plan->name ) ?
215 strtoupper( $site->plan->title ) :
216 strtoupper( __fs( 'free', $slug ) )
217 );
218
219 if ( is_object( $license ) ) {
220 if ( ! $hide_license_key ) {
221 $profile[] = array(
222 'id' => 'license_key',
223 'title' => __fs( 'License Key', $slug ),
224 'value' => $license->secret_key,
225 );
226 }
227 }
228 }
229 }
230 ?>
231 <?php $odd = true;
232 foreach ( $profile as $p ) : ?>
233 <?php
234 if ( 'plan' === $p['id'] && ! $fs->has_paid_plan() ) {
235 // If plugin don't have any paid plans, there's no reason
236 // to show current plan.
237 continue;
238 }
239 ?>
240 <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
241 <td>
242 <nobr><?php echo $p['title'] ?>:</nobr>
243 </td>
244 <td<?php if ( 'plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
245 <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
246 <code><?php echo htmlspecialchars( substr( $p['value'], 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $p['value'], - 3 ) ) ?></code>
247 <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
248 readonly/>
249 <?php else : ?>
250 <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
251 <?php endif ?>
252 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
253 <label class="fs-tag fs-warn"><?php fs_esc_html_echo( 'not-verified', $slug ) ?></label>
254 <?php endif ?>
255 <?php if ( 'plan' === $p['id'] ) : ?>
256 <?php if ( $fs->is_trial() ) : ?>
257 <label class="fs-tag fs-success"><?php fs_esc_html_echo( 'trial', $slug ) ?></label>
258 <?php endif ?>
259 <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
260 <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
261 <label
262 class="fs-tag fs-warn"><?php echo esc_html( sprintf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $license->expiration ) ) ) ) ?></label>
263 <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
264 <label
265 class="fs-tag fs-success"><?php echo esc_html( sprintf( __fs( 'renews-in', $slug ), human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ) ?></label>
266 <?php endif ?>
267 <?php elseif ( $fs->is_trial() ) : ?>
268 <label
269 class="fs-tag fs-warn"><?php echo esc_html( sprintf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ) ?></label>
270 <?php endif ?>
271 <div class="button-group">
272 <?php $available_license = $fs->is_free_plan() ? $fs->_get_available_premium_license() : false ?>
273 <?php if ( false !== $available_license && ( $available_license->left() > 0 || ( $site->is_localhost() && $available_license->is_free_localhost ) ) ) : ?>
274 <?php $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ) ?>
275 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
276 method="POST">
277 <input type="hidden" name="fs_action" value="activate_license">
278 <input type="hidden" name="license_id" value="<?php echo $available_license->id ?>">
279 <?php wp_nonce_field( 'activate_license' ) ?>
280 <input type="submit" class="button button-primary"
281 value="<?php echo esc_attr( sprintf(
282 __fs( 'activate-x-plan', $slug ) . '%s',
283 $premium_plan->title,
284 ( $site->is_localhost() && $available_license->is_free_localhost ) ?
285 ' [' . __fs( 'localhost', $slug ) . ']' :
286 ( $available_license->is_single_site() ?
287 '' :
288 ' [' . ( 1 < $available_license->left() ?
289 sprintf( __fs( 'x-left', $slug ), $available_license->left() ) :
290 strtolower( __fs( 'last-license', $slug ) ) ) . ']'
291 )
292 ) ) ?> ">
293 </form>
294 <?php else : ?>
295 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
296 method="POST" class="button-group">
297 <?php if ( $show_upgrade && $fs->is_premium() ) : ?>
298 <a class="button activate-license-trigger <?php echo $slug ?>" href="#"><?php fs_esc_html_echo( 'activate-license', $slug ) ?></a>
299 <?php endif ?>
300 <input type="submit" class="button"
301 value="<?php fs_esc_attr_echo( 'sync-license', $slug ) ?>">
302 <input type="hidden" name="fs_action"
303 value="<?php echo $slug ?>_sync_license">
304 <?php wp_nonce_field( $slug . '_sync_license' ) ?>
305 <a href="<?php echo $fs->get_upgrade_url() ?>"
306 class="button<?php if ( $show_upgrade ) {
307 echo ' button-primary';
308 } ?> button-upgrade"><i
309 class="dashicons dashicons-cart"></i> <?php fs_esc_html_echo( $show_upgrade ? 'upgrade' : 'change-plan', $slug ) ?></a>
310 </form>
311 <?php endif ?>
312 </div>
313 <?php elseif ( 'version' === $p['id'] && $fs->has_paid_plan() ) : ?>
314 <?php if ( $fs->has_premium_version() ) : ?>
315 <?php if ( $fs->is_premium() ) : ?>
316 <label
317 class="fs-tag fs-<?php echo $fs->can_use_premium_code() ? 'success' : 'warn' ?>"><?php fs_esc_html_echo( 'premium-version', $slug ) ?></label>
318 <?php elseif ( $fs->can_use_premium_code() ) : ?>
319 <label class="fs-tag fs-warn"><?php fs_esc_html_echo( 'free-version', $slug ) ?></label>
320 <?php endif ?>
321 <?php endif ?>
322 <?php endif ?>
323 </td>
324 <?php if ( 'plan' !== $p['id'] ) : ?>
325 <td class="fs-right">
326 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
327 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
328 <input type="hidden" name="fs_action" value="verify_email">
329 <?php wp_nonce_field( 'verify_email' ) ?>
330 <input type="submit" class="button button-small"
331 value="<?php fs_esc_attr_echo( 'verify-email', $slug ) ?>">
332 </form>
333 <?php endif ?>
334 <?php if ( 'version' === $p['id'] ) : ?>
335 <?php if ( $fs->has_release_on_freemius() ) : ?>
336 <div class="button-group">
337 <?php if ( $is_paying || $fs->is_trial() ) : ?>
338 <?php if ( ! $fs->is_allowed_to_install() ) : ?>
339 <a target="_blank" class="button button-primary"
340 href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php echo sprintf( __fs( 'download-x-version', $slug ), ( $fs->is_trial() ? $trial_plan->title : $site->plan->title ) ) . ( is_object( $update ) ? ' [' . $update->version . ']' : '' ) ?></a>
341 <?php elseif ( is_object( $update ) ) : ?>
342 <a class="button button-primary"
343 href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $fs->get_plugin_basename() ), 'upgrade-plugin_' . $fs->get_plugin_basename() ) ?>"><?php echo fs_esc_html( 'install-update-now', $slug ) . ' [' . $update->version . ']' ?></a>
344 <?php endif ?>
345 <?php endif; ?>
346 </div>
347 <?php endif ?>
348 <?php
349 elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
350 <button class="button button-small fs-toggle-visibility"><?php echo esc_html( __fs( 'show', $slug ) ) ?></button>
351 <?php if ('license_key' === $p['id']) : ?>
352 <button class="button button-small activate-license-trigger <?php echo $slug ?>"><?php echo esc_html( __fs( 'change-license', $slug ) ) ?></button>
353 <?php endif ?>
354 <?php
355 elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
356 ( is_string( $user->secret_key ) && in_array( $p['id'], array(
357 'email',
358 'user_name'
359 ) ) )
360 ) : ?>
361 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
362 onsubmit="var val = prompt('<?php printf( __fs( 'what-is-your-x', $slug ), $p['title'] ) ?>', '<?php echo $p['value'] ?>'); if (null == val || '' === val) return false; jQuery('input[name=fs_<?php echo $p['id'] ?>_<?php echo $slug ?>]').val(val); return true;">
363 <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
364 <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $slug ?>"
365 value="">
366 <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
367 <input type="submit" class="button button-small"
368 value="<?php fs_esc_attr_echo( 'edit', $slug ) ?>">
369 </form>
370 <?php endif ?>
371 </td>
372 <?php endif ?>
373 </tr>
374 <?php $odd = ! $odd;
375 endforeach ?>
376 </table>
377 </div>
378 </div>
379 <script type="text/javascript">
380 (function ($) {
381 $('.fs-toggle-visibility').click(function () {
382 var
383 $this = $(this),
384 $parent = $this.closest('tr'),
385 $input = $parent.find('input');
386
387 $parent.find('code').toggle();
388 $input.toggle();
389
390 if ($input.is(':visible')) {
391 $this.html(<?php fs_json_encode_echo( 'hide', $slug ) ?>);
392 setTimeout(function () {
393 $input.select().focus();
394 }, 100);
395 }
396 else {
397 $this.html(<?php fs_json_encode_echo( 'show', $slug ) ?>);
398 }
399 });
400 }(jQuery));
401
402 </script>
403
404 <?php
405 $account_addons = $fs->get_account_addons();
406 if ( ! is_array( $account_addons ) ) {
407 $account_addons = array();
408 }
409
410 $installed_addons = $fs->get_installed_addons();
411 $installed_addons_ids = array();
412 foreach ( $installed_addons as $fs_addon ) {
413 $installed_addons_ids[] = $fs_addon->get_id();
414 }
415
416 $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
417 ?>
418 <?php if ( 0 < count( $addons_to_show ) ) : ?>
419 <!-- Add-Ons -->
420 <div class="postbox">
421 <div class="">
422 <!-- <div class="inside">-->
423 <table id="fs_addons" class="widefat">
424 <thead>
425 <tr>
426 <th><h3><?php fs_esc_html_echo( 'add-ons', $slug ) ?></h3></th>
427 <th><?php fs_esc_html_echo( 'id', $slug ) ?></th>
428 <th><?php fs_esc_html_echo( 'version', $slug ) ?></th>
429 <th><?php fs_esc_html_echo( 'plan', $slug ) ?></th>
430 <th><?php fs_esc_html_echo( 'license', $slug ) ?></th>
431 <th></th>
432 <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
433 <th></th>
434 <?php endif ?>
435 </tr>
436 </thead>
437 <tbody>
438 <?php $odd = true;
439 foreach ( $addons_to_show as $addon_id ) : ?>
440 <?php
441 $addon = $fs->get_addon( $addon_id );
442 $is_addon_activated = $fs->is_addon_activated( $addon->slug );
443 $is_addon_connected = $fs->is_addon_connected( $addon->slug );
444
445 $fs_addon = $is_addon_connected ? freemius( $addon->slug ) : false;
446 if ( is_object( $fs_addon ) ) {
447 $is_paying = $fs_addon->is_paying();
448 $user = $fs_addon->get_user();
449 $site = $fs_addon->get_site();
450 $license = $fs_addon->_get_license();
451 $subscription = $fs_addon->_get_subscription();
452 $plan = $fs_addon->get_plan();
453 $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
454 $is_paid_trial = $fs_addon->is_paid_trial();
455 $show_upgrade = ( ! $is_paying && ! $is_paid_trial && ! $fs_addon->_has_premium_license() );
456 $is_current_license_expired = is_object( $license ) && $license->is_expired();
457 }
458
459 // var_dump( $is_paid_trial, $license, $site, $subscription );
460
461 ?>
462 <tr<?php if ( $odd ) {
463 echo ' class="alternate"';
464 } ?>>
465 <td>
466 <!-- Title -->
467 <?php echo $addon->title ?>
468 </td>
469 <?php if ( $is_addon_connected ) : ?>
470 <?php // Add-on Installed ?>
471 <?php $addon_site = $fs_addon->get_site(); ?>
472 <td>
473 <!-- ID -->
474 <?php echo $addon_site->id ?>
475 </td>
476 <td>
477 <!-- Version -->
478 <?php echo $fs_addon->get_plugin_version() ?>
479 </td>
480 <td>
481 <!-- Plan Title -->
482 <?php echo is_string( $addon_site->plan->name ) ? strtoupper( $addon_site->plan->title ) : 'FREE' ?>
483 </td>
484 <td>
485 <!-- Expiration -->
486 <?php
487 $tags = array();
488
489 if ( $fs_addon->is_trial() ) {
490 $tags[] = array( 'label' => __fs( 'trial', $slug ), 'type' => 'success' );
491
492 $tags[] = array(
493 'label' => sprintf( __fs( ( $is_paid_trial ? 'renews-in' : 'expires-in' ), $slug ), human_time_diff( time(), strtotime( $site->trial_ends ) ) ),
494 'type' => ( $is_paid_trial ? 'success' : 'warn' )
495 );
496 } else {
497 if ( is_object( $license ) ) {
498 if ( $license->is_cancelled ) {
499 $tags[] = array(
500 'label' => __fs( 'cancelled', $slug ),
501 'type' => 'error'
502 );
503 } else if ( $license->is_expired() ) {
504 $tags[] = array(
505 'label' => __fs( 'expired', $slug ),
506 'type' => 'error'
507 );
508 } else if ( $license->is_lifetime() ) {
509 $tags[] = array(
510 'label' => __fs( 'no-expiration', $slug ),
511 'type' => 'success'
512 );
513 } else if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) {
514 $tags[] = array(
515 'label' => sprintf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $license->expiration ) ) ),
516 'type' => 'warn'
517 );
518 } else if ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) {
519 $tags[] = array(
520 'label' => sprintf( __fs( 'renews-in', $slug ), human_time_diff( time(), strtotime( $subscription->next_payment ) ) ),
521 'type' => 'success'
522 );
523 }
524 }
525 }
526
527 foreach ( $tags as $t ) {
528 printf( '<label class="fs-tag fs-%s">%s</label>' . "\n", $t['type'], $t['label'] );
529 }
530 ?>
531 </td>
532 <?php
533 $buttons = array();
534 if ( $is_addon_activated ) {
535 if ( $is_paying ) {
536 $buttons[] = fs_ui_get_action_button(
537 $slug,
538 'account',
539 'deactivate_license',
540 __fs( 'deactivate-license', $slug ),
541 array( 'plugin_id' => $addon_id ),
542 false
543 );
544
545 $human_readable_license_expiration = human_time_diff( time(), strtotime( $license->expiration ) );
546 $downgrade_confirmation_message = sprintf( __fs( 'downgrade-x-confirm', $slug ),
547 $plan->title,
548 $human_readable_license_expiration );
549
550 $after_downgrade_message_id = ( ! $license->is_block_features ?
551 'after-downgrade-non-blocking' :
552 'after-downgrade-blocking' );
553
554 $after_downgrade_message = sprintf( __fs( $after_downgrade_message_id, $slug ), $plan->title );
555
556 if ( ! $license->is_lifetime() && $is_active_subscription ) {
557 $buttons[] = fs_ui_get_action_button(
558 $slug,
559 'account',
560 'downgrade_account',
561 __fs( 'downgrade', $slug ),
562 array( 'plugin_id' => $addon_id ),
563 false,
564 false,
565 ( $downgrade_confirmation_message . ' ' . $after_downgrade_message ),
566 'POST'
567 );
568 }
569 } else if ( $is_paid_trial ) {
570 $buttons[] = fs_ui_get_action_button(
571 $slug,
572 'account',
573 'cancel_trial',
574 __fs( 'cancel-trial', $slug ),
575 array( 'plugin_id' => $addon_id ),
576 false,
577 'dashicons dashicons-download',
578 __fs( 'cancel-trial-confirm', $slug ),
579 'POST'
580 );
581 } else {
582 $premium_license = $fs_addon->_get_available_premium_license();
583
584 if ( is_object( $premium_license ) ) {
585 $site = $fs_addon->get_site();
586
587 $buttons[] = fs_ui_get_action_button(
588 $slug,
589 'account',
590 'activate_license',
591 sprintf( __fs( 'activate-x-plan', $slug ), $fs_addon->get_plan_title(), ( $site->is_localhost() && $premium_license->is_free_localhost ) ? '[localhost]' : ( 1 < $premium_license->left() ? $premium_license->left() . ' left' : '' ) ),
592 array(
593 'plugin_id' => $addon_id,
594 'license_id' => $premium_license->id,
595 )
596 );
597 }
598 }
599
600 if ( 0 == count( $buttons ) ) {
601 // Add sync license only if non of the other CTAs are visible.
602 $buttons[] = fs_ui_get_action_button(
603 $slug,
604 'account',
605 $slug . '_sync_license',
606 __fs( 'sync-license', $slug ),
607 array( 'plugin_id' => $addon_id ),
608 false
609 );
610
611 }
612 } else if ( ! $show_upgrade ) {
613 if ( $fs->is_addon_installed( $addon->slug ) ) {
614 $addon_file = $fs->get_addon_basename( $addon->slug );
615 $buttons[] = sprintf(
616 '<a class="button button-primary edit" href="%s" title="%s">%s</a>',
617 wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ),
618 fs_esc_attr( 'activate-this-addon', $slug ),
619 __fs( 'activate', $slug )
620 );
621 } else {
622 if ( $fs->is_allowed_to_install() ) {
623 $buttons[] = sprintf(
624 '<a class="button button-primary edit" href="%s">%s</a>',
625 wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ),
626 __fs( 'install-now', $slug )
627 );
628 } else {
629 $buttons[] = sprintf(
630 '<a target="_blank" class="button button-primary edit" href="%s">%s</a>',
631 $fs->_get_latest_download_local_url( $addon_id ),
632 __fs( 'download-latest', $slug )
633 );
634 }
635 }
636 }
637
638 if ( $show_upgrade ) {
639 $buttons[] = sprintf( '<a href="%s" class="thickbox button button-primary" aria-label="%s" data-title="%s"><i class="dashicons dashicons-cart"></i> %s</a>',
640 esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
641 '&TB_iframe=true&width=600&height=550' ) ),
642 esc_attr( sprintf( __fs( 'more-information-about-x', $slug ), $addon->title ) ),
643 esc_attr( $addon->title ),
644 __fs( ( $fs_addon->has_free_plan() ? 'upgrade' : 'purchase' ), $slug )
645 );
646 }
647
648 $buttons_count = count( $buttons );
649 ?>
650
651 <td>
652 <!-- Actions -->
653 <?php if ($buttons_count > 1) : ?>
654 <div class="button-group">
655 <?php endif ?>
656 <?php foreach ( $buttons as $button ) : ?>
657 <?php echo $button ?>
658 <?php endforeach ?>
659 <?php if ($buttons_count > 1) : ?>
660 </div>
661 <?php endif ?>
662 </td>
663 <?php else : ?>
664 <?php // Add-on NOT Installed or was never connected.
665 ?>
666 <td colspan="4">
667 <!-- Action -->
668 <?php if ( $fs->is_addon_installed( $addon->slug ) ) : ?>
669 <?php $addon_file = $fs->get_addon_basename( $addon->slug ) ?>
670 <a class="button button-primary"
671 href="<?php echo wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ) ?>"
672 title="<?php fs_esc_attr_echo( 'activate-this-addon', $slug ) ?>"
673 class="edit"><?php fs_esc_html_echo( 'activate', $slug ) ?></a>
674 <?php else : ?>
675 <?php if ( $fs->is_allowed_to_install() ) : ?>
676 <a class="button button-primary"
677 href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ) ?>"><?php fs_esc_html_echo( 'install-now', $slug ) ?></a>
678 <?php else : ?>
679 <a target="_blank" class="button button-primary"
680 href="<?php echo $fs->_get_latest_download_local_url( $addon_id ) ?>"><?php fs_esc_html_echo( 'download-latest', $slug ) ?></a>
681 <?php endif ?>
682 <?php endif ?>
683 </td>
684 <?php endif ?>
685 <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
686 <td>
687 <!-- Optional Delete Action -->
688 <?php
689 if ( $is_addon_activated ) {
690 fs_ui_action_button(
691 $slug, 'account',
692 'delete_account',
693 __fs( 'delete', $slug ),
694 array( 'plugin_id' => $addon_id ),
695 false
696 );
697 }
698 ?>
699 </td>
700 <?php endif ?>
701 </tr>
702 <?php $odd = ! $odd;
703 endforeach ?>
704 </tbody>
705 </table>
706 </div>
707 </div>
708 <?php endif ?>
709
710 <?php $fs->do_action( 'after_account_details' ) ?>
711 </div>
712 </div>
713 </div>
714 </div>
715 </div>
716 <?php
717 $params = array(
718 'page' => 'account',
719 'module_id' => $fs->get_id(),
720 'module_slug' => $slug,
721 'module_version' => $fs->get_plugin_version(),
722 );
723 fs_require_template( 'powered-by.php', $params );