|
@@ 1757-1759 (lines=3) @@
|
| 1754 |
|
* @return bool |
| 1755 |
|
*/ |
| 1756 |
|
public static function validate_services( $value, $request, $param ) { |
| 1757 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 1758 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 1759 |
|
} |
| 1760 |
|
|
| 1761 |
|
// Allow to clear everything. |
| 1762 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 1797-1799 (lines=3) @@
|
| 1794 |
|
* @return bool |
| 1795 |
|
*/ |
| 1796 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 1797 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 1798 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 1799 |
|
} |
| 1800 |
|
|
| 1801 |
|
// Allow to clear everything. |
| 1802 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |