|
@@ 2113-2115 (lines=3) @@
|
| 2110 |
|
* @return bool |
| 2111 |
|
*/ |
| 2112 |
|
public static function validate_services( $value, $request, $param ) { |
| 2113 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 2114 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 2115 |
|
} |
| 2116 |
|
|
| 2117 |
|
// Allow to clear everything. |
| 2118 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 2150-2152 (lines=3) @@
|
| 2147 |
|
* @return bool |
| 2148 |
|
*/ |
| 2149 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 2150 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 2151 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 2152 |
|
} |
| 2153 |
|
|
| 2154 |
|
// Allow to clear everything. |
| 2155 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |