PluginProbe ʕ •ᴥ•ʔ
Image Widget / 4.2
Image Widget v4.2
trunk 1.0 2.0 2.1 2.2 2.2.1 2.2.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.2 3.2.1 3.2.10 3.2.11 3.2.2 3.2.3 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 4.0 4.0.1 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 4.1.1 4.1.2 4.2 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.11 4.4.12 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9
image-widget / freemius / templates / account.php
image-widget / freemius / templates Last commit date
plugin-info 10 years ago account.php 10 years ago add-ons.php 10 years ago admin-notice.php 10 years ago all-admin-notice.php 10 years ago checkout.php 10 years ago connect.php 10 years ago contact.php 10 years ago deactivation-feedback-modal.php 10 years ago debug.php 10 years ago email.php 10 years ago firewall-issues-js.php 10 years ago pending-activation.php 10 years ago plugin-icon.php 10 years ago powered-by.php 10 years ago pricing.php 10 years ago sticky-admin-notice-js.php 10 years ago
account.php
442 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 $slug = $VARS['slug'];
10 /**
11 * @var Freemius $fs
12 */
13 $fs = freemius( $slug );
14
15 /**
16 * @var FS_Plugin_Tag $update
17 */
18 $update = $fs->get_update();
19
20 $is_paying = $fs->is_paying();
21 $user = $fs->get_user();
22 $site = $fs->get_site();
23 $name = $user->get_name();
24 $license = $fs->_get_license();
25 $subscription = $fs->_get_subscription();
26 $plan = $fs->get_plan();
27 $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
28 ?>
29
30 <div class="wrap">
31 <h2 class="nav-tab-wrapper">
32 <a href="<?php $fs->get_account_url() ?>" class="nav-tab nav-tab-active"><?php _efs( 'account' ) ?></a>
33 <?php if ( $fs->_has_addons() ) : ?>
34 <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>" class="nav-tab"><?php _efs( 'add-ons' ) ?></a>
35 <?php endif ?>
36 <?php if ( $fs->is_not_paying() && $fs->has_paid_plan() ) : ?>
37 <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php _efs( 'upgrade' ) ?></a>
38 <?php if ( ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
39 <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php _efs( 'free-trial' ) ?></a>
40 <?php endif ?>
41 <?php endif ?>
42 </h2>
43
44 <div id="poststuff">
45 <div id="fs_account">
46 <div class="has-sidebar has-right-sidebar">
47 <div class="has-sidebar-content">
48 <div class="postbox">
49 <h3><?php _efs( 'account-details' ) ?></h3>
50
51 <div class="fs-header-actions">
52 <ul>
53 <li>
54 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
55 <input type="hidden" name="fs_action" value="delete_account">
56 <?php wp_nonce_field( 'delete_account' ) ?>
57 <a href="#" onclick="if (confirm('<?php
58 if ( $is_active_subscription ) {
59 echo esc_attr( sprintf( __fs( 'delete-account-x-confirm' ), $plan->title ) );
60 } else {
61 _efs( 'delete-account-confirm' );
62 }
63 ?>')) this.parentNode.submit(); return false;"><?php _efs( 'delete-account' ) ?></a>
64 </form>
65 </li>
66 <?php if ( $is_paying ) : ?>
67 <li>
68 &nbsp;&nbsp;
69 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
70 <input type="hidden" name="fs_action" value="deactivate_license">
71 <?php wp_nonce_field( 'deactivate_license' ) ?>
72 <a href="#"
73 onclick="if (confirm('<?php _efs( 'deactivate-license-confirm' ) ?>')) this.parentNode.submit(); return false;"><?php _efs( 'deactivate-license' ) ?></a>
74 </form>
75 </li>
76 <?php if ( ! $license->is_lifetime() &&
77 $is_active_subscription
78 ) : ?>
79 <li>
80 &nbsp;&nbsp;
81 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
82 <input type="hidden" name="fs_action" value="downgrade_account">
83 <?php wp_nonce_field( 'downgrade_account' ) ?>
84 <a href="#"
85 onclick="if (confirm('<?php printf( __fs( 'downgrade-x-confirm' ), $plan->title, human_time_diff( time(), strtotime( $license->expiration ) ) ) ?> <?php if ( ! $license->is_block_features ) {
86 printf( __fs( 'after-downgrade-non-blocking' ), $plan->title );
87 } else {
88 printf( __fs( 'after-downgrade-blocking' ), $plan->title );
89 }?> <?php _efs( 'proceed-confirmation' ) ?>')) this.parentNode.submit(); return false;"><?php _efs( 'downgrade' ) ?></a>
90 </form>
91 </li>
92 <?php endif ?>
93 <li>
94 &nbsp;&nbsp;
95 <a href="<?php echo $fs->get_upgrade_url() ?>"><?php _efs( 'change-plan' ) ?></a>
96 </li>
97 <?php endif ?>
98 </ul>
99 </div>
100 <div class="inside">
101 <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
102 <?php
103 $profile = array();
104 $profile[] = array(
105 'id' => 'user_name',
106 'title' => __fs( 'name' ),
107 'value' => $name
108 );
109 // if (isset($user->email) && false !== strpos($user->email, '@'))
110 $profile[] = array(
111 'id' => 'email',
112 'title' => __fs( 'email' ),
113 'value' => $user->email
114 );
115 if ( is_numeric( $user->id ) ) {
116 $profile[] = array(
117 'id' => 'user_id',
118 'title' => __fs( 'user-id' ),
119 'value' => $user->id
120 );
121 }
122
123 $profile[] = array(
124 'id' => 'site_id',
125 'title' => __fs( 'site-id' ),
126 'value' => is_string( $site->id ) ?
127 $site->id :
128 __fs( 'no-id' )
129 );
130
131 $profile[] = array(
132 'id' => 'site_public_key',
133 'title' => __fs( 'public-key' ),
134 'value' => $site->public_key
135 );
136
137 $profile[] = array(
138 'id' => 'site_secret_key',
139 'title' => __fs( 'secret-key' ),
140 'value' => ( ( is_string( $site->secret_key ) ) ?
141 $site->secret_key :
142 __fs( 'no-secret' )
143 )
144 );
145
146 if ( $fs->is_trial() ) {
147 $trial_plan = $fs->get_trial_plan();
148
149 $profile[] = array(
150 'id' => 'plan',
151 'title' => __fs( 'plan' ),
152 'value' => ( is_string( $trial_plan->name ) ?
153 strtoupper( $trial_plan->title ) . ' ' :
154 '' ) . strtoupper( __fs( 'trial' ) )
155 );
156 } else {
157 $profile[] = array(
158 'id' => 'plan',
159 'title' => __fs( 'plan' ),
160 'value' => is_string( $site->plan->name ) ?
161 strtoupper( $site->plan->title ) :
162 strtoupper( __fs( 'free' ) )
163 );
164 }
165
166 $profile[] = array(
167 'id' => 'version',
168 'title' => __fs( 'version' ),
169 'value' => $fs->get_plugin_version()
170 );
171 ?>
172 <?php $odd = true;
173 foreach ( $profile as $p ) : ?>
174 <?php
175 if ( 'plan' === $p['id'] && ! $fs->has_paid_plan() ) {
176 // If plugin don't have any paid plans, there's no reason
177 // to show current plan.
178 continue;
179 }
180 ?>
181 <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
182 <td>
183 <nobr><?php echo $p['title'] ?>:</nobr>
184 </td>
185 <td>
186 <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
187 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
188 <label><?php _efs( 'not-verified' ) ?></label>
189 <?php endif ?>
190 <?php if ( 'plan' === $p['id'] ) : ?>
191 <?php if ( $fs->is_trial() ) : ?>
192 <label><?php printf( __fs( 'expires-in' ), human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ?></label>
193 <?php elseif ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
194 <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
195 <label><?php printf( __fs( 'expires-in' ), human_time_diff( time(), strtotime( $license->expiration ) ) ) ?></label>
196 <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
197 <label><?php printf( __fs( 'renews-in' ), human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ?></label>
198 <?php endif ?>
199 <?php endif ?>
200 <?php endif ?>
201
202 </td>
203 <td class="fs-right">
204 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
205 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
206 <input type="hidden" name="fs_action" value="verify_email">
207 <?php wp_nonce_field( 'verify_email' ) ?>
208 <input type="submit" class="button button-small"
209 value="<?php _efs( 'verify-email' ) ?>">
210 </form>
211 <?php endif ?>
212 <?php if ( 'plan' === $p['id'] ) : ?>
213 <div class="button-group">
214 <?php $license = $fs->is_not_paying() ? $fs->_get_available_premium_license() : false ?>
215 <?php if ( false !== $license && ( $license->left() > 0 || ( $site->is_localhost() && $license->is_free_localhost ) ) ) : ?>
216 <?php $premium_plan = $fs->_get_plan_by_id( $license->plan_id ) ?>
217 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
218 method="POST">
219 <input type="hidden" name="fs_action" value="activate_license">
220 <?php wp_nonce_field( 'activate_license' ) ?>
221 <input type="submit" class="button button-primary"
222 value="<?php printf(
223 __fs( 'activate-x-plan' ),
224 $premium_plan->title,
225 ( $site->is_localhost() && $license->is_free_localhost ) ?
226 '[' . __fs( 'localhost' ) . ']' :
227 ( 1 < $license->left() ? $license->left() . ' left' : '' )
228 ) ?> ">
229 </form>
230 <?php else : ?>
231 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
232 method="POST" class="button-group">
233 <input type="submit" class="button"
234 value="<?php _efs( 'sync-license' ) ?>">
235 <input type="hidden" name="fs_action"
236 value="<?php echo $slug ?>_sync_license">
237 <?php wp_nonce_field( $slug . '_sync_license' ) ?>
238 <a href="<?php echo $fs->get_upgrade_url() ?>"
239 class="button<?php if ( ! $is_paying ) {
240 echo ' button-primary';
241 } ?> button-upgrade"><?php ( ! $is_paying ) ?
242 _efs( 'upgrade' ) :
243 _efs( 'change-plan' )
244 ?></a>
245 </form>
246 <?php endif ?>
247 </div>
248 <?php elseif ( 'version' === $p['id'] ) : ?>
249 <div class="button-group">
250 <?php if ( $is_paying || $fs->is_trial() ) : ?>
251 <?php if ( ! $fs->is_allowed_to_install() ) : ?>
252 <a target="_blank" class="button button-primary"
253 href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php echo sprintf( __fs( 'download-x-version' ), $site->plan->title ) . ( is_object( $update ) ? ' [' . $update->version . ']' : '' ) ?></a>
254 <?php elseif ( is_object( $update ) ) : ?>
255 <a class="button button-primary"
256 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( 'install-update-now' ) . ' [' . $update->version . ']' ?></a>
257 <?php endif ?>
258 <?php endif; ?>
259 </div>
260 <?php
261 elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
262 ( is_string( $user->secret_key ) && in_array( $p['id'], array(
263 'email',
264 'user_name'
265 ) ) )
266 ) : ?>
267 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
268 onsubmit="var val = prompt('<?php printf( __fs( 'what-is-your-x' ), $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;">
269 <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
270 <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $slug ?>"
271 value="">
272 <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
273 <input type="submit" class="button button-small"
274 value="<?php _ex( 'Edit', 'verb', 'freemius' ) ?>">
275 </form>
276 <?php endif ?>
277 </td>
278 </tr>
279 <?php $odd = ! $odd; endforeach ?>
280 </table>
281 </div>
282 </div>
283 <?php
284 $account_addons = $fs->get_account_addons();
285 if ( ! is_array( $account_addons ) ) {
286 $account_addons = array();
287 }
288
289 $installed_addons = $fs->get_installed_addons();
290 $installed_addons_ids = array();
291 foreach ( $installed_addons as $fs_addon ) {
292 $installed_addons_ids[] = $fs_addon->get_id();
293 }
294
295 $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
296 ?>
297 <?php if ( 0 < count( $addons_to_show ) ) : ?>
298 <div class="postbox">
299 <table id="fs_addons" class="widefat">
300 <thead>
301 <tr>
302 <th></th>
303 <th><?php _efs( 'version' ) ?></th>
304 <th><?php _efs( 'plan' ) ?></th>
305 <th><?php _efs( 'expiration' ) ?></th>
306 <th></th>
307 <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
308 <th></th>
309 <?php endif ?>
310 </tr>
311 </thead>
312 <tbody>
313 <?php foreach ( $addons_to_show as $addon_id ) : ?>
314 <?php
315 $addon = $fs->get_addon( $addon_id );
316 $is_addon_activated = $fs->is_addon_activated( $addon->slug );
317
318 $fs_addon = $is_addon_activated ? freemius( $addon->slug ) : false;
319 ?>
320 <tr>
321 <td>
322 <?php echo $addon->title ?>
323 </td>
324 <?php if ( $is_addon_activated ) : ?>
325 <?php // Add-on Installed ?>
326 <?php $addon_site = $fs_addon->get_site(); ?>
327 <td><?php echo $fs_addon->get_plugin_version() ?></td>
328 <td><?php echo is_string( $addon_site->plan->name ) ? strtoupper( $addon_site->plan->title ) : 'FREE' ?></td>
329 <?php
330 $current_license = $fs_addon->_get_license();
331 $is_current_license_expired = is_object( $current_license ) && $current_license->is_expired();
332 ?>
333 <?php if ( $fs_addon->is_not_paying() ) : ?>
334 <?php if ( $is_current_license_expired ) : ?>
335 <td><?php _efs( 'expired' ) ?></td>
336 <?php endif ?>
337 <?php $premium_license = $fs_addon->_get_available_premium_license() ?>
338 <td<?php if ( ! $is_current_license_expired ) {
339 echo ' colspan="2"';
340 } ?>>
341 <?php if ( is_object( $premium_license ) && ! $premium_license->is_utilized() ) : ?>
342 <?php $site = $fs_addon->get_site() ?>
343 <?php fs_ui_action_button(
344 $slug, 'account',
345 'activate_license',
346 sprintf( __fs( 'activate-x-plan' ), $fs_addon->get_plan_title(), ( $site->is_localhost() && $premium_license->is_free_localhost ) ? '[localhost]' : ( 1 < $premium_license->left() ? $premium_license->left() . ' left' : '' ) ),
347 array( 'plugin_id' => $addon_id )
348 ) ?>
349 <?php else : ?>
350 <div class="button-group">
351 <?php fs_ui_action_button(
352 $slug, 'account',
353 $slug . '_sync_license',
354 __fs( 'sync-license' ),
355 array( 'plugin_id' => $addon_id ),
356 false
357 ) ?>
358 <?php echo sprintf( '<a href="%s" class="thickbox button button-primary" aria-label="%s" data-title="%s">%s</a>',
359 esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
360 '&TB_iframe=true&width=600&height=550' ) ),
361 esc_attr( sprintf( __fs( 'more-information-about-x' ), $addon->title ) ),
362 esc_attr( $addon->title ),
363 __fs( 'upgrade' )
364 ) ?>
365 </div>
366 <?php endif ?>
367 </td>
368 <?php else : ?>
369 <?php if ( is_object( $current_license ) ) : ?>
370 <td><?php
371 if ( $current_license->is_lifetime() ) {
372 _efs( 'no-expiration' );
373 } else if ( $current_license->is_expired() ) {
374 _efs( 'expired' );
375 } else {
376 echo sprintf(
377 __fs( 'in-x' ),
378 human_time_diff( time(), strtotime( $current_license->expiration ) )
379 );
380 }
381 ?></td>
382 <td>
383 <?php fs_ui_action_button(
384 $slug, 'account',
385 'deactivate_license',
386 __fs( 'deactivate-license' ),
387 array( 'plugin_id' => $addon_id ),
388 false
389 ) ?>
390 </td>
391 <?php endif ?>
392 <?php endif ?>
393 <?php else : ?>
394 <?php // Add-on NOT Installed
395 ?>
396 <td colspan="4">
397 <?php if ( $fs->is_addon_installed( $addon->slug ) ) : ?>
398 <?php $addon_file = $fs->get_addon_basename( $addon->slug ) ?>
399 <a class="button button-primary"
400 href="<?php echo wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ) ?>"
401 title="<?php esc_attr( __fs( 'activate-this-addon' ) ) ?>"
402 class="edit"><?php _efs( 'activate' ) ?></a>
403 <?php else : ?>
404 <?php if ( $fs->is_allowed_to_install() ) : ?>
405 <a class="button button-primary"
406 href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ) ?>"><?php _efs( 'install-now' ) ?></a>
407 <?php else : ?>
408 <a target="_blank" class="button button-primary"
409 href="<?php echo $fs->_get_latest_download_local_url( $addon_id ) ?>"><?php _efs( 'download-latest' ) ?></a>
410 <?php endif ?>
411 <?php endif ?>
412 </td>
413 <?php endif ?>
414 <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
415 <td>
416 <?php
417 if ( $is_addon_activated ) {
418 fs_ui_action_button(
419 $slug, 'account',
420 'delete_account',
421 __fs( 'delete' ),
422 array( 'plugin_id' => $addon_id ),
423 false
424 );
425 }
426 ?>
427 </td>
428 <?php endif ?>
429 </tr>
430 <?php endforeach ?>
431 </tbody>
432 </table>
433 </div>
434 <?php endif ?>
435
436 <?php $fs->do_action( 'after_account_details' ) ?>
437 </div>
438 </div>
439 </div>
440 </div>
441 </div>
442 <?php fs_require_template( 'powered-by.php' ) ?>