| @@ 171-173 (lines=3) @@ | ||
| 168 | } |
|
| 169 | $args = $attributes['args'][ $param ]; |
|
| 170 | ||
| 171 | if ( 'string' === $args['type'] && ! is_string( $value ) ) { |
|
| 172 | return new WP_Error( 'woocommerce_rest_invalid_param', sprintf( __( '%1$s is not of type %2$s', 'woocommerce' ), $param, 'string' ) ); |
|
| 173 | } |
|
| 174 | ||
| 175 | if ( 'data' === $args['format'] ) { |
|
| 176 | $regex = '#^\d{4}-\d{2}-\d{2}$#'; |
|
| @@ 177-179 (lines=3) @@ | ||
| 174 | return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not of type %s', 'woocommerce' ), $param, 'integer' ) ); |
|
| 175 | } |
|
| 176 | ||
| 177 | if ( 'string' === $args['type'] && ! is_string( $value ) ) { |
|
| 178 | return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not of type %s', 'woocommerce' ), $param, 'string' ) ); |
|
| 179 | } |
|
| 180 | ||
| 181 | if ( isset( $args['format'] ) ) { |
|
| 182 | switch ( $args['format'] ) { |
|