PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-import/src/endpoints/class-custom-css.php +16 -14 12.0.3 → 16.3-beta View file →
@@ -6,8 +6,16 @@
6 6 */
7 7
8 8 namespace Automattic\Jetpack\Import\Endpoints;
9 9
10 +use WP_Error;
11 +use WP_REST_Request;
12 +use WP_REST_Response;
13 +
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit( 0 );
16 +}
17 +
10 18 require_once ABSPATH . 'wp-includes/theme.php';
11 19
12 20 /**
13 21 * Class Custom_CSS
@@ -14,11 +22,16 @@
14 22 */
15 23 class Custom_CSS extends \WP_REST_Posts_Controller {
16 24
17 25 /**
26 + * Base class
27 + */
28 + use Import;
29 +
30 + /**
18 31 * The Import ID add a new item to the schema.
19 32 */
20 - use Import;
33 + use Import_ID;
21 34
22 35 /**
23 36 * Whether the controller supports batching.
24 37 *
@@ -35,21 +48,8 @@
35 48 $this->rest_base = 'custom-css';
36 49 }
37 50
38 51 /**
39 - * Registers the routes for the objects of the controller.
40 - *
41 - * @see WP_REST_Posts_Controller::register_rest_route()
42 - */
43 - public function register_routes() {
44 - register_rest_route(
45 - self::$rest_namespace,
46 - '/' . $this->rest_base,
47 - $this->get_route_options()
48 - );
49 - }
50 -
51 - /**
52 52 * Update the custom CSS post.
53 53 *
54 54 * @param WP_REST_Request $request Full details about the request.
55 55 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
@@ -54,8 +54,10 @@
54 54 * @param WP_REST_Request $request Full details about the request.
55 55 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
56 56 */
57 57 public function create_item( $request ) {
58 + // Set the WP_IMPORTING constant to prevent sync notifications
59 + $this->set_importing();
58 60 $args = array(
59 61 'stylesheet' => $request['title'],
60 62 );
61 63