|
@@ 1707-1709 (lines=3) @@
|
| 1704 |
|
* @return bool |
| 1705 |
|
*/ |
| 1706 |
|
public static function validate_posint( $value = 0, $request, $param ) { |
| 1707 |
|
if ( ! is_numeric( $value ) || $value <= 0 ) { |
| 1708 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) ); |
| 1709 |
|
} |
| 1710 |
|
return true; |
| 1711 |
|
} |
| 1712 |
|
|
|
@@ 1824-1826 (lines=3) @@
|
| 1821 |
|
if ( ! is_array( $value ) ) { |
| 1822 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) ); |
| 1823 |
|
} |
| 1824 |
|
if ( ! array_intersect( $views, $value ) ) { |
| 1825 |
|
return new WP_Error( 'invalid_param', sprintf( |
| 1826 |
|
/* 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 */ |
| 1827 |
|
esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views ) |
| 1828 |
|
) ); |
| 1829 |
|
} |
|
@@ 1970-1972 (lines=3) @@
|
| 1967 |
|
* @return bool |
| 1968 |
|
*/ |
| 1969 |
|
public static function validate_string( $value = '', $request, $param ) { |
| 1970 |
|
if ( ! is_string( $value ) ) { |
| 1971 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) ); |
| 1972 |
|
} |
| 1973 |
|
return true; |
| 1974 |
|
} |
| 1975 |
|
|