|
@@ 2038-2040 (lines=3) @@
|
| 2035 |
|
|
| 2036 |
|
// If it's an associative array, use the keys to check that the value is among those admitted. |
| 2037 |
|
$enum = ( count( array_filter( array_keys( $args['enum'] ), 'is_string' ) ) > 0 ) ? array_keys( $args['enum'] ) : $args['enum']; |
| 2038 |
|
if ( ! in_array( $value, $enum ) ) { |
| 2039 |
|
return new WP_Error( 'invalid_param_value', sprintf( esc_html__( '%s must be one of %s', 'jetpack' ), $param, implode( ', ', $enum ) ) ); |
| 2040 |
|
} |
| 2041 |
|
} |
| 2042 |
|
return true; |
| 2043 |
|
} |
|
@@ 2063-2065 (lines=3) @@
|
| 2060 |
|
|
| 2061 |
|
$modules = Jetpack::get_available_modules(); |
| 2062 |
|
|
| 2063 |
|
if ( count( array_intersect( $value, $modules ) ) != count( $value ) ) { |
| 2064 |
|
return new WP_Error( 'invalid_param_value', sprintf( esc_html__( '%s must be a list of valid modules', 'jetpack' ), $param ) ); |
| 2065 |
|
} |
| 2066 |
|
|
| 2067 |
|
return true; |
| 2068 |
|
} |
|
@@ 2217-2219 (lines=3) @@
|
| 2214 |
|
$sharer = new Sharing_Service(); |
| 2215 |
|
$services = array_keys( $sharer->get_all_services() ); |
| 2216 |
|
|
| 2217 |
|
if ( ! empty( $value ) && ! in_array( $value, $services ) ) { |
| 2218 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s is not a registered custom sharing service.', 'jetpack' ), $param ) ); |
| 2219 |
|
} |
| 2220 |
|
|
| 2221 |
|
return true; |
| 2222 |
|
} |