PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.3
Tiered Pricing Table for WooCommerce v2.2.3
8.1.0 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 All 92 releases
← All changes | freemius/templates/account/partials/addon.php +81 -24 2.1.1 → 2.2.3 View file →
@@ -7,14 +7,18 @@
7 7 $addon_id = $VARS['addon_id'];
8 8 $odd = $VARS['odd'];
9 9 $slug = $fs->get_slug();
10 10
11 + $fs_blog_id = $VARS['fs_blog_id'];
11 12
12 - $addon = $fs->get_addon( $addon_id );
13 + $active_plugins_directories_map = $VARS['active_plugins_directories_map'];
14 +
15 + $addon_info = $VARS['addon_info'];
13 16 $is_addon_activated = $fs->is_addon_activated( $addon_id );
14 - $is_addon_connected = $fs->is_addon_connected( $addon_id );
17 + $is_addon_connected = $addon_info['is_connected'];
18 + $is_addon_installed = $VARS['is_addon_installed'];
15 19
16 - $fs_addon = $is_addon_connected ?
20 + $fs_addon = ( $is_addon_connected && $is_addon_installed ) ?
17 21 freemius( $addon_id ) :
18 22 false;
19 23
20 24 // Aliases.
@@ -20,10 +24,10 @@
20 24 // Aliases.
21 25 $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
22 26 $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
23 27 $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
24 - /* translators: %1s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
25 - $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 );
28 + /* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
29 + $downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %s plan license will expire in %s.', 'downgrade-x-confirm', $slug );
26 30 $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 );
27 31 $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 );
28 32 $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 );
29 33 $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 );
@@ -47,13 +51,17 @@
47 51
48 52 // Defaults.
49 53 $plan = null;
50 54 $is_paid_trial = false;
55 + /**
56 + * @var FS_Plugin_License $license
57 + */
51 58 $license = null;
52 59 $site = null;
53 60 $is_active_subscription = false;
54 61 $subscription = null;
55 62 $is_paying = false;
63 + $show_upgrade = false;
56 64
57 65 if ( is_object( $fs_addon ) ) {
58 66 $is_paying = $fs_addon->is_paying();
59 67 $user = $fs_addon->get_user();
@@ -62,13 +70,57 @@
62 70 $subscription = ( is_object( $license ) ?
63 71 $fs_addon->_get_subscription( $license->id ) :
64 72 null );
65 73 $plan = $fs_addon->get_plan();
66 - $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
74 + $plan_name = $plan->name;
75 + $plan_title = $plan->title;
67 76 $is_paid_trial = $fs_addon->is_paid_trial();
68 77 $show_upgrade = ( $fs_addon->has_paid_plan() && ! $is_paying && ! $is_paid_trial && ! $fs_addon->_has_premium_license() );
69 - $is_current_license_expired = is_object( $license ) && $license->is_expired();
78 + $version = $fs_addon->get_plugin_version();
79 + } else if ( $is_addon_connected ) {
80 + if (
81 + empty( $addon_info ) ||
82 + ! isset( $addon_info['site'] )
83 + ) {
84 + $is_addon_connected = false;
85 + } else {
86 + /**
87 + * @var FS_Site $site
88 + */
89 + $site = $addon_info['site'];
90 + $version = $addon_info['version'];
91 +
92 + $plan_name = isset( $addon_info['plan_name'] ) ?
93 + $addon_info['plan_name'] :
94 + '';
95 +
96 + $plan_title = isset( $addon_info['plan_title'] ) ?
97 + $addon_info['plan_title'] :
98 + '';
99 +
100 + if ( isset( $addon_info['license'] ) ) {
101 + $license = $addon_info['license'];
102 + }
103 +
104 + if ( isset( $addon_info['subscription'] ) ) {
105 + $subscription = $addon_info['subscription'];
106 + }
107 +
108 + $has_valid_and_active_license = (
109 + is_object( $license ) &&
110 + $license->is_active() &&
111 + $license->is_valid()
112 + );
113 +
114 + $is_paid_trial = (
115 + $site->is_trial() &&
116 + $has_valid_and_active_license &&
117 + ( $site->trial_plan_id == $license->plan_id )
118 + );
119 + }
70 120 }
121 +
122 + $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
71 123 ?>
72 124 <tr<?php if ( $odd ) {
73 125 echo ' class="alternate"';
74 126 } ?>>
@@ -73,9 +125,9 @@
73 125 echo ' class="alternate"';
74 126 } ?>>
75 127 <td>
76 128 <!-- Title -->
77 - <?php echo $addon->title ?>
129 + <?php echo $addon_info['title'] ?>
78 130 </td>
79 131 <?php if ( $is_addon_connected ) : ?>
80 132 <!-- ID -->
81 133 <td><?php echo $site->id ?></td>
@@ -81,16 +133,16 @@
81 133 <td><?php echo $site->id ?></td>
82 134 <!--/ ID -->
83 135
84 136 <!-- Version -->
85 - <td><?php echo $fs_addon->get_plugin_version() ?></td>
137 + <td><?php echo $version ?></td>
86 138 <!--/ Version -->
87 139
88 140 <!-- Plan Title -->
89 - <td><?php echo strtoupper( is_string( $plan->name ) ? $plan->title : $free_text ) ?></td>
141 + <td><?php echo strtoupper( is_string( $plan_name ) ? $plan_title : $free_text ) ?></td>
90 142 <!--/ Plan Title -->
91 143
92 - <?php if ( $fs_addon->is_trial() || is_object( $license ) ) : ?>
144 + <?php if ( $site->is_trial() || is_object( $license ) ) : ?>
93 145
94 146 <!-- Expiration -->
95 147 <td>
96 148 <?php
@@ -95,9 +147,9 @@
95 147 <td>
96 148 <?php
97 149 $tags = array();
98 150
99 - if ( $fs_addon->is_trial() ) {
151 + if ( $site->is_trial() ) {
100 152 $tags[] = array( 'label' => $trial_text, 'type' => 'success' );
101 153
102 154 $tags[] = array(
103 155 'label' => sprintf(
@@ -202,9 +254,9 @@
202 254 'dashicons dashicons-download',
203 255 $cancel_trial_confirm_text,
204 256 'POST'
205 257 );
206 - } else {
258 + } else if ( ! is_object( $license ) || ! $license->is_features_enabled() ) {
207 259 $premium_license = $fs_addon->_get_available_premium_license();
208 260
209 261 if ( is_object( $premium_license ) ) {
210 262 $premium_plan = $fs_addon->_get_plan_by_id( $premium_license->plan_id );
@@ -257,19 +309,22 @@
257 309 }
258 310 } else if ( ! $show_upgrade ) {
259 311 if ( $fs->is_addon_installed( $addon_id ) ) {
260 312 $addon_file = $fs->get_addon_basename( $addon_id );
261 - $buttons[] = sprintf(
262 - '<a class="button button-primary edit" href="%s" title="%s">%s</a>',
263 - wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ),
264 - fs_esc_attr_inline( 'Activate this add-on', 'activate-this-addon', $slug ),
265 - $activate_text
266 - );
313 +
314 + if ( ! isset( $active_plugins_directories_map[ dirname( $addon_file ) ] ) ) {
315 + $buttons[] = sprintf(
316 + '<a class="button button-primary edit" href="%s" title="%s">%s</a>',
317 + wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ),
318 + fs_esc_attr_inline( 'Activate this add-on', 'activate-this-addon', $slug ),
319 + $activate_text
320 + );
321 + }
267 322 } else {
268 323 if ( $fs->is_allowed_to_install() ) {
269 324 $buttons[] = sprintf(
270 325 '<a class="button button-primary edit" href="%s">%s</a>',
271 - wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ),
326 + wp_nonce_url( self_admin_url( 'update.php?' . ( ( isset( $addon_info['has_paid_plan'] ) && $addon_info['has_paid_plan'] ) ? 'fs_allow_updater_and_dialog=true&' : '' ) . 'action=install-plugin&plugin=' . $addon_info['slug'] ), 'install-plugin_' . $addon_info['slug'] ),
272 327 fs_text_inline( 'Install Now', 'install-now', $slug )
273 328 );
274 329 } else {
275 330 $buttons[] = sprintf(
@@ -282,12 +337,12 @@
282 337 }
283 338
284 339 if ( $show_upgrade ) {
285 340 $buttons[] = sprintf( '<a href="%s" class="thickbox button button-small button-primary" aria-label="%s" data-title="%s"><i class="dashicons dashicons-cart"></i> %s</a>',
286 - esc_url( network_admin_url( 'plugin-install.php?fs_allow_updater_and_dialog=true&tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
341 + esc_url( network_admin_url( 'plugin-install.php?fs_allow_updater_and_dialog=true' . ( ! empty( $fs_blog_id ) ? '&fs_blog_id=' . $fs_blog_id : '' ) . '&tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon_info['slug'] .
287 342 '&TB_iframe=true&width=600&height=550' ) ),
288 - esc_attr( sprintf( fs_text_inline( 'More information about %s', 'more-information-about-x', $slug ), $addon->title ) ),
289 - esc_attr( $addon->title ),
343 + esc_attr( sprintf( fs_text_inline( 'More information about %s', 'more-information-about-x', $slug ), $addon_info['title'] ) ),
344 + esc_attr( $addon_info['title'] ),
290 345 ( $fs_addon->has_free_plan() ?
291 346 $upgrade_text :
292 347 fs_text_x_inline( 'Purchase', 'verb', 'purchase', $slug ) )
293 348 );
@@ -311,16 +366,18 @@
311 366 <!-- Action -->
312 367 <td colspan="4">
313 368 <?php if ( $fs->is_addon_installed( $addon_id ) ) : ?>
314 369 <?php $addon_file = $fs->get_addon_basename( $addon_id ) ?>
370 + <?php if ( ! isset( $active_plugins_directories_map[ dirname( $addon_file ) ] ) ) : ?>
315 371 <a class="button button-primary"
316 372 href="<?php echo wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ) ?>"
317 373 title="<?php fs_esc_attr_echo_inline( 'Activate this add-on', 'activate-this-addon', $slug ) ?>"
318 374 class="edit"><?php echo esc_html( $activate_text ) ?></a>
375 + <?php endif ?>
319 376 <?php else : ?>
320 377 <?php if ( $fs->is_allowed_to_install() ) : ?>
321 378 <a class="button button-primary"
322 - 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_inline( 'Install Now', 'install-now', $slug ) ?></a>
379 + href="<?php echo wp_nonce_url( self_admin_url( 'update.php?' . ( ( isset( $addon_info['has_paid_plan'] ) && $addon_info['has_paid_plan'] ) ? 'fs_allow_updater_and_dialog=true&' : '' ) . 'action=install-plugin&plugin=' . $addon_info['slug'] ), 'install-plugin_' . $addon_info['slug'] ) ?>"><?php fs_esc_html_echo_inline( 'Install Now', 'install-now', $slug ) ?></a>
323 380 <?php else : ?>
324 381 <a target="_blank" class="button button-primary"
325 382 href="<?php echo $fs->_get_latest_download_local_url( $addon_id ) ?>"><?php echo esc_html( $download_latest_text ) ?></a>
326 383 <?php endif ?>