| @@ -16,28 +16,21 @@ | ||
| 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 | - | |
| 23 | 20 | $has_any_active_clone = false; |
| 24 | 21 | |
| 25 | 22 | $is_multisite = is_multisite(); |
| 26 | - | |
| 27 | - $auto_off_timestamp = wp_next_scheduled( 'fs_debug_turn_off_logging_hook' ) * 1000; | |
| 28 | 23 | ?> |
| 29 | 24 | <h1><?php echo fs_text_inline( 'Freemius Debug' ) . ' - ' . fs_text_inline( 'SDK' ) . ' v.' . $fs_active_plugins->newest->version ?></h1> |
| 30 | 25 | <div> |
| 31 | 26 | <!-- Debugging Switch --> |
| 27 | + <?php //$debug_mode = get_option( 'fs_debug_mode', null ) ?> | |
| 32 | 28 | <span class="fs-switch-label"><?php fs_esc_html_echo_x_inline( 'Debugging', 'as code debugging' ) ?></span> |
| 33 | 29 | |
| 34 | 30 | <div class="fs-switch fs-round <?php echo WP_FS__DEBUG_SDK ? 'fs-on' : 'fs-off' ?>"> |
| 35 | 31 | <div class="fs-toggle"></div> |
| 36 | 32 | </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 | - | |
| 40 | 33 | <script type="text/javascript"> |
| 41 | 34 | (function ($) { |
| 42 | 35 | $(document).ready(function () { |
| 43 | 36 | // Switch toggle |
| @@ -45,22 +38,14 @@ | ||
| 45 | 38 | $( this ) |
| 46 | 39 | .toggleClass( 'fs-on' ) |
| 47 | 40 | .toggleClass( 'fs-off' ); |
| 48 | 41 | |
| 49 | - var is_on = ($(this).hasClass( 'fs-on' ) ? 1 : 0); | |
| 50 | - | |
| 51 | 42 | $.post( <?php echo Freemius::ajax_url() ?>, { |
| 52 | 43 | action: 'fs_toggle_debug_mode', |
| 53 | 44 | // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. |
| 54 | 45 | _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_toggle_debug_mode' ) ); ?>, |
| 55 | - is_on | |
| 56 | - }, function (response) { | |
| 57 | - if (is_on) { | |
| 58 | - startCountdownManually(); | |
| 59 | - } else { | |
| 60 | - stopCountdownManually(); | |
| 61 | - } | |
| 62 | - | |
| 46 | + is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0) | |
| 47 | + }, function ( response ) { | |
| 63 | 48 | if ( 1 == response ) { |
| 64 | 49 | // Refresh page on success. |
| 65 | 50 | location.reload(); |
| 66 | 51 | } |
| @@ -65,52 +50,8 @@ | ||
| 65 | 50 | location.reload(); |
| 66 | 51 | } |
| 67 | 52 | }); |
| 68 | 53 | }); |
| 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 | - | |
| 113 | 54 | }); |
| 114 | 55 | }(jQuery)); |
| 115 | 56 | </script> |
| 116 | 57 | </div> |
| @@ -257,19 +198,11 @@ | ||
| 257 | 198 | 'key' => 'WP_FS__DIR', |
| 258 | 199 | 'val' => WP_FS__DIR, |
| 259 | 200 | ), |
| 260 | 201 | array( |
| 261 | - 'key' => 'DISABLE_WP_CRON', | |
| 262 | - 'val' => defined( 'DISABLE_WP_CRON' ) ? ( DISABLE_WP_CRON ? 'true' : 'false' ) : 'Not defined', | |
| 263 | - ), | |
| 264 | - array( | |
| 265 | 202 | 'key' => 'wp_using_ext_object_cache()', |
| 266 | 203 | 'val' => wp_using_ext_object_cache() ? 'true' : 'false', |
| 267 | 204 | ), |
| 268 | - array( | |
| 269 | - 'key' => 'Freemius::get_unfiltered_site_url()', | |
| 270 | - 'val' => Freemius::get_unfiltered_site_url(), | |
| 271 | - ), | |
| 272 | 205 | ) |
| 273 | 206 | ?> |
| 274 | 207 | <br> |
| 275 | 208 | <table class="widefat"> |
| @@ -285,25 +218,16 @@ | ||
| 285 | 218 | <tr<?php if ( $alternate ) { |
| 286 | 219 | echo ' class="alternate"'; |
| 287 | 220 | } ?>> |
| 288 | 221 | <td><?php echo $p['key'] ?></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> | |
| 222 | + <td><?php echo $p['val'] ?></td> | |
| 294 | 223 | </tr> |
| 295 | 224 | <?php $alternate = ! $alternate ?> |
| 296 | 225 | <?php endforeach ?> |
| 297 | 226 | </tbody> |
| 298 | 227 | </table> |
| 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"> | |
| 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"> | |
| 306 | 230 | <thead> |
| 307 | 231 | <tr> |
| 308 | 232 | <th><?php fs_esc_html_echo_x_inline( 'Version', 'product version' ) ?></th> |
| 309 | 233 | <th><?php fs_esc_html_echo_inline( 'SDK Path' ) ?></th> |
| @@ -335,15 +259,10 @@ | ||
| 335 | 259 | <?php $active_modules_by_id = array() ?> |
| 336 | 260 | <?php foreach ( $module_types as $module_type ) : ?> |
| 337 | 261 | <?php $modules = fs_get_entities( $fs_options->get_option( $module_type . 's' ), FS_Plugin::get_class_name() ) ?> |
| 338 | 262 | <?php if ( is_array( $modules ) && count( $modules ) > 0 ) : ?> |
| 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"> | |
| 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"> | |
| 346 | 265 | <thead> |
| 347 | 266 | <tr> |
| 348 | 267 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 349 | 268 | <th><?php fs_esc_html_echo_inline( 'Slug' ) ?></th> |
| @@ -360,9 +279,8 @@ | ||
| 360 | 279 | <th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th> |
| 361 | 280 | </tr> |
| 362 | 281 | </thead> |
| 363 | 282 | <tbody> |
| 364 | - <?php $alternate = false; ?> | |
| 365 | 283 | <?php foreach ( $modules as $slug => $data ) : ?> |
| 366 | 284 | <?php |
| 367 | 285 | if ( WP_FS__MODULE_TYPE_THEME !== $module_type ) { |
| 368 | 286 | $is_active = is_plugin_active( $data->file ); |
| @@ -384,14 +302,14 @@ | ||
| 384 | 302 | |
| 385 | 303 | $active_modules_by_id[ $data->id ] = true; |
| 386 | 304 | } |
| 387 | 305 | ?> |
| 388 | - <tr<?php if ( $alternate ) { echo ' class="alternate" '; } ?><?php if ( $is_active ) { | |
| 306 | + <tr<?php if ( $is_active ) { | |
| 389 | 307 | $has_api_connectivity = $fs->has_api_connectivity(); |
| 390 | 308 | |
| 391 | 309 | if ( true === $has_api_connectivity && $fs->is_on() ) { |
| 392 | 310 | echo ' style="background: #E6FFE6; font-weight: bold"'; |
| 393 | - } else if ( false === $has_api_connectivity || ! $fs->is_on() ) { | |
| 311 | + } else { | |
| 394 | 312 | echo ' style="background: #ffd0d0; font-weight: bold"'; |
| 395 | 313 | } |
| 396 | 314 | } ?>> |
| 397 | 315 | <td><?php echo $data->id ?></td> |
| @@ -397,9 +315,9 @@ | ||
| 397 | 315 | <td><?php echo $data->id ?></td> |
| 398 | 316 | <td><?php echo $slug ?></td> |
| 399 | 317 | <td><?php echo $data->version ?></td> |
| 400 | 318 | <td><?php echo $data->title ?></td> |
| 401 | - <td<?php if ( $is_active && false === $has_api_connectivity ) { | |
| 319 | + <td<?php if ( $is_active && true !== $has_api_connectivity ) { | |
| 402 | 320 | echo ' style="color: red; text-transform: uppercase;"'; |
| 403 | 321 | } ?>><?php if ( $is_active ) { |
| 404 | 322 | echo esc_html( true === $has_api_connectivity ? |
| 405 | 323 | fs_text_x_inline( 'Connected', 'as connection was successful' ) : |
| @@ -404,9 +322,9 @@ | ||
| 404 | 322 | echo esc_html( true === $has_api_connectivity ? |
| 405 | 323 | fs_text_x_inline( 'Connected', 'as connection was successful' ) : |
| 406 | 324 | ( false === $has_api_connectivity ? |
| 407 | 325 | fs_text_x_inline( 'Blocked', 'as connection blocked' ) : |
| 408 | - fs_text_x_inline( 'No requests yet', 'API connectivity state is unknown' ) ) | |
| 326 | + fs_text_x_inline( 'Unknown', 'API connectivity state is unknown' ) ) | |
| 409 | 327 | ); |
| 410 | 328 | } ?></td> |
| 411 | 329 | <td<?php if ( $is_active && ! $fs->is_on() ) { |
| 412 | 330 | echo ' style="color: red; text-transform: uppercase;"'; |
| @@ -458,9 +376,8 @@ | ||
| 458 | 376 | <?php endif ?> |
| 459 | 377 | <?php endif ?> |
| 460 | 378 | </td> |
| 461 | 379 | </tr> |
| 462 | - <?php $alternate = ! $alternate ?> | |
| 463 | 380 | <?php endforeach ?> |
| 464 | 381 | </tbody> |
| 465 | 382 | </table> |
| 466 | 383 | <?php endif ?> |
| @@ -475,19 +392,14 @@ | ||
| 475 | 392 | |
| 476 | 393 | $all_plans = false; |
| 477 | 394 | ?> |
| 478 | 395 | <?php if ( is_array( $sites_map ) && count( $sites_map ) > 0 ) : ?> |
| 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( | |
| 396 | + <h2><?php echo esc_html( sprintf( | |
| 484 | 397 | /* translators: %s: 'plugin' or 'theme' */ |
| 485 | 398 | fs_text_inline( '%s Installs', 'module-installs' ), |
| 486 | 399 | ( WP_FS__MODULE_TYPE_PLUGIN === $module_type ? fs_text_inline( 'Plugin', 'plugin' ) : fs_text_inline( 'Theme', 'theme' ) ) |
| 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"> | |
| 400 | + ) ) ?> / <?php fs_esc_html_echo_x_inline( 'Sites', 'like websites', 'sites' ) ?></h2> | |
| 401 | + <table id="fs_<?php echo $module_type ?>_installs" class="widefat"> | |
| 490 | 402 | <thead> |
| 491 | 403 | <tr> |
| 492 | 404 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 493 | 405 | <?php if ( $is_multisite ) : ?> |
| @@ -595,15 +507,10 @@ | ||
| 595 | 507 | <?php |
| 596 | 508 | $addons = $VARS['addons']; |
| 597 | 509 | ?> |
| 598 | 510 | <?php foreach ( $addons as $plugin_id => $plugin_addons ) : ?> |
| 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"> | |
| 511 | + <h2><?php echo esc_html( sprintf( fs_text_inline( 'Add Ons of module %s', 'addons-of-x' ), $plugin_id ) ) ?></h2> | |
| 512 | + <table id="fs_addons" class="widefat"> | |
| 606 | 513 | <thead> |
| 607 | 514 | <tr> |
| 608 | 515 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 609 | 516 | <th><?php fs_esc_html_echo_inline( 'Title' ) ?></th> |
| @@ -659,15 +566,10 @@ | ||
| 659 | 566 | } |
| 660 | 567 | |
| 661 | 568 | ?> |
| 662 | 569 | <?php if ( is_array( $users ) && 0 < count( $users ) ) : ?> |
| 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"> | |
| 570 | + <h2><?php fs_esc_html_echo_inline( 'Users' ) ?></h2> | |
| 571 | + <table id="fs_users" class="widefat"> | |
| 670 | 572 | <thead> |
| 671 | 573 | <tr> |
| 672 | 574 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 673 | 575 | <th><?php fs_esc_html_echo_inline( 'Name' ) ?></th> |
| @@ -713,15 +615,10 @@ | ||
| 713 | 615 | * @var FS_Plugin_License[] $licenses |
| 714 | 616 | */ |
| 715 | 617 | $licenses = $VARS[ $module_type . '_licenses' ] ?> |
| 716 | 618 | <?php if ( is_array( $licenses ) && count( $licenses ) > 0 ) : ?> |
| 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"> | |
| 619 | + <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> | |
| 620 | + <table id="fs_<?php echo $module_type ?>_licenses" class="widefat"> | |
| 724 | 621 | <thead> |
| 725 | 622 | <tr> |
| 726 | 623 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 727 | 624 | <th><?php fs_esc_html_echo_inline( 'Plugin ID' ) ?></th> |
| @@ -757,12 +654,8 @@ | ||
| 757 | 654 | </tbody> |
| 758 | 655 | </table> |
| 759 | 656 | <?php endif ?> |
| 760 | 657 | <?php endforeach ?> |
| 761 | -<?php | |
| 762 | - $page_params = array( 'is_fs_debug_page' => true ); | |
| 763 | - fs_require_template( 'debug/scheduled-crons.php', $page_params ); | |
| 764 | -?> | |
| 765 | 658 | <?php if ( FS_Logger::is_storage_logging_on() ) : ?> |
| 766 | 659 | |
| 767 | 660 | <h2><?php fs_esc_html_echo_inline( 'Debug Log', 'debug-log' ) ?></h2> |
| 768 | 661 | |
| @@ -935,25 +828,4 @@ | ||
| 935 | 828 | loadLogs(); |
| 936 | 829 | }); |
| 937 | 830 | </script> |
| 938 | 831 | <?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> | |