WP_Super_Cache_Rest_Update_Settings::callback()
Update the cache settings.
Метод класса: WP_Super_Cache_Rest_Update_Settings{}
Хуков нет.
Возвращает
WP_Error|WP_REST_Response
.
Использование
$WP_Super_Cache_Rest_Update_Settings = new WP_Super_Cache_Rest_Update_Settings(); $WP_Super_Cache_Rest_Update_Settings->callback( $request );
- $request(WP_REST_Request) (обязательный)
- Full data about the request.
Код WP_Super_Cache_Rest_Update_Settings::callback() WP Super Cache Rest Update Settings::callback WPSCache 1.12.4
public function callback( $request ) { $parameters = $request->get_json_params(); // Override to force locking. if ( defined( 'WPSC_DISABLE_LOCKING' ) ) { $parameters['cache_disable_locking'] = 1; } // Set the nonce to valid, so that form sets will work later. global $valid_nonce; $valid_nonce = true; $errors = array(); if ( isset( $parameters['easy'] ) ) { $errors = $this->toggle_easy_caching( $parameters['easy'] ); } elseif ( isset( $parameters[ 'reset' ] ) ) { $errors = $this->restore_default_settings( $parameters ); } else { foreach ( $parameters as $name => $value ) { $has_error = $this->set_value_by_key( $value, $name ); if ( false == is_numeric( $has_error ) && false == is_bool( $has_error ) ) { $errors[] = $has_error; } } $this->save_time_settings( $parameters ); $this->save_preload_settings(); $this->set_debug_settings( $parameters ); } if ( ! empty( $errors ) ) { return rest_ensure_response( $errors ); } else { $get_settings = new WP_Super_Cache_Rest_Get_Settings(); return $get_settings->callback( $request ); } }