|
@@ 1850-1852 (lines=3) @@
|
| 1847 |
|
* @return bool |
| 1848 |
|
*/ |
| 1849 |
|
public static function validate_services( $value, $request, $param ) { |
| 1850 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 1851 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 1852 |
|
} |
| 1853 |
|
|
| 1854 |
|
// Allow to clear everything. |
| 1855 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 1890-1892 (lines=3) @@
|
| 1887 |
|
* @return bool |
| 1888 |
|
*/ |
| 1889 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 1890 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 1891 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 1892 |
|
} |
| 1893 |
|
|
| 1894 |
|
// Allow to clear everything. |
| 1895 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |