PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.1.0
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.1.0
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | admin/class-convertkit-admin-refresh-resources.php +0 -25 3.3.13.1.0 View file →
@@ -39,24 +39,9 @@
39 39 'kit/v1',
40 40 '/resources/refresh/(?P<resource>[a-zA-Z0-9-_]+)',
41 41 array(
42 42 'methods' => WP_REST_Server::CREATABLE,
43 - 'args' => array(
44 - // Resource: Validate resource is included in the request, a valid resource
45 - // and sanitize the resource.
46 - 'resource' => array(
47 - 'required' => true,
48 - 'validate_callback' => function ( $param ) {
49 -
50 - return is_string( $param ) && in_array( $param, array( 'forms', 'landing_pages', 'tags', 'posts', 'products', 'restrict_content' ), true );
51 -
52 - },
53 - 'sanitize_callback' => 'sanitize_text_field',
54 - ),
55 - ),
56 43 'callback' => array( $this, 'refresh_resources' ),
57 -
58 - // Only refresh resources for users who can edit posts.
59 44 'permission_callback' => function () {
60 45 return current_user_can( 'edit_posts' );
61 46 },
62 47 )
@@ -104,17 +89,8 @@
104 89 $results = $products->refresh();
105 90 break;
106 91
107 92 case 'restrict_content':
108 - // Fetch Forms.
109 - $forms = new ConvertKit_Resource_Forms( 'user_refresh_resource' );
110 - $results_forms = $forms->refresh();
111 -
112 - // Bail if an error occured.
113 - if ( is_wp_error( $results_forms ) ) {
114 - return rest_ensure_response( $results_forms );
115 - }
116 -
117 93 // Fetch Tags.
118 94 $tags = new ConvertKit_Resource_Tags( 'user_refresh_resource' );
119 95 $results_tags = $tags->refresh();
120 96
@@ -134,9 +110,8 @@
134 110
135 111 // Return resources.
136 112 return rest_ensure_response(
137 113 array(
138 - 'forms' => array_values( $results_forms ),
139 114 'tags' => array_values( $results_tags ),
140 115 'products' => array_values( $results_products ),
141 116 )
142 117 );