|
@@ 1877-1879 (lines=3) @@
|
| 1874 |
|
* @return bool |
| 1875 |
|
*/ |
| 1876 |
|
public static function validate_services( $value, $request, $param ) { |
| 1877 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 1878 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 1879 |
|
} |
| 1880 |
|
|
| 1881 |
|
// Allow to clear everything. |
| 1882 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 1917-1919 (lines=3) @@
|
| 1914 |
|
* @return bool |
| 1915 |
|
*/ |
| 1916 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 1917 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 1918 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 1919 |
|
} |
| 1920 |
|
|
| 1921 |
|
// Allow to clear everything. |
| 1922 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |