|
@@ 2137-2139 (lines=3) @@
|
| 2134 |
|
* @return bool |
| 2135 |
|
*/ |
| 2136 |
|
public static function validate_services( $value, $request, $param ) { |
| 2137 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 2138 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 2139 |
|
} |
| 2140 |
|
|
| 2141 |
|
// Allow to clear everything. |
| 2142 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 2174-2176 (lines=3) @@
|
| 2171 |
|
* @return bool |
| 2172 |
|
*/ |
| 2173 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 2174 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 2175 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 2176 |
|
} |
| 2177 |
|
|
| 2178 |
|
// Allow to clear everything. |
| 2179 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |