| 1 |
<?php |
| 2 |
|
| 3 |
$notice = ''; |
| 4 |
|
| 5 |
$cache_messages = [ |
| 6 |
'fastcgi-saved' => __( 'Cache settings has been updated.', 'flywp' ), |
| 7 |
'fastcgi-purged' => __( 'Cache has been cleared.', 'flywp' ), |
| 8 |
'fastcgi-enabled' => __( 'Page Caching has been enabled.', 'flywp' ), |
| 9 |
'fastcgi-disabled' => __( 'Page Caching has been disabled.', 'flywp' ), |
| 10 |
]; |
| 11 |
|
| 12 |
if ( isset( $_GET['fly-notice'] ) && isset( $cache_messages[ $_GET['fly-notice'] ] ) ) { |
| 13 |
$notice = $cache_messages[ $_GET['fly-notice'] ]; |
| 14 |
} |
| 15 |
?> |
| 16 |
|
| 17 |
<div class="fw-bg-white fw-shadow fw-rounded fw-sm:rounded-lg fw-mb-6"> |
| 18 |
<div class=""> |
| 19 |
<div class="fw-flex fw-px-4 fw-py-4 fw-fw-sm:p-6 fw-items-center fw-justify-between fw-border-b fw-border-gray-200"> |
| 20 |
<h3 class="fw-text-lg fw-font-semibold fw-leading-6 fw-text-gray-900 fw-m-0"> |
| 21 |
<?php esc_html_e( 'Page Cache', 'flywp' ); ?> |
| 22 |
</h3> |
| 23 |
|
| 24 |
<?php if ( flywp()->fastcgi->enabled() ) { ?> |
| 25 |
<div class="fw-text-green-600"> |
| 26 |
<span class="dashicons dashicons-yes-alt"></span> |
| 27 |
<?php esc_html_e( 'Enabled', 'flywp' ); ?> |
| 28 |
</div> |
| 29 |
<?php } else { ?> |
| 30 |
|
| 31 |
<div class="fw-text-gray-400"> |
| 32 |
<span class="dashicons dashicons-no-alt"></span> |
| 33 |
<?php esc_html_e( 'Disabled', 'flywp' ); ?> |
| 34 |
</div> |
| 35 |
<?php } ?> |
| 36 |
</div> |
| 37 |
|
| 38 |
<?php if ( $notice ) { ?> |
| 39 |
<div class="fw-bg-green-200 fw-text-green-800 fw-px-4 fw-py-1 fly-form-notice"> |
| 40 |
<p><?php echo esc_html( $notice ); ?></p> |
| 41 |
</div> |
| 42 |
<?php } ?> |
| 43 |
|
| 44 |
<div class="fw-mt-2 fw-px-4 fw-py-4 fw-fw-sm:p-6 fw-text-sm fw-text-gray-500 md:fw-flex"> |
| 45 |
<div class="md:fw-w-2/3"> |
| 46 |
<p class="fw-mt-0 fw-text-sm"><?php esc_html_e( 'Nginx FastCGI Cache is a very fast page caching system that boosts up your website page load speed. It\'s recommended to enable the page cache.', 'flywp' ); ?></p> |
| 47 |
</div> |
| 48 |
|
| 49 |
<?php if ( flywp()->fastcgi->enabled() ) { ?> |
| 50 |
<div class="md:fw-w-1/3 fw-text-center md:fw-text-right"> |
| 51 |
<a href="<?php echo esc_url( flywp()->fastcgi->purge_cache_url() ); ?>" class="button button-primary button-hero !fw-bg-indigo-600 hover:!fw-bg-indigo-700"><?php esc_html_e( 'Clear Cache', 'flywp' ); ?></a> |
| 52 |
</div> |
| 53 |
<?php } ?> |
| 54 |
</div> |
| 55 |
|
| 56 |
<div class="fw-px-4 fw-py-3 fw-fw-sm:p-6 fw-mt-5 fw-bg-gray-100 fw-p-4 fw-border-t fw-rounded-br fw-rounded-bl fw-border-gray-200 fw-text-right"> |
| 57 |
<?php if ( flywp()->fastcgi->enabled() ) { ?> |
| 58 |
<a href="<?php echo esc_url( $this->fastcgi->enable_disable_url( 'disable' ) ); ?>" class="button button-secondary button-large"> |
| 59 |
<?php esc_html_e( 'Disable', 'flywp' ); ?> |
| 60 |
</a> |
| 61 |
<?php } else { ?> |
| 62 |
|
| 63 |
<a href="<?php echo esc_url( $this->fastcgi->enable_disable_url( 'enable' ) ); ?>" class="button button-primary button-large"> |
| 64 |
<?php esc_html_e( 'Enable Cache', 'flywp' ); ?> |
| 65 |
</a> |
| 66 |
<?php } ?> |
| 67 |
|
| 68 |
<button type="button" class="button button-secondary button-large fw-flex fw-items-center" id="fastcgi-settings-button"> |
| 69 |
<span class="dashicons dashicons-admin-generic button-active fw-mt-1"></span> |
| 70 |
<?php esc_html_e( 'Settings', 'flywp' ); ?> |
| 71 |
</button> |
| 72 |
</div> |
| 73 |
|
| 74 |
<div class="fw-px-4 fw-py-3 fw-hidden" id="fastcgi-settings"> |
| 75 |
<form method="POST" action=""> |
| 76 |
<p><strong><?php esc_html_e( 'Homepage Settings', 'flywp' ); ?></strong></p> |
| 77 |
|
| 78 |
<label for="home-purge-created" class="fw-block fw-pb-3"> |
| 79 |
<input name="home-purge-created" type="checkbox" <?php checked( flywp()->fastcgi->get_setting( 'home_created' ), true ); ?> id="home-purge-created" value="1"> |
| 80 |
<?php esc_html_e( 'Flush homepage when a post is published or modified', 'flywp' ); ?> |
| 81 |
</label> |
| 82 |
|
| 83 |
<label for="home-purge-deleted" class="fw-block fw-pb-3"> |
| 84 |
<input name="home-purge-deleted" type="checkbox" <?php checked( flywp()->fastcgi->get_setting( 'home_deleted' ), true ); ?> id="home-purge-deleted" value="1"> |
| 85 |
<?php esc_html_e( 'Flush homepage when a post is deleted', 'flywp' ); ?> |
| 86 |
</label> |
| 87 |
|
| 88 |
<!-- |
| 89 |
<p><strong>Single Post</strong></p> |
| 90 |
|
| 91 |
<label for="single-post-created" class="fw-block fw-pb-3"> |
| 92 |
<input name="single-post-created" type="checkbox" <?php checked( flywp()->fastcgi->get_setting( 'single_modified' ), true ); ?> id="single-post-created" value="1"> |
| 93 |
Flush the single post page when it's modified |
| 94 |
</label> |
| 95 |
|
| 96 |
<label for="single-post-comment" class="fw-block fw-pb-3"> |
| 97 |
<input name="single-post-comment" type="checkbox" <?php checked( flywp()->fastcgi->get_setting( 'single_comment' ), true ); ?> id="single-post-comment" value="1"> |
| 98 |
Flush the single post page when a comment is added or deleted |
| 99 |
</label> |
| 100 |
--> |
| 101 |
|
| 102 |
<div class="fw-pt-4 fw-text-right"> |
| 103 |
<button type="button" class="button button-secondary button-large" id="fastcgi-settings-close"> |
| 104 |
<?php esc_html_e( 'Close', 'flywp' ); ?> |
| 105 |
</button> |
| 106 |
<?php submit_button( __( 'Save Changes', 'flywp' ), 'primary', 'submit', false ); ?> |
| 107 |
<?php wp_nonce_field( 'flywp-fastcgi-nonce', 'flywp-fastcgi-nonce' ); ?> |
| 108 |
</div> |
| 109 |
</form> |
| 110 |
</div> |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
|