PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / 1.0
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel v1.0
1.7.1 1.7.0 1.6.0 1.5.2 trunk 0.1 0.2.0 0.2.1 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 1.0 1.1 1.2 1.3.1 1.4.0 1.4.1 1.5.0 1.5.1 All 26 releases
← All changes | includes/Api/Fastcgi_Cache.php +14 -11 0.4.21.0 View file →
@@ -7,9 +7,9 @@
7 7 /**
8 8 * API constructor.
9 9 */
10 10 public function __construct() {
11 - flywp()->router->post( 'fastcgi-cache', [$this, 'handle_cache_setting'] );
11 + flywp()->router->post( 'fastcgi-cache', [ $this, 'handle_cache_setting' ] );
12 12 }
13 13
14 14 /**
15 15 * Handle request.
@@ -16,23 +16,26 @@
16 16 *
17 17 * @return void
18 18 */
19 19 public function handle_cache_setting( $args ) {
20 - if ( !isset( $args['status'] ) ) {
21 - wp_send_json_error( [
22 - 'message' => 'Missing status.',
23 - ] );
20 + if ( ! isset( $args['status'] ) ) {
21 + wp_send_json_error(
22 + [
23 + 'message' => 'Missing status.',
24 + ]
25 + );
24 26 }
25 27
26 - $valid_types = ['enable', 'disable'];
27 - $type = isset( $_GET['type'] ) && in_array( $_GET['type'], $valid_types ) ? $_GET['type'] : 'enable';
28 + $enabled = isset( $args['status'] ) && $args['status'] === 'enabled' ? true : false;
28 29
29 30 $settings = flywp()->fastcgi->settings();
30 - $settings['enabled'] = $type === 'enable' ? true : false;
31 + $settings['enabled'] = $enabled;
31 32
32 33 update_option( flywp()->fastcgi::SETTINGS_KEY, $settings );
33 34
34 - wp_send_json_success( [
35 - 'message' => 'Updated successfully.',
36 - ] );
35 + wp_send_json_success(
36 + [
37 + 'message' => 'Updated successfully.',
38 + ]
39 + );
37 40 }
38 41 }