PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 3.1.4
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v3.1.4
4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 2.6.1 All 38 releases
← All changes | freemius/templates/debug.php +94 -22 1.2.33.1.4 View file →
@@ -15,8 +15,12 @@
15 15 $fs_options = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
16 16
17 17 $off_text = fs_text_x_inline( 'Off', 'as turned off' );
18 18 $on_text = fs_text_x_inline( 'On', 'as turned on' );
19 +
20 + $has_any_active_clone = false;
21 +
22 + $is_multisite = is_multisite();
19 23 ?>
20 24 <h1><?php echo fs_text_inline( 'Freemius Debug' ) . ' - ' . fs_text_inline( 'SDK' ) . ' v.' . $fs_active_plugins->newest->version ?></h1>
21 25 <div>
22 26 <!-- Debugging Switch -->
@@ -34,10 +38,12 @@
34 38 $( this )
35 39 .toggleClass( 'fs-on' )
36 40 .toggleClass( 'fs-off' );
37 41
38 - $.post( ajaxurl, {
42 + $.post( <?php echo Freemius::ajax_url() ?>, {
39 43 action: 'fs_toggle_debug_mode',
44 + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
45 + _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_toggle_debug_mode' ) ); ?>,
40 46 is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0)
41 47 }, function ( response ) {
42 48 if ( 1 == response ) {
43 49 // Refresh page on success.
@@ -76,9 +82,19 @@
76 82 <?php wp_nonce_field( 'clear_updates_data' ) ?>
77 83 <button class="button"><?php fs_esc_html_echo_inline( 'Clear Updates Transients' ) ?></button>
78 84 </form>
79 85 </td>
86 + <?php if ( Freemius::is_deactivation_snoozed() ) : ?>
80 87 <td>
88 + <!-- Reset Deactivation Snoozing -->
89 + <form action="" method="POST">
90 + <input type="hidden" name="fs_action" value="reset_deactivation_snoozing">
91 + <?php wp_nonce_field( 'reset_deactivation_snoozing' ) ?>
92 + <button class="button"><?php fs_esc_html_echo_inline( 'Reset Deactivation Snoozing' ) ?> (Expires in <?php echo ( Freemius::deactivation_snooze_expires_at() - time() ) ?> sec)</button>
93 + </form>
94 + </td>
95 + <?php endif ?>
96 + <td>
81 97 <!-- Sync Data with Server -->
82 98 <form action="" method="POST">
83 99 <input type="hidden" name="background_sync" value="true">
84 100 <button class="button button-primary"><?php fs_esc_html_echo_inline( 'Sync Data From Server' ) ?></button>
@@ -99,8 +115,17 @@
99 115 </td>
100 116 <td>
101 117 <button id="fs_set_db_option" class="button"><?php fs_esc_html_echo_inline( 'Set DB Option' ) ?></button>
102 118 </td>
119 + <td>
120 + <?php
121 + $fs_debug_page_url = 'admin.php?page=freemius&fs_action=allow_clone_resolution_notice';
122 + $fs_debug_page_url = fs_is_network_admin() ?
123 + network_admin_url( $fs_debug_page_url ) :
124 + admin_url( $fs_debug_page_url );
125 + ?>
126 + <a href="<?php echo wp_nonce_url( $fs_debug_page_url, 'fs_allow_clone_resolution_notice' ) ?>" class="button button-primary">Resolve Clone(s)</a>
127 + </td>
103 128 </tr>
104 129 </tbody>
105 130 </table>
106 131 <script type="text/javascript">
@@ -108,11 +133,12 @@
108 133 $('#fs_load_db_option').click(function () {
109 134 var optionName = prompt('Please enter the option name:');
110 135
111 136 if (optionName) {
112 - $.post(ajaxurl, {
137 + $.post(<?php echo Freemius::ajax_url() ?>, {
113 138 action : 'fs_get_db_option',
114 - _wpnonce : '<?php echo wp_create_nonce( 'fs_get_db_option' ) ?>',
139 + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
140 + _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_get_db_option' ) ); ?>,
115 141 option_name: optionName
116 142 }, function (response) {
117 143 if (response.data.value)
118 144 prompt('The option value is:', response.data.value);
@@ -128,11 +154,12 @@
128 154 if (optionName) {
129 155 var optionValue = prompt('Please enter the option value:');
130 156
131 157 if (optionValue) {
132 - $.post(ajaxurl, {
158 + $.post(<?php echo Freemius::ajax_url() ?>, {
133 159 action : 'fs_set_db_option',
134 - _wpnonce : '<?php echo wp_create_nonce( 'fs_set_db_option' ) ?>',
160 + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
161 + _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_set_db_option' ) ); ?>,
135 162 option_name : optionName,
136 163 option_value: optionValue
137 164 }, function () {
138 165 alert('Option was successfully set.');
@@ -170,8 +197,12 @@
170 197 array(
171 198 'key' => 'WP_FS__DIR',
172 199 'val' => WP_FS__DIR,
173 200 ),
201 + array(
202 + 'key' => 'wp_using_ext_object_cache()',
203 + 'val' => wp_using_ext_object_cache() ? 'true' : 'false',
204 + ),
174 205 )
175 206 ?>
176 207 <br>
177 208 <table class="widefat">
@@ -224,9 +255,9 @@
224 255 WP_FS__MODULE_TYPE_PLUGIN,
225 256 WP_FS__MODULE_TYPE_THEME
226 257 );
227 258 ?>
228 -
259 +<?php $active_modules_by_id = array() ?>
229 260 <?php foreach ( $module_types as $module_type ) : ?>
230 261 <?php $modules = fs_get_entities( $fs_options->get_option( $module_type . 's' ), FS_Plugin::get_class_name() ) ?>
231 262 <?php if ( is_array( $modules ) && count( $modules ) > 0 ) : ?>
232 263 <h2><?php echo esc_html( ( WP_FS__MODULE_TYPE_PLUGIN == $module_type ) ? fs_text_inline( 'Plugins', 'plugins' ) : fs_text_inline( 'Themes', 'themes' ) ) ?></h2>
@@ -240,9 +271,9 @@
240 271 <th><?php fs_esc_html_echo_x_inline( 'API', 'as application program interface' ) ?></th>
241 272 <th><?php fs_esc_html_echo_inline( 'Freemius State' ) ?></th>
242 273 <th><?php fs_esc_html_echo_inline( 'Module Path' ) ?></th>
243 274 <th><?php fs_esc_html_echo_inline( 'Public Key' ) ?></th>
244 - <?php if ( is_multisite() ) : ?>
275 + <?php if ( $is_multisite ) : ?>
245 276 <th><?php fs_esc_html_echo_inline( 'Network Blog' ) ?></th>
246 277 <th><?php fs_esc_html_echo_inline( 'Network User' ) ?></th>
247 278 <?php endif ?>
248 279 <th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th>
@@ -263,11 +294,20 @@
263 294 $is_active = ( ( $parent_theme instanceof WP_Theme ) && $parent_theme->stylesheet === $data->file );
264 295 }
265 296 }
266 297 ?>
267 - <?php $fs = $is_active ? freemius( $data->id ) : null ?>
298 + <?php
299 + $fs = null;
300 + if ( $is_active ) {
301 + $fs = freemius( $data->id );
302 +
303 + $active_modules_by_id[ $data->id ] = true;
304 + }
305 + ?>
268 306 <tr<?php if ( $is_active ) {
269 - if ( $fs->has_api_connectivity() && $fs->is_on() ) {
307 + $has_api_connectivity = $fs->has_api_connectivity();
308 +
309 + if ( true === $has_api_connectivity && $fs->is_on() ) {
270 310 echo ' style="background: #E6FFE6; font-weight: bold"';
271 311 } else {
272 312 echo ' style="background: #ffd0d0; font-weight: bold"';
273 313 }
@@ -275,14 +315,16 @@
275 315 <td><?php echo $data->id ?></td>
276 316 <td><?php echo $slug ?></td>
277 317 <td><?php echo $data->version ?></td>
278 318 <td><?php echo $data->title ?></td>
279 - <td<?php if ( $is_active && ! $fs->has_api_connectivity() ) {
319 + <td<?php if ( $is_active && true !== $has_api_connectivity ) {
280 320 echo ' style="color: red; text-transform: uppercase;"';
281 321 } ?>><?php if ( $is_active ) {
282 - echo esc_html( $fs->has_api_connectivity() ?
322 + echo esc_html( true === $has_api_connectivity ?
283 323 fs_text_x_inline( 'Connected', 'as connection was successful' ) :
284 - fs_text_x_inline( 'Blocked', 'as connection blocked' )
324 + ( false === $has_api_connectivity ?
325 + fs_text_x_inline( 'Blocked', 'as connection blocked' ) :
326 + fs_text_x_inline( 'Unknown', 'API connectivity state is unknown' ) )
285 327 );
286 328 } ?></td>
287 329 <td<?php if ( $is_active && ! $fs->is_on() ) {
288 330 echo ' style="color: red; text-transform: uppercase;"';
@@ -293,9 +335,9 @@
293 335 );
294 336 } ?></td>
295 337 <td><?php echo $data->file ?></td>
296 338 <td><?php echo $data->public_key ?></td>
297 - <?php if ( is_multisite() ) : ?>
339 + <?php if ( $is_multisite ) : ?>
298 340 <?php
299 341 $network_blog_id = null;
300 342 $network_user = null;
301 343
@@ -347,10 +389,9 @@
347 389 * @var array[string]FS_Site|array[string]FS_Site[] $sites_map
348 390 */
349 391 $sites_map = $VARS[ $module_type . '_sites' ];
350 392
351 - $is_multisite = is_multisite();
352 - $all_plans = false;
393 + $all_plans = false;
353 394 ?>
354 395 <?php if ( is_array( $sites_map ) && count( $sites_map ) > 0 ) : ?>
355 396 <h2><?php echo esc_html( sprintf(
356 397 /* translators: %s: 'plugin' or 'theme' */
@@ -374,17 +415,39 @@
374 415 <th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th>
375 416 </tr>
376 417 </thead>
377 418 <tbody>
419 + <?php $site_url = null ?>
378 420 <?php foreach ( $sites_map as $slug => $sites ) : ?>
379 - <?php if ( ! is_array( $sites ) ) {
380 - $sites = array( $sites );
381 - } ?>
382 421 <?php foreach ( $sites as $site ) : ?>
422 + <?php
423 + $blog_id = $is_multisite ?
424 + $site->blog_id :
425 + null;
426 +
427 + if ( is_null( $site_url ) || $is_multisite ) {
428 + $site_url = Freemius::get_unfiltered_site_url(
429 + $blog_id,
430 + true,
431 + true
432 + );
433 + }
434 +
435 + $is_active_clone = ( $site->is_clone( $site_url ) && isset( $active_modules_by_id[ $site->plugin_id ] ) );
436 +
437 + if ( $is_active_clone ) {
438 + $has_any_active_clone = true;
439 + }
440 + ?>
383 441 <tr>
384 - <td><?php echo $site->id ?></td>
442 + <td>
443 + <?php echo $site->id ?>
444 + <?php if ( $is_active_clone ) : ?>
445 + <label class="fs-tag fs-warn">Clone</label>
446 + <?php endif ?>
447 + </td>
385 448 <?php if ( $is_multisite ) : ?>
386 - <td><?php echo $site->blog_id ?></td>
449 + <td><?php echo $blog_id ?></td>
387 450 <td><?php echo fs_strip_url_protocol( $site->url ) ?></td>
388 451 <?php endif ?>
389 452 <td><?php echo $slug ?></td>
390 453 <td><?php echo $site->user_id ?></td>
@@ -479,10 +542,17 @@
479 542 /**
480 543 * @var FS_User[] $users
481 544 */
482 545 $users = $VARS['users'];
546 + $user_ids_map = array();
483 547 $users_with_developer_license_by_id = array();
484 548
549 + if ( is_array( $users ) && ! empty( $users ) ) {
550 + foreach ( $users as $user ) {
551 + $user_ids_map[ $user->id ] = true;
552 + }
553 + }
554 +
485 555 foreach ( $module_types as $module_type ) {
486 556 /**
487 557 * @var FS_Plugin_License[] $licenses
488 558 */
@@ -573,9 +643,9 @@
573 643 <td><?php echo $license->activated ?></td>
574 644 <td><?php echo $license->is_block_features ? 'Blocking' : 'Flexible' ?></td>
575 645 <td><?php echo $license->is_whitelabeled ? 'Whitelabeled' : 'Normal' ?></td>
576 646 <td><?php
577 - echo $license->is_whitelabeled ?
647 + echo ( $license->is_whitelabeled || ! isset( $user_ids_map[ $license->user_id ] ) ) ?
578 648 $license->get_html_escaped_masked_secret_key() :
579 649 esc_html( $license->secret_key );
580 650 ?></td>
581 651 <td><?php echo $license->expiration ?></td>
@@ -721,10 +791,12 @@
721 791
722 792 offset = 0;
723 793 }
724 794
725 - $.post(ajaxurl, {
795 + $.post(<?php echo Freemius::ajax_url() ?>, {
726 796 action : 'fs_get_debug_log',
797 + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
798 + _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_get_debug_log' ) ); ?>,
727 799 filters: filters,
728 800 offset : offset,
729 801 limit : limit
730 802 }, function (response) {