@@ 231-233 (lines=3) @@ | ||
228 | return array(); |
|
229 | } |
|
230 | ||
231 | if ( ! is_array( $values ) ) { |
|
232 | return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); |
|
233 | } |
|
234 | ||
235 | $final_values = array(); |
|
236 | foreach ( $values as $value ) { |
|
@@ 254-256 (lines=3) @@ | ||
251 | * @return string|WP_Error |
|
252 | */ |
|
253 | public function validate_setting_image_width_field( $values, $setting ) { |
|
254 | if ( ! is_array( $values ) ) { |
|
255 | return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); |
|
256 | } |
|
257 | ||
258 | $current = $setting['value']; |
|
259 | if ( isset( $values['width'] ) ) { |
@@ 70-72 (lines=3) @@ | ||
67 | $parsed_url = @parse_url( $image_url ); |
|
68 | ||
69 | // Check parsed URL. |
|
70 | if ( ! $parsed_url || ! is_array( $parsed_url ) ) { |
|
71 | return new WP_Error( 'woocommerce_rest_invalid_image_url', sprintf( __( 'Invalid URL %s.', 'woocommerce' ), $image_url ), array( 'status' => 400 ) ); |
|
72 | } |
|
73 | ||
74 | // Ensure url is valid. |
|
75 | $image_url = esc_url_raw( $image_url ); |