|
@@ 3414-3420 (lines=7) @@
|
| 3411 |
|
} |
| 3412 |
|
|
| 3413 |
|
switch ( $field_type ) { |
| 3414 |
|
case 'email': |
| 3415 |
|
// Make sure the email address is valid |
| 3416 |
|
if ( ! is_string( $field_value ) || ! is_email( $field_value ) ) { |
| 3417 |
|
/* translators: %s is the name of a form field */ |
| 3418 |
|
$this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) ); |
| 3419 |
|
} |
| 3420 |
|
break; |
| 3421 |
|
case 'checkbox-multiple': |
| 3422 |
|
// Check that there is at least one option selected |
| 3423 |
|
if ( empty( $field_value ) ) { |
|
@@ 3428-3433 (lines=6) @@
|
| 3425 |
|
$this->add_error( sprintf( __( '%s requires at least one selection', 'jetpack' ), $field_label ) ); |
| 3426 |
|
} |
| 3427 |
|
break; |
| 3428 |
|
default: |
| 3429 |
|
// Just check for presence of any text |
| 3430 |
|
if ( ! is_string( $field_value ) || ! strlen( trim( $field_value ) ) ) { |
| 3431 |
|
/* translators: %s is the name of a form field */ |
| 3432 |
|
$this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) ); |
| 3433 |
|
} |
| 3434 |
|
} |
| 3435 |
|
} |
| 3436 |
|
|