| @@ -15,29 +15,18 @@ | ||
| 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 | - // For some reason css was missing | |
| 21 | - fs_enqueue_local_style( 'fs_common', '/admin/common.css' ); | |
| 22 | - | |
| 23 | - $has_any_active_clone = false; | |
| 24 | - | |
| 25 | - $is_multisite = is_multisite(); | |
| 26 | - | |
| 27 | - $auto_off_timestamp = wp_next_scheduled( 'fs_debug_turn_off_logging_hook' ) * 1000; | |
| 28 | 19 | ?> |
| 29 | 20 | <h1><?php echo fs_text_inline( 'Freemius Debug' ) . ' - ' . fs_text_inline( 'SDK' ) . ' v.' . $fs_active_plugins->newest->version ?></h1> |
| 30 | 21 | <div> |
| 31 | 22 | <!-- Debugging Switch --> |
| 23 | + <?php //$debug_mode = get_option( 'fs_debug_mode', null ) ?> | |
| 32 | 24 | <span class="fs-switch-label"><?php fs_esc_html_echo_x_inline( 'Debugging', 'as code debugging' ) ?></span> |
| 33 | 25 | |
| 34 | 26 | <div class="fs-switch fs-round <?php echo WP_FS__DEBUG_SDK ? 'fs-on' : 'fs-off' ?>"> |
| 35 | 27 | <div class="fs-toggle"></div> |
| 36 | 28 | </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 | 29 | <script type="text/javascript"> |
| 41 | 30 | (function ($) { |
| 42 | 31 | $(document).ready(function () { |
| 43 | 32 | // Switch toggle |
| @@ -45,22 +34,12 @@ | ||
| 45 | 34 | $( this ) |
| 46 | 35 | .toggleClass( 'fs-on' ) |
| 47 | 36 | .toggleClass( 'fs-off' ); |
| 48 | 37 | |
| 49 | - var is_on = ($(this).hasClass( 'fs-on' ) ? 1 : 0); | |
| 50 | - | |
| 51 | - $.post( <?php echo Freemius::ajax_url() ?>, { | |
| 38 | + $.post( ajaxurl, { | |
| 52 | 39 | action: 'fs_toggle_debug_mode', |
| 53 | - // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. | |
| 54 | - _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 | - | |
| 40 | + is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0) | |
| 41 | + }, function ( response ) { | |
| 63 | 42 | if ( 1 == response ) { |
| 64 | 43 | // Refresh page on success. |
| 65 | 44 | location.reload(); |
| 66 | 45 | } |
| @@ -65,52 +44,8 @@ | ||
| 65 | 44 | location.reload(); |
| 66 | 45 | } |
| 67 | 46 | }); |
| 68 | 47 | }); |
| 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 | 48 | }); |
| 114 | 49 | }(jQuery)); |
| 115 | 50 | </script> |
| 116 | 51 | </div> |
| @@ -141,19 +76,9 @@ | ||
| 141 | 76 | <?php wp_nonce_field( 'clear_updates_data' ) ?> |
| 142 | 77 | <button class="button"><?php fs_esc_html_echo_inline( 'Clear Updates Transients' ) ?></button> |
| 143 | 78 | </form> |
| 144 | 79 | </td> |
| 145 | - <?php if ( Freemius::is_deactivation_snoozed() ) : ?> | |
| 146 | 80 | <td> |
| 147 | - <!-- Reset Deactivation Snoozing --> | |
| 148 | - <form action="" method="POST"> | |
| 149 | - <input type="hidden" name="fs_action" value="reset_deactivation_snoozing"> | |
| 150 | - <?php wp_nonce_field( 'reset_deactivation_snoozing' ) ?> | |
| 151 | - <button class="button"><?php fs_esc_html_echo_inline( 'Reset Deactivation Snoozing' ) ?> (Expires in <?php echo ( Freemius::deactivation_snooze_expires_at() - time() ) ?> sec)</button> | |
| 152 | - </form> | |
| 153 | - </td> | |
| 154 | - <?php endif ?> | |
| 155 | - <td> | |
| 156 | 81 | <!-- Sync Data with Server --> |
| 157 | 82 | <form action="" method="POST"> |
| 158 | 83 | <input type="hidden" name="background_sync" value="true"> |
| 159 | 84 | <button class="button button-primary"><?php fs_esc_html_echo_inline( 'Sync Data From Server' ) ?></button> |
| @@ -174,17 +99,8 @@ | ||
| 174 | 99 | </td> |
| 175 | 100 | <td> |
| 176 | 101 | <button id="fs_set_db_option" class="button"><?php fs_esc_html_echo_inline( 'Set DB Option' ) ?></button> |
| 177 | 102 | </td> |
| 178 | - <td> | |
| 179 | - <?php | |
| 180 | - $fs_debug_page_url = 'admin.php?page=freemius&fs_action=allow_clone_resolution_notice'; | |
| 181 | - $fs_debug_page_url = fs_is_network_admin() ? | |
| 182 | - network_admin_url( $fs_debug_page_url ) : | |
| 183 | - admin_url( $fs_debug_page_url ); | |
| 184 | - ?> | |
| 185 | - <a href="<?php echo wp_nonce_url( $fs_debug_page_url, 'fs_allow_clone_resolution_notice' ) ?>" class="button button-primary">Resolve Clone(s)</a> | |
| 186 | - </td> | |
| 187 | 103 | </tr> |
| 188 | 104 | </tbody> |
| 189 | 105 | </table> |
| 190 | 106 | <script type="text/javascript"> |
| @@ -192,12 +108,11 @@ | ||
| 192 | 108 | $('#fs_load_db_option').click(function () { |
| 193 | 109 | var optionName = prompt('Please enter the option name:'); |
| 194 | 110 | |
| 195 | 111 | if (optionName) { |
| 196 | - $.post(<?php echo Freemius::ajax_url() ?>, { | |
| 112 | + $.post(ajaxurl, { | |
| 197 | 113 | action : 'fs_get_db_option', |
| 198 | - // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. | |
| 199 | - _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_get_db_option' ) ); ?>, | |
| 114 | + _wpnonce : '<?php echo wp_create_nonce( 'fs_get_db_option' ) ?>', | |
| 200 | 115 | option_name: optionName |
| 201 | 116 | }, function (response) { |
| 202 | 117 | if (response.data.value) |
| 203 | 118 | prompt('The option value is:', response.data.value); |
| @@ -213,12 +128,11 @@ | ||
| 213 | 128 | if (optionName) { |
| 214 | 129 | var optionValue = prompt('Please enter the option value:'); |
| 215 | 130 | |
| 216 | 131 | if (optionValue) { |
| 217 | - $.post(<?php echo Freemius::ajax_url() ?>, { | |
| 132 | + $.post(ajaxurl, { | |
| 218 | 133 | action : 'fs_set_db_option', |
| 219 | - // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. | |
| 220 | - _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_set_db_option' ) ); ?>, | |
| 134 | + _wpnonce : '<?php echo wp_create_nonce( 'fs_set_db_option' ) ?>', | |
| 221 | 135 | option_name : optionName, |
| 222 | 136 | option_value: optionValue |
| 223 | 137 | }, function () { |
| 224 | 138 | alert('Option was successfully set.'); |
| @@ -256,20 +170,8 @@ | ||
| 256 | 170 | array( |
| 257 | 171 | 'key' => 'WP_FS__DIR', |
| 258 | 172 | 'val' => WP_FS__DIR, |
| 259 | 173 | ), |
| 260 | - array( | |
| 261 | - 'key' => 'DISABLE_WP_CRON', | |
| 262 | - 'val' => defined( 'DISABLE_WP_CRON' ) ? ( DISABLE_WP_CRON ? 'true' : 'false' ) : 'Not defined', | |
| 263 | - ), | |
| 264 | - array( | |
| 265 | - 'key' => 'wp_using_ext_object_cache()', | |
| 266 | - 'val' => wp_using_ext_object_cache() ? 'true' : 'false', | |
| 267 | - ), | |
| 268 | - array( | |
| 269 | - 'key' => 'Freemius::get_unfiltered_site_url()', | |
| 270 | - 'val' => Freemius::get_unfiltered_site_url(), | |
| 271 | - ), | |
| 272 | 174 | ) |
| 273 | 175 | ?> |
| 274 | 176 | <br> |
| 275 | 177 | <table class="widefat"> |
| @@ -285,25 +187,16 @@ | ||
| 285 | 187 | <tr<?php if ( $alternate ) { |
| 286 | 188 | echo ' class="alternate"'; |
| 287 | 189 | } ?>> |
| 288 | 190 | <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> | |
| 191 | + <td><?php echo $p['val'] ?></td> | |
| 294 | 192 | </tr> |
| 295 | 193 | <?php $alternate = ! $alternate ?> |
| 296 | 194 | <?php endforeach ?> |
| 297 | 195 | </tbody> |
| 298 | 196 | </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"> | |
| 197 | +<h2><?php fs_esc_html_echo_x_inline( 'SDK Versions', 'as software development kit versions', 'sdk-versions' ) ?></h2> | |
| 198 | +<table id="fs_sdks" class="widefat"> | |
| 306 | 199 | <thead> |
| 307 | 200 | <tr> |
| 308 | 201 | <th><?php fs_esc_html_echo_x_inline( 'Version', 'product version' ) ?></th> |
| 309 | 202 | <th><?php fs_esc_html_echo_inline( 'SDK Path' ) ?></th> |
| @@ -331,19 +224,14 @@ | ||
| 331 | 224 | WP_FS__MODULE_TYPE_PLUGIN, |
| 332 | 225 | WP_FS__MODULE_TYPE_THEME |
| 333 | 226 | ); |
| 334 | 227 | ?> |
| 335 | -<?php $active_modules_by_id = array() ?> | |
| 228 | + | |
| 336 | 229 | <?php foreach ( $module_types as $module_type ) : ?> |
| 337 | 230 | <?php $modules = fs_get_entities( $fs_options->get_option( $module_type . 's' ), FS_Plugin::get_class_name() ) ?> |
| 338 | 231 | <?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"> | |
| 232 | + <h2><?php echo esc_html( ( WP_FS__MODULE_TYPE_PLUGIN == $module_type ) ? fs_text_inline( 'Plugins', 'plugins' ) : fs_text_inline( 'Themes', 'themes' ) ) ?></h2> | |
| 233 | + <table id="fs_<?php echo $module_type ?>" class="widefat"> | |
| 346 | 234 | <thead> |
| 347 | 235 | <tr> |
| 348 | 236 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 349 | 237 | <th><?php fs_esc_html_echo_inline( 'Slug' ) ?></th> |
| @@ -352,9 +240,9 @@ | ||
| 352 | 240 | <th><?php fs_esc_html_echo_x_inline( 'API', 'as application program interface' ) ?></th> |
| 353 | 241 | <th><?php fs_esc_html_echo_inline( 'Freemius State' ) ?></th> |
| 354 | 242 | <th><?php fs_esc_html_echo_inline( 'Module Path' ) ?></th> |
| 355 | 243 | <th><?php fs_esc_html_echo_inline( 'Public Key' ) ?></th> |
| 356 | - <?php if ( $is_multisite ) : ?> | |
| 244 | + <?php if ( is_multisite() ) : ?> | |
| 357 | 245 | <th><?php fs_esc_html_echo_inline( 'Network Blog' ) ?></th> |
| 358 | 246 | <th><?php fs_esc_html_echo_inline( 'Network User' ) ?></th> |
| 359 | 247 | <?php endif ?> |
| 360 | 248 | <th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th> |
| @@ -360,9 +248,8 @@ | ||
| 360 | 248 | <th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th> |
| 361 | 249 | </tr> |
| 362 | 250 | </thead> |
| 363 | 251 | <tbody> |
| 364 | - <?php $alternate = false; ?> | |
| 365 | 252 | <?php foreach ( $modules as $slug => $data ) : ?> |
| 366 | 253 | <?php |
| 367 | 254 | if ( WP_FS__MODULE_TYPE_THEME !== $module_type ) { |
| 368 | 255 | $is_active = is_plugin_active( $data->file ); |
| @@ -376,22 +263,13 @@ | ||
| 376 | 263 | $is_active = ( ( $parent_theme instanceof WP_Theme ) && $parent_theme->stylesheet === $data->file ); |
| 377 | 264 | } |
| 378 | 265 | } |
| 379 | 266 | ?> |
| 380 | - <?php | |
| 381 | - $fs = null; | |
| 382 | - if ( $is_active ) { | |
| 383 | - $fs = freemius( $data->id ); | |
| 384 | - | |
| 385 | - $active_modules_by_id[ $data->id ] = true; | |
| 386 | - } | |
| 387 | - ?> | |
| 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() ) { | |
| 267 | + <?php $fs = $is_active ? freemius( $data->id ) : null ?> | |
| 268 | + <tr<?php if ( $is_active ) { | |
| 269 | + if ( $fs->has_api_connectivity() && $fs->is_on() ) { | |
| 392 | 270 | echo ' style="background: #E6FFE6; font-weight: bold"'; |
| 393 | - } else if ( false === $has_api_connectivity || ! $fs->is_on() ) { | |
| 271 | + } else { | |
| 394 | 272 | echo ' style="background: #ffd0d0; font-weight: bold"'; |
| 395 | 273 | } |
| 396 | 274 | } ?>> |
| 397 | 275 | <td><?php echo $data->id ?></td> |
| @@ -397,16 +275,14 @@ | ||
| 397 | 275 | <td><?php echo $data->id ?></td> |
| 398 | 276 | <td><?php echo $slug ?></td> |
| 399 | 277 | <td><?php echo $data->version ?></td> |
| 400 | 278 | <td><?php echo $data->title ?></td> |
| 401 | - <td<?php if ( $is_active && false === $has_api_connectivity ) { | |
| 279 | + <td<?php if ( $is_active && ! $fs->has_api_connectivity() ) { | |
| 402 | 280 | echo ' style="color: red; text-transform: uppercase;"'; |
| 403 | 281 | } ?>><?php if ( $is_active ) { |
| 404 | - echo esc_html( true === $has_api_connectivity ? | |
| 282 | + echo esc_html( $fs->has_api_connectivity() ? | |
| 405 | 283 | fs_text_x_inline( 'Connected', 'as connection was successful' ) : |
| 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' ) ) | |
| 284 | + fs_text_x_inline( 'Blocked', 'as connection blocked' ) | |
| 409 | 285 | ); |
| 410 | 286 | } ?></td> |
| 411 | 287 | <td<?php if ( $is_active && ! $fs->is_on() ) { |
| 412 | 288 | echo ' style="color: red; text-transform: uppercase;"'; |
| @@ -417,9 +293,9 @@ | ||
| 417 | 293 | ); |
| 418 | 294 | } ?></td> |
| 419 | 295 | <td><?php echo $data->file ?></td> |
| 420 | 296 | <td><?php echo $data->public_key ?></td> |
| 421 | - <?php if ( $is_multisite ) : ?> | |
| 297 | + <?php if ( is_multisite() ) : ?> | |
| 422 | 298 | <?php |
| 423 | 299 | $network_blog_id = null; |
| 424 | 300 | $network_user = null; |
| 425 | 301 | |
| @@ -458,9 +334,8 @@ | ||
| 458 | 334 | <?php endif ?> |
| 459 | 335 | <?php endif ?> |
| 460 | 336 | </td> |
| 461 | 337 | </tr> |
| 462 | - <?php $alternate = ! $alternate ?> | |
| 463 | 338 | <?php endforeach ?> |
| 464 | 339 | </tbody> |
| 465 | 340 | </table> |
| 466 | 341 | <?php endif ?> |
| @@ -472,22 +347,18 @@ | ||
| 472 | 347 | * @var array[string]FS_Site|array[string]FS_Site[] $sites_map |
| 473 | 348 | */ |
| 474 | 349 | $sites_map = $VARS[ $module_type . '_sites' ]; |
| 475 | 350 | |
| 476 | - $all_plans = false; | |
| 351 | + $is_multisite = is_multisite(); | |
| 352 | + $all_plans = false; | |
| 477 | 353 | ?> |
| 478 | 354 | <?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( | |
| 355 | + <h2><?php echo esc_html( sprintf( | |
| 484 | 356 | /* translators: %s: 'plugin' or 'theme' */ |
| 485 | 357 | fs_text_inline( '%s Installs', 'module-installs' ), |
| 486 | 358 | ( 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"> | |
| 359 | + ) ) ?> / <?php fs_esc_html_echo_x_inline( 'Sites', 'like websites', 'sites' ) ?></h2> | |
| 360 | + <table id="fs_<?php echo $module_type ?>_installs" class="widefat"> | |
| 490 | 361 | <thead> |
| 491 | 362 | <tr> |
| 492 | 363 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 493 | 364 | <?php if ( $is_multisite ) : ?> |
| @@ -503,39 +374,17 @@ | ||
| 503 | 374 | <th><?php fs_esc_html_echo_inline( 'Actions' ) ?></th> |
| 504 | 375 | </tr> |
| 505 | 376 | </thead> |
| 506 | 377 | <tbody> |
| 507 | - <?php $site_url = null ?> | |
| 508 | 378 | <?php foreach ( $sites_map as $slug => $sites ) : ?> |
| 379 | + <?php if ( ! is_array( $sites ) ) { | |
| 380 | + $sites = array( $sites ); | |
| 381 | + } ?> | |
| 509 | 382 | <?php foreach ( $sites as $site ) : ?> |
| 510 | - <?php | |
| 511 | - $blog_id = $is_multisite ? | |
| 512 | - $site->blog_id : | |
| 513 | - null; | |
| 514 | - | |
| 515 | - if ( is_null( $site_url ) || $is_multisite ) { | |
| 516 | - $site_url = Freemius::get_unfiltered_site_url( | |
| 517 | - $blog_id, | |
| 518 | - true, | |
| 519 | - true | |
| 520 | - ); | |
| 521 | - } | |
| 522 | - | |
| 523 | - $is_active_clone = ( $site->is_clone( $site_url ) && isset( $active_modules_by_id[ $site->plugin_id ] ) ); | |
| 524 | - | |
| 525 | - if ( $is_active_clone ) { | |
| 526 | - $has_any_active_clone = true; | |
| 527 | - } | |
| 528 | - ?> | |
| 529 | 383 | <tr> |
| 530 | - <td> | |
| 531 | - <?php echo $site->id ?> | |
| 532 | - <?php if ( $is_active_clone ) : ?> | |
| 533 | - <label class="fs-tag fs-warn">Clone</label> | |
| 534 | - <?php endif ?> | |
| 535 | - </td> | |
| 384 | + <td><?php echo $site->id ?></td> | |
| 536 | 385 | <?php if ( $is_multisite ) : ?> |
| 537 | - <td><?php echo $blog_id ?></td> | |
| 386 | + <td><?php echo $site->blog_id ?></td> | |
| 538 | 387 | <td><?php echo fs_strip_url_protocol( $site->url ) ?></td> |
| 539 | 388 | <?php endif ?> |
| 540 | 389 | <td><?php echo $slug ?></td> |
| 541 | 390 | <td><?php echo $site->user_id ?></td> |
| @@ -595,15 +444,10 @@ | ||
| 595 | 444 | <?php |
| 596 | 445 | $addons = $VARS['addons']; |
| 597 | 446 | ?> |
| 598 | 447 | <?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"> | |
| 448 | + <h2><?php echo esc_html( sprintf( fs_text_inline( 'Add Ons of module %s', 'addons-of-x' ), $plugin_id ) ) ?></h2> | |
| 449 | + <table id="fs_addons" class="widefat"> | |
| 606 | 450 | <thead> |
| 607 | 451 | <tr> |
| 608 | 452 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 609 | 453 | <th><?php fs_esc_html_echo_inline( 'Title' ) ?></th> |
| @@ -635,17 +479,10 @@ | ||
| 635 | 479 | /** |
| 636 | 480 | * @var FS_User[] $users |
| 637 | 481 | */ |
| 638 | 482 | $users = $VARS['users']; |
| 639 | - $user_ids_map = array(); | |
| 640 | 483 | $users_with_developer_license_by_id = array(); |
| 641 | 484 | |
| 642 | - if ( is_array( $users ) && ! empty( $users ) ) { | |
| 643 | - foreach ( $users as $user ) { | |
| 644 | - $user_ids_map[ $user->id ] = true; | |
| 645 | - } | |
| 646 | - } | |
| 647 | - | |
| 648 | 485 | foreach ( $module_types as $module_type ) { |
| 649 | 486 | /** |
| 650 | 487 | * @var FS_Plugin_License[] $licenses |
| 651 | 488 | */ |
| @@ -659,15 +496,10 @@ | ||
| 659 | 496 | } |
| 660 | 497 | |
| 661 | 498 | ?> |
| 662 | 499 | <?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"> | |
| 500 | + <h2><?php fs_esc_html_echo_inline( 'Users' ) ?></h2> | |
| 501 | + <table id="fs_users" class="widefat"> | |
| 670 | 502 | <thead> |
| 671 | 503 | <tr> |
| 672 | 504 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 673 | 505 | <th><?php fs_esc_html_echo_inline( 'Name' ) ?></th> |
| @@ -713,15 +545,10 @@ | ||
| 713 | 545 | * @var FS_Plugin_License[] $licenses |
| 714 | 546 | */ |
| 715 | 547 | $licenses = $VARS[ $module_type . '_licenses' ] ?> |
| 716 | 548 | <?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"> | |
| 549 | + <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> | |
| 550 | + <table id="fs_<?php echo $module_type ?>_licenses" class="widefat"> | |
| 724 | 551 | <thead> |
| 725 | 552 | <tr> |
| 726 | 553 | <th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th> |
| 727 | 554 | <th><?php fs_esc_html_echo_inline( 'Plugin ID' ) ?></th> |
| @@ -746,9 +573,9 @@ | ||
| 746 | 573 | <td><?php echo $license->activated ?></td> |
| 747 | 574 | <td><?php echo $license->is_block_features ? 'Blocking' : 'Flexible' ?></td> |
| 748 | 575 | <td><?php echo $license->is_whitelabeled ? 'Whitelabeled' : 'Normal' ?></td> |
| 749 | 576 | <td><?php |
| 750 | - echo ( $license->is_whitelabeled || ! isset( $user_ids_map[ $license->user_id ] ) ) ? | |
| 577 | + echo $license->is_whitelabeled ? | |
| 751 | 578 | $license->get_html_escaped_masked_secret_key() : |
| 752 | 579 | esc_html( $license->secret_key ); |
| 753 | 580 | ?></td> |
| 754 | 581 | <td><?php echo $license->expiration ?></td> |
| @@ -757,12 +584,8 @@ | ||
| 757 | 584 | </tbody> |
| 758 | 585 | </table> |
| 759 | 586 | <?php endif ?> |
| 760 | 587 | <?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 | 588 | <?php if ( FS_Logger::is_storage_logging_on() ) : ?> |
| 766 | 589 | |
| 767 | 590 | <h2><?php fs_esc_html_echo_inline( 'Debug Log', 'debug-log' ) ?></h2> |
| 768 | 591 | |
| @@ -898,12 +721,10 @@ | ||
| 898 | 721 | |
| 899 | 722 | offset = 0; |
| 900 | 723 | } |
| 901 | 724 | |
| 902 | - $.post(<?php echo Freemius::ajax_url() ?>, { | |
| 725 | + $.post(ajaxurl, { | |
| 903 | 726 | action : 'fs_get_debug_log', |
| 904 | - // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. | |
| 905 | - _wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_get_debug_log' ) ); ?>, | |
| 906 | 727 | filters: filters, |
| 907 | 728 | offset : offset, |
| 908 | 729 | limit : limit |
| 909 | 730 | }, function (response) { |
| @@ -935,25 +756,4 @@ | ||
| 935 | 756 | loadLogs(); |
| 936 | 757 | }); |
| 937 | 758 | </script> |
| 938 | 759 | <?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> | |