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