PluginProbe
Passster – Password Protect Pages and Content / 4.3.16
Passster – Password Protect Pages and Content v4.3.16
4.3.16 4.3.15 4.3.14 4.3.12 4.3.13 4.3.11 4.3.10 4.3.9 4.3.8 4.3.7 4.3.6 4.3.5 trunk 3.5.4 3.5.5.2 3.5.5.8 3.5.5.9 4.0 4.1.4 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.15 All 48 releases
← All changes | inc/freemius/templates/debug.php +155 -23 4.04.3.16 View file →
@@ -16,21 +16,28 @@
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 19
20 + // For some reason css was missing
21 + fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
22 +
20 23 $has_any_active_clone = false;
21 24
22 25 $is_multisite = is_multisite();
26 +
27 + $auto_off_timestamp = wp_next_scheduled( 'fs_debug_turn_off_logging_hook' ) * 1000;
23 28 ?>
24 29 <h1><?php echo fs_text_inline( 'Freemius Debug' ) . ' - ' . fs_text_inline( 'SDK' ) . ' v.' . $fs_active_plugins->newest->version ?></h1>
25 30 <div>
26 31 <!-- Debugging Switch -->
27 - <?php //$debug_mode = get_option( 'fs_debug_mode', null ) ?>
28 32 <span class="fs-switch-label"><?php fs_esc_html_echo_x_inline( 'Debugging', 'as code debugging' ) ?></span>
29 33
30 34 <div class="fs-switch fs-round <?php echo WP_FS__DEBUG_SDK ? 'fs-on' : 'fs-off' ?>">
31 35 <div class="fs-toggle"></div>
32 36 </div>
37 +
38 + <span class="auto-off-debug-countdown hidden"><?php echo fs_esc_html_echo_x_inline( 'Auto off in:', 'timer for auto-disabling debug' ); ?> <span class="time">23:59:59</span>
39 +
33 40 <script type="text/javascript">
34 41 (function ($) {
35 42 $(document).ready(function () {
36 43 // Switch toggle
@@ -38,14 +45,22 @@
38 45 $( this )
39 46 .toggleClass( 'fs-on' )
40 47 .toggleClass( 'fs-off' );
41 48
49 + var is_on = ($(this).hasClass( 'fs-on' ) ? 1 : 0);
50 +
42 51 $.post( <?php echo Freemius::ajax_url() ?>, {
43 52 action: 'fs_toggle_debug_mode',
44 53 // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
45 54 _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_toggle_debug_mode' ) ); ?>,
46 - is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0)
47 - }, function ( response ) {
55 + is_on
56 + }, function (response) {
57 + if (is_on) {
58 + startCountdownManually();
59 + } else {
60 + stopCountdownManually();
61 + }
62 +
48 63 if ( 1 == response ) {
49 64 // Refresh page on success.
50 65 location.reload();
51 66 }
@@ -50,8 +65,52 @@
50 65 location.reload();
51 66 }
52 67 });
53 68 });
69 +
70 + // Countdown
71 + var countdownElement = document.querySelector('.auto-off-debug-countdown');
72 + var timeElement = countdownElement.querySelector('.time');
73 + var targetTime = <?php echo wp_json_encode( $auto_off_timestamp ); ?>;
74 + var countdownTimeout;
75 +
76 + function updateCountdown() {
77 + var currentTime = new Date().getTime();
78 + var remainingTimeInMs = targetTime - currentTime;
79 + var hours = Math.floor((remainingTimeInMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
80 + var minutes = Math.floor((remainingTimeInMs % (1000 * 60 * 60)) / (1000 * 60));
81 + var seconds = Math.floor((remainingTimeInMs % (1000 * 60)) / 1000);
82 +
83 +
84 + if (remainingTimeInMs < 1000) {
85 + countdownElement.classList.add('hidden');
86 + countdownTimeout = null;
87 + } else {
88 + timeElement.innerHTML = hours + ":"
89 + + minutes.toString().padStart(2, '0') + ":"
90 + + seconds.toString().padStart(2, '0');
91 + countdownElement.classList.remove('hidden');
92 +
93 + if (countdownTimeout) {
94 + clearTimeout(countdownTimeout);
95 + }
96 + countdownTimeout = setTimeout(updateCountdown, 1000);
97 + }
98 + }
99 +
100 + function startCountdownManually() {
101 + targetTime = ( new Date().getTime() ) + (24 * 60 * 60 * 1000) - 1;
102 + updateCountdown();
103 + }
104 +
105 + function stopCountdownManually() {
106 + targetTime = new Date().getTime();
107 + updateCountdown();
108 + }
109 +
110 + updateCountdown();
111 + // End countdown
112 +
54 113 });
55 114 }(jQuery));
56 115 </script>
57 116 </div>
@@ -198,11 +257,19 @@
198 257 'key' => 'WP_FS__DIR',
199 258 'val' => WP_FS__DIR,
200 259 ),
201 260 array(
261 + 'key' => 'DISABLE_WP_CRON',
262 + 'val' => defined( 'DISABLE_WP_CRON' ) ? ( DISABLE_WP_CRON ? 'true' : 'false' ) : 'Not defined',
263 + ),
264 + array(
202 265 'key' => 'wp_using_ext_object_cache()',
203 266 'val' => wp_using_ext_object_cache() ? 'true' : 'false',
204 267 ),
268 + array(
269 + 'key' => 'Freemius::get_unfiltered_site_url()',
270 + 'val' => Freemius::get_unfiltered_site_url(),
271 + ),
205 272 )
206 273 ?>
207 274 <br>
208 275 <table class="widefat">
@@ -218,16 +285,25 @@
218 285 <tr<?php if ( $alternate ) {
219 286 echo ' class="alternate"';
220 287 } ?>>
221 288 <td><?php echo $p['key'] ?></td>
222 - <td><?php echo $p['val'] ?></td>
289 + <td><?php echo $p['val'] ?><?php
290 + if ( 'DISABLE_WP_CRON' === $p['key'] && 'true' === $p['val'] ) {
291 + echo '<p><small><strong>Freemius SDK’s sync cron jobs will not run unless an alternative server-side cron is set up.</strong></small></p>';
292 + }
293 + ?></td>
223 294 </tr>
224 295 <?php $alternate = ! $alternate ?>
225 296 <?php endforeach ?>
226 297 </tbody>
227 298 </table>
228 -<h2><?php fs_esc_html_echo_x_inline( 'SDK Versions', 'as software development kit versions', 'sdk-versions' ) ?></h2>
229 -<table id="fs_sdks" class="widefat">
299 +<h2>
300 + <button class="fs-debug-table-toggle-button" aria-expanded="true">
301 + <span class="fs-debug-table-toggle-icon">▼</span>
302 + </button>
303 + <?php fs_esc_html_echo_x_inline( 'SDK Versions', 'as software development kit versions', 'sdk-versions' ) ?>
304 +</h2>
305 +<table id="fs_sdks" class="widefat fs-debug-table">
230 306 <thead>
231 307 <tr>
232 308 <th><?php fs_esc_html_echo_x_inline( 'Version', 'product version' ) ?></th>
233 309 <th><?php fs_esc_html_echo_inline( 'SDK Path' ) ?></th>
@@ -259,10 +335,15 @@
259 335 <?php $active_modules_by_id = array() ?>
260 336 <?php foreach ( $module_types as $module_type ) : ?>
261 337 <?php $modules = fs_get_entities( $fs_options->get_option( $module_type . 's' ), FS_Plugin::get_class_name() ) ?>
262 338 <?php if ( is_array( $modules ) && count( $modules ) > 0 ) : ?>
263 - <h2><?php echo esc_html( ( WP_FS__MODULE_TYPE_PLUGIN == $module_type ) ? fs_text_inline( 'Plugins', 'plugins' ) : fs_text_inline( 'Themes', 'themes' ) ) ?></h2>
264 - <table id="fs_<?php echo $module_type ?>" class="widefat">
339 + <h2>
340 + <button class="fs-debug-table-toggle-button" aria-expanded="true">
341 + <span class="fs-debug-table-toggle-icon">▼</span>
342 + </button>
343 + <?php echo esc_html( ( WP_FS__MODULE_TYPE_PLUGIN == $module_type ) ? fs_text_inline( 'Plugins', 'plugins' ) : fs_text_inline( 'Themes', 'themes' ) ) ?>
344 + </h2>
345 + <table id="fs_<?php echo $module_type ?>" class="widefat fs-debug-table">
265 346 <thead>
266 347 <tr>
267 348 <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
268 349 <th><?php fs_esc_html_echo_inline( 'Slug' ) ?></th>
@@ -279,8 +360,9 @@
279 360 <th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th>
280 361 </tr>
281 362 </thead>
282 363 <tbody>
364 + <?php $alternate = false; ?>
283 365 <?php foreach ( $modules as $slug => $data ) : ?>
284 366 <?php
285 367 if ( WP_FS__MODULE_TYPE_THEME !== $module_type ) {
286 368 $is_active = is_plugin_active( $data->file );
@@ -302,12 +384,14 @@
302 384
303 385 $active_modules_by_id[ $data->id ] = true;
304 386 }
305 387 ?>
306 - <tr<?php if ( $is_active ) {
307 - if ( $fs->has_api_connectivity() && $fs->is_on() ) {
388 + <tr<?php if ( $alternate ) { echo ' class="alternate" '; } ?><?php if ( $is_active ) {
389 + $has_api_connectivity = $fs->has_api_connectivity();
390 +
391 + if ( true === $has_api_connectivity && $fs->is_on() ) {
308 392 echo ' style="background: #E6FFE6; font-weight: bold"';
309 - } else {
393 + } else if ( false === $has_api_connectivity || ! $fs->is_on() ) {
310 394 echo ' style="background: #ffd0d0; font-weight: bold"';
311 395 }
312 396 } ?>>
313 397 <td><?php echo $data->id ?></td>
@@ -313,14 +397,16 @@
313 397 <td><?php echo $data->id ?></td>
314 398 <td><?php echo $slug ?></td>
315 399 <td><?php echo $data->version ?></td>
316 400 <td><?php echo $data->title ?></td>
317 - <td<?php if ( $is_active && ! $fs->has_api_connectivity() ) {
401 + <td<?php if ( $is_active && false === $has_api_connectivity ) {
318 402 echo ' style="color: red; text-transform: uppercase;"';
319 403 } ?>><?php if ( $is_active ) {
320 - echo esc_html( $fs->has_api_connectivity() ?
404 + echo esc_html( true === $has_api_connectivity ?
321 405 fs_text_x_inline( 'Connected', 'as connection was successful' ) :
322 - fs_text_x_inline( 'Blocked', 'as connection blocked' )
406 + ( false === $has_api_connectivity ?
407 + fs_text_x_inline( 'Blocked', 'as connection blocked' ) :
408 + fs_text_x_inline( 'No requests yet', 'API connectivity state is unknown' ) )
323 409 );
324 410 } ?></td>
325 411 <td<?php if ( $is_active && ! $fs->is_on() ) {
326 412 echo ' style="color: red; text-transform: uppercase;"';
@@ -372,8 +458,9 @@
372 458 <?php endif ?>
373 459 <?php endif ?>
374 460 </td>
375 461 </tr>
462 + <?php $alternate = ! $alternate ?>
376 463 <?php endforeach ?>
377 464 </tbody>
378 465 </table>
379 466 <?php endif ?>
@@ -388,14 +475,19 @@
388 475
389 476 $all_plans = false;
390 477 ?>
391 478 <?php if ( is_array( $sites_map ) && count( $sites_map ) > 0 ) : ?>
392 - <h2><?php echo esc_html( sprintf(
479 + <h2>
480 + <button class="fs-debug-table-toggle-button" aria-expanded="true">
481 + <span class="fs-debug-table-toggle-icon">▼</span>
482 + </button>
483 + <?php echo esc_html( sprintf(
393 484 /* translators: %s: 'plugin' or 'theme' */
394 485 fs_text_inline( '%s Installs', 'module-installs' ),
395 486 ( WP_FS__MODULE_TYPE_PLUGIN === $module_type ? fs_text_inline( 'Plugin', 'plugin' ) : fs_text_inline( 'Theme', 'theme' ) )
396 - ) ) ?> / <?php fs_esc_html_echo_x_inline( 'Sites', 'like websites', 'sites' ) ?></h2>
397 - <table id="fs_<?php echo $module_type ?>_installs" class="widefat">
487 + ) ) ?> / <?php fs_esc_html_echo_x_inline( 'Sites', 'like websites', 'sites' ) ?>
488 + </h2>
489 + <table id="fs_<?php echo $module_type ?>_installs" class="widefat fs-debug-table">
398 490 <thead>
399 491 <tr>
400 492 <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
401 493 <?php if ( $is_multisite ) : ?>
@@ -503,10 +595,15 @@
503 595 <?php
504 596 $addons = $VARS['addons'];
505 597 ?>
506 598 <?php foreach ( $addons as $plugin_id => $plugin_addons ) : ?>
507 - <h2><?php echo esc_html( sprintf( fs_text_inline( 'Add Ons of module %s', 'addons-of-x' ), $plugin_id ) ) ?></h2>
508 - <table id="fs_addons" class="widefat">
599 + <h2>
600 + <button class="fs-debug-table-toggle-button" aria-expanded="true">
601 + <span class="fs-debug-table-toggle-icon">▼</span>
602 + </button>
603 + <?php echo esc_html( sprintf( fs_text_inline( 'Add Ons of module %s', 'addons-of-x' ), $plugin_id ) ) ?>
604 + </h2>
605 + <table id="fs_addons" class="widefat fs-debug-table">
509 606 <thead>
510 607 <tr>
511 608 <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
512 609 <th><?php fs_esc_html_echo_inline( 'Title' ) ?></th>
@@ -562,10 +659,15 @@
562 659 }
563 660
564 661 ?>
565 662 <?php if ( is_array( $users ) && 0 < count( $users ) ) : ?>
566 - <h2><?php fs_esc_html_echo_inline( 'Users' ) ?></h2>
567 - <table id="fs_users" class="widefat">
663 + <h2>
664 + <button class="fs-debug-table-toggle-button" aria-expanded="true">
665 + <span class="fs-debug-table-toggle-icon">▼</span>
666 + </button>
667 + <?php fs_esc_html_echo_inline( 'Users' ) ?>
668 + </h2>
669 + <table id="fs_users" class="widefat fs-debug-table">
568 670 <thead>
569 671 <tr>
570 672 <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
571 673 <th><?php fs_esc_html_echo_inline( 'Name' ) ?></th>
@@ -611,10 +713,15 @@
611 713 * @var FS_Plugin_License[] $licenses
612 714 */
613 715 $licenses = $VARS[ $module_type . '_licenses' ] ?>
614 716 <?php if ( is_array( $licenses ) && count( $licenses ) > 0 ) : ?>
615 - <h2><?php echo esc_html( sprintf( fs_text_inline( '%s Licenses', 'module-licenses' ), ( WP_FS__MODULE_TYPE_PLUGIN === $module_type ? fs_text_inline( 'Plugin', 'plugin' ) : fs_text_inline( 'Theme', 'theme' ) ) ) ) ?></h2>
616 - <table id="fs_<?php echo $module_type ?>_licenses" class="widefat">
717 + <h2>
718 + <button class="fs-debug-table-toggle-button" aria-expanded="true">
719 + <span class="fs-debug-table-toggle-icon">▼</span>
720 + </button>
721 + <?php echo esc_html( sprintf( fs_text_inline( '%s Licenses', 'module-licenses' ), ( WP_FS__MODULE_TYPE_PLUGIN === $module_type ? fs_text_inline( 'Plugin', 'plugin' ) : fs_text_inline( 'Theme', 'theme' ) ) ) ) ?>
722 + </h2>
723 + <table id="fs_<?php echo $module_type ?>_licenses" class="widefat fs-debug-table">
617 724 <thead>
618 725 <tr>
619 726 <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
620 727 <th><?php fs_esc_html_echo_inline( 'Plugin ID' ) ?></th>
@@ -650,8 +757,12 @@
650 757 </tbody>
651 758 </table>
652 759 <?php endif ?>
653 760 <?php endforeach ?>
761 +<?php
762 + $page_params = array( 'is_fs_debug_page' => true );
763 + fs_require_template( 'debug/scheduled-crons.php', $page_params );
764 +?>
654 765 <?php if ( FS_Logger::is_storage_logging_on() ) : ?>
655 766
656 767 <h2><?php fs_esc_html_echo_inline( 'Debug Log', 'debug-log' ) ?></h2>
657 768
@@ -824,4 +935,25 @@
824 935 loadLogs();
825 936 });
826 937 </script>
827 938 <?php endif ?>
939 +<script type="text/javascript">
940 + // JavaScript to toggle the visibility of the table body and change the caret icon
941 + jQuery( document ).ready( function ( $ ) {
942 + $( '.fs-debug-table-toggle-button' ).on( 'click', function () {
943 + const button = $( this );
944 + const table = button.closest( 'h2' ).next( 'table' );
945 + const isExpanded = ( 'false' === button.attr( 'aria-expanded' ) );
946 +
947 + button.attr( 'aria-expanded', isExpanded );
948 + button.find( '.fs-debug-table-toggle-icon' ).text( isExpanded ? '▼' : '▶' );
949 +
950 + table.css( {
951 + display : isExpanded ? 'table' : 'block',
952 + borderBottomWidth: isExpanded ? '1px' : '0',
953 + maxHeight : isExpanded ? 'auto' : '0',
954 + } );
955 + } );
956 +
957 + $( '.fs-debug-table-toggle-button:last' ).click();
958 + } );
959 +</script>