|
@@ 2120-2122 (lines=3) @@
|
| 2117 |
|
* @return bool |
| 2118 |
|
*/ |
| 2119 |
|
public static function validate_services( $value, $request, $param ) { |
| 2120 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 2121 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 2122 |
|
} |
| 2123 |
|
|
| 2124 |
|
// Allow to clear everything. |
| 2125 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 2157-2159 (lines=3) @@
|
| 2154 |
|
* @return bool |
| 2155 |
|
*/ |
| 2156 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 2157 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 2158 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 2159 |
|
} |
| 2160 |
|
|
| 2161 |
|
// Allow to clear everything. |
| 2162 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |