| 1 |
<div class="fw-bg-white fw-shadow fw-rounded fw-sm:rounded-lg fw-mb-4"> |
| 2 |
<form method="POST" action=""> |
| 3 |
<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"> |
| 4 |
<h2 class="fw-text-lg fw-font-semibold fw-m-0"> |
| 5 |
<?php esc_html_e( 'WordPress Optimizations', 'flywp' ); ?> |
| 6 |
</h2> |
| 7 |
|
| 8 |
<?php if ( flywp()->optimize->enabled() ) { ?> |
| 9 |
<div class="fw-text-green-600"> |
| 10 |
<span class="dashicons dashicons-yes-alt"></span> |
| 11 |
<?php esc_html_e( 'Enabled', 'flywp' ); ?> |
| 12 |
</div> |
| 13 |
<?php } else { ?> |
| 14 |
|
| 15 |
<div class="fw-text-gray-400"> |
| 16 |
<span class="dashicons dashicons-no-alt"></span> |
| 17 |
<?php esc_html_e( 'Disabled', 'flywp' ); ?> |
| 18 |
</div> |
| 19 |
<?php } ?> |
| 20 |
</div> |
| 21 |
|
| 22 |
<?php if ( isset( $_GET['message'] ) && $_GET['message'] === 'optimizations-settings-saved' ) { ?> |
| 23 |
<div class="fw-bg-green-200 fw-text-green-800 fw-px-4 fw-py-1 fly-form-notice"> |
| 24 |
<p><?php esc_html_e( 'Optimization settings have been saved.', 'flywp' ); ?></p> |
| 25 |
</div> |
| 26 |
<?php } ?> |
| 27 |
|
| 28 |
<div class="fw-mt-2 fw-px-4 fw-py-4 fw-fw-sm:p-6 fw-text-sm fw-text-gray-500 fw-space-y-8" id="optimization-wrapper"> |
| 29 |
|
| 30 |
<div class="fw-flex fw-gap-3 fw-mb-4"> |
| 31 |
<label for="enable-optimization" class="fw-block fw-switch fw-mt-1"> |
| 32 |
<input type="checkbox" id="enable-optimization" name="enabled" class="fw-switch-input" <?php checked( flywp()->optimize->enabled() ); ?> /> |
| 33 |
<span class="fw-switch-toggle"></span> |
| 34 |
</label> |
| 35 |
|
| 36 |
<div class="fw-flex-1"> |
| 37 |
<div class="fw-font-medium fw-text-gray-700 fw-mb-1"> |
| 38 |
<?php echo esc_html( __( 'Enable WordPress Optimizations', 'flywp ' ) ); ?> |
| 39 |
</div> |
| 40 |
|
| 41 |
<div class="fw-text-gray-500"> |
| 42 |
<?php echo esc_html( __( 'Enable or disable WordPress optimizations.', 'flywp' ) ); ?> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
</div> |
| 46 |
|
| 47 |
<?php $show_class = flywp()->optimize->enabled() ? '' : 'style="display:none"'; ?> |
| 48 |
<?php foreach ( self::options() as $section => $data ) { ?> |
| 49 |
<div class="section section-<?php echo esc_attr( $section ); ?>" <?php echo $show_class; ?>> |
| 50 |
<div class="fw-border-b fw-border-gray-200 fw-mb-6 fw-pb-3"> |
| 51 |
<h3 class="fw-text-base fw-font-semibold fw-m-0"><?php echo esc_html( $data['title'] ); ?></h3> |
| 52 |
<p class="fw-text-gray-600 fw-m-0"><?php echo esc_html( $data['description'] ); ?></p> |
| 53 |
</div> |
| 54 |
|
| 55 |
<?php foreach ( $data['fields'] as $key => $field ) { ?> |
| 56 |
<div class="fw-flex fw-gap-3 fw-mb-4"> |
| 57 |
<label for="<?php echo esc_attr( $section . '-' . $key ); ?>" class="fw-block fw-switch fw-mt-1"> |
| 58 |
<input type="checkbox" id="<?php echo esc_attr( $section . '-' . $key ); ?>" name="<?php echo esc_attr( $section . '[' . $key . ']' ); ?>" class="fw-switch-input" <?php checked( flywp()->optimize->feature_enabled( $key, $section ) ); ?> /> |
| 59 |
<span class="fw-switch-toggle"></span> |
| 60 |
</label> |
| 61 |
|
| 62 |
<div class="fw-flex-1"> |
| 63 |
<div class="fw-font-medium fw-text-gray-700 fw-mb-1"> |
| 64 |
<?php echo esc_html( $field['label'] ); ?> |
| 65 |
</div> |
| 66 |
|
| 67 |
<div class="fw-text-gray-500"> |
| 68 |
<?php echo esc_html( $field['description'] ); ?> |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
|
| 73 |
<?php } ?> |
| 74 |
|
| 75 |
</div> |
| 76 |
|
| 77 |
<?php } ?> |
| 78 |
</div> |
| 79 |
|
| 80 |
<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"> |
| 81 |
<button type="submit" class="button button-primary button-large !fw-bg-indigo-600 hover:!fw-bg-indigo-700" id="fastcgi-settings-button"> |
| 82 |
<?php esc_html_e( 'Save Settings', 'flywp' ); ?> |
| 83 |
</button> |
| 84 |
|
| 85 |
<?php wp_nonce_field( 'flywp-optimizations-settings', 'flywp-optimizations-nonce' ); ?> |
| 86 |
</div> |
| 87 |
</form> |
| 88 |
</div> |
| 89 |
|