PluginProbe
WooCommerce / 11.1.0
WooCommerce v11.1.0
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / src / Admin / API / SettingOptions.php
SettingOptions.php
43 lines 878 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * REST API Setting Options Controller
4 *
5 * Handles requests to /settings/{option}
6 */
7
8 namespace Automattic\WooCommerce\Admin\API;
9
10 defined( 'ABSPATH' ) || exit;
11
12 use Automattic\WooCommerce\Admin\API\Reports\Cache as ReportsCache;
13
14 /**
15 * Setting Options controller.
16 *
17 * @internal
18 * @extends WC_REST_Setting_Options_Controller
19 */
20 class SettingOptions extends \WC_REST_Setting_Options_Controller {
21
22 /**
23 * Endpoint namespace.
24 *
25 * @var string
26 */
27 protected $namespace = 'wc-analytics';
28
29 /**
30 * Invalidates API cache when updating settings options.
31 *
32 * @param WP_REST_Request $request Full details about the request.
33 * @return array Of WP_Error or WP_REST_Response.
34 */
35 public function batch_items( $request ) {
36 // Invalidate the API cache.
37 ReportsCache::invalidate();
38
39 // Process the request.
40 return parent::batch_items( $request );
41 }
42 }
43