PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 1.5
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v1.5
3.6.0 3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 All 110 releases
buttonizer-multifunctional-button / freemius / templates / account / partials / site.php

site.php in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder 1.5, at freemius/templates/account/partials/site.php

331 lines 18.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $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'];
26
27 $install = $VARS['install'];
28 $is_registered = ! empty( $install );
29 $license = null;
30 $trial_plan = $fs->get_trial_plan();
31 $free_text = fs_text_inline( 'Free', 'free', $slug );
32 ?>
33 <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 <!-- Install ID or Opt-in option -->
35 <td><?php if ( $is_registered ) : ?>
36 <?php echo $install->id ?>
37 <?php else : ?>
38 <?php $action = 'opt_in' ?>
39 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
40 <input type="hidden" name="fs_action" value="<?php echo $action ?>">
41 <?php wp_nonce_field( trim( "{$action}:{$blog_id}", ':' ) ) ?>
42 <input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
43 <button class="fs-opt-in button button-small"><?php fs_esc_html_echo_inline( 'Opt In', 'opt-in', $slug ) ?></button>
44 </form>
45 <?php endif ?>
46 </td>
47 <!--/ Install ID or Opt-in option -->
48
49 <!-- Site URL -->
50 <td class="fs-field-url fs-main-column"><?php echo fs_strip_url_protocol( $site['url'] ) ?></td>
51 <!--/ Site URL -->
52
53 <!-- License Activation / Deactivation -->
54 <td><?php if ( $has_paid_plan ) {
55 $view_params = array(
56 'freemius' => $fs,
57 'slug' => $slug,
58 'blog_id' => $blog_id,
59 'class' => 'button-small',
60 );
61
62 $license = null;
63 if ( $is_registered ) {
64 $view_params['install_id'] = $install->id;
65 $view_params['is_localhost'] = $install->is_localhost();
66
67 $has_license = FS_Plugin_License::is_valid_id( $install->license_id );
68 $license = $has_license ?
69 $fs->_get_license_by_id( $install->license_id ) :
70 null;
71 } else {
72 $view_params['is_localhost'] = FS_Site::is_localhost_by_address( $site['url'] );
73 }
74
75 if ( is_object( $license ) ) {
76 $view_params['license'] = $license;
77
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;
84 } else {
85 // Try to find any available license for activation.
86 $available_license = $fs->_get_available_premium_license( $view_params['is_localhost'] );
87 }
88
89 if ( is_object( $available_license ) ) {
90 $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id );
91
92 $view_params['license'] = $available_license;
93 $view_params['class'] .= ' button-primary';
94 $view_params['plan'] = $premium_plan;
95
96 fs_require_template( 'account/partials/activate-license-button.php', $view_params );
97 }
98 }
99 } ?></td>
100 <!--/ License Activation / Deactivation -->
101
102 <!-- Plan -->
103 <td><?php if ( $is_registered ) : ?>
104 <?php
105 if ( ! $has_paid_plan ) {
106 $plan_title = $free_text;
107 } else {
108 if ( $install->is_trial() ) {
109 if ( $trial_plan->id == $install->trial_plan_id ) {
110 $plan_title = is_string( $trial_plan->name ) ?
111 strtoupper( $trial_plan->title ) :
112 fs_text_inline( 'Trial', 'trial', $slug );
113 } else {
114 $plan_title = fs_text_inline( 'Trial', 'trial', $slug );
115 }
116 } else {
117 $plan = $fs->_get_plan_by_id( $install->plan_id );
118 $plan_title = strtoupper( is_string( $plan->title ) ?
119 $plan->title :
120 strtoupper( $free_text )
121 );
122 }
123 }
124 ?>
125 <code><?php echo $plan_title ?></code>
126 <?php endif ?></td>
127 <!--/ Plan -->
128
129 <!-- More details button -->
130 <td><?php if ( $is_registered ) : ?>
131 <button class="fs-show-install-details button button-small">More details <i
132 class="dashicons dashicons-arrow-right-alt2"></i>
133 </button><?php endif ?></td>
134 <!--/ More details button -->
135 </tr>
136 <?php if ( $is_registered ) : ?>
137 <!-- More details -->
138 <tr class="fs-install-details" data-install-id="<?php echo $install->id ?>" style="display: none">
139 <td colspan="5">
140 <table class="widefat fs-key-value-table">
141 <tbody>
142 <?php $row_index = 0 ?>
143 <!-- Blog ID -->
144 <tr <?php if ( 1 == $row_index % 2 ) {
145 echo ' class="alternate"';
146 } ?>>
147 <td>
148 <nobr><?php fs_esc_html_echo_inline( 'Blog ID', 'blog-id', $slug ) ?>:</nobr>
149 </td>
150 <td><code><?php echo $blog_id ?></code></td>
151 <td><?php if ( ! FS_Plugin_License::is_valid_id( $install->license_id ) ) : ?>
152 <!-- Toggle Usage Tracking -->
153 <?php $action = 'toggle_tracking' ?>
154 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
155 <input type="hidden" name="fs_action" value="<?php echo $action ?>">
156 <?php wp_nonce_field( trim( "{$action}:{$blog_id}:{$install->id}", ':' ) ) ?>
157 <input type="hidden" name="install_id" value="<?php echo $install->id ?>">
158 <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 ) {
160 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>
162 </form>
163 <!--/ Toggle Usage Tracking -->
164 <?php endif ?></td>
165 </tr>
166 <?php $row_index ++ ?>
167 <!--/ Blog ID -->
168
169 <?php if ( $is_registered && $install->user_id != $main_user->id ) : ?>
170 <?php
171 /**
172 * @var FS_User $user
173 */
174 $user = Freemius::_get_user_by_id( $install->user_id ) ?>
175 <?php if ( is_object( $user ) ) : ?>
176 <!-- User Name -->
177 <tr <?php if ( 1 == $row_index % 2 ) {
178 echo ' class="alternate"';
179 } ?>>
180 <td>
181 <nobr><?php fs_esc_html_echo_inline( 'Owner Name', 'owner-name', $slug ) ?>:</nobr>
182 </td>
183 <td colspan="2"><code><?php echo htmlspecialchars( $user->get_name() ) ?></code></td>
184 </tr>
185 <?php $row_index ++ ?>
186 <!--/ User Name -->
187
188 <!-- User Email -->
189 <tr <?php if ( 1 == $row_index % 2 ) {
190 echo ' class="alternate"';
191 } ?>>
192 <td>
193 <nobr><?php fs_esc_html_echo_inline( 'Owner Email', 'owner-email', $slug ) ?>:</nobr>
194 </td>
195 <td colspan="2"><code><?php echo htmlspecialchars( $user->email ) ?></code></td>
196 </tr>
197 <?php $row_index ++ ?>
198 <!--/ User Email -->
199
200 <!-- User ID -->
201 <tr <?php if ( 1 == $row_index % 2 ) {
202 echo ' class="alternate"';
203 } ?>>
204 <td>
205 <nobr><?php fs_esc_html_echo_inline( 'Owner ID', 'owner-id', $slug ) ?>:</nobr>
206 </td>
207 <td colspan="2"><code><?php echo $user->id ?></code></td>
208 </tr>
209 <?php $row_index ++ ?>
210 <!--/ User ID -->
211 <?php endif ?>
212 <?php endif ?>
213
214 <!-- Public Key -->
215 <tr <?php if ( 1 == $row_index % 2 ) {
216 echo ' class="alternate"';
217 } ?>>
218 <td>
219 <nobr><?php fs_esc_html_echo_inline( 'Public Key', 'public-key', $slug ) ?>:</nobr>
220 </td>
221 <td colspan="2"><code><?php echo htmlspecialchars( $install->public_key ) ?></code></td>
222 </tr>
223 <?php $row_index ++ ?>
224 <!--/ Public Key -->
225
226 <!-- Secret Key -->
227 <tr <?php if ( 1 == $row_index % 2 ) {
228 echo ' class="alternate"';
229 } ?>>
230 <td>
231 <nobr><?php fs_esc_html_echo_inline( 'Secret Key', 'secret-key', $slug ) ?>:</nobr>
232 </td>
233 <td>
234 <code><?php echo htmlspecialchars( substr( $install->secret_key, 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $install->secret_key, - 3 ) ) ?></code>
235 <input type="text" value="<?php echo htmlspecialchars( $install->secret_key ) ?>"
236 style="display: none" readonly/></td>
237 <td><button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button></td>
238 </tr>
239 <?php $row_index ++ ?>
240 <!--/ Secret Key -->
241
242 <?php if ( is_object( $license ) ) : ?>
243 <!-- License Key -->
244 <tr <?php if ( 1 == $row_index % 2 ) {
245 echo ' class="alternate"';
246 } ?>>
247 <td>
248 <nobr><?php fs_esc_html_echo_inline( 'License Key', 'license-key', $slug ) ?>:</nobr>
249 </td>
250 <td>
251 <code><?php echo htmlspecialchars( substr( $license->secret_key, 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $license->secret_key, - 3 ) ) ?></code>
252 <input type="text" value="<?php echo htmlspecialchars( $license->secret_key ) ?>"
253 style="display: none" readonly/></td>
254 <td>
255 <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
256 <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 </td>
258 </tr>
259 <?php $row_index ++ ?>
260 <!--/ License Key -->
261
262 <?php if ( ! is_object( $main_license ) || $main_license->id != $license->id ) : ?>
263 <?php $subscription = $fs->_get_subscription( $license->id ) ?>
264 <?php if ( ! $license->is_lifetime() && is_object( $subscription ) ) : ?>
265 <!-- Subscription -->
266 <tr <?php if ( 1 == $row_index % 2 ) {
267 echo ' class="alternate"';
268 } ?>>
269 <td>
270 <nobr><?php fs_esc_html_echo_inline( 'Subscription', 'subscription', $slug ) ?>:</nobr>
271 </td>
272 <?php
273 $is_active_subscription = $subscription->is_active();
274
275 $renews_in_text = fs_text_inline( 'Auto renews in %s', 'renews-in', $slug );
276 /* translators: %s: Time period (e.g. Expires in "2 months") */
277 $expires_in_text = fs_text_inline( 'Expires in %s', 'expires-in', $slug );
278 ?>
279 <td>
280 <code><?php echo $subscription->id ?> - <?php
281 echo ( 12 == $subscription->billing_cycle ?
282 _fs_text_inline( 'Annual', 'annual', $slug ) :
283 _fs_text_inline( 'Monthly', 'monthly', $slug )
284 );
285 ?>
286 </code>
287 <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
288 <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $license->expiration ) ) ) ) ?></label>
289 <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
290 <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ) ?></label>
291 <?php endif ?>
292 </td>
293 <td><?php if ( $is_active_subscription ) : ?>
294 <?php
295 $downgrade_x_confirm_text = fs_text_inline( 'Downgrading your plan will immediately stop all future recurring payments and your %s plan license will expire in %s.', 'downgrade-x-confirm', $slug );
296 $after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s updates and support.', 'after-downgrade-non-blocking', $slug );
297 $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 );
298 $downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug );
299
300 $human_readable_license_expiration = human_time_diff( time(), strtotime( $license->expiration ) );
301 $downgrade_confirmation_message = sprintf(
302 $downgrade_x_confirm_text,
303 $plan->title,
304 $human_readable_license_expiration
305 );
306
307 $after_downgrade_message = ! $license->is_block_features ?
308 sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) :
309 sprintf( $after_downgrade_blocking_text, $plan->title );
310 ?>
311 <?php $action = 'downgrade_account' ?>
312 <form id="fs_downgrade" action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
313 <input type="hidden" name="fs_action" value="<?php echo $action ?>">
314 <?php wp_nonce_field( trim( "{$action}:{$blog_id}", ':' ) ) ?>
315 <input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
316 <button class="button button-small" onclick="if (confirm('<?php echo ( $downgrade_confirmation_message . ' ' . $after_downgrade_message ) ?>')) { this.parentNode.submit(); } else { return false; }"><?php echo $downgrade_text ?></button>
317 </form>
318 <?php endif ?></td>
319 </tr>
320 <?php $row_index ++ ?>
321 <?php endif ?>
322 <!--/ Subscription -->
323 <?php endif ?>
324 <?php endif ?>
325
326 </tbody>
327 </table>
328 </td>
329 </tr>
330 <!--/ More details -->
331 <?php endif ?>