|
@@ 3321-3327 (lines=7) @@
|
| 3318 |
|
} |
| 3319 |
|
|
| 3320 |
|
switch ( $field_type ) { |
| 3321 |
|
case 'email': |
| 3322 |
|
// Make sure the email address is valid |
| 3323 |
|
if ( ! is_string( $field_value ) || ! is_email( $field_value ) ) { |
| 3324 |
|
/* translators: %s is the name of a form field */ |
| 3325 |
|
$this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) ); |
| 3326 |
|
} |
| 3327 |
|
break; |
| 3328 |
|
case 'checkbox-multiple': |
| 3329 |
|
// Check that there is at least one option selected |
| 3330 |
|
if ( empty( $field_value ) ) { |
|
@@ 3335-3340 (lines=6) @@
|
| 3332 |
|
$this->add_error( sprintf( __( '%s requires at least one selection', 'jetpack' ), $field_label ) ); |
| 3333 |
|
} |
| 3334 |
|
break; |
| 3335 |
|
default: |
| 3336 |
|
// Just check for presence of any text |
| 3337 |
|
if ( ! is_string( $field_value ) || ! strlen( trim( $field_value ) ) ) { |
| 3338 |
|
/* translators: %s is the name of a form field */ |
| 3339 |
|
$this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) ); |
| 3340 |
|
} |
| 3341 |
|
} |
| 3342 |
|
} |
| 3343 |
|
|