|
@@ 1974-1976 (lines=3) @@
|
| 1971 |
|
* @return bool |
| 1972 |
|
*/ |
| 1973 |
|
public static function validate_services( $value, $request, $param ) { |
| 1974 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 1975 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 1976 |
|
} |
| 1977 |
|
|
| 1978 |
|
// Allow to clear everything. |
| 1979 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 2011-2013 (lines=3) @@
|
| 2008 |
|
* @return bool |
| 2009 |
|
*/ |
| 2010 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 2011 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 2012 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 2013 |
|
} |
| 2014 |
|
|
| 2015 |
|
// Allow to clear everything. |
| 2016 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |