|
@@ 1684-1686 (lines=3) @@
|
| 1681 |
|
* @return bool |
| 1682 |
|
*/ |
| 1683 |
|
public static function validate_posint( $value = 0, $request, $param ) { |
| 1684 |
|
if ( ! is_numeric( $value ) || $value <= 0 ) { |
| 1685 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a positive integer.', 'jetpack' ), $param ) ); |
| 1686 |
|
} |
| 1687 |
|
return true; |
| 1688 |
|
} |
| 1689 |
|
|
|
@@ 1801-1803 (lines=3) @@
|
| 1798 |
|
if ( ! is_array( $value ) ) { |
| 1799 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array of post types.', 'jetpack' ), $param ) ); |
| 1800 |
|
} |
| 1801 |
|
if ( ! array_intersect( $views, $value ) ) { |
| 1802 |
|
return new WP_Error( 'invalid_param', sprintf( |
| 1803 |
|
/* 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 */ |
| 1804 |
|
esc_html__( '%1$s must be %2$s.', 'jetpack' ), $param, join( ', ', $views ) |
| 1805 |
|
) ); |
| 1806 |
|
} |
|
@@ 1947-1949 (lines=3) @@
|
| 1944 |
|
* @return bool |
| 1945 |
|
*/ |
| 1946 |
|
public static function validate_string( $value = '', $request, $param ) { |
| 1947 |
|
if ( ! is_string( $value ) ) { |
| 1948 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a string.', 'jetpack' ), $param ) ); |
| 1949 |
|
} |
| 1950 |
|
return true; |
| 1951 |
|
} |
| 1952 |
|
|