/** * Attempts to update the settings on a particular service and instance */ public function update_items($request) { $request_params = $request->get_params(); $request_body = $request->get_body(); $settings = json_decode($request_body, false, WOOCOMMERCE_CONNECT_MAX_JSON_DECODE_DEPTH); if (empty($settings) || !is_object($settings) || !property_exists($settings, 'wcc_debug_on')) { $error = new WP_Error('bad_form_data', __('Unable to update settings. The form data could not be read.', 'connectforwoocommerce'), array('status' => 400)); $this->logger->log($error, __CLASS__); return $error; } error_log("WCC DEBUG ON = {$settings->wcc_debug_on}"); if (1 == $settings->wcc_debug_on) { $this->logger->enable_logging(); } else { $this->logger->disable_logging(); } return new WP_REST_Response(array('success' => true), 200); }