|
@@ 1690-1692 (lines=3) @@
|
| 1687 |
|
* @return bool |
| 1688 |
|
*/ |
| 1689 |
|
public static function validate_posint( $value = 0, $request, $param ) { |
| 1690 |
|
if ( ! is_numeric( $value ) || $value <= 0 ) { |
| 1691 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) ); |
| 1692 |
|
} |
| 1693 |
|
return true; |
| 1694 |
|
} |
| 1695 |
|
|
|
@@ 1807-1809 (lines=3) @@
|
| 1804 |
|
if ( ! is_array( $value ) ) { |
| 1805 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) ); |
| 1806 |
|
} |
| 1807 |
|
if ( ! array_intersect( $views, $value ) ) { |
| 1808 |
|
return new WP_Error( 'invalid_param', sprintf( |
| 1809 |
|
/* 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 */ |
| 1810 |
|
esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views ) |
| 1811 |
|
) ); |
| 1812 |
|
} |
|
@@ 1953-1955 (lines=3) @@
|
| 1950 |
|
* @return bool |
| 1951 |
|
*/ |
| 1952 |
|
public static function validate_string( $value = '', $request, $param ) { |
| 1953 |
|
if ( ! is_string( $value ) ) { |
| 1954 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) ); |
| 1955 |
|
} |
| 1956 |
|
return true; |
| 1957 |
|
} |
| 1958 |
|
|