@@ 3387-3393 (lines=7) @@ | ||
3384 | } |
|
3385 | ||
3386 | switch ( $field_type ) { |
|
3387 | case 'email': |
|
3388 | // Make sure the email address is valid |
|
3389 | if ( ! is_string( $field_value ) || ! is_email( $field_value ) ) { |
|
3390 | /* translators: %s is the name of a form field */ |
|
3391 | $this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) ); |
|
3392 | } |
|
3393 | break; |
|
3394 | case 'checkbox-multiple': |
|
3395 | // Check that there is at least one option selected |
|
3396 | if ( empty( $field_value ) ) { |
|
@@ 3401-3406 (lines=6) @@ | ||
3398 | $this->add_error( sprintf( __( '%s requires at least one selection', 'jetpack' ), $field_label ) ); |
|
3399 | } |
|
3400 | break; |
|
3401 | default: |
|
3402 | // Just check for presence of any text |
|
3403 | if ( ! is_string( $field_value ) || ! strlen( trim( $field_value ) ) ) { |
|
3404 | /* translators: %s is the name of a form field */ |
|
3405 | $this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) ); |
|
3406 | } |
|
3407 | } |
|
3408 | } |
|
3409 |