PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / 1.1
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel v1.1
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
flywp / includes / Api / Fastcgi_Cache.php

Fastcgi_Cache.php in FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel 1.1, at includes/Api/Fastcgi_Cache.php

42 lines 877 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FlyWP\Api;
4
5 class Fastcgi_Cache {
6
7 /**
8 * API constructor.
9 */
10 public function __construct() {
11 flywp()->router->post( 'fastcgi-cache', [ $this, 'handle_cache_setting' ] );
12 }
13
14 /**
15 * Handle request.
16 *
17 * @return void
18 */
19 public function handle_cache_setting( $args ) {
20 if ( ! isset( $args['status'] ) ) {
21 wp_send_json_error(
22 [
23 'message' => 'Missing status.',
24 ]
25 );
26 }
27
28 $enabled = isset( $args['status'] ) && $args['status'] === 'enabled' ? true : false;
29
30 $settings = flywp()->fastcgi->settings();
31 $settings['enabled'] = $enabled;
32
33 update_option( flywp()->fastcgi::SETTINGS_KEY, $settings );
34
35 wp_send_json_success(
36 [
37 'message' => 'Updated successfully.',
38 ]
39 );
40 }
41 }
42