PluginProbe
Powered Cache – Caching and Optimization for WordPress – Easily Improve PageSpeed & Web Vitals Score / trunk
Powered Cache – Caching and Optimization for WordPress – Easily Improve PageSpeed & Web Vitals Score vtrunk
trunk 1.0 1.0.1 1.1 1.1.1 1.1.2 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1 2.1.1 2.1.2 2.2 2.2.1 All 69 releases
← All changes | includes/admin/partials/settings-page.php +1030 -204 2.0.3trunk View file →
@@ -6,19 +6,23 @@
6 6 */
7 7
8 8 namespace PoweredCache\Admin\Partials\SettingsPage;
9 9
10 +use PoweredCache\Async\CachePreloader;
10 11 use function PoweredCache\Utils\can_configure_htaccess;
11 12 use function PoweredCache\Utils\can_configure_object_cache;
12 13 use function PoweredCache\Utils\can_control_all_settings;
13 14 use function PoweredCache\Utils\cdn_zones;
14 15 use function PoweredCache\Utils\get_available_object_caches;
15 -use function PoweredCache\Utils\get_db_cleanup_counts;
16 +use function PoweredCache\Utils\get_decrypted_setting;
16 17 use function PoweredCache\Utils\get_doc_url;
17 18 use function PoweredCache\Utils\get_timeout_with_interval;
19 +use function PoweredCache\Utils\is_local_site;
18 20 use function PoweredCache\Utils\is_premium;
19 -use function PoweredCache\Utils\js_execution_methods;
21 +use function PoweredCache\Utils\mask_string;
22 +use function PoweredCache\Utils\sanitize_css;
20 23 use function PoweredCache\Utils\scheduled_cleanup_frequency_options;
24 +use const PoweredCache\Constants\UNMASK_CHARACTER_LENGTH;
21 25
22 26 if ( ! defined( 'ABSPATH' ) ) {
23 27 exit; // Exit if accessed directly.
24 28 }
@@ -24,10 +28,14 @@
24 28 }
25 29 // phpcs:disable WordPress.WhiteSpace.PrecisionAlignment.Found
26 30 // phpcs:disable Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
27 31 // phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
32 +// phpcs:disable WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAttrNotByEscHTML
33 +// phpcs:disable WordPressVIPMinimum.Security.ProperEscapingFunction.notAttrEscAttr
28 34
29 -$settings = \PoweredCache\Utils\get_settings();
35 +$settings = \PoweredCache\Utils\get_settings();
36 +$cf_api_key = \PoweredCache\Extensions\Cloudflare\Cloudflare::get_cf_api_key();
37 +$cf_api_token = \PoweredCache\Extensions\Cloudflare\Cloudflare::get_cf_api_token();
30 38
31 39 ?>
32 40
33 41 <main class="sui-wrap">
@@ -39,9 +47,9 @@
39 47 </h1>
40 48
41 49 <!-- Float element to Right -->
42 50 <div class="sui-actions-right">
43 - <a href="<?php echo esc_url( get_doc_url( '/' ) ); ?>" target="_blank" class="sui-button sui-button-blue">
51 + <a href="<?php echo esc_url( get_doc_url( '/' ) ); ?>" target="_blank" class="sui-button sui-hidden-sm sui-button-blue">
44 52 <i class="sui-icon-academy" aria-hidden="true"></i>
45 53 <?php esc_html_e( 'Documentation', 'powered-cache' ); ?>
46 54 </a>
47 55 </div>
@@ -105,9 +113,9 @@
105 113 ?>
106 114
107 115 </ul>
108 116
109 - <button type="submit" name="powered_cache_form_action" class="sui-button sui-button-blue" value="save_settings"><?php esc_html_e( 'Save Changes', 'powered-cache' ); ?></button>
117 + <button type="submit" name="powered_cache_form_action" class="sui-button sui-margin-bottom sui-hidden-sm sui-button-blue" value="save_settings"><?php esc_html_e( 'Save Changes', 'powered-cache' ); ?></button>
110 118 </div>
111 119
112 120 <!-- TAB: Regular -->
113 121 <div class="sui-box" id="basic-options" data-tab="basic-options" style="">
@@ -161,9 +169,20 @@
161 169 <option <?php selected( $settings['object_cache'], $object_cache_backend ); ?> value="<?php echo esc_attr( $object_cache_backend ); ?>"><?php echo esc_attr( ucfirst( $object_cache_backend ) ); ?></option>
162 170 <?php endforeach; ?>
163 171 </select>
164 172 <span id="object_cache_description" class="sui-description"><?php esc_html_e( 'You will also need to configure the object cache backend.', 'powered-cache' ); ?><a href="<?php echo esc_url( get_doc_url( 'object-caching' ) ); ?>" target="_blank"><?php esc_html_e( 'Learn More', 'powered-cache' ); ?></a></span>
173 +
174 + <div role="alert" id="object_cache_alloptions_message" class="sui-hidden sui-notice" aria-live="assertive">
175 + <div class="sui-notice-content">
176 + <div class="sui-notice-message">
177 +
178 + </div>
179 + </div>
180 + </div>
165 181 </div>
182 +
183 +
184 +
166 185 </div>
167 186 </div>
168 187 <?php endif; ?>
169 188
@@ -291,14 +310,9 @@
291 310
292 311 </div>
293 312
294 313 <div class="sui-box-footer">
295 - <div class="sui-actions-left">
296 - <button type="submit" name="powered_cache_form_action" value="save_settings" class="sui-button sui-button-blue">
297 - <i class="sui-icon-save" aria-hidden="true"></i>
298 - <?php esc_html_e( 'Update settings', 'powered-cache' ); ?>
299 - </button>
300 - </div>
314 + <?php require 'settings-form-action.php'; ?>
301 315 </div>
302 316
303 317 </div>
304 318
@@ -357,9 +371,9 @@
357 371 rows="5"
358 372 ><?php echo esc_textarea( $settings['rejected_user_agents'] ); ?></textarea>
359 373 <span id="rejected_user_agents_description" class="sui-description">
360 374 <?php esc_html_e( 'Never send cached results for these user agents.', 'powered-cache' ); ?>
361 - (<a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'rejected-user-agents' ) ); ?>" target="_blank">?</a>)
375 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'rejected-user-agents' ) ); ?>" target="_blank">(?)</a>
362 376 </span>
363 377 </div>
364 378 </div>
365 379 </div>
@@ -386,9 +400,9 @@
386 400 aria-describedby="rejected_cookies_description"
387 401 rows="5"
388 402 ><?php echo esc_textarea( $settings['rejected_cookies'] ); ?></textarea>
389 403 <span id="rejected_cookies_description" class="sui-description"><?php esc_html_e( 'Never cache pages that use the specified cookies.', 'powered-cache' ); ?>
390 - (<a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'rejected-cookies' ) ); ?>" target="_blank">?</a>)
404 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'rejected-cookies' ) ); ?>" target="_blank">(?)</a>
391 405 </span>
392 406 </div>
393 407 </div>
394 408 </div>
@@ -394,12 +408,46 @@
394 408 </div>
395 409 </div>
396 410 </div>
397 411
412 + <!-- Rejected Referrers -->
413 + <div class="sui-box-settings-row">
414 + <div class="sui-box-settings-col-1">
415 + <span class="sui-settings-label" id="rejected_referrers_label">
416 + <?php esc_html_e( 'Rejected Referrers', 'powered-cache' ); ?>
417 + </span>
418 + </div>
419 +
420 + <div class="sui-box-settings-col-2">
421 + <div class="sui-row">
422 + <div class="sui-col-md-8">
423 + <div class="sui-form-field">
424 + <label for="rejected_referrers" class="sui-label">
425 + <i><?php esc_html_e( 'Enter rejected referrers (one per line)', 'powered-cache' ); ?></i>
426 + </label>
427 + <textarea
428 + placeholder="https://example.com"
429 + id="rejected_referrers"
430 + name="rejected_referrers"
431 + class="sui-form-control"
432 + aria-labelledby="rejected_referrers_label"
433 + aria-describedby="rejected_referrers_description"
434 + rows="5"
435 + ><?php echo esc_textarea( $settings['rejected_referrers'] ); ?></textarea>
436 + <span id="rejected_referrers_description" class="sui-description">
437 + <?php esc_html_e( 'Never cache pages that use the specified referrers.', 'powered-cache' ); ?>
438 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'rejected-referrers' ) ); ?>" target="_blank">(?)</a>
439 + </span>
440 + </div>
441 + </div>
442 + </div>
443 + </div>
444 + </div>
445 +
398 446 <!-- Cookie Vary -->
399 447 <div class="sui-box-settings-row">
400 448 <div class="sui-box-settings-col-1">
401 - <span class="sui-settings-label" id="rejected_cookies_label"><?php esc_html_e( 'Vary Cookies', 'powered-cache' ); ?></span>
449 + <span class="sui-settings-label" id="vary_cookies_label"><?php esc_html_e( 'Vary Cookies', 'powered-cache' ); ?></span>
402 450 </div>
403 451
404 452 <div class="sui-box-settings-col-2">
405 453 <div class="sui-row">
@@ -415,9 +463,9 @@
415 463 aria-describedby="vary_cookies_description"
416 464 rows="5"
417 465 ><?php echo esc_textarea( $settings['vary_cookies'] ); ?></textarea>
418 466 <span id="vary_cookies_description" class="sui-description"><?php esc_html_e( 'Separate cache will be generated based on the cookie match.', 'powered-cache' ); ?>
419 - (<a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'vary-cookies' ) ); ?>" target="_blank">?</a>)
467 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'vary-cookies' ) ); ?>" target="_blank">(?)</a>
420 468 </span>
421 469 </div>
422 470 </div>
423 471 </div>
@@ -444,9 +492,9 @@
444 492 aria-describedby="rejected_uri_description"
445 493 rows="5"
446 494 ><?php echo esc_textarea( $settings['rejected_uri'] ); ?></textarea>
447 495 <span id="rejected_uri_description" class="sui-description"><?php esc_html_e( 'Ignore the specified pages / directories. Supports regex.', 'powered-cache' ); ?>
448 - (<a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'ignored-pages' ) ); ?>" target="_blank">?</a>)
496 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'ignored-pages' ) ); ?>" target="_blank">(?)</a>
449 497 </span>
450 498 </div>
451 499 </div>
452 500 </div>
@@ -452,29 +500,56 @@
452 500 </div>
453 501 </div>
454 502 </div>
455 503
456 - <!-- Accepted query strings -->
504 + <!-- Cache query strings -->
457 505 <div class="sui-box-settings-row">
458 506 <div class="sui-box-settings-col-1">
459 - <span class="sui-settings-label"><?php esc_html_e( 'Accepted query strings', 'powered-cache' ); ?></span>
507 + <span class="sui-settings-label"><?php esc_html_e( 'Cache Query Strings', 'powered-cache' ); ?></span>
460 508 </div>
461 509 <div class="sui-box-settings-col-2">
462 510 <div class="sui-row">
463 511 <div class="sui-col-md-8">
464 512 <div class="sui-form-field">
465 - <label for="accepted_query_strings" class="sui-label"><i><?php esc_html_e( 'Enter allowed query parameter (one per line)', 'powered-cache' ); ?></i></label>
513 + <label for="cache_query_strings" class="sui-label"><i><?php esc_html_e( 'Enter query strings for cache (one per line)', 'powered-cache' ); ?></i></label>
466 514 <textarea
515 + id="cache_query_strings"
516 + name="cache_query_strings"
517 + class="sui-form-control"
518 + aria-describedby="cache_query_strings_description"
519 + rows="5"
520 + ><?php echo esc_textarea( $settings['cache_query_strings'] ); ?></textarea>
521 + <span id="cache_query_strings_description" class="sui-description">
522 + <?php esc_html_e( 'Powered Cache will create separate caching file for the value of these query strings.', 'powered-cache' ); ?>
523 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'cache-query-strings' ) ); ?>" target="_blank">(?)</a>
524 + </span>
525 + </div>
526 + </div>
527 + </div>
528 + </div>
529 + </div>
530 +
531 + <!-- Ignored query strings -->
532 + <div class="sui-box-settings-row">
533 + <div class="sui-box-settings-col-1">
534 + <span class="sui-settings-label"><?php esc_html_e( 'Ignored Query Strings', 'powered-cache' ); ?></span>
535 + </div>
536 + <div class="sui-box-settings-col-2">
537 + <div class="sui-row">
538 + <div class="sui-col-md-8">
539 + <div class="sui-form-field">
540 + <label for="ignored_query_strings" class="sui-label"><i><?php esc_html_e( 'Enter allowed query parameter (one per line)', 'powered-cache' ); ?></i></label>
541 + <textarea
467 542 placeholder="utm_"
468 - id="accepted_query_strings"
469 - name="accepted_query_strings"
543 + id="ignored_query_strings"
544 + name="ignored_query_strings"
470 545 class="sui-form-control"
471 - aria-describedby="accepted_query_strings_description"
546 + aria-describedby="ignored_query_strings_description"
472 547 rows="5"
473 - ><?php echo esc_textarea( $settings['accepted_query_strings'] ); ?></textarea>
474 - <span id="accepted_query_strings_description" class="sui-description">
548 + ><?php echo esc_textarea( $settings['ignored_query_strings'] ); ?></textarea>
549 + <span id="ignored_query_strings_description" class="sui-description">
475 550 <?php esc_html_e( 'Powered Cache will ignore these query string and serve the standard cache file. Tracking parameters such as utm_* ignored by default.', 'powered-cache' ); ?>
476 - (<a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'accepted-query-strings' ) ); ?>" target="_blank">?</a>)
551 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'ignored-query-strings' ) ); ?>" target="_blank">(?)</a>
477 552 </span>
478 553 </div>
479 554 </div>
480 555 </div>
@@ -501,9 +576,9 @@
501 576 rows="5"
502 577 ><?php echo esc_textarea( $settings['purge_additional_pages'] ); ?></textarea>
503 578 <span id="purge_additional_pages_description" class="sui-description">
504 579 <?php esc_html_e( 'Powered Cache is smart enough to purge only necessary pages during the post changes, however sometimes particular pages need to purge. (eg. the pages that use custom shortcode)', 'powered-cache' ); ?>
505 - (<a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'purge-additional-pages' ) ); ?>" target="_blank">?</a>)
580 + <a href="<?php echo esc_url( get_doc_url( '/advanced-options/', 'purge-additional-pages' ) ); ?>" target="_blank">(?)</a>
506 581 </span>
507 582 </div>
508 583 </div>
509 584 </div>
@@ -511,14 +586,9 @@
511 586 </div>
512 587
513 588 </div>
514 589 <div class="sui-box-footer">
515 - <div class="sui-actions-left">
516 - <button type="submit" name="powered_cache_form_action" value="save_settings" class="sui-button sui-button-blue">
517 - <i class="sui-icon-save" aria-hidden="true"></i>
518 - <?php esc_html_e( 'Update settings', 'powered-cache' ); ?>
519 - </button>
520 - </div>
590 + <?php require 'settings-form-action.php'; ?>
521 591 </div>
522 592 </div>
523 593
524 594 <!-- TAB: File Optimization -->
@@ -527,9 +597,9 @@
527 597 <div class="sui-box-header">
528 598 <h2 class="sui-box-title"><?php esc_html_e( 'File Optimization', 'powered-cache' ); ?></h2>
529 599 </div>
530 600
531 - <div class="sui-box-body">
601 + <div class="sui-box-body sui-upsell-items">
532 602 <?php
533 603 /**
534 604 * Fires before file optimization section
535 605 *
@@ -552,8 +622,9 @@
552 622 type="checkbox"
553 623 id="minify_html"
554 624 name="minify_html"
555 625 aria-labelledby="minify_html_label"
626 + aria-controls="minify_html_dom_optimization_control"
556 627 value="1"
557 628 <?php checked( 1, $settings['minify_html'] ); ?>
558 629 >
559 630 <span class="sui-toggle-slider" aria-hidden="true"></span>
@@ -561,8 +632,27 @@
561 632 <span id="minify_html_label_description" class="sui-description"><?php esc_html_e( 'Removes all whitespace characters from the HTML output, minimizing the HTML size.', 'powered-cache' ); ?></span>
562 633 </label>
563 634 </div>
564 635
636 + <div style=" <?php echo( ! $settings['minify_html'] ? 'display:none' : '' ); ?>" tabindex="0" id="minify_html_dom_optimization_control">
637 + <div class="sui-form-field">
638 + <label for="minify_html_dom_optimization" class="sui-toggle">
639 + <input type="checkbox"
640 + value="1"
641 + name="minify_html_dom_optimization"
642 + id="minify_html_dom_optimization"
643 + <?php checked( 1, $settings['minify_html_dom_optimization'] ); ?>
644 + >
645 + <span class="sui-toggle-slider" aria-hidden="true"></span>
646 + <span id="minify_html_dom_optimization_label" class="sui-toggle-label"><?php esc_html_e( 'Optimize HTML via Dom Parser', 'powered-cache' ); ?></span>
647 + <span id="minify_html_dom_optimization_description" class="sui-description">
648 + <?php esc_html_e( 'Improves HTML minification efficiency.', 'powered-cache' ); ?>
649 + </span>
650 + </label>
651 + <br>
652 + </div>
653 + </div>
654 +
565 655 <div class="sui-form-field">
566 656 <label for="combine_google_fonts" class="sui-toggle">
567 657 <input
568 658 type="checkbox"
@@ -568,8 +658,9 @@
568 658 type="checkbox"
569 659 id="combine_google_fonts"
570 660 name="combine_google_fonts"
571 661 aria-labelledby="combine_google_fonts_label"
662 + aria-controls="swap_google_fonts_display_control"
572 663 value="1"
573 664 <?php checked( 1, $settings['combine_google_fonts'] ); ?>
574 665 >
575 666 <span class="sui-toggle-slider" aria-hidden="true"></span>
@@ -575,13 +666,48 @@
575 666 <span class="sui-toggle-slider" aria-hidden="true"></span>
576 667 <span id="combine_google_fonts_label" class="sui-toggle-label"><?php esc_html_e( 'Combine Google Fonts', 'powered-cache' ); ?></span>
577 668 <span id="combine-google-fonts-description" class="sui-description">
578 669 <?php esc_html_e( 'Combines all Google Fonts URLs into a single URL and optimizes loading of that URL.', 'powered-cache' ); ?>
579 - (<a href="<?php echo esc_url( get_doc_url( '/combine-google-fonts/' ) ); ?>" target="_blank">?</a>)
670 + <a href="<?php echo esc_url( get_doc_url( '/combine-google-fonts/' ) ); ?>" target="_blank">(?)</a>
580 671 </span>
581 672 </label>
582 673 </div>
583 674
675 + <div style=" <?php echo( ! $settings['combine_google_fonts'] ? 'display:none' : '' ); ?>" tabindex="0" id="swap_google_fonts_display_control">
676 + <div class="sui-form-field">
677 + <label for="swap_google_fonts_display" class="sui-toggle">
678 + <input type="checkbox"
679 + value="1"
680 + name="swap_google_fonts_display"
681 + id="swap_google_fonts_display"
682 + <?php checked( 1, $settings['swap_google_fonts_display'] ); ?>
683 + >
684 + <span class="sui-toggle-slider" aria-hidden="true"></span>
685 + <span id="swap_google_fonts_display_label" class="sui-toggle-label"><?php esc_html_e( 'Swap Google Fonts Display', 'powered-cache' ); ?></span>
686 + <span id="swap_google_fonts_display_description" class="sui-description">
687 + <?php esc_html_e( 'Ensure text remains visible during webfont load.', 'powered-cache' ); ?>
688 + </span>
689 + </label>
690 + <br>
691 + </div>
692 + </div>
693 + <div class="sui-form-field">
694 + <label for="use_bunny_fonts" class="sui-toggle">
695 + <input type="checkbox"
696 + value="1"
697 + name="use_bunny_fonts"
698 + id="use_bunny_fonts"
699 + <?php checked( 1, $settings['use_bunny_fonts'] ); ?>
700 + >
701 + <span class="sui-toggle-slider" aria-hidden="true"></span>
702 + <span id="use_bunny_fonts_label" class="sui-toggle-label"><?php esc_html_e( 'Use Bunny Fonts', 'powered-cache' ); ?></span>
703 + <span id="use_bunny_fonts_description" class="sui-description">
704 + <?php esc_html_e( 'Use Bunny Fonts as drop-in replacement for Google Fonts', 'powered-cache' ); ?>
705 + </span>
706 + </label>
707 + </div>
708 +
709 +
584 710 </div>
585 711 </div>
586 712
587 713 <!-- CSS Files -->
@@ -587,9 +713,9 @@
587 713 <!-- CSS Files -->
588 714 <div class="<?php echo esc_attr( apply_filters( 'powered_cache_admin_page_fo_css_classes', 'sui-box-settings-row ' ) ); ?>">
589 715 <div class="sui-box-settings-col-1">
590 716 <span class="sui-settings-label"><?php esc_html_e( 'CSS Optimization', 'powered-cache' ); ?>
591 - (<a href="<?php echo esc_url( get_doc_url( '/css-optimization/' ) ); ?>" target="_blank">?</a>)
717 + <a href="<?php echo esc_url( get_doc_url( '/css-optimization/' ) ); ?>" target="_blank">(?)</a>
592 718 </span>
593 719 </div>
594 720
595 721 <div class="sui-box-settings-col-2">
@@ -604,9 +730,9 @@
604 730 value="1"
605 731 <?php checked( 1, $settings['minify_css'] ); ?>
606 732 >
607 733 <span class="sui-toggle-slider" aria-hidden="true"></span>
608 - <span id="minify_css_label" class="sui-toggle-label"><?php esc_html_e( 'Minify CSS' ); ?></span>
734 + <span id="minify_css_label" class="sui-toggle-label"><?php esc_html_e( 'Minify CSS', 'powered-cache' ); ?></span>
609 735 <span id="minify_css_description" class="sui-description"><?php esc_html_e( 'Minify CSS files', 'powered-cache' ); ?></span>
610 736 </label>
611 737 </div>
612 738
@@ -620,9 +746,9 @@
620 746 value="1"
621 747 <?php checked( 1, $settings['combine_css'] ); ?>
622 748 >
623 749 <span class="sui-toggle-slider" aria-hidden="true"></span>
624 - <span id="combine_css_label" class="sui-toggle-label"><?php esc_html_e( 'Combine CSS files' ); ?></span>
750 + <span id="combine_css_label" class="sui-toggle-label"><?php esc_html_e( 'Combine CSS files', 'powered-cache' ); ?></span>
625 751 <span id="combine_css_description" class="sui-description"><?php esc_html_e( 'Combine CSS files to reduce HTTP requests', 'powered-cache' ); ?></span>
626 752 </label>
627 753 </div>
628 754
@@ -634,9 +760,8 @@
634 760 placeholder="e.g /wp-content/themes/example/style/custom.css"
635 761 id="excluded_css_files"
636 762 name="excluded_css_files"
637 763 class="sui-form-control"
638 - aria-labelledby="label-unique-id"
639 764 aria-describedby="excluded_css_files_description"
640 765 rows="5"
641 766 ><?php echo esc_textarea( $settings['excluded_css_files'] ); ?></textarea>
642 767 <span id="excluded_css_files_description" class="sui-description">
@@ -644,17 +769,193 @@
644 769 </span>
645 770 </div>
646 771 </div>
647 772 </div>
773 + </div>
774 + </div>
648 775
776 + <!-- Critical CSS -->
777 + <div class="<?php echo esc_attr( apply_filters( 'powered_cache_admin_page_fo_critical_css_classes', 'sui-box-settings-row ' ) ); ?> <?php echo( ! is_premium() ? 'sui-disabled' : '' ); ?>">
778 + <div class="sui-box-settings-col-1">
779 + <span class="sui-settings-label"><?php esc_html_e( 'Critical CSS', 'powered-cache' ); ?>
780 + <a href="<?php echo esc_url( get_doc_url( '/critical-css/' ) ); ?>" target="_blank">(?)</a>
781 + <?php if ( ! is_premium() ) : ?>
782 + <span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Premium', 'powered-cache' ); ?></span>
783 + <?php endif; ?>
784 + </span>
785 + <span class="sui-description"><?php esc_html_e( 'Extract & Inline Critical-path CSS from HTML', 'powered-cache' ); ?></span>
786 + </div>
787 +
788 + <div class="sui-box-settings-col-2">
789 +
790 + <div class="sui-form-field">
791 + <label for="critical_css" class="sui-toggle">
792 + <input
793 + type="checkbox"
794 + id="critical_css"
795 + name="critical_css"
796 + aria-labelledby="critical_css_label"
797 + aria-controls="critical_css_fallback_controls"
798 + value="1"
799 + <?php checked( 1, $settings['critical_css'] ); ?>
800 + >
801 + <span class="sui-toggle-slider" aria-hidden="true"></span>
802 + <span id="critical_css_label" class="sui-toggle-label"><?php esc_html_e( ' Critical CSS', 'powered-cache' ); ?></span>
803 + <span id="critical_css_description" class="sui-description"><?php esc_html_e( 'Critical CSS is a technique that extracts the CSS above the fold to display the page as quickly as possible.', 'powered-cache' ); ?></span>
804 + </label>
805 + </div>
806 +
807 + <div style=" <?php echo( ! $settings['critical_css'] ? 'display:none' : '' ); ?>" tabindex="0" id="critical_css_fallback_controls">
808 + <div class="sui-row">
809 + <div class="sui-col-md-8">
810 + <div class="sui-form-field">
811 + <label for="critical_css_additional_files" class="sui-label"><i><?php esc_html_e( 'Additional files to critical (one per line)', 'powered-cache' ); ?></i></label>
812 + <textarea
813 + id="critical_css_additional_files"
814 + name="critical_css_additional_files"
815 + class="sui-form-control"
816 + aria-describedby="critical_css_additional_files_description"
817 + rows="5"
818 + ><?php echo esc_textarea( $settings['critical_css_additional_files'] ); // phpcs:ignore ?></textarea>
819 + <span id="critical_css_additional_files_description" class="sui-description">
820 + <?php esc_html_e( 'Critical CSS uses resources found in the head section of the page. If you need to include additional resources, add them here.', 'powered-cache' ); ?>
821 + </span>
822 + </div>
823 + </div>
824 + </div>
825 + <div class="sui-row">
826 + <div class="sui-col-md-8">
827 + <div class="sui-form-field">
828 + <label for="critical_css_excluded_files" class="sui-label"><i><?php esc_html_e( 'Excluded files from critical (one per line)', 'powered-cache' ); ?></i></label>
829 + <textarea
830 + id="critical_css_excluded_files"
831 + name="critical_css_excluded_files"
832 + class="sui-form-control"
833 + aria-describedby="critical_css_excluded_files_description"
834 + rows="5"
835 + ><?php echo esc_textarea( $settings['critical_css_excluded_files'] ); // phpcs:ignore ?></textarea>
836 + <span id="critical_css_excluded_files_description" class="sui-description">
837 + <?php esc_html_e( 'Ignore these files during the Critical CSS generation.', 'powered-cache' ); ?>
838 + </span>
839 + </div>
840 + </div>
841 + </div>
842 + <div class="sui-row">
843 + <div class="sui-col-md-8">
844 + <div class="sui-form-field">
845 + <label for="critical_css_appended_content" class="sui-label"><i><?php esc_html_e( 'Append to Critical CSS', 'powered-cache' ); ?></i></label>
846 + <textarea
847 + id="critical_css_appended_content"
848 + name="critical_css_appended_content"
849 + class="sui-form-control"
850 + aria-describedby="critical_css_appended_content_description"
851 + rows="5"
852 + ><?php echo wp_unslash( sanitize_css( $settings['critical_css_appended_content'] ) ); // phpcs:ignore ?></textarea>
853 + <span id="critical_css_appended_content_description" class="sui-description">
854 + <?php esc_html_e( 'Extend Critical CSS by appending custom CSS here.', 'powered-cache' ); ?>
855 + </span>
856 + </div>
857 + </div>
858 + </div>
859 + <div class="sui-row">
860 + <div class="sui-col-md-8">
861 + <div class="sui-form-field">
862 + <label for="critical_css_fallback" class="sui-label"><i><?php esc_html_e( 'Fallback Critical CSS ', 'powered-cache' ); ?></i></label>
863 + <textarea
864 + id="critical_css_fallback"
865 + name="critical_css_fallback"
866 + class="sui-form-control"
867 + aria-describedby="critical_css_fallback_description"
868 + rows="5"
869 + ><?php echo wp_unslash( sanitize_css( $settings['critical_css_fallback'] ) ); // phpcs:ignore ?></textarea>
870 + <span id="critical_css_fallback_description" class="sui-description">
871 + <?php esc_html_e( 'The fallback CSS if auto-generated CSS is incomplete.', 'powered-cache' ); ?>
872 + </span>
873 + </div>
874 + </div>
875 + </div>
876 +
877 + </div>
649 878 </div>
650 879 </div>
651 880
881 +
882 + <!-- Unused CSS -->
883 + <div class="<?php echo esc_attr( apply_filters( 'powered_cache_admin_page_fo_ucss_classes', 'sui-box-settings-row ' ) ); ?> <?php echo( ! is_premium() ? 'sui-disabled' : '' ); ?>">
884 + <div class="sui-box-settings-col-1">
885 + <span class="sui-settings-label"><?php esc_html_e( 'Unused CSS', 'powered-cache' ); ?>
886 + <a href="<?php echo esc_url( get_doc_url( '/remove-unused-css/' ) ); ?>" target="_blank">(?)</a>
887 + <?php if ( ! is_premium() ) : ?>
888 + <span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Premium', 'powered-cache' ); ?></span>
889 + <?php endif; ?>
890 + </span>
891 + <span class="sui-description"><?php esc_html_e( 'Remove Unused CSS', 'powered-cache' ); ?></span>
892 + </div>
893 +
894 + <div class="sui-box-settings-col-2">
895 + <div class="sui-form-field">
896 + <label for="remove_unused_css" class="sui-toggle">
897 + <input
898 + type="checkbox"
899 + id="remove_unused_css"
900 + name="remove_unused_css"
901 + aria-labelledby="remove_unused_css_label"
902 + aria-controls="remove_unused_css_safelist"
903 + value="1"
904 + <?php checked( 1, $settings['remove_unused_css'] ); ?>
905 + >
906 + <span class="sui-toggle-slider" aria-hidden="true"></span>
907 + <span id="remove_unused_css_label" class="sui-toggle-label"><?php esc_html_e( 'Remove Unused CSS', 'powered-cache' ); ?></span>
908 + <span id="remove_unused_css_description" class="sui-description"><?php esc_html_e( 'It reduces page size by removing all CSS and stylesheets that are not used while keeping only the used CSS.', 'powered-cache' ); ?></span>
909 + </label>
910 + </div>
911 +
912 + <div style=" <?php echo( ! $settings['remove_unused_css'] ? 'display:none' : '' ); ?>" tabindex="0" id="remove_unused_css_safelist">
913 + <div class="sui-row">
914 + <div class="sui-col-md-8">
915 + <div class="sui-form-field">
916 + <label for="ucss_safelist" class="sui-label"><i><?php esc_html_e( 'Safelist', 'powered-cache' ); ?></i></label>
917 + <textarea
918 + id="ucss_safelist"
919 + name="ucss_safelist"
920 + class="sui-form-control"
921 + aria-describedby="ucss_safelist_description"
922 + rows="5"
923 + ><?php echo esc_textarea( $settings['ucss_safelist'] ); // phpcs:ignore ?></textarea>
924 + <span id="ucss_safelist_description" class="sui-description">
925 + <?php esc_html_e( 'Specify CSS selectors that should not be removed. (one per line)', 'powered-cache' ); ?>
926 + </span>
927 + </div>
928 + </div>
929 + </div>
930 + <div class="sui-row">
931 + <div class="sui-col-md-8">
932 + <div class="sui-form-field">
933 + <label for="ucss_excluded_files" class="sui-label"><i><?php esc_html_e( 'Excluded files', 'powered-cache' ); ?></i></label>
934 + <textarea
935 + id="ucss_excluded_files"
936 + name="ucss_excluded_files"
937 + class="sui-form-control"
938 + aria-describedby="ucss_excluded_files_description"
939 + rows="5"
940 + ><?php echo esc_textarea( $settings['ucss_excluded_files'] ); // phpcs:ignore ?></textarea>
941 + <span id="ucss_excluded_files_description" class="sui-description">
942 + <?php esc_html_e( 'Specify CSS files that should be ignored during the UCSS generation process. (one per line)', 'powered-cache' ); ?>
943 + </span>
944 + </div>
945 + </div>
946 + </div>
947 + </div>
948 +
949 + </div>
950 + </div>
951 +
952 +
652 953 <!-- JS Files -->
653 954 <div class="<?php echo esc_attr( apply_filters( 'powered_cache_admin_page_fo_js_classes', 'sui-box-settings-row ' ) ); ?>">
654 955 <div class="sui-box-settings-col-1">
655 956 <span class="sui-settings-label"><?php esc_html_e( 'JavaScript Optimization', 'powered-cache' ); ?>
656 - (<a href="<?php echo esc_url( get_doc_url( '/js-optimization/' ) ); ?>" target="_blank">?</a>)
957 + <a href="<?php echo esc_url( get_doc_url( '/js-optimization/' ) ); ?>" target="_blank">(?)</a>
657 958 </span>
658 959 </div>
659 960
660 961 <div class="sui-box-settings-col-2">
@@ -665,8 +966,9 @@
665 966 type="checkbox"
666 967 id="minify_js"
667 968 name="minify_js"
668 969 aria-labelledby="minify_js_label"
970 + aria-controls="excluded_js_files_field"
669 971 value="1"
670 972 <?php checked( 1, $settings['minify_js'] ); ?>
671 973 >
672 974 <span class="sui-toggle-slider" aria-hidden="true"></span>
@@ -677,88 +979,215 @@
677 979
678 980 <div class="sui-form-field">
679 981 <label for="combine_js" class="sui-toggle">
680 982 <input
681 - type="checkbox"
682 - id="combine_js"
683 - name="combine_js"
684 - aria-labelledby="combine_js_label"
685 - value="1"
983 + type="checkbox"
984 + id="combine_js"
985 + name="combine_js"
986 + aria-labelledby="combine_js_label"
987 + value="1"
686 988 <?php checked( 1, $settings['combine_js'] ); ?>
989 + <?php disabled( false, ( $settings['minify_js'] && ! $settings['js_delay'] ) ); ?>
687 990 >
688 991 <span class="sui-toggle-slider" aria-hidden="true"></span>
689 992 <span id="combine_js_label" class="sui-toggle-label"><?php esc_html_e( 'Combine JavaScript Files', 'powered-cache' ); ?></span>
690 - <span id="combine_js_description" class="sui-description"><?php esc_html_e( 'Combines JS files into fewer files to reduce HTTP requests.', 'powered-cache' ); ?></span>
993 + <span id="combine_js_description" class="sui-description"><?php esc_html_e( 'Combines JS files into fewer files to reduce HTTP requests. If your site is using HTTP/2, it is not recommended to proceed with this option.', 'powered-cache' ); ?></span>
994 + <div role="alert" class="sui-notice sui-notice-blue sui-active" aria-live="assertive" style="display: block;">
995 + <div class="sui-notice-content">
996 + <div class="sui-notice-message">
997 + <span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>
998 + <p>
999 + <?php esc_html_e( 'For compatibility reasons, this option will only work when delayed JavaScript execution is not activated and it requires minification to be enabled.', 'powered-cache' ); ?>
1000 + </p>
1001 + </div>
1002 + </div>
1003 + </div>
691 1004 </label>
692 1005 </div>
693 1006
694 - <div class="sui-row">
695 - <div class="sui-col-md-8">
696 - <div class="sui-form-field">
697 - <label for="excluded_js_files" class="sui-label"><i><?php esc_html_e( 'JavaScript files to exclude (one per line)', 'powered-cache' ); ?></i></label>
1007 + <div style=" <?php echo( ! $settings['minify_js'] ? 'display:none' : '' ); ?>" class="sui-form-field" tabindex="0" id="excluded_js_files_field">
1008 + <div class="sui-row">
1009 + <div class="sui-col-md-8">
1010 + <label for="excluded_js_files" class="sui-label"><i><?php esc_html_e( 'Exclusions', 'powered-cache' ); ?></i></label>
698 1011 <textarea
699 - placeholder="e.g /wp-content/themes/example/js/custom.js"
700 - id="excluded_js_files"
701 - name="excluded_js_files"
702 - class="sui-form-control"
703 - aria-labelledby="label-unique-id"
704 - aria-describedby="excluded_js_files_description"
705 - rows="5"
1012 + placeholder="e.g /wp-content/themes/example/js/custom.js"
1013 + id="excluded_js_files"
1014 + name="excluded_js_files"
1015 + class="sui-form-control"
1016 + aria-describedby="excluded_js_files_description"
1017 + rows="5"
706 1018 ><?php echo esc_textarea( $settings['excluded_js_files'] ); ?></textarea>
707 1019 <span id="excluded_js_files_description" class="sui-description">
708 - <?php esc_html_e( 'Listed files will not get minified or combined', 'powered-cache' ); ?>
1020 + <?php esc_html_e( 'JavaScript files to exclude. Listed files will not get minified or combined (one per line).', 'powered-cache' ); ?>
1021 + <?php echo wp_kses_post( __( 'You can use <i>(.*)</i> for matching all files for a path.', 'powered-cache' ) ); ?>
1022 + <a href="<?php echo esc_url( get_doc_url( '/js-optimization/' ) ); ?>" target="_blank">(?)</a>
709 1023 </span>
710 1024 </div>
711 1025 </div>
712 1026 </div>
713 1027
714 - </div>
715 - </div>
1028 + <div class="sui-form-field">
1029 + <label for="js_defer" class="sui-toggle">
1030 + <input
1031 + type="checkbox"
1032 + id="js_defer"
1033 + name="js_defer"
1034 + aria-labelledby="js_defer_label"
1035 + aria-controls="js_defer_exclusions_field"
1036 + value="1"
1037 + <?php checked( 1, $settings['js_defer'] ); ?>
1038 + >
1039 + <span class="sui-toggle-slider" aria-hidden="true"></span>
1040 + <span id="js_defer_label" class="sui-toggle-label"><?php esc_html_e( 'Load JavaScript deferred', 'powered-cache' ); ?></span>
1041 + <span id="js_defer_description" class="sui-description"><?php esc_html_e( 'Avoid render-blocking scripts by deferring them.', 'powered-cache' ); ?></span>
1042 + </label>
1043 + </div>
716 1044
717 - <div class="<?php echo esc_attr( apply_filters( 'powered_cache_admin_page_fo_js_classes', 'sui-box-settings-row ' ) ); ?>">
718 - <div class="sui-box-settings-col-1">
719 - <span class="sui-settings-label" id="js_execution_method_label"><?php esc_html_e( 'JavaScript execution method', 'powered-cache' ); ?></span>
720 - <span class="sui-description"></span>
721 - </div>
722 - <div class="sui-box-settings-col-2">
723 - <div class="sui-form-field">
724 - <select id="js_execution_method" name="js_execution_method" aria-labelledby="js_execution_method_label" aria-describedby="js_execution_method_description">
725 - <?php foreach ( js_execution_methods() as $method => $name ) : ?>
726 - <option <?php selected( $settings['js_execution_method'], esc_attr( $method ) ); ?> value="<?php echo esc_attr( $method ); ?>"><?php echo esc_attr( $name ); ?></option>
727 - <?php endforeach; ?>
728 - </select>
1045 + <div style=" <?php echo( ! $settings['js_defer'] ? 'display:none' : '' ); ?>" class="sui-form-field" tabindex="0" id="js_defer_exclusions_field">
1046 + <div class="sui-row">
1047 + <div class="sui-col-md-8">
1048 + <label for="js_defer_exclusions" class="sui-label"><i><?php esc_html_e( 'Exclusions', 'powered-cache' ); ?></i></label>
1049 + <textarea
1050 + placeholder="e.g /wp-content/plugins/example/js/(.*)"
1051 + id="js_defer_exclusions"
1052 + name="js_defer_exclusions"
1053 + class="sui-form-control"
1054 + aria-describedby="js_defer_exclusions_description"
1055 + rows="5"
1056 + ><?php echo esc_textarea( $settings['js_defer_exclusions'] ); // phpcs:ignore ?></textarea>
1057 + <span id="js_defer_exclusions_description" class="sui-description">
1058 + <?php esc_html_e( 'Listed files will not get deferred (one per line).', 'powered-cache' ); ?>
1059 + <?php echo wp_kses_post( __( 'You can use <i>(.*)</i> for matching all files for a path.', 'powered-cache' ) ); ?>
1060 + </span>
1061 + </div>
729 1062
730 - <span id="js_execution_method_description" class="sui-description"><?php esc_html_e( 'It determines how browsers execute the JS scripts.', 'powered-cache' ); ?></span>
1063 + </div>
731 1064 </div>
732 1065
1066 +
733 1067 <div class="sui-form-field">
734 - <label for="js_execution_optimized_only" class="sui-toggle">
1068 + <label for="js_delay" class="sui-toggle">
735 1069 <input
736 - type="checkbox"
737 - id="js_execution_optimized_only"
738 - name="js_execution_optimized_only"
739 - aria-labelledby="js_execution_optimized_only_label"
740 - value="1"
741 - <?php checked( 1, $settings['js_execution_optimized_only'] ); ?>
1070 + type="checkbox"
1071 + id="js_delay"
1072 + name="js_delay"
1073 + aria-labelledby="js_delay_label"
1074 + aria-controls="js_delay_exclusions_field"
1075 + value="1"
1076 + <?php
1077 + checked( 1, $settings['js_delay'] );
1078 + ?>
742 1079 >
743 1080 <span class="sui-toggle-slider" aria-hidden="true"></span>
744 - <span id="js_execution_optimized_only_label" class="sui-toggle-label"><?php esc_html_e( 'Use execution method for the optimized scripts only', 'powered-cache' ); ?></span>
745 - <span id="js_execution_optimized_only_description" class="sui-description"><?php esc_html_e( 'When this option is turned off all JS scripts will be executed in the same way.', 'powered-cache' ); ?></span>
1081 + <span id="js_delay_label" class="sui-toggle-label"><?php esc_html_e( 'Delay JavaScript execution', 'powered-cache' ); ?></span>
1082 + <span id="js_delay_description" class="sui-description"><?php esc_html_e( 'Execute scripts following user interactions such as mouse movements, keyboard inputs, or scrolling. This technique enhances the page\'s loading time and boosts overall performance.', 'powered-cache' ); ?></span>
746 1083 </label>
747 1084 </div>
748 1085
1086 + <div class="sui-form-field" style=" <?php echo( ! $settings['js_delay'] ? 'display:none' : '' ); ?>" tabindex="0" id="js_delay_exclusions_field">
1087 + <div class="sui-row">
1088 + <div class="sui-col-md-8">
1089 + <label for="js_delay_exclusions" class="sui-label"><i><?php esc_html_e( 'Exclusions', 'powered-cache' ); ?></i></label>
1090 + <textarea
1091 + placeholder="e.g /wp-content/themes/example/js/(.*)"
1092 + id="js_delay_exclusions"
1093 + name="js_delay_exclusions"
1094 + class="sui-form-control"
1095 + aria-describedby="js_delay_exclusions_description"
1096 + rows="5"
1097 + ><?php echo esc_textarea( $settings['js_delay_exclusions'] ); // phpcs:ignore ?></textarea>
1098 + <span id="js_delay_exclusions_description" class="sui-description">
1099 + <?php esc_html_e( 'Listed files will not get delayed (one per line).', 'powered-cache' ); ?>
1100 + <?php echo wp_kses_post( __( 'You can use <i>(.*)</i> for matching all files for a path.', 'powered-cache' ) ); ?>
1101 + </span>
1102 + </div>
1103 + </div>
1104 + <div class="sui-row">
1105 + <div class="sui-col-md-8">
1106 + <span for="js-delay-default-exclusions" class="sui-label"><i><?php esc_html_e( 'If you have problems after enabling delay JavaScript execution, you can copy-paste following exceptions and see if the problem resolved.', 'powered-cache' ); ?></i></span>
1107 + <pre class="sui-code-snippet" id="js-delay-default-exclusions">
1108 +/wp-content(.*)
1109 +/wp-includes(.*)
1110 +js-(before|after|extra)</pre>
1111 + </div>
1112 + <span id="js_delay_exclusions_description" class="sui-description">
1113 + <?php esc_html_e( 'These rules will skip delays for JavaScript files loaded through WordPress core, themes, and plugins.', 'powered-cache' ); ?>
1114 + <a href="<?php echo esc_url( get_doc_url( '/js-execution/' ) ); ?>" target="_blank">(?)</a>
1115 + </span>
1116 + </div>
1117 +
1118 + <div class="sui-row sui-border-frame">
1119 + <div class="sui-form-field">
1120 + <label for="js_delay_timeout" id="js_delay_timeout-label" class="sui-label"><?php esc_html_e( 'Delay Timeout', 'powered-cache' ); ?></label>
1121 + <input
1122 + name="js_delay_timeout"
1123 + value="<?php echo esc_attr( $settings['js_delay_timeout'] ); ?>"
1124 + id="js_delay_timeout"
1125 + class="sui-form-control sui-field-has-suffix"
1126 + type="number"
1127 + min="0"
1128 + max="100000"
1129 + />
1130 + <span class="sui-field-suffix">
1131 + <span class="sui-description"><?php esc_html_e( 'Milliseconds', 'powered-cache' ); ?></span>
1132 + </span>
1133 + <span class="sui-description"><?php esc_html_e( 'Enter a delay in milliseconds for auto-loading JavaScript if no user interaction occurs. With a delay above 0, the script loads after the set time or upon any user action, whichever comes first. Enter 0 to disable. (1000ms = 1s)', 'powered-cache' ); ?></span>
1134 + </div>
1135 + </div>
1136 + </div>
1137 +
749 1138 </div>
1139 + </div>
750 1140
751 - </div>
1141 +
1142 + <?php if ( can_control_all_settings() ) : ?>
1143 + <div class="sui-box-settings-row">
1144 + <div class="sui-box-settings-col-1">
1145 + <span class="sui-settings-label"><?php esc_html_e( 'Rewrite File Optimizer', 'powered-cache' ); ?></span>
1146 + <span class="sui-description"></span>
1147 + </div>
1148 +
1149 + <div class="sui-box-settings-col-2">
1150 + <div class="sui-form-field">
1151 + <label for="rewrite_file_optimizer" id="rewrite_file_optimizer_label" class="sui-toggle">
1152 + <input
1153 + type="checkbox"
1154 + id="rewrite_file_optimizer"
1155 + name="rewrite_file_optimizer"
1156 + aria-labelledby="rewrite_file_optimizer_label"
1157 + aria-describedby="enable_rewrite_file_optimizer_description"
1158 + value="1"
1159 + <?php checked( 1, $settings['rewrite_file_optimizer'] ); ?>
1160 + >
1161 + <span class="sui-toggle-slider" aria-hidden="true"></span>
1162 + <span id="enable_rewrite_file_optimizer_label" class="sui-toggle-label"><?php esc_html_e( 'Enable rewrite for file optimizer.', 'powered-cache' ); ?></span>
1163 + <span id="enable_rewrite_file_optimizer_description" class="sui-description">
1164 + <?php echo wp_kses_post( __( 'This feature uses <code>/_static/??</code> instead <code>file-optimizer.php??</code> for file optimization requests. If automatic .htaccess configuration is enabled, the necessary settings will be applied automatically. If not, you will need to manually add the appropriate rewrite rules.</a>', 'powered-cache' ) ); ?>
1165 + <a href="<?php echo esc_url( get_doc_url( 'rewrite-file-optimizer' ) ); ?>" target="_blank"><?php esc_html_e( '(?)', 'powered-cache' ); ?></a>
1166 + </span>
1167 + </label>
1168 + </div>
1169 + <?php if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) : ?>
1170 + <div role="alert" class="sui-notice sui-notice-yellow sui-active" aria-live="assertive" style="display: block;">
1171 + <div class="sui-notice-content">
1172 + <div class="sui-notice-message">
1173 + <span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>
1174 + <p>
1175 + <?php esc_html_e( 'This feature may not work on Windows servers without manual .htaccess configuration.', 'powered-cache' ); ?>
1176 + </p>
1177 + </div>
1178 + </div>
1179 + </div>
1180 + <?php endif; ?>
1181 + </div>
1182 + </div>
1183 + <?php endif; ?>
1184 +
1185 +
752 1186 </div>
753 1187
754 1188 <div class="sui-box-footer">
755 - <div class="sui-actions-left">
756 - <button type="submit" name="powered_cache_form_action" value="save_settings" class="sui-button sui-button-blue">
757 - <i class="sui-icon-save" aria-hidden="true"></i>
758 - <?php esc_html_e( 'Update settings', 'powered-cache' ); ?>
759 - </button>
760 - </div>
1189 + <?php require 'settings-form-action.php'; ?>
761 1190 </div>
762 1191 </div>
763 1192
764 1193 <!-- TAB: Media -->
@@ -769,8 +1198,73 @@
769 1198 </div>
770 1199
771 1200 <div class="sui-box-body">
772 1201 <?php do_action( 'powered_cache_admin_page_before_media_optimization' ); ?>
1202 + <div class="sui-box-settings-row <?php echo( ! is_premium() ? 'sui-disabled' : '' ); ?>">
1203 +
1204 + <div class="sui-box-settings-col-1">
1205 + <span class="sui-settings-label"><?php esc_html_e( 'Image Optimization', 'powered-cache' ); ?>
1206 + <?php if ( ! is_premium() ) : ?>
1207 + <span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Premium', 'powered-cache' ); ?></span>
1208 + <?php endif; ?>
1209 + </span>
1210 + <span class="sui-description"></span>
1211 + </div>
1212 +
1213 + <div class="sui-box-settings-col-2">
1214 + <div class="sui-form-field">
1215 + <label for="enable_image_optimization" class="sui-toggle">
1216 + <input
1217 + type="checkbox"
1218 + id="enable_image_optimization"
1219 + name="enable_image_optimization"
1220 + aria-labelledby="enable_image_optimization_label"
1221 + aria-describedby="enable_image_optimization_description"
1222 + aria-controls="image-optimizer-details"
1223 + value="1"
1224 + <?php checked( 1, $settings['enable_image_optimization'] ); ?>
1225 + >
1226 + <span class="sui-toggle-slider" aria-hidden="true"></span>
1227 + <span id="enable_image_optimization_label" class="sui-toggle-label"><?php esc_html_e( 'Enable Image Optimization Service', 'powered-cache' ); ?></span>
1228 + <span id="enable_image_optimization_description" class="sui-description"><?php esc_html_e( "Our image optimization service instantly optimizes images from our global network of servers. Images will be served in the AVIF format when supported by the user's browser. If AVIF is not supported, the WebP format will be used as a fallback, ensuring efficient loading and high-quality visuals.", 'powered-cache' ); ?>
1229 + <a href="<?php echo esc_url( get_doc_url( '/image-optimization/' ) ); ?>" target="_blank">(?)</a>
1230 + </span>
1231 + </label>
1232 + </div>
1233 +
1234 + <div style="<?php echo( ! $settings['enable_image_optimization'] ? 'display:none' : '' ); ?>" tabindex="0" id="image-optimizer-details">
1235 + <div class="sui-form-field">
1236 + <label for="image_optimizer_preferred_format" class="sui-toggle">
1237 + <input
1238 + type="checkbox"
1239 + id="image_optimizer_preferred_format"
1240 + name="image_optimizer_preferred_format"
1241 + aria-labelledby="image_optimizer_preferred_format_label"
1242 + aria-describedby="image_optimizer_preferred_format_description"
1243 + value="webp"
1244 + <?php checked( 'webp', $settings['image_optimizer_preferred_format'] ); ?>
1245 + >
1246 + <span class="sui-toggle-slider" aria-hidden="true"></span>
1247 + <span id="image_optimizer_preferred_format_label" class="sui-toggle-label"><?php esc_html_e( 'Use WebP over AVIF', 'powered-cache' ); ?></span>
1248 + <span id="image_optimizer_preferred_format_description" class="sui-description">
1249 + <?php esc_html_e( 'Activate this option to prioritize the WebP format over AVIF for image optimization.', 'powered-cache' ); ?>
1250 + </span>
1251 + </label>
1252 + </div>
1253 + <?php if ( ! is_multisite() && ! is_local_site() && is_premium() ) : ?>
1254 + <div class="sui-form-field">
1255 + <a
1256 + href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=powered_cache_purge_image_optimizer' ), 'powered_cache_purge_image_optimizer' ) ); ?>"
1257 + class="sui-button sui-button-ghost" id="clear_image_optimizer_cache">
1258 + <?php esc_html_e( 'Clear Image Optimizer Cache', 'powered-cache' ); ?>
1259 + </a>
1260 + </div>
1261 + <?php endif; ?>
1262 + </div>
1263 +
1264 + </div>
1265 + </div>
1266 +
773 1267 <!-- Lazy Load settings -->
774 1268
775 1269 <div class="<?php echo esc_attr( apply_filters( 'powered_cache_admin_page_lazy_load_settings_classes', 'sui-box-settings-row' ) ); ?>">
776 1270
@@ -777,9 +1271,9 @@
777 1271 <div class="sui-box-settings-col-1">
778 1272 <span class="sui-settings-label"><?php esc_html_e( 'Lazy Load', 'powered-cache' ); ?></span>
779 1273 <span class="sui-description">
780 1274 <?php esc_html_e( 'Loads images and iframes only when visible to the user.', 'powered-cache' ); ?>
781 - (<a href="<?php echo esc_url( get_doc_url( '/enable-lazy-load/' ) ); ?>" target="_blank">?</a>)
1275 + <a href="<?php echo esc_url( get_doc_url( '/enable-lazy-load/' ) ); ?>" target="_blank">(?)</a>
782 1276 </span>
783 1277 </div>
784 1278
785 1279 <div class="sui-box-settings-col-2">
@@ -800,105 +1294,157 @@
800 1294 <span id="enable_lazy_load_label" class="sui-toggle-label"><?php esc_html_e( 'Enable Lazy Load', 'powered-cache' ); ?></span>
801 1295 </label>
802 1296 </div>
803 1297
804 - <div style=" <?php echo( ! $settings['enable_lazy_load'] ? 'display:none' : '' ); ?>" tabindex="0" id="lazy-load-details" class="sui-toggle-content sui-border-frame">
1298 + <div style="<?php echo( ! $settings['enable_lazy_load'] ? 'display:none' : '' ); ?>" tabindex="0" id="lazy-load-details">
1299 + <div class="sui-border-frame">
1300 + <div class="sui-form-field">
1301 + <div class="sui-row">
1302 + <label for="lazy_load_post_content" class="sui-checkbox">
805 1303
806 - <div class="sui-form-field">
807 - <div class="sui-row">
808 - <label for="lazy_load_post_content" class="sui-checkbox">
809 -
810 - <input
1304 + <input
811 1305 type="checkbox"
812 1306 id="lazy_load_post_content"
813 1307 name="lazy_load_post_content"
814 1308 value="1"
815 - <?php checked( 1, $settings['lazy_load_post_content'] ); ?>
816 - >
1309 + <?php checked( 1, $settings['lazy_load_post_content'] ); ?>
1310 + >
817 1311
818 - <span aria-hidden="true"></span>
819 - <span id="lazy_load_post_content_label"><?php esc_html_e( 'Enable for post content.', 'powered-cache' ); ?></span>
820 - </label>
821 - </div>
1312 + <span aria-hidden="true"></span>
1313 + <span id="lazy_load_post_content_label"><?php esc_html_e( 'Enable for post content.', 'powered-cache' ); ?></span>
1314 + </label>
1315 + </div>
822 1316
823 - <div class="sui-row">
824 - <label for="lazy_load_images" class="sui-checkbox">
1317 + <div class="sui-row">
1318 + <label for="lazy_load_images" class="sui-checkbox">
825 1319
826 - <input
1320 + <input
827 1321 type="checkbox"
828 1322 id="lazy_load_images"
829 1323 name="lazy_load_images"
830 1324 value="1"
831 - <?php checked( 1, $settings['lazy_load_images'] ); ?>
832 - >
1325 + <?php checked( 1, $settings['lazy_load_images'] ); ?>
1326 + >
833 1327
834 - <span aria-hidden="true"></span>
835 - <span id="lazy_load_images_label"><?php esc_html_e( 'Enable for images.', 'powered-cache' ); ?></span>
836 - </label>
837 - </div>
1328 + <span aria-hidden="true"></span>
1329 + <span id="lazy_load_images_label"><?php esc_html_e( 'Enable for images.', 'powered-cache' ); ?></span>
1330 + </label>
1331 + </div>
838 1332
839 - <div class="sui-row">
840 - <label for="lazy_load_iframes" class="sui-checkbox">
1333 + <div class="sui-row">
1334 + <label for="lazy_load_iframes" class="sui-checkbox">
841 1335
842 - <input
1336 + <input
843 1337 type="checkbox"
844 1338 id="lazy_load_iframes"
845 1339 name="lazy_load_iframes"
846 1340 value="1"
847 - <?php checked( 1, $settings['lazy_load_iframes'] ); ?>
848 - >
1341 + <?php checked( 1, $settings['lazy_load_iframes'] ); ?>
1342 + >
849 1343
850 - <span aria-hidden="true"></span>
851 - <span id="lazy_load_iframes_label"><?php esc_html_e( 'Enable for iframes.', 'powered-cache' ); ?></span>
852 - </label>
853 - </div>
854 - <div class="sui-row">
855 - <label for="lazy_load_widgets" class="sui-checkbox">
1344 + <span aria-hidden="true"></span>
1345 + <span id="lazy_load_iframes_label"><?php esc_html_e( 'Enable for iframes.', 'powered-cache' ); ?></span>
1346 + </label>
1347 + </div>
1348 + <div class="sui-row">
1349 + <label for="lazy_load_widgets" class="sui-checkbox">
856 1350
857 - <input
1351 + <input
858 1352 type="checkbox"
859 1353 id="lazy_load_widgets"
860 1354 name="lazy_load_widgets"
861 1355 value="1"
862 - <?php checked( 1, $settings['lazy_load_widgets'] ); ?>
863 - >
1356 + <?php checked( 1, $settings['lazy_load_widgets'] ); ?>
1357 + >
864 1358
865 - <span aria-hidden="true"></span>
866 - <span id="lazy_load_widgets_label"><?php esc_html_e( 'Enable for widgets.', 'powered-cache' ); ?></span>
867 - </label>
868 - </div>
869 - <div class="sui-row">
870 - <label for="lazy_load_post_thumbnail" class="sui-checkbox">
1359 + <span aria-hidden="true"></span>
1360 + <span id="lazy_load_widgets_label"><?php esc_html_e( 'Enable for widgets.', 'powered-cache' ); ?></span>
1361 + </label>
1362 + </div>
1363 + <div class="sui-row">
1364 + <label for="lazy_load_post_thumbnail" class="sui-checkbox">
871 1365
872 - <input
1366 + <input
873 1367 type="checkbox"
874 1368 id="lazy_load_post_thumbnail"
875 1369 name="lazy_load_post_thumbnail"
876 1370 value="1"
877 - <?php checked( 1, $settings['lazy_load_post_thumbnail'] ); ?>
878 - >
1371 + <?php checked( 1, $settings['lazy_load_post_thumbnail'] ); ?>
1372 + >
879 1373
880 - <span aria-hidden="true"></span>
881 - <span id="lazy_load_post_thumbnail_label"><?php esc_html_e( 'Enable for post thumbnails.', 'powered-cache' ); ?></span>
882 - </label>
883 - </div>
884 - <div class="sui-row">
885 - <label for="lazy_load_avatars" class="sui-checkbox">
1374 + <span aria-hidden="true"></span>
1375 + <span id="lazy_load_post_thumbnail_label"><?php esc_html_e( 'Enable for post thumbnails.', 'powered-cache' ); ?></span>
1376 + </label>
1377 + </div>
1378 + <div class="sui-row">
1379 + <label for="lazy_load_avatars" class="sui-checkbox">
886 1380
887 - <input
1381 + <input
888 1382 type="checkbox"
889 1383 id="lazy_load_avatars"
890 1384 name="lazy_load_avatars"
891 1385 value="1"
892 - <?php checked( 1, $settings['lazy_load_avatars'] ); ?>
893 - >
1386 + <?php checked( 1, $settings['lazy_load_avatars'] ); ?>
1387 + >
894 1388
895 - <span aria-hidden="true"></span>
896 - <span id="lazy_load_avatars_label"><?php esc_html_e( 'Enable for avatars.', 'powered-cache' ); ?></span>
1389 + <span aria-hidden="true"></span>
1390 + <span id="lazy_load_avatars_label"><?php esc_html_e( 'Enable for avatars.', 'powered-cache' ); ?></span>
1391 + </label>
1392 + </div>
1393 + <div class="sui-row">
1394 + <label for="lazy_load_youtube" class="sui-checkbox">
1395 +
1396 + <input
1397 + type="checkbox"
1398 + id="lazy_load_youtube"
1399 + name="lazy_load_youtube"
1400 + value="1"
1401 + <?php checked( 1, $settings['lazy_load_youtube'] ); ?>
1402 + >
1403 +
1404 + <span aria-hidden="true"></span>
1405 + <span id="lazy_load_youtube_label"><?php esc_html_e( 'Replace Youtube videos by thumbnail.', 'powered-cache' ); ?></span>
1406 + </label>
1407 + </div>
1408 + </div>
1409 + </div>
1410 + <div class="sui-form-field">
1411 + <span id="cdn_rejected_files_label" class="sui-settings-label"><?php esc_html_e( 'Excluded images or iframes', 'powered-cache' ); ?></span>
1412 +
1413 + <textarea
1414 + placeholder="/wp-content/themes/example/images/logo.png"
1415 + id="lazy_load_exclusions"
1416 + name="lazy_load_exclusions"
1417 + class="sui-form-control"
1418 + aria-labelledby="lazy_load_exclusions_label"
1419 + aria-describedby="lazy_load_exclusions_description"
1420 + rows="5"
1421 + ><?php echo esc_textarea( $settings['lazy_load_exclusions'] ); ?></textarea>
1422 + <span id="lazy_load_exclusions_description" class="sui-description">
1423 + <?php esc_html_e( 'Specify keywords to exclude images or iframes from being lazy loaded. You can use full or partial strings, including the filename, CSS class, or domain. (one per line)', 'powered-cache' ); ?>
1424 + <a href="<?php echo esc_url( get_doc_url( '/enable-lazy-load/' ) ); ?>" target="_blank">(?)</a>
1425 + </span>
1426 + </div>
1427 +
1428 + <div class="sui-border-frame">
1429 + <div class="sui-form-field">
1430 + <label for="lazy_load_skip_first_nth_img" id="lazy_load_skip_first_nth_img-label">
1431 + <?php esc_html_e( 'Lazy Load from nth image', 'powered-cache' ); ?>
897 1432 </label>
1433 + <input
1434 + name="lazy_load_skip_first_nth_img"
1435 + value="<?php echo absint( $settings['lazy_load_skip_first_nth_img'] ); ?>"
1436 + id="lazy_load_skip_first_nth_img"
1437 + class="sui-form-control sui-field-has-suffix"
1438 + type="number"
1439 + min="0"
1440 + max="30"
1441 + />
1442 + <div class="sui-description">
1443 + <?php esc_html_e( 'Do not lazy load the first X images. This value can be modified to prevent the lazy loading of above-the-fold images, which otherwise could negatively affect the Largest Contentful Paint (LCP).', 'powered-cache' ); ?>
1444 + </div>
898 1445 </div>
899 1446 </div>
900 -
901 1447 </div>
902 1448
903 1449 <div class="sui-row">
904 1450 <label for="disable_wp_lazy_load" class="sui-toggle">
@@ -918,8 +1464,41 @@
918 1464 </div>
919 1465
920 1466 </div>
921 1467
1468 + <div class="sui-box-settings-row <?php echo( ! is_premium() ? 'sui-disabled' : '' ); ?>">
1469 + <div class="sui-box-settings-col-1">
1470 + <span class="sui-settings-label"><?php esc_html_e( 'Image Dimensions', 'powered-cache' ); ?>
1471 + <?php if ( ! is_premium() ) : ?>
1472 + <span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Premium', 'powered-cache' ); ?></span>
1473 + <?php endif; ?>
1474 + </span>
1475 + <span class="sui-description"></span>
1476 + </div>
1477 +
1478 + <div class="sui-box-settings-col-2">
1479 + <div class="sui-form-field">
1480 + <label for="add_missing_image_dimensions" class="sui-toggle">
1481 + <input
1482 + type="checkbox"
1483 + id="add_missing_image_dimensions"
1484 + name="add_missing_image_dimensions"
1485 + aria-labelledby="add_missing_image_dimensions_label"
1486 + aria-describedby="add_missing_image_dimensions_description"
1487 + value="1"
1488 + <?php checked( 1, $settings['add_missing_image_dimensions'] ); ?>
1489 + <?php echo( ! is_premium() ? 'disabled="disabled"' : '' ); ?>
1490 + >
1491 + <span class="sui-toggle-slider" aria-hidden="true"></span>
1492 + <span id="add_missing_image_dimensions_label" class="sui-toggle-label"><?php esc_html_e( 'Add missing image dimensions.', 'powered-cache' ); ?></span>
1493 + <span id="add_missing_image_dimensions_description" class="sui-description"><?php esc_html_e( 'Adds missing width and height attributes into images, potentially preventing layout shifts and enhancing the experience for your visitors.', 'powered-cache' ); ?>
1494 + <a href="<?php echo esc_url( get_doc_url( '/image-dimensions/' ) ); ?>" target="_blank">(?)</a>
1495 + </span>
1496 + </label>
1497 + </div>
1498 + </div>
1499 + </div>
1500 +
922 1501 <div class="sui-box-settings-row">
923 1502
924 1503 <div class="sui-box-settings-col-1">
925 1504 <span class="sui-settings-label"><?php esc_html_e( 'Embeds', 'powered-cache' ); ?></span>
@@ -940,9 +1519,9 @@
940 1519 >
941 1520 <span class="sui-toggle-slider" aria-hidden="true"></span>
942 1521 <span id="disable_wp_embeds_label" class="sui-toggle-label"><?php esc_html_e( 'Disable WordPress Embeds', 'powered-cache' ); ?></span>
943 1522 <span id="disable_wp_embeds_description" class="sui-description"><?php esc_html_e( 'Disables embedding posts from WordPress-based websites (including your own) which converts URLs into heavy iframes.', 'powered-cache' ); ?>
944 - (<a href="<?php echo esc_url( get_doc_url( '/disable-wordpress-embeds/' ) ); ?>" target="_blank">?</a>)
1523 + <a href="<?php echo esc_url( get_doc_url( '/disable-wordpress-embeds/' ) ); ?>" target="_blank">(?)</a>
945 1524 </span>
946 1525 </label>
947 1526 </div>
948 1527 </div>
@@ -970,9 +1549,9 @@
970 1549 <span class="sui-toggle-slider" aria-hidden="true"></span>
971 1550 <span id="disable_emoji_scripts_label" class="sui-toggle-label"><?php esc_html_e( 'Remove Emoji Scripts', 'powered-cache' ); ?></span>
972 1551 <span id="disable_emoji_scripts_description" class="sui-description">
973 1552 <?php esc_html_e( 'Removes the unnecessary emoji scripts from your website front-end. Doesn\'t remove emojis, don\'t worry.', 'powered-cache' ); ?>
974 - (<a href="<?php echo esc_url( get_doc_url( '/remove-emoji-scripts/' ) ); ?>" target="_blank">?</a>)
1553 + <a href="<?php echo esc_url( get_doc_url( '/remove-emoji-scripts/' ) ); ?>" target="_blank">(?)</a>
975 1554 </span>
976 1555 </label>
977 1556 </div>
978 1557 </div>
@@ -979,14 +1558,9 @@
979 1558 </div>
980 1559
981 1560 </div>
982 1561 <div class="sui-box-footer">
983 - <div class="sui-actions-left">
984 - <button type="submit" name="powered_cache_form_action" value="save_settings" class="sui-button sui-button-blue">
985 - <i class="sui-icon-save" aria-hidden="true"></i>
986 - <?php esc_html_e( 'Update settings', 'powered-cache' ); ?>
987 - </button>
988 - </div>
1562 + <?php require 'settings-form-action.php'; ?>
989 1563 </div>
990 1564 </div>
991 1565
992 1566 <!-- TAB: CDN -->
@@ -1017,9 +1591,10 @@
1017 1591 >
1018 1592 <span class="sui-toggle-slider" aria-hidden="true"></span>
1019 1593 <span id="enable_cdn_label" class="sui-toggle-label"><?php esc_html_e( 'Enable CDN Integration', 'powered-cache' ); ?></span>
1020 1594 <span id="enable_cdn_description" class="sui-description"><?php esc_html_e( 'Please make sure that your CDN is properly setup before enabling this feature ', 'powered-cache' ); ?>
1021 - <a href="<?php echo esc_url( get_doc_url( '/cdn-integration/' ) ); ?>" target="_blank">(?)</a></span>
1595 + <a href="<?php echo esc_url( get_doc_url( '/cdn-integration/' ) ); ?>" target="_blank">(?)</a>
1596 + </span>
1022 1597 </label>
1023 1598 </div>
1024 1599 </div>
1025 1600
@@ -1032,15 +1607,25 @@
1032 1607 </div>
1033 1608
1034 1609 <div class="sui-box-settings-col-2">
1035 1610 <div id="cdn-zones" class="sui-form-field">
1611 + <?php
1612 + if ( empty( $settings['cdn_hostname'] ) ) {
1613 + $settings['cdn_hostname'] = [ '' ];
1614 + }
1615 +
1616 + if ( empty( $settings['cdn_zone'] ) ) {
1617 + $settings['cdn_zone'] = [ '' ];
1618 + }
1619 + ?>
1620 +
1036 1621 <?php foreach ( $settings['cdn_hostname'] as $key => $cdn ) : ?>
1037 1622 <div id="cdn-zone-<?php echo absint( $key ); ?>" class="cdn-zone sui-form-field">
1038 - <input id="cdn_hostname" value="<?php echo esc_url( $cdn ); ?>" name="cdn_hostname[]" style="width: 300px" placeholder="https://cdn.example.org" class="cdn_hostname sui-form-control sui-input-md sui-field-has-suffix" aria-labelledby="label-unique-id">
1039 - <span>for</span>
1040 - <span class="sui-field-suffix" style="width: 120px">
1623 + <input id="cdn_hostname_<?php echo absint( $key ); ?>" value="<?php echo esc_attr( $cdn ); ?>" name="cdn_hostname[]" style="width: 300px" placeholder="cdn.example.org" class="cdn_hostname sui-form-control sui-input-md sui-field-has-suffix">
1624 + <span><?php esc_html_e( 'for', 'powered-cache' ); ?></span>
1625 + <span class="sui-field-suffix" style="min-width: 120px;">
1041 1626 <div class="sui-form-field sui-input-md">
1042 - <select id="cdn_zone" name="cdn_zone[]" class="sui-form-control cdn_zone">
1627 + <select id="cdn_zone_<?php echo absint( $key ); ?>" name="cdn_zone[]" class="sui-form-control cdn_zone">
1043 1628 <?php foreach ( cdn_zones() as $zone => $zone_name ) : ?>
1044 1629 <option <?php selected( $settings['cdn_zone'][ $key ], $zone ); ?> value="<?php echo esc_attr( $zone ); ?>"><?php echo esc_attr( $zone_name ); ?></option>
1045 1630 <?php endforeach; ?>
1046 1631 </select>
@@ -1090,14 +1675,9 @@
1090 1675 </div>
1091 1676
1092 1677 </div>
1093 1678 <div class="sui-box-footer">
1094 - <div class="sui-actions-left">
1095 - <button type="submit" name="powered_cache_form_action" value="save_settings" class="sui-button sui-button-blue">
1096 - <i class="sui-icon-save" aria-hidden="true"></i>
1097 - <?php esc_html_e( 'Update settings', 'powered-cache' ); ?>
1098 - </button>
1099 - </div>
1679 + <?php require 'settings-form-action.php'; ?>
1100 1680 </div>
1101 1681 </div>
1102 1682
1103 1683 <!-- TAB: Preload -->
@@ -1115,9 +1695,28 @@
1115 1695 <span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>
1116 1696 <p><?php esc_html_e( 'It seems page caching is not activated yet. Page caching needs to be enabled in order to get the advantage of preloading features!', 'powered-cache' ); ?></p>
1117 1697 </div>
1118 1698 </div>
1699 +
1119 1700 </div>
1701 + <?php if ( $settings['enable_cache_preload'] ) : ?>
1702 + <?php
1703 + $batch = CachePreloader::factory()->get_batches( 1 );
1704 + $remaining_item = ! empty( $batch[0] ) && $batch[0]->data ? count( $batch[0]->data ) : 0;
1705 + ?>
1706 + <?php if ( ! empty( $remaining_item ) ) : ?>
1707 + <div class="sui-notice sui-notice-warning" style="padding:10px 20px;margin-bottom:0;">
1708 + <div class="sui-notice-content">
1709 + <div class="sui-notice-message">
1710 + <span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>
1711 + <p>
1712 + <?php echo esc_html( sprintf( __( 'Preloader is currently running. Remaining items: %d (Refresh to see progress)', 'powered-cache' ), $remaining_item ) ); ?>
1713 + </p>
1714 + </div>
1715 + </div>
1716 + </div>
1717 + <?php endif; ?>
1718 + <?php endif; ?>
1120 1719
1121 1720 <div class="sui-box-settings-row">
1122 1721
1123 1722 <div class="sui-box-settings-col-1">
@@ -1123,9 +1722,9 @@
1123 1722 <div class="sui-box-settings-col-1">
1124 1723 <span class="sui-settings-label"><?php esc_html_e( 'Cache Preload', 'powered-cache' ); ?></span>
1125 1724 <span class="sui-description">
1126 1725 <?php esc_html_e( 'Preloading will visit pages based on the settings and generate cache, just like any other visitor to the site.', 'powered-cache' ); ?>
1127 - (<a href="<?php echo esc_url( get_doc_url( '/enable-preloading/' ) ); ?>" target="_blank">?</a>)
1726 + <a href="<?php echo esc_url( get_doc_url( '/enable-preloading/' ) ); ?>" target="_blank">(?)</a>
1128 1727 </span>
1129 1728 </div>
1130 1729
1131 1730 <div class="sui-box-settings-col-2">
@@ -1203,8 +1802,28 @@
1203 1802 <span id="preload_public_tax_label" class="sui-toggle-label"><?php esc_html_e( 'Enable for public taxonomies', 'powered-cache' ); ?></span>
1204 1803 <span id="preload_public_tax_description" class="sui-description"><?php esc_html_e( 'Preload archive pages of taxonomies. (tags, category etc..)', 'powered-cache' ); ?></span>
1205 1804 </label>
1206 1805 </div>
1806 + <div class="sui-row sui-border-frame">
1807 +
1808 + <div class="sui-form-field">
1809 + <label for="preload_request_interval" id="preload_request_interval-label" class="sui-label"><?php esc_html_e( 'Preloader request interval', 'powered-cache' ); ?></label>
1810 + <input
1811 + name="preload_request_interval"
1812 + value="<?php echo esc_attr( $settings['preload_request_interval'] ); ?>"
1813 + id="preload_request_interval"
1814 + class="sui-form-control sui-field-has-suffix"
1815 + type="number"
1816 + min="1"
1817 + max="10"
1818 + />
1819 + <span class="sui-field-suffix">
1820 + <span class="sui-description"><?php esc_html_e( 'Seconds', 'powered-cache' ); ?></span>
1821 + </span>
1822 + <span class="sui-description"><?php esc_html_e( 'Adjust the delay between preload requests. If your website is hosted on a slow server, consider increasing the interval between requests.', 'powered-cache' ); ?></span>
1823 +
1824 + </div>
1825 + </div>
1207 1826 </div>
1208 1827
1209 1828 </div>
1210 1829 </div>
@@ -1256,9 +1875,9 @@
1256 1875 rows="7"
1257 1876 ><?php echo esc_textarea( $settings['preload_sitemap'] ); ?></textarea>
1258 1877 <span id="preload_sitemap_description" class="sui-description">
1259 1878 <?php esc_html_e( 'Preload the urls in listed sitemaps.', 'powered-cache' ); ?>
1260 - (<a href="<?php echo esc_url( get_doc_url( '/sitemap-preloading/' ) ); ?>" target="_blank">?</a>)
1879 + <a href="<?php echo esc_url( get_doc_url( '/sitemap-preloading/' ) ); ?>" target="_blank">(?)</a>
1261 1880 </span>
1262 1881 </div>
1263 1882
1264 1883 </div>
@@ -1266,9 +1885,9 @@
1266 1885 </div>
1267 1886 </div>
1268 1887 </div>
1269 1888
1270 - <!-- Mobile Cache settings -->
1889 + <!-- DNS Prefetch settings -->
1271 1890 <div class="sui-box-settings-row">
1272 1891 <div class="sui-box-settings-col-1">
1273 1892 <span class="sui-settings-label"><?php esc_html_e( 'Prefetch DNS', 'powered-cache' ); ?></span>
1274 1893 <span class="sui-description"><?php esc_html_e( 'DNS-prefetch is an attempt to resolve domain names before resources get requested.', 'powered-cache' ); ?></span>
@@ -1279,9 +1898,9 @@
1279 1898 <div class="sui-col-md-8">
1280 1899 <div class="sui-form-field">
1281 1900 <label for="prefetch_dns" class="sui-label"><i><?php esc_html_e( 'Enter external hosts to be prefetched (one per line)', 'powered-cache' ); ?></i></label>
1282 1901 <textarea
1283 - placeholder="https://fonts.googleapis.com"
1902 + placeholder="//fonts.googleapis.com"
1284 1903 id="prefetch_dns"
1285 1904 name="prefetch_dns"
1286 1905 class="sui-form-control"
1287 1906 aria-describedby="prefetch_dns_description"
@@ -1288,24 +1907,124 @@
1288 1907 rows="7"
1289 1908 ><?php echo esc_textarea( $settings['prefetch_dns'] ); ?></textarea>
1290 1909 <span id="prefetch_dns_description" class="sui-description">
1291 1910 <?php esc_html_e( 'DNS-prefetch would reduce DNS lookup time.', 'powered-cache' ); ?>
1292 - (<a href="<?php echo esc_url( get_doc_url( '/prefetch-dns/' ) ); ?>" target="_blank">?</a>)
1911 + <a href="<?php echo esc_url( get_doc_url( '/prefetch-dns/' ) ); ?>" target="_blank">(?)</a>
1293 1912 </span>
1294 1913 </div>
1295 1914 </div>
1296 1915 </div>
1297 1916 </div>
1917 +
1298 1918 </div>
1919 + <div class="sui-box-settings-row">
1920 + <div class="sui-box-settings-col-1">
1921 + <span class="sui-settings-label"><?php esc_html_e( 'Preconnect', 'powered-cache' ); ?></span>
1922 + <span class="sui-description"><?php esc_html_e( 'Preconnect is used to indicate an origin that will be used to fetch required resources. It initializes an early connection, which includes the DNS lookup, TCP handshake, and optional TLS negotiation.', 'powered-cache' ); ?></span>
1923 + </div>
1299 1924
1925 + <div class="sui-box-settings-col-2">
1926 + <div class="sui-row">
1927 + <div class="sui-col-md-8">
1928 + <div class="sui-form-field">
1929 + <label for="preconnect_resource" class="sui-label"><i><?php esc_html_e( 'Enter external hosts to be preconnected (one per line)', 'powered-cache' ); ?></i></label>
1930 + <textarea
1931 + placeholder="https://fonts.googleapis.com"
1932 + id="preconnect_resource"
1933 + name="preconnect_resource"
1934 + class="sui-form-control"
1935 + aria-describedby="preconnect_resource_description"
1936 + rows="7"
1937 + ><?php echo esc_textarea( $settings['preconnect_resource'] ); ?></textarea>
1938 + <span id="preconnect_resource_description" class="sui-description">
1939 + <?php esc_html_e( 'The preconnect hint is best used for only the most critical connections.', 'powered-cache' ); ?>
1940 + <a href="<?php echo esc_url( get_doc_url( '/preconnect-resources/' ) ); ?>" target="_blank">(?)</a>
1941 + </span>
1942 + </div>
1943 + </div>
1944 + </div>
1945 + </div>
1946 +
1947 +
1948 + </div>
1949 +
1950 + <div class="sui-box-settings-row <?php echo( ! is_premium() ? 'sui-disabled' : '' ); ?>">
1951 + <div class="sui-box-settings-col-1">
1952 + <span class="sui-settings-label"><?php esc_html_e( 'LCP Optimization', 'powered-cache' ); ?>
1953 + <?php if ( ! is_premium() ) : ?>
1954 + <span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Premium', 'powered-cache' ); ?></span>
1955 + <?php endif; ?>
1956 + </span>
1957 + <span class="sui-description"></span>
1958 + </div>
1959 +
1960 + <div class="sui-box-settings-col-2">
1961 + <div class="sui-form-field">
1962 + <label for="enable_lcp_optimization" class="sui-toggle">
1963 + <input
1964 + type="checkbox"
1965 + id="enable_lcp_optimization"
1966 + name="enable_lcp_optimization"
1967 + value="1"
1968 + aria-labelledby="enable_lcp_optimization_label"
1969 + aria-describedby="enable_lcp_optimization_description"
1970 + <?php checked( $settings['enable_lcp_optimization'], 1 ); ?>
1971 + >
1972 + <span class="sui-toggle-slider" aria-hidden="true"></span>
1973 + <span id="enable_lcp_optimization_label" class="sui-toggle-label">
1974 + <?php esc_html_e( 'Enable Automatic LCP Optimization', 'powered-cache' ); ?>
1975 + </span>
1976 + <span id="enable_lcp_optimization_description" class="sui-description">
1977 + <?php esc_html_e( 'Automatically detect and preload the Largest Contentful Paint (LCP) image to improve page loading experience.', 'powered-cache' ); ?>
1978 + <a href="<?php echo esc_url( get_doc_url( '/lcp-optimization/' ) ); ?>" target="_blank" rel="noopener noreferrer">
1979 + <?php esc_html_e( 'Learn more', 'powered-cache' ); ?>
1980 + </a>
1981 + </span>
1982 + </label>
1983 + </div>
1984 + </div>
1985 +
1986 + </div>
1987 +
1988 +
1989 + <div class="sui-box-settings-row <?php echo( ! is_premium() ? 'sui-disabled' : '' ); ?>">
1990 + <div class="sui-box-settings-col-1">
1991 + <span class="sui-settings-label"><?php esc_html_e( 'Prefetch links', 'powered-cache' ); ?>
1992 + <?php if ( ! is_premium() ) : ?>
1993 + <span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Premium', 'powered-cache' ); ?></span>
1994 + <?php endif; ?>
1995 + </span>
1996 + <span class="sui-description"></span>
1997 + </div>
1998 +
1999 + <div class="sui-box-settings-col-2">
2000 + <div class="sui-form-field">
2001 + <label for="prefetch_links" class="sui-toggle">
2002 + <input
2003 + type="checkbox"
2004 + id="prefetch_links"
2005 + name="prefetch_links"
2006 + aria-labelledby="prefetch_links_label"
2007 + aria-describedby="prefetch_links_description"
2008 + value="1"
2009 + <?php checked( 1, $settings['prefetch_links'] ); ?>
2010 + >
2011 + <span class="sui-toggle-slider" aria-hidden="true"></span>
2012 + <span id="prefetch_links_label" class="sui-toggle-label"><?php esc_html_e( 'Enable link prefetching', 'powered-cache' ); ?></span>
2013 + <span id="prefetch_links_description" class="sui-description"><?php esc_html_e( 'Faster subsequent page-loads by prefetching or prerendering in-viewport links during idle time.', 'powered-cache' ); ?>
2014 + <a href="<?php echo esc_url( get_doc_url( '/prefetch-links/' ) ); ?>" target="_blank">(?)</a>
2015 + </span>
2016 + </label>
2017 + </div>
2018 + </div>
2019 + </div>
2020 +
2021 +
2022 +
2023 +
1300 2024 </div>
1301 2025 <div class="sui-box-footer">
1302 - <div class="sui-actions-left">
1303 - <button type="submit" name="powered_cache_form_action" value="save_settings" class="sui-button sui-button-blue">
1304 - <i class="sui-icon-save" aria-hidden="true"></i>
1305 - <?php esc_html_e( 'Update settings', 'powered-cache' ); ?>
1306 - </button>
1307 - </div>
2026 + <?php require 'settings-form-action.php'; ?>
1308 2027 </div>
1309 2028 </div>
1310 2029
1311 2030 <!-- TAB: Dashed -->
@@ -1504,9 +2223,9 @@
1504 2223 <span class="sui-tooltip sui-tooltip-constrained" data-tooltip="<?php esc_html_e( 'Permanently delete all transients.', 'powered-cache' ); ?>">
1505 2224 <i class="sui-icon-info" aria-hidden="true"></i>
1506 2225 </span>
1507 2226 </span>
1508 - <span id="db_cleanup_all_transients_description" class="sui-description"><?php printf( esc_html__( '%s expired transient in database', 'powered-cache' ), absint( $db_info['db_cleanup_all_transients'] ) ); ?></span>
2227 + <span id="db_cleanup_all_transients_description" class="sui-description"><?php printf( esc_html__( '%s transient in database', 'powered-cache' ), absint( $db_info['db_cleanup_all_transients'] ) ); ?></span>
1509 2228 </label>
1510 2229 </div>
1511 2230 </div>
1512 2231
@@ -1556,9 +2275,9 @@
1556 2275 </div><!-- end col-third -->
1557 2276
1558 2277 <div class="sui-box-settings-col-2">
1559 2278 <div class="sui-form-field">
1560 - <label for="enable_scheduled_db_cleanup" class="sui-toggle">
2279 + <label for="enable_scheduled_db_cleanup" id="enable_scheduled_db_cleanup_label" class="sui-toggle">
1561 2280 <input
1562 2281 type="checkbox"
1563 2282 id="enable_scheduled_db_cleanup"
1564 2283 name="enable_scheduled_db_cleanup"
@@ -1644,34 +2363,54 @@
1644 2363 <div class="sui-box-body">
1645 2364 <p><?php esc_html_e( 'Cloudflare extension for PoweredCache. It allows to purge Cloudflare cache within WordPress.', 'powered-cache' ); ?></p>
1646 2365 <div id="cloudflare-details" style="<?php echo( ! $settings['enable_cloudflare'] ? 'display:none' : '' ); ?>">
1647 2366 <div class="sui-form-field">
1648 -
1649 - <label for="cloudflare-email" id="cloudflare-email-label" class="sui-label"><?php esc_html_e( 'Cloudflare Email', 'powered-cache' ); ?></label>
2367 + <label for="cloudflare-api-token" id="cloudflare-api-token-label" class="sui-label"><?php esc_html_e( 'API Token', 'powered-cache' ); ?></label>
1650 2368 <input
1651 - placeholder="john@example.com"
1652 - name="cloudflare_email"
1653 - value="<?php echo esc_attr( $settings['cloudflare_email'] ); ?>"
1654 - id="cloudflare-email"
1655 - class="sui-form-control"
2369 + name="cloudflare_api_token"
2370 + value="<?php echo esc_attr( $cf_api_token ? mask_string( $cf_api_token, UNMASK_CHARACTER_LENGTH ) : '' ); ?>"
2371 + id="cloudflare-api-token"
2372 + class="sui-form-control"
1656 2373 />
2374 + <span id="cloudflare_api_token_description" class="sui-description">
2375 + <?php esc_html_e( 'Recommended authentication method.', 'powered-cache' ); ?>
2376 + <a href="<?php echo esc_url( 'https://dash.cloudflare.com/profile/api-tokens' ); ?>" rel="noopener" target="_blank">
2377 + <?php esc_html_e( 'Create a new token', 'powered-cache' ); ?>
2378 + </a>
2379 + <?php esc_html_e( 'Or you can enter Cloudflare email and API Key.', 'powered-cache' ); ?>
2380 + </span>
1657 2381 </div>
1658 2382
1659 - <div class="sui-form-field">
1660 2383
1661 - <label for="cloudflare-api-key" id="cloudflare-api-key-label" class="sui-label"><?php esc_html_e( 'API Key', 'powered-cache' ); ?></label>
2384 + <div id="cloudflare-api-details" class="sui-row" style="<?php echo( ! empty( $cf_api_token ) ? 'display:none' : '' ); ?>">
2385 + <div class="sui-col">
2386 + <div class="sui-form-field">
2387 + <label for="cloudflare-email" id="cloudflare-email-label" class="sui-label"><?php esc_html_e( 'Cloudflare Email', 'powered-cache' ); ?></label>
2388 + <input
2389 + placeholder="john@example.com"
2390 + name="cloudflare_email"
2391 + value="<?php echo esc_attr( $settings['cloudflare_email'] ); ?>"
2392 + id="cloudflare-email"
2393 + class="sui-form-control"
2394 + />
2395 + </div>
2396 + </div>
1662 2397
1663 - <input
1664 - name="cloudflare_api_key"
1665 - value="<?php echo esc_attr( $settings['cloudflare_api_key'] ); ?>"
1666 - id="cloudflare-api-key"
1667 - class="sui-form-control"
1668 - type="password"
1669 - />
1670 - </div>
2398 + <div class="sui-col">
2399 + <div class="sui-form-field">
2400 + <label for="cloudflare-api-key" id="cloudflare-api-key-label" class="sui-label"><?php esc_html_e( 'API Key', 'powered-cache' ); ?></label>
2401 + <input
2402 + name="cloudflare_api_key"
2403 + value="<?php echo esc_attr( $cf_api_key ? mask_string( $cf_api_key, UNMASK_CHARACTER_LENGTH ) : '' ); ?>"
2404 + id="cloudflare-api-key"
2405 + class="sui-form-control"
2406 + />
2407 + </div>
2408 + </div>
2409 + </div>
1671 2410
2411 +
1672 2412 <div class="sui-form-field">
1673 -
1674 2413 <label for="cloudflare-zone" id="cloudflare-zone-label" class="sui-label"><?php esc_html_e( 'Zone ID', 'powered-cache' ); ?></label>
1675 2414
1676 2415 <input
1677 2416 name="cloudflare_zone"
@@ -1756,9 +2495,9 @@
1756 2495 <span id="heartbeat-dashboard-modify-label"><?php esc_html_e( 'Modify', 'powered-cache' ); ?></span>
1757 2496 </label>
1758 2497 </div>
1759 2498 <div id="heartbeat-dashboard-interval-control" style="<?php echo( ! ( 'modify' === $settings['heartbeat_dashboard_status'] ) ? 'display:none' : '' ); ?>">
1760 - <label for="heartbeat-dashboard" id="heartbeat-dashboard-label" class="sui-label"><?php esc_html_e( 'Heartbeat Interval for Dashboard', 'powered-cache' ); ?></label>
2499 + <label for="heartbeat_dashboard_interval" id="heartbeat-dashboard-label" class="sui-label"><?php esc_html_e( 'Heartbeat Interval for Dashboard', 'powered-cache' ); ?></label>
1761 2500 <div class="sui-form-field">
1762 2501 <input
1763 2502 name="heartbeat_dashboard_interval"
1764 2503 value="<?php echo esc_attr( $settings['heartbeat_dashboard_interval'] ); ?>"
@@ -1821,9 +2560,9 @@
1821 2560 <span id="heartbeat-editor-modify-label"><?php esc_html_e( 'Modify', 'powered-cache' ); ?></span>
1822 2561 </label>
1823 2562 </div>
1824 2563 <div id="heartbeat-editor-interval-control" style="<?php echo( ! ( 'modify' === $settings['heartbeat_editor_status'] ) ? 'display:none' : '' ); ?>">
1825 - <label for="heartbeat-editor" id="heartbeat-editor-label" class="sui-label"><?php esc_html_e( 'Heartbeat Interval for Post Editor', 'powered-cache' ); ?></label>
2564 + <label for="heartbeat_editor_interval" id="heartbeat-editor-label" class="sui-label"><?php esc_html_e( 'Heartbeat Interval for Post Editor', 'powered-cache' ); ?></label>
1826 2565 <div class="sui-form-field">
1827 2566 <input
1828 2567 name="heartbeat_editor_interval"
1829 2568 value="<?php echo esc_attr( $settings['heartbeat_editor_interval'] ); ?>"
@@ -1884,9 +2623,9 @@
1884 2623 </label>
1885 2624 </div>
1886 2625
1887 2626 <div id="heartbeat-frontend-interval-control" style="<?php echo( ! ( 'modify' === $settings['heartbeat_frontend_status'] ) ? 'display:none' : '' ); ?>">
1888 - <label for="heartbeat-frontend" id="heartbeat-frontend-label" class="sui-label"><?php esc_html_e( 'Heartbeat Interval for Dashboard', 'powered-cache' ); ?></label>
2627 + <label for="heartbeat_frontend_interval" id="heartbeat-frontend-label" class="sui-label"><?php esc_html_e( 'Heartbeat Interval for Dashboard', 'powered-cache' ); ?></label>
1889 2628 <div class="sui-form-field">
1890 2629 <input
1891 2630 name="heartbeat_frontend_interval"
1892 2631 value="<?php echo esc_attr( $settings['heartbeat_frontend_interval'] ); ?>"
@@ -1962,9 +2701,9 @@
1962 2701 <?php if ( ! is_premium() ) : ?>
1963 2702 <div class="sui-box-settings-row sui-upsell-row">
1964 2703 <div class="sui-upsell-notice" style="padding-left: 0;">
1965 2704 <p><?php esc_html_e( 'With our premium version of Powered Cache you can use Varnish extension and unlock some other speedbooster features.', 'powered-cache' ); ?><br>
1966 - <button class="sui-button sui-button-purple" style="margin-top: 10px;"><?php esc_html_e( 'Try Premium today', 'powered-cache' ); ?></button>
2705 + <a href="https://poweredcache.com/" rel="noopener" target="_blank" class="sui-button sui-button-purple" style="margin-top: 10px;color:#fff;"><?php esc_html_e( 'Try Premium today', 'powered-cache' ); ?></a>
1967 2706 </p>
1968 2707 </div>
1969 2708 </div>
1970 2709 <?php endif; ?>
@@ -1983,9 +2722,9 @@
1983 2722 </div>
1984 2723 <?php endif; ?>
1985 2724 <div class="sui-actions-right">
1986 2725 <div class="sui-form-field">
1987 - <label for="enable_google_tracking" class="sui-toggle">
2726 + <label for="enable_google_tracking" id="enable_google_tracking_label" class="sui-toggle">
1988 2727 <input
1989 2728 <?php echo( ! is_premium() ? 'disabled="disabled"' : '' ); ?>
1990 2729 type="checkbox"
1991 2730 id="enable_google_tracking"
@@ -2011,9 +2750,9 @@
2011 2750 <?php if ( ! is_premium() ) : ?>
2012 2751 <div class="sui-box-settings-row sui-upsell-row">
2013 2752 <div class="sui-upsell-notice" style="padding-left: 0;">
2014 2753 <p><?php esc_html_e( 'With our premium version of Powered Cache you can use this extension and unlock some other speedbooster features.', 'powered-cache' ); ?><br>
2015 - <button class="sui-button sui-button-purple" style="margin-top: 10px;"><?php esc_html_e( 'Try Premium today', 'powered-cache' ); ?></button>
2754 + <a href="https://poweredcache.com/" rel="noopener" target="_blank" class="sui-button sui-button-purple" style="margin-top: 10px;color:#fff;"><?php esc_html_e( 'Try Premium today', 'powered-cache' ); ?></a>
2016 2755 </p>
2017 2756 </div>
2018 2757 </div>
2019 2758 <?php endif; ?>
@@ -2064,9 +2803,9 @@
2064 2803 <?php if ( ! is_premium() ) : ?>
2065 2804 <div class="sui-box-settings-row sui-upsell-row">
2066 2805 <div class="sui-upsell-notice" style="padding-left: 0;">
2067 2806 <p><?php esc_html_e( 'With our premium version of Powered Cache you can use this extension and unlock some other speedbooster features.', 'powered-cache' ); ?><br>
2068 - <button class="sui-button sui-button-purple" style="margin-top: 10px;"><?php esc_html_e( 'Try Premium today', 'powered-cache' ); ?></button>
2807 + <a href="https://poweredcache.com/" rel="noopener" target="_blank" class="sui-button sui-button-purple" style="margin-top: 10px;color:#fff;"><?php esc_html_e( 'Try Premium today', 'powered-cache' ); ?></a>
2069 2808 </p>
2070 2809 </div>
2071 2810 </div>
2072 2811 <?php endif; ?>
@@ -2093,9 +2832,9 @@
2093 2832 </div>
2094 2833
2095 2834 <div class="sui-box-settings-col-2">
2096 2835 <div class="sui-form-field">
2097 - <label for="cache_footprint" class="sui-toggle">
2836 + <label for="cache_footprint" id="cache_footprint_label" class="sui-toggle">
2098 2837 <input
2099 2838 type="checkbox"
2100 2839 id="cache_footprint"
2101 2840 name="cache_footprint"
@@ -2105,13 +2844,86 @@
2105 2844 <?php checked( 1, $settings['cache_footprint'] ); ?>
2106 2845 >
2107 2846 <span class="sui-toggle-slider" aria-hidden="true"></span>
2108 2847 <span id="enable_cache_footprint_label" class="sui-toggle-label"><?php esc_html_e( 'Show caching footprints in the HTML output.', 'powered-cache' ); ?></span>
2109 - <span id="enable_cache_footprint_description" class="sui-description"><?php esc_html_e( 'Adds helpful informations to cached output.', 'powered-cache' ); ?></span>
2848 + <span id="enable_cache_footprint_description" class="sui-description"><?php esc_html_e( 'Adds helpful information to cached output.', 'powered-cache' ); ?></span>
2110 2849 </label>
2111 2850 </div>
2112 2851 </div>
2113 2852 </div>
2853 +
2854 + <!-- Developer Mode Toggle -->
2855 + <div class="sui-box-settings-row">
2856 + <div class="sui-box-settings-col-1">
2857 + <span class="sui-settings-label"><?php esc_html_e( 'Development Mode', 'powered-cache' ); ?></span>
2858 + <span class="sui-description"><?php esc_html_e( 'Temporarily disables caching and optimizations. Useful while making changes to your site.', 'powered-cache' ); ?></span>
2859 + </div>
2860 +
2861 + <div class="sui-box-settings-col-2">
2862 + <div class="sui-form-field">
2863 + <?php if ( \PoweredCache\Utils\is_dev_mode_active() ) : ?>
2864 + <button
2865 + type="submit"
2866 + name="powered_cache_form_action"
2867 + value="disable_dev_mode"
2868 + class="sui-button sui-button-ghost sui-button-green"
2869 + >
2870 + <?php esc_html_e( 'Disable Dev Mode', 'powered-cache' ); ?>
2871 + </button>
2872 + <p class="sui-description">
2873 + <?php esc_html_e( 'Development mode is currently active. Caching and optimizations are disabled until turned off.', 'powered-cache' ); ?>
2874 + </p>
2875 + <?php else : ?>
2876 + <button
2877 + type="submit"
2878 + name="powered_cache_form_action"
2879 + value="enable_dev_mode"
2880 + class="sui-button sui-button-ghost sui-button-red"
2881 + >
2882 + <?php esc_html_e( 'Enable Dev Mode', 'powered-cache' ); ?>
2883 + </button>
2884 + <p class="sui-description">
2885 + <?php esc_html_e( 'Temporarily disables caching and optimizations. Useful while making changes to your site.', 'powered-cache' ); ?>
2886 + </p>
2887 + <?php endif; ?>
2888 +
2889 + </div>
2890 + </div>
2891 + </div>
2892 +
2893 +
2894 + <div class="sui-box-settings-row">
2895 + <div class="sui-box-settings-col-1">
2896 + <span class="sui-settings-label"><?php esc_html_e( 'Async Cache Cleaning', 'powered-cache' ); ?>
2897 + <span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Experimental', 'powered-cache' ); ?></span>
2898 + </span>
2899 +
2900 + <span class="sui-description"></span>
2901 + </div>
2902 +
2903 + <div class="sui-box-settings-col-2">
2904 + <div class="sui-form-field">
2905 + <label for="async_cache_cleaning" id="async_cache_cleaning_label" class="sui-toggle">
2906 + <input
2907 + type="checkbox"
2908 + id="async_cache_cleaning"
2909 + name="async_cache_cleaning"
2910 + aria-labelledby="async_cache_cleaning_label"
2911 + aria-describedby="enable_async_cache_cleaning_description"
2912 + value="1"
2913 + <?php checked( 1, $settings['async_cache_cleaning'] ); ?>
2914 + >
2915 + <span class="sui-toggle-slider" aria-hidden="true"></span>
2916 + <span id="enable_async_cache_cleaning_label" class="sui-toggle-label"><?php esc_html_e( 'Enable async cache clean-up.', 'powered-cache' ); ?></span>
2917 + <span id="enable_async_cache_cleaning_description" class="sui-description"><?php esc_html_e( 'On large sites, it might take a longer time to perform cache purging actions. This option allows performing clean-up tasks in async background processes.', 'powered-cache' ); ?>
2918 + <i>(<?php esc_html_e( 'This is an experimental feature, use it wisely. It might conflict with preloading functionality since both features work in the background.', 'powered-cache' ); ?>)</i>
2919 + </span>
2920 + </label>
2921 + </div>
2922 + </div>
2923 + </div>
2924 +
2925 +
2114 2926 <?php if ( can_control_all_settings() ) : ?>
2115 2927 <div class="sui-box-settings-row">
2116 2928 <div class="sui-box-settings-col-1">
2117 2929 <span class="sui-settings-label"><?php esc_html_e( 'Download Configuration', 'powered-cache' ); ?></span>
@@ -2166,8 +2978,22 @@
2166 2978
2167 2979 <div class="sui-box-settings-col-2">
2168 2980 <div class="sui-form-field">
2169 2981 <button type="submit" role="button" name="powered_cache_form_action" value="export_settings" class="sui-button sui-button-ghost sui-button-blue"><?php esc_html_e( 'Download Settings', 'powered-cache' ); ?></button>
2982 + <?php if ( $settings['enable_cloudflare'] ) : ?>
2983 + <div role="alert" class="sui-notice sui-notice-yellow sui-active sui-padding-top" aria-live="assertive" style="display: block;">
2984 + <div class="sui-notice-content">
2985 + <div class="sui-notice-message">
2986 + <span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>
2987 + <p>
2988 + <strong><?php esc_html_e( 'Please note:', 'powered-cache' ); ?></strong>
2989 + <?php esc_html_e( 'Due to the sensitive nature of Cloudflare API credentials, they will not be included in the exported settings file.', 'powered-cache' ); ?>
2990 + <a href="<?php echo esc_url( get_doc_url( 'cloudflare' ) ); ?>" target="_blank"><?php esc_html_e( 'Learn More', 'powered-cache' ); ?></a>
2991 + </p>
2992 + </div>
2993 + </div>
2994 + </div>
2995 + <?php endif; ?>
2170 2996 </div>
2171 2997 </div>
2172 2998 </div>
2173 2999