|
@@ 1971-1973 (lines=3) @@
|
| 1968 |
|
* @return bool|WP_Error |
| 1969 |
|
*/ |
| 1970 |
|
public static function validate_posint( $value = 0, $request, $param ) { |
| 1971 |
|
if ( ! is_numeric( $value ) || $value <= 0 ) { |
| 1972 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) ); |
| 1973 |
|
} |
| 1974 |
|
return true; |
| 1975 |
|
} |
| 1976 |
|
|
|
@@ 2106-2108 (lines=3) @@
|
| 2103 |
|
if ( ! is_array( $value ) ) { |
| 2104 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) ); |
| 2105 |
|
} |
| 2106 |
|
if ( ! array_intersect( $views, $value ) ) { |
| 2107 |
|
return new WP_Error( 'invalid_param', sprintf( |
| 2108 |
|
/* Translators: first variable is the name of a parameter passed to endpoint holding the post type where Sharing will be displayed, the second is a list of post types where Sharing can be displayed */ |
| 2109 |
|
esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views ) |
| 2110 |
|
) ); |
| 2111 |
|
} |
|
@@ 2252-2254 (lines=3) @@
|
| 2249 |
|
* @return bool|WP_Error |
| 2250 |
|
*/ |
| 2251 |
|
public static function validate_string( $value = '', $request, $param ) { |
| 2252 |
|
if ( ! is_string( $value ) ) { |
| 2253 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) ); |
| 2254 |
|
} |
| 2255 |
|
return true; |
| 2256 |
|
} |
| 2257 |
|
|