| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
* Settings page template |
| 5 |
* |
| 6 |
* @package PoweredCache |
| 7 |
* @subpackage PoweredCache/Settings |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly |
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
?> |
| 16 |
|
| 17 |
<div class="meta-box-sortables ui-sortable"> |
| 18 |
|
| 19 |
<div class="postbox"> |
| 20 |
<div class="inside"> |
| 21 |
<?php if(isset($_GET['action']) && 'run-diagnostic' === $_GET['action']):?> |
| 22 |
<?php |
| 23 |
$checks = Powered_Cache_Admin_Helper::diagnostic_info(); |
| 24 |
|
| 25 |
foreach ($checks as $check_key => $result){ |
| 26 |
if($result['status']){ |
| 27 |
echo '<span class="dashicons dashicons-yes"></span>'; |
| 28 |
}else{ |
| 29 |
echo '<span class="dashicons dashicons-no"></span>'; |
| 30 |
} |
| 31 |
echo $result['description']; |
| 32 |
echo '<br>'; |
| 33 |
} |
| 34 |
?> |
| 35 |
<?php else:?> |
| 36 |
<table class="form-table"> |
| 37 |
<tbody> |
| 38 |
<?php if ( powered_cache_is_premium() ): ?> |
| 39 |
<tr> |
| 40 |
<th scope="row"><label for="powered_cache_cache_message"><?php _e( 'Cache footprint', 'powered-cache' ); ?></label></th> |
| 41 |
<td> |
| 42 |
<label><input type="checkbox" id="powered_cache_cache_message" name="powered_cache_settings[show_cache_message]" <?php checked( powered_cache_get_option( 'show_cache_message' ), 1 ); ?> value="1"><?php _e( 'Show caching footprints in the HTML output.', 'powered-cache' ); ?></label> |
| 43 |
</td> |
| 44 |
</tr> |
| 45 |
<?php endif; ?> |
| 46 |
|
| 47 |
<?php |
| 48 |
// additional control needed for cache flushing |
| 49 |
if ( ( is_multisite() && current_user_can( 'manage_network' ) ) || ( ! is_multisite() && current_user_can( 'activate_plugins' ) ) ): ?> |
| 50 |
<tr> |
| 51 |
<th scope="row"><label for="powered_cache_clear_cache"><?php _e( 'Clear Cache', 'powered-cache' ); ?></label></th> |
| 52 |
<td> |
| 53 |
<?php echo Powered_Cache_Admin_Helper::flush_cache_button(); ?> |
| 54 |
<br> |
| 55 |
<span class="description"><?php _e( 'Clear all cache, including object cache', 'powered-cache' ); ?></span> |
| 56 |
</td> |
| 57 |
</tr> |
| 58 |
<?php endif; ?> |
| 59 |
|
| 60 |
<tr> |
| 61 |
<th scope="row"><label for="powered_cache_rewrite"><?php _e( 'Download Configuration', 'powered-cache' ); ?></label></th> |
| 62 |
<td> |
| 63 |
<a href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?action=powered_cache_download_rewrite_settings&server=apache' ), 'powered_cache_download_rewrite' ); ?>" class="button-secondary"> |
| 64 |
<?php _e( '.htaccess configuration', 'powered-cache' ); ?> |
| 65 |
</a> |
| 66 |
<a href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?action=powered_cache_download_rewrite_settings&server=nginx' ), 'powered_cache_download_rewrite' ); ?>" class="button-secondary"> |
| 67 |
<?php _e( 'nginx configuration', 'powered-cache' ); ?> |
| 68 |
</a> |
| 69 |
<br> |
| 70 |
<span class="description"><?php _e( 'Download configuration file for your server', 'powered-cache' ); ?></span> |
| 71 |
</td> |
| 72 |
</tr> |
| 73 |
<tr> |
| 74 |
<th scope="row"><label for="powered_cache_clear_cache"><?php _e( 'Reset All Settings', 'powered-cache' ); ?></label></th> |
| 75 |
<td> |
| 76 |
<?php echo Powered_Cache_Admin_Helper::reset_settings_button(); ?> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<tr> |
| 80 |
<th scope="row"><label for="powered_cache_clear_cache"><?php _e( 'Diagnostic', 'powered-cache' ); ?></label></th> |
| 81 |
<td> |
| 82 |
<?php echo Powered_Cache_Admin_Helper::diagnostic_button(); ?><br> |
| 83 |
<span class="description"><?php _e( 'If you get trouble, perform the diagnostic checks', 'powered-cache' ); ?></span> |
| 84 |
</td> |
| 85 |
</tr> |
| 86 |
|
| 87 |
<tr> |
| 88 |
<th scope="row"><label for="powered_cache_export_settings"><?php _e( 'Export', 'powered-cache' ); ?></label></th> |
| 89 |
<td> |
| 90 |
<?php echo Powered_Cache_Admin_Helper::export_settings_button(); ?> |
| 91 |
</td> |
| 92 |
</tr> |
| 93 |
|
| 94 |
<tr> |
| 95 |
<th scope="row"><label for="powered_cache_import_settings"><?php _e( 'Import', 'powered-cache' ); ?></label></th> |
| 96 |
<td> |
| 97 |
<input type="file" id="powered_cache_import_settings" name="powered_cache_import"> |
| 98 |
<br> |
| 99 |
<input type="submit" name="do-import" id="do-import" class="button" value="<?php _e('Upload and import','powered-cache');?>"> |
| 100 |
</td> |
| 101 |
</tr> |
| 102 |
|
| 103 |
|
| 104 |
</tbody> |
| 105 |
</table> |
| 106 |
<?php endif;?> |
| 107 |
</div> |
| 108 |
<!-- .inside --> |
| 109 |
|
| 110 |
</div> |
| 111 |
<!-- .postbox --> |
| 112 |
|
| 113 |
</div> |
| 114 |
|