|
@@ 1616-1618 (lines=3) @@
|
| 1613 |
|
* @return bool |
| 1614 |
|
*/ |
| 1615 |
|
public static function validate_services( $value, $request, $param ) { |
| 1616 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 1617 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 1618 |
|
} |
| 1619 |
|
|
| 1620 |
|
// Allow to clear everything. |
| 1621 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
|
@@ 1656-1658 (lines=3) @@
|
| 1653 |
|
* @return bool |
| 1654 |
|
*/ |
| 1655 |
|
public static function validate_custom_service( $value, $request, $param ) { |
| 1656 |
|
if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) { |
| 1657 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) ); |
| 1658 |
|
} |
| 1659 |
|
|
| 1660 |
|
// Allow to clear everything. |
| 1661 |
|
if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) { |