PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.90
WindPress – Tailwind CSS integration for WordPress v3.2.90
3.2.90 3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 All 144 releases
← All changes | src/Api/Admin/Settings/Options.php +14 -14 3.0.33.2.90 View file →
@@ -11,34 +11,34 @@
11 11 declare (strict_types=1);
12 12 namespace WindPress\WindPress\Api\Admin\Settings;
13 13
14 14 use WIND_PRESS;
15 +use WindPress\WindPress\Api\AbstractApi;
16 +use WindPress\WindPress\Api\ApiInterface;
15 17 use WP_REST_Request;
16 18 use WP_REST_Response;
17 19 use WP_REST_Server;
18 -use WindPress\WindPress\Api\AbstractApi;
19 -use WindPress\WindPress\Api\ApiInterface;
20 20 class Options extends AbstractApi implements ApiInterface
21 21 {
22 22 public function __construct()
23 23 {
24 24 }
25 - public function get_prefix() : string
25 + public function get_prefix(): string
26 26 {
27 27 return 'admin/settings/options';
28 28 }
29 - public function register_custom_endpoints() : void
29 + public function register_custom_endpoints(): void
30 30 {
31 - \register_rest_route(self::API_NAMESPACE, $this->get_prefix() . '/index', ['methods' => WP_REST_Server::READABLE, 'callback' => fn(\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->index($wprestRequest), 'permission_callback' => fn(\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest)]);
32 - \register_rest_route(self::API_NAMESPACE, $this->get_prefix() . '/store', ['methods' => WP_REST_Server::CREATABLE, 'callback' => fn(\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->store($wprestRequest), 'permission_callback' => fn(\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest)]);
31 + register_rest_route(self::API_NAMESPACE, $this->get_prefix() . '/index', ['methods' => WP_REST_Server::READABLE, 'callback' => fn(\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->index($wprestRequest), 'permission_callback' => fn(\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest)]);
32 + register_rest_route(self::API_NAMESPACE, $this->get_prefix() . '/store', ['methods' => WP_REST_Server::CREATABLE, 'callback' => fn(\WP_REST_Request $wprestRequest): \WP_REST_Response => $this->store($wprestRequest), 'permission_callback' => fn(\WP_REST_Request $wprestRequest): bool => $this->permission_callback($wprestRequest)]);
33 33 }
34 - public function index(WP_REST_Request $wprestRequest) : WP_REST_Response
34 + public function index(WP_REST_Request $wprestRequest): WP_REST_Response
35 35 {
36 - $options = \json_decode(\get_option(WIND_PRESS::WP_OPTION . '_options', '{}'), null, 512, \JSON_THROW_ON_ERROR);
37 - $options = \apply_filters('f!windpress/api/admin/settings/options:index', $options);
36 + $options = json_decode(get_option(WIND_PRESS::WP_OPTION . '_options', '{}'), null, 512, \JSON_THROW_ON_ERROR);
37 + $options = apply_filters('f!windpress/api/admin/settings/options:index', $options);
38 38 return new WP_REST_Response(['options' => $options]);
39 39 }
40 - public function store(WP_REST_Request $wprestRequest) : WP_REST_Response
40 + public function store(WP_REST_Request $wprestRequest): WP_REST_Response
41 41 {
42 42 $payload = $wprestRequest->get_json_params();
43 43 $options = $payload['options'];
44 44 if (empty($options)) {
@@ -43,10 +43,10 @@
43 43 $options = $payload['options'];
44 44 if (empty($options)) {
45 45 $options = (object) $options;
46 46 }
47 - $options = \apply_filters('f!windpress/api/admin/settings/options:store.before', $options);
48 - \update_option(WIND_PRESS::WP_OPTION . '_options', \wp_json_encode($options, \JSON_THROW_ON_ERROR));
49 - \do_action('f!windpress/api/admin/settings/options:store.after', $options);
50 - return new WP_REST_Response(['message' => 'Settings updated']);
47 + $options = apply_filters('f!windpress/api/admin/settings/options:store.before', $options);
48 + update_option(WIND_PRESS::WP_OPTION . '_options', wp_json_encode($options, \JSON_THROW_ON_ERROR));
49 + do_action('a!windpress/api/admin/settings/options:store.after', $options);
50 + return new WP_REST_Response(['message' => __('Settings updated', 'windpress')]);
51 51 }
52 52 }