PluginProbe ʕ •ᴥ•ʔ
Auto Post Cleaner / 3.10.2
Auto Post Cleaner v3.10.2
3.12.0 3.13.1 3.2.4 3.2.5 3.3.0 3.3.10 3.3.11 3.3.8 3.4.2 3.5.3 3.6.0 3.7.0 3.7.1 3.7.2 3.7.3 3.7.5 3.7.6 3.8.0 3.9.0 3.9.4 3.9.6 3.9.7 trunk 3.0.0 3.1.0 3.10.1 3.10.2 3.11.4
delete-old-posts-programmatically / freemius / templates / account / partials / site.php
delete-old-posts-programmatically / freemius / templates / account / partials Last commit date
activate-license-button.php 5 years ago addon.php 2 years ago deactivate-license-button.php 5 years ago disconnect-button.php 3 years ago index.php 5 years ago site.php 3 years ago
site.php
354 lines
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 2.0.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 * @var Freemius $fs
16 * @var FS_Plugin_License $main_license
17 */
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'];
28
29 $install = $VARS['install'];
30 $is_registered = ! empty( $install );
31 $license = null;
32 $trial_plan = $fs->get_trial_plan();
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 }
38 ?>
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 ?>>
40 <!-- Install ID or Opt-in option -->
41 <td><?php if ( $is_registered ) : ?>
42 <?php echo $install->id ?>
43 <?php else : ?>
44 <?php $action = 'opt_in' ?>
45 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
46 <input type="hidden" name="fs_action" value="<?php echo $action ?>">
47 <?php wp_nonce_field( trim( "{$action}:{$blog_id}", ':' ) ) ?>
48 <input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
49 <button class="fs-opt-in button button-small"><?php fs_esc_html_echo_inline( 'Opt In', 'opt-in', $slug ) ?></button>
50 </form>
51 <?php endif ?>
52 </td>
53 <!--/ Install ID or Opt-in option -->
54
55 <!-- Site URL -->
56 <td class="fs-field-url fs-main-column"><?php echo fs_strip_url_protocol( $site['url'] ) ?></td>
57 <!--/ Site URL -->
58
59 <!-- License Activation / Deactivation -->
60 <td><?php if ( $has_paid_plan ) {
61 $view_params = array(
62 'freemius' => $fs,
63 'slug' => $slug,
64 'blog_id' => $blog_id,
65 'class' => 'button-small',
66 );
67
68 $license = null;
69 if ( $is_registered ) {
70 $view_params['install_id'] = $install->id;
71 $view_params['is_localhost'] = $install->is_localhost();
72
73 $has_license = FS_Plugin_License::is_valid_id( $install->license_id );
74 $license = $has_license ?
75 $fs->_get_license_by_id( $install->license_id ) :
76 null;
77 } else {
78 $view_params['is_localhost'] = FS_Site::is_localhost_by_address( $site['url'] );
79 }
80
81 if ( ! $is_whitelabeled ) {
82 if ( is_object( $license ) ) {
83 $view_params['license'] = $license;
84
85 // Show license deactivation button.
86 fs_require_template( 'account/partials/deactivate-license-button.php', $view_params );
87 } else {
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 }
95
96 if ( is_object( $available_license ) ) {
97 $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id );
98
99 $view_params['license'] = $available_license;
100 $view_params['class'] .= ' button-primary';
101 $view_params['plan'] = $premium_plan;
102
103 fs_require_template( 'account/partials/activate-license-button.php', $view_params );
104 }
105 }
106 }
107 } ?></td>
108 <!--/ License Activation / Deactivation -->
109
110 <!-- Plan -->
111 <td><?php if ( $is_registered ) : ?>
112 <?php
113 if ( ! $has_paid_plan ) {
114 $plan_title = $free_text;
115 } else {
116 if ( $install->is_trial() ) {
117 if ( is_object( $trial_plan ) && $trial_plan->id == $install->trial_plan_id ) {
118 $plan_title = is_string( $trial_plan->name ) ?
119 strtoupper( $trial_plan->title ) :
120 fs_text_inline( 'Trial', 'trial', $slug );
121 } else {
122 $plan_title = fs_text_inline( 'Trial', 'trial', $slug );
123 }
124 } else {
125 $plan = $fs->_get_plan_by_id( $install->plan_id );
126 $plan_title = strtoupper( is_string( $plan->title ) ?
127 $plan->title :
128 strtoupper( $free_text )
129 );
130 }
131 }
132 ?>
133 <code><?php echo $plan_title ?></code>
134 <?php endif ?></td>
135 <!--/ Plan -->
136
137 <!-- More details button -->
138 <td><?php if ( $is_registered ) : ?>
139 <button class="fs-show-install-details button button-small">More details <i
140 class="dashicons dashicons-arrow-right-alt2"></i>
141 </button><?php endif ?></td>
142 <!--/ More details button -->
143 </tr>
144 <?php if ( $is_registered ) : ?>
145 <!-- More details -->
146 <tr class="fs-install-details" data-install-id="<?php echo $install->id ?>" style="display: none">
147 <td colspan="5">
148 <table class="widefat fs-key-value-table">
149 <tbody>
150 <?php $row_index = 0 ?>
151 <!-- Blog ID -->
152 <tr <?php if ( 1 == $row_index % 2 ) {
153 echo ' class="alternate"';
154 } ?>>
155 <td>
156 <nobr><?php fs_esc_html_echo_inline( 'Blog ID', 'blog-id', $slug ) ?>:</nobr>
157 </td>
158 <td><code><?php echo $blog_id ?></code></td>
159 <td><?php if ( ! FS_Plugin_License::is_valid_id( $install->license_id ) ) : ?>
160 <!-- Toggle Usage Tracking -->
161 <?php $action = 'toggle_tracking' ?>
162 <?php $is_disconnected = ! FS_Permission_Manager::instance( $fs )->is_homepage_url_tracking_allowed( $blog_id ) ?>
163 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
164 <input type="hidden" name="fs_action" value="<?php echo $action ?>">
165 <?php wp_nonce_field( trim( "{$action}:{$blog_id}:{$install->id}", ':' ) ) ?>
166 <input type="hidden" name="install_id" value="<?php echo $install->id ?>">
167 <input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
168 <button class="fs-toggle-tracking button button-small<?php if ( $is_disconnected ) {
169 echo ' button-primary';
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>
171 </form>
172 <!--/ Toggle Usage Tracking -->
173 <?php endif ?></td>
174 </tr>
175 <?php $row_index ++ ?>
176 <!--/ Blog ID -->
177
178 <?php if ( $install->user_id != $main_user->id ) : ?>
179 <?php
180 /**
181 * @var FS_User $user
182 */
183 $user = Freemius::_get_user_by_id( $install->user_id ) ?>
184 <?php if ( is_object( $user ) ) : ?>
185 <!-- User Name -->
186 <tr <?php if ( 1 == $row_index % 2 ) {
187 echo ' class="alternate"';
188 } ?>>
189 <td>
190 <nobr><?php fs_esc_html_echo_inline( 'Owner Name', 'owner-name', $slug ) ?>:</nobr>
191 </td>
192 <td colspan="2"><code><?php echo htmlspecialchars( $user->get_name() ) ?></code></td>
193 </tr>
194 <?php $row_index ++ ?>
195 <!--/ User Name -->
196
197 <!-- User Email -->
198 <tr <?php if ( 1 == $row_index % 2 ) {
199 echo ' class="alternate"';
200 } ?>>
201 <td>
202 <nobr><?php fs_esc_html_echo_inline( 'Owner Email', 'owner-email', $slug ) ?>:</nobr>
203 </td>
204 <td colspan="2"><code><?php echo htmlspecialchars( $user->email ) ?></code></td>
205 </tr>
206 <?php $row_index ++ ?>
207 <!--/ User Email -->
208
209 <!-- User ID -->
210 <tr <?php if ( 1 == $row_index % 2 ) {
211 echo ' class="alternate"';
212 } ?>>
213 <td>
214 <nobr><?php fs_esc_html_echo_inline( 'Owner ID', 'owner-id', $slug ) ?>:</nobr>
215 </td>
216 <td colspan="2"><code><?php echo $user->id ?></code></td>
217 </tr>
218 <?php $row_index ++ ?>
219 <!--/ User ID -->
220 <?php endif ?>
221 <?php endif ?>
222
223 <!-- Public Key -->
224 <tr <?php if ( 1 == $row_index % 2 ) {
225 echo ' class="alternate"';
226 } ?>>
227 <td>
228 <nobr><?php fs_esc_html_echo_inline( 'Public Key', 'public-key', $slug ) ?>:</nobr>
229 </td>
230 <td><code><?php echo htmlspecialchars( $install->public_key ) ?></code></td>
231 <td></td>
232 </tr>
233 <?php $row_index ++ ?>
234 <!--/ Public Key -->
235
236 <!-- Secret Key -->
237 <tr <?php if ( 1 == $row_index % 2 ) {
238 echo ' class="alternate"';
239 } ?>>
240 <td>
241 <nobr><?php fs_esc_html_echo_inline( 'Secret Key', 'secret-key', $slug ) ?>:</nobr>
242 </td>
243 <td>
244 <code><?php echo FS_Plugin_License::mask_secret_key_for_html( $install->secret_key ) ?></code>
245 <?php if ( ! $is_whitelabeled ) : ?>
246 <input type="text" value="<?php echo htmlspecialchars( $install->secret_key ) ?>"
247 style="display: none" readonly/></td>
248 <?php endif ?>
249 <?php if ( ! $is_whitelabeled ) : ?>
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 ?>
252 </tr>
253 <?php $row_index ++ ?>
254 <!--/ Secret Key -->
255
256 <?php if ( is_object( $license ) ) : ?>
257 <!-- License Key -->
258 <tr <?php if ( 1 == $row_index % 2 ) {
259 echo ' class="alternate"';
260 } ?>>
261 <td>
262 <nobr><?php fs_esc_html_echo_inline( 'License Key', 'license-key', $slug ) ?>:</nobr>
263 </td>
264 <td>
265 <code><?php echo $license->get_html_escaped_masked_secret_key() ?></code>
266 <?php if ( ! $is_whitelabeled ) : ?>
267 <input type="text" value="<?php echo htmlspecialchars( $license->secret_key ) ?>"
268 style="display: none" readonly/></td>
269 <?php endif ?>
270 <?php if ( ! $is_whitelabeled ) : ?>
271 <td>
272 <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
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>
274 </td>
275 <?php endif ?>
276 </tr>
277 <?php $row_index ++ ?>
278 <!--/ License Key -->
279
280 <?php if ( ! is_object( $main_license ) || $main_license->id != $license->id ) : ?>
281 <?php $subscription = $fs->_get_subscription( $license->id ) ?>
282 <?php if ( ! $license->is_lifetime() && is_object( $subscription ) ) : ?>
283 <!-- Subscription -->
284 <tr <?php if ( 1 == $row_index % 2 ) {
285 echo ' class="alternate"';
286 } ?>>
287 <td>
288 <nobr><?php fs_esc_html_echo_inline( 'Subscription', 'subscription', $slug ) ?>:</nobr>
289 </td>
290 <?php
291 $is_active_subscription = $subscription->is_active();
292
293 $renews_in_text = fs_text_inline( 'Auto renews in %s', 'renews-in', $slug );
294 /* translators: %s: Time period (e.g. Expires in "2 months") */
295 $expires_in_text = fs_text_inline( 'Expires in %s', 'expires-in', $slug );
296 ?>
297 <td>
298 <code><?php echo $subscription->id ?> - <?php
299 echo ( 12 == $subscription->billing_cycle ?
300 _fs_text_inline( 'Annual', 'annual', $slug ) :
301 _fs_text_inline( 'Monthly', 'monthly', $slug )
302 );
303 ?>
304 </code>
305 <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
306 <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $license->expiration ) ) ) ) ?></label>
307 <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
308 <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ) ?></label>
309 <?php endif ?>
310 </td>
311 <td><?php if ( $is_active_subscription ) : ?>
312 <?php
313 $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
314 $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $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 );
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 );
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 );
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 );
320 $downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug );
321
322 $human_readable_license_expiration = human_time_diff( time(), strtotime( $license->expiration ) );
323 $downgrade_confirmation_message = sprintf(
324 $downgrade_x_confirm_text,
325 ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
326 $plan->title,
327 $human_readable_license_expiration
328 );
329
330 $after_downgrade_message = ! $license->is_block_features ?
331 sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) :
332 sprintf( $after_downgrade_blocking_text, $plan->title );
333 ?>
334 <?php $action = 'downgrade_account' ?>
335 <form id="fs_downgrade" action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
336 <input type="hidden" name="fs_action" value="<?php echo $action ?>">
337 <?php wp_nonce_field( trim( "{$action}:{$blog_id}", ':' ) ) ?>
338 <input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
339 <button class="button button-small" onclick="if (confirm('<?php echo esc_attr( $downgrade_confirmation_message . ' ' . $after_downgrade_message . ' ' . $prices_increase_text ) ?>')) { this.parentNode.submit(); } else { return false; }"><?php echo $downgrade_text ?></button>
340 </form>
341 <?php endif ?></td>
342 </tr>
343 <?php $row_index ++ ?>
344 <?php endif ?>
345 <!--/ Subscription -->
346 <?php endif ?>
347 <?php endif ?>
348
349 </tbody>
350 </table>
351 </td>
352 </tr>
353 <!--/ More details -->
354 <?php endif ?>