|
@@ 1762-1764 (lines=3) @@
|
| 1759 |
|
* @return bool |
| 1760 |
|
*/ |
| 1761 |
|
public static function validate_services( $value, $request, $param ) { |
| 1762 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 1763 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 1764 |
|
} |
| 1765 |
|
|
| 1766 |
|
// Allow to clear everything. |
| 1767 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 1802-1804 (lines=3) @@
|
| 1799 |
|
* @return bool |
| 1800 |
|
*/ |
| 1801 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 1802 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 1803 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 1804 |
|
} |
| 1805 |
|
|
| 1806 |
|
// Allow to clear everything. |
| 1807 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |