| @@ -14,16 +14,18 @@ | ||
| 14 | 14 | * @var array $VARS |
| 15 | 15 | * @var Freemius $fs |
| 16 | 16 | * @var FS_Plugin_License $main_license |
| 17 | 17 | */ |
| 18 | - $fs = $VARS['freemius']; | |
| 19 | - $slug = $fs->get_slug(); | |
| 20 | - $site = $VARS['site']; | |
| 21 | - $main_license = $VARS['license']; | |
| 22 | - $has_paid_plan = $fs->has_paid_plan(); | |
| 23 | - $is_premium = $fs->is_premium(); | |
| 24 | - $main_user = $fs->get_user(); | |
| 25 | - $blog_id = $site['blog_id']; | |
| 18 | + $fs = $VARS['freemius']; | |
| 19 | + $slug = $fs->get_slug(); | |
| 20 | + $site = $VARS['site']; | |
| 21 | + $main_license = $VARS['license']; | |
| 22 | + $is_data_debug_mode = $fs->is_data_debug_mode(); | |
| 23 | + $is_whitelabeled = $fs->is_whitelabeled(); | |
| 24 | + $has_paid_plan = $fs->has_paid_plan(); | |
| 25 | + $is_premium = $fs->is_premium(); | |
| 26 | + $main_user = $VARS['user']; | |
| 27 | + $blog_id = $site['blog_id']; | |
| 26 | 28 | |
| 27 | 29 | $install = $VARS['install']; |
| 28 | 30 | $is_registered = ! empty( $install ); |
| 29 | 31 | $license = null; |
| @@ -28,8 +30,12 @@ | ||
| 28 | 30 | $is_registered = ! empty( $install ); |
| 29 | 31 | $license = null; |
| 30 | 32 | $trial_plan = $fs->get_trial_plan(); |
| 31 | 33 | $free_text = fs_text_inline( 'Free', 'free', $slug ); |
| 34 | + | |
| 35 | + if ( $is_whitelabeled && is_object( $install ) && $fs->is_delegated_connection( $blog_id ) ) { | |
| 36 | + $is_whitelabeled = $fs->is_whitelabeled( true, $blog_id ); | |
| 37 | + } | |
| 32 | 38 | ?> |
| 33 | 39 | <tr class="fs-site-details" data-blog-id="<?php echo $blog_id ?>"<?php if ( $is_registered ) : ?> data-install-id="<?php echo $install->id ?>"<?php endif ?>> |
| 34 | 40 | <!-- Install ID or Opt-in option --> |
| 35 | 41 | <td><?php if ( $is_registered ) : ?> |
| @@ -71,30 +77,32 @@ | ||
| 71 | 77 | } else { |
| 72 | 78 | $view_params['is_localhost'] = FS_Site::is_localhost_by_address( $site['url'] ); |
| 73 | 79 | } |
| 74 | 80 | |
| 75 | - if ( is_object( $license ) ) { | |
| 76 | - $view_params['license'] = $license; | |
| 81 | + if ( ! $is_whitelabeled ) { | |
| 82 | + if ( is_object( $license ) ) { | |
| 83 | + $view_params['license'] = $license; | |
| 77 | 84 | |
| 78 | - // Show license deactivation button. | |
| 79 | - fs_require_template( 'account/partials/deactivate-license-button.php', $view_params ); | |
| 80 | - } else { | |
| 81 | - if ( is_object( $main_license ) && $main_license->can_activate( $view_params['is_localhost'] ) ) { | |
| 82 | - // Main license is available for activation. | |
| 83 | - $available_license = $main_license; | |
| 85 | + // Show license deactivation button. | |
| 86 | + fs_require_template( 'account/partials/deactivate-license-button.php', $view_params ); | |
| 84 | 87 | } else { |
| 85 | - // Try to find any available license for activation. | |
| 86 | - $available_license = $fs->_get_available_premium_license( $view_params['is_localhost'] ); | |
| 87 | - } | |
| 88 | + if ( is_object( $main_license ) && $main_license->can_activate( $view_params['is_localhost'] ) ) { | |
| 89 | + // Main license is available for activation. | |
| 90 | + $available_license = $main_license; | |
| 91 | + } else { | |
| 92 | + // Try to find any available license for activation. | |
| 93 | + $available_license = $fs->_get_available_premium_license( $view_params['is_localhost'] ); | |
| 94 | + } | |
| 88 | 95 | |
| 89 | - if ( is_object( $available_license ) ) { | |
| 90 | - $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ); | |
| 96 | + if ( is_object( $available_license ) ) { | |
| 97 | + $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ); | |
| 91 | 98 | |
| 92 | - $view_params['license'] = $available_license; | |
| 93 | - $view_params['class'] .= ' button-primary'; | |
| 94 | - $view_params['plan'] = $premium_plan; | |
| 99 | + $view_params['license'] = $available_license; | |
| 100 | + $view_params['class'] .= ' button-primary'; | |
| 101 | + $view_params['plan'] = $premium_plan; | |
| 95 | 102 | |
| 96 | - fs_require_template( 'account/partials/activate-license-button.php', $view_params ); | |
| 103 | + fs_require_template( 'account/partials/activate-license-button.php', $view_params ); | |
| 104 | + } | |
| 97 | 105 | } |
| 98 | 106 | } |
| 99 | 107 | } ?></td> |
| 100 | 108 | <!--/ License Activation / Deactivation --> |
| @@ -105,9 +113,9 @@ | ||
| 105 | 113 | if ( ! $has_paid_plan ) { |
| 106 | 114 | $plan_title = $free_text; |
| 107 | 115 | } else { |
| 108 | 116 | if ( $install->is_trial() ) { |
| 109 | - if ( $trial_plan->id == $install->trial_plan_id ) { | |
| 117 | + if ( is_object( $trial_plan ) && $trial_plan->id == $install->trial_plan_id ) { | |
| 110 | 118 | $plan_title = is_string( $trial_plan->name ) ? |
| 111 | 119 | strtoupper( $trial_plan->title ) : |
| 112 | 120 | fs_text_inline( 'Trial', 'trial', $slug ); |
| 113 | 121 | } else { |
| @@ -150,16 +158,17 @@ | ||
| 150 | 158 | <td><code><?php echo $blog_id ?></code></td> |
| 151 | 159 | <td><?php if ( ! FS_Plugin_License::is_valid_id( $install->license_id ) ) : ?> |
| 152 | 160 | <!-- Toggle Usage Tracking --> |
| 153 | 161 | <?php $action = 'toggle_tracking' ?> |
| 162 | + <?php $is_disconnected = ! FS_Permission_Manager::instance( $fs )->is_homepage_url_tracking_allowed( $blog_id ) ?> | |
| 154 | 163 | <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"> |
| 155 | 164 | <input type="hidden" name="fs_action" value="<?php echo $action ?>"> |
| 156 | 165 | <?php wp_nonce_field( trim( "{$action}:{$blog_id}:{$install->id}", ':' ) ) ?> |
| 157 | 166 | <input type="hidden" name="install_id" value="<?php echo $install->id ?>"> |
| 158 | 167 | <input type="hidden" name="blog_id" value="<?php echo $blog_id ?>"> |
| 159 | - <button class="fs-toggle-tracking button button-small<?php if ( $install->is_disconnected ) { | |
| 168 | + <button class="fs-toggle-tracking button button-small<?php if ( $is_disconnected ) { | |
| 160 | 169 | echo ' button-primary'; |
| 161 | - } ?>" data-is-disconnected="<?php echo $install->is_disconnected ? 'true' : 'false' ?>"><?php $install->is_disconnected ? fs_esc_html_echo_inline( 'Opt In', 'opt-in', $slug ) : fs_esc_html_echo_inline( 'Opt Out', 'opt-out', $slug ) ?></button> | |
| 170 | + } ?>" data-is-disconnected="<?php echo $is_disconnected ? 'true' : 'false' ?>"><?php $is_disconnected ? fs_esc_html_echo_inline( 'Opt In', 'opt-in', $slug ) : fs_esc_html_echo_inline( 'Opt Out', 'opt-out', $slug ) ?></button> | |
| 162 | 171 | </form> |
| 163 | 172 | <!--/ Toggle Usage Tracking --> |
| 164 | 173 | <?php endif ?></td> |
| 165 | 174 | </tr> |
| @@ -165,9 +174,9 @@ | ||
| 165 | 174 | </tr> |
| 166 | 175 | <?php $row_index ++ ?> |
| 167 | 176 | <!--/ Blog ID --> |
| 168 | 177 | |
| 169 | - <?php if ( $is_registered && $install->user_id != $main_user->id ) : ?> | |
| 178 | + <?php if ( $install->user_id != $main_user->id ) : ?> | |
| 170 | 179 | <?php |
| 171 | 180 | /** |
| 172 | 181 | * @var FS_User $user |
| 173 | 182 | */ |
| @@ -217,9 +226,10 @@ | ||
| 217 | 226 | } ?>> |
| 218 | 227 | <td> |
| 219 | 228 | <nobr><?php fs_esc_html_echo_inline( 'Public Key', 'public-key', $slug ) ?>:</nobr> |
| 220 | 229 | </td> |
| 221 | - <td colspan="2"><code><?php echo htmlspecialchars( $install->public_key ) ?></code></td> | |
| 230 | + <td><code><?php echo htmlspecialchars( $install->public_key ) ?></code></td> | |
| 231 | + <td></td> | |
| 222 | 232 | </tr> |
| 223 | 233 | <?php $row_index ++ ?> |
| 224 | 234 | <!--/ Public Key --> |
| 225 | 235 | |
| @@ -230,12 +240,16 @@ | ||
| 230 | 240 | <td> |
| 231 | 241 | <nobr><?php fs_esc_html_echo_inline( 'Secret Key', 'secret-key', $slug ) ?>:</nobr> |
| 232 | 242 | </td> |
| 233 | 243 | <td> |
| 234 | - <code><?php echo htmlspecialchars( substr( $install->secret_key, 0, 6 ) ) . str_pad( '', 23 * 6, '•' ) . htmlspecialchars( substr( $install->secret_key, - 3 ) ) ?></code> | |
| 244 | + <code><?php echo FS_Plugin_License::mask_secret_key_for_html( $install->secret_key ) ?></code> | |
| 245 | + <?php if ( ! $is_whitelabeled ) : ?> | |
| 235 | 246 | <input type="text" value="<?php echo htmlspecialchars( $install->secret_key ) ?>" |
| 236 | 247 | style="display: none" readonly/></td> |
| 248 | + <?php endif ?> | |
| 249 | + <?php if ( ! $is_whitelabeled ) : ?> | |
| 237 | 250 | <td><button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button></td> |
| 251 | + <?php endif ?> | |
| 238 | 252 | </tr> |
| 239 | 253 | <?php $row_index ++ ?> |
| 240 | 254 | <!--/ Secret Key --> |
| 241 | 255 | |
| @@ -247,15 +261,19 @@ | ||
| 247 | 261 | <td> |
| 248 | 262 | <nobr><?php fs_esc_html_echo_inline( 'License Key', 'license-key', $slug ) ?>:</nobr> |
| 249 | 263 | </td> |
| 250 | 264 | <td> |
| 251 | - <code><?php echo htmlspecialchars( substr( $license->secret_key, 0, 6 ) ) . str_pad( '', 23 * 6, '•' ) . htmlspecialchars( substr( $license->secret_key, - 3 ) ) ?></code> | |
| 265 | + <code><?php echo $license->get_html_escaped_masked_secret_key() ?></code> | |
| 266 | + <?php if ( ! $is_whitelabeled ) : ?> | |
| 252 | 267 | <input type="text" value="<?php echo htmlspecialchars( $license->secret_key ) ?>" |
| 253 | 268 | style="display: none" readonly/></td> |
| 269 | + <?php endif ?> | |
| 270 | + <?php if ( ! $is_whitelabeled ) : ?> | |
| 254 | 271 | <td> |
| 255 | 272 | <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button> |
| 256 | 273 | <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> |
| 257 | 274 | </td> |
| 275 | + <?php endif ?> | |
| 258 | 276 | </tr> |
| 259 | 277 | <?php $row_index ++ ?> |
| 260 | 278 | <!--/ License Key --> |
| 261 | 279 | |
| @@ -293,10 +311,10 @@ | ||
| 293 | 311 | <td><?php if ( $is_active_subscription ) : ?> |
| 294 | 312 | <?php |
| 295 | 313 | $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug ); |
| 296 | 314 | $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug ); |
| 297 | - /* translators: %1s: Either 'Downgrading your plan' or 'Cancelling the subscription' */ | |
| 298 | - $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 ); | |
| 315 | + /* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */ | |
| 316 | + $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 ); | |
| 299 | 317 | $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 ); |
| 300 | 318 | $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 ); |
| 301 | 319 | $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 ); |
| 302 | 320 | $downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug ); |