@@ 95-97 (lines=3) @@ | ||
92 | $total += count( $items['delete'] ); |
|
93 | } |
|
94 | ||
95 | if ( $total > $limit ) { |
|
96 | return new WP_Error( 'woocommerce_rest_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), array( 'status' => 413 ) ); |
|
97 | } |
|
98 | ||
99 | return true; |
|
100 | } |
@@ 362-364 (lines=3) @@ | ||
359 | ); |
|
360 | ||
361 | // Checks for errors. |
|
362 | if ( false === $update ) { |
|
363 | return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Could not edit the attribute.', 'woocommerce' ), array( 'status' => 400 ) ); |
|
364 | } |
|
365 | ||
366 | $attribute = $this->get_attribute( $id ); |
|
367 | ||
@@ 424-426 (lines=3) @@ | ||
421 | array( '%d' ) |
|
422 | ); |
|
423 | ||
424 | if ( false === $deleted ) { |
|
425 | return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); |
|
426 | } |
|
427 | ||
428 | $taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name ); |
|
429 |
@@ 95-97 (lines=3) @@ | ||
92 | } |
|
93 | } |
|
94 | ||
95 | if ( false === $method ) { |
|
96 | return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); |
|
97 | } |
|
98 | ||
99 | $data = $this->prepare_item_for_response( $method, $request ); |
|
100 | ||
@@ 153-155 (lines=3) @@ | ||
150 | } |
|
151 | } |
|
152 | ||
153 | if ( false === $method ) { |
|
154 | return new WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( 'Resource cannot be created.', 'woocommerce' ), array( 'status' => 500 ) ); |
|
155 | } |
|
156 | ||
157 | $method = $this->update_fields( $instance_id, $method, $request ); |
|
158 | if ( is_wp_error( $method ) ) { |
|
@@ 193-195 (lines=3) @@ | ||
190 | } |
|
191 | } |
|
192 | ||
193 | if ( false === $method ) { |
|
194 | return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); |
|
195 | } |
|
196 | ||
197 | $method = $this->update_fields( $instance_id, $method, $request ); |
|
198 | if ( is_wp_error( $method ) ) { |
|
@@ 249-251 (lines=3) @@ | ||
246 | } |
|
247 | } |
|
248 | ||
249 | if ( false === $method ) { |
|
250 | return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); |
|
251 | } |
|
252 | ||
253 | $method = $this->update_fields( $instance_id, $method, $request ); |
|
254 | if ( is_wp_error( $method ) ) { |
@@ 105-107 (lines=3) @@ | ||
102 | // Recheck filetype |
|
103 | $wp_filetype = wp_check_filetype( $file_name, wc_rest_allowed_image_mime_types() ); |
|
104 | ||
105 | if ( ! $wp_filetype['type'] ) { |
|
106 | return new WP_Error( 'woocommerce_rest_invalid_image_type', __( 'Invalid image type.', 'woocommerce' ), array( 'status' => 400 ) ); |
|
107 | } |
|
108 | } |
|
109 | ||
110 | // Upload the file. |