PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / trunk
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel vtrunk
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/FlyApi.php +7 -5 0.3trunk View file →
@@ -19,13 +19,14 @@
19 19 * @param string $action
20 20 *
21 21 * @return array|false
22 22 */
23 - public function cache_toggle( $action = 'enable' ) {
23 + public function cache_toggle( $action = 'enable', $type = 'fastcgi' ) {
24 24 return $this->post(
25 25 '/cache-toggle',
26 26 [
27 27 'action' => $action,
28 + 'type' => $type,
28 29 ]
29 30 );
30 31 }
31 32
@@ -34,9 +35,9 @@
34 35 *
35 36 * @return string
36 37 */
37 38 protected function get_endpoint() {
38 - return apply_filters( 'flywp_api_endpoint', 'https://app.flywp.io/api/site-api' );
39 + return apply_filters( 'flywp_api_endpoint', 'https://app.flywp.com/site-api' );
39 40 }
40 41
41 42 /**
42 43 * Send a GET request to the API.
@@ -71,9 +72,9 @@
71 72 /**
72 73 * Send a POST request to the API.
73 74 *
74 75 * @param string $path
75 - * @param array $data
76 + * @param array $data
76 77 *
77 78 * @return array|false
78 79 */
79 80 public function post( $path, $data = [] ) {
@@ -84,14 +85,15 @@
84 85 [
85 86 'headers' => [
86 87 'Authorization' => 'Bearer ' . flywp()->get_key(),
87 88 ],
88 - 'body' => $data,
89 + 'body' => $data,
89 90 ]
90 91 );
91 92
92 93 if ( is_wp_error( $response ) ) {
93 - // Handle error if needed
94 + error_log( print_r( $response, true ) );
95 +
94 96 return false;
95 97 }
96 98
97 99 $body = wp_remote_retrieve_body( $response );