Helpers
11 months ago
Integrations
1 week ago
RestApi
2 weeks ago
abilities
2 weeks ago
abstracts
2 weeks ago
admin
2 weeks ago
blocks
1 year ago
elementor
2 years ago
export
2 months ago
fields
2 weeks ago
interfaces
8 years ago
libraries
2 years ago
log-handlers
1 year ago
shortcodes
2 weeks ago
stats
5 months ago
templates
3 months ago
traits
2 weeks ago
class-everest-forms.php
1 week ago
class-evf-addon-upsell.php
2 weeks ago
class-evf-ajax.php
2 weeks ago
class-evf-autoloader.php
7 years ago
class-evf-background-process-import-entries.php
1 year ago
class-evf-background-updater.php
7 years ago
class-evf-cache-helper.php
2 months ago
class-evf-cron.php
2 years ago
class-evf-deprecated-action-hooks.php
6 years ago
class-evf-deprecated-filter-hooks.php
5 years ago
class-evf-email-entries-report.php
3 months ago
class-evf-emails.php
2 weeks ago
class-evf-fields.php
2 weeks ago
class-evf-form-handler.php
2 weeks ago
class-evf-form-task.php
2 weeks ago
class-evf-forms-features.php
2 weeks ago
class-evf-frontend-scripts.php
2 weeks ago
class-evf-install.php
2 months ago
class-evf-integrations.php
3 months ago
class-evf-log-levels.php
8 years ago
class-evf-logger.php
5 years ago
class-evf-post-types.php
1 year ago
class-evf-privacy.php
6 years ago
class-evf-report-cron.php
2 months ago
class-evf-reporting.php
2 months ago
class-evf-session-handler.php
7 years ago
class-evf-shortcodes.php
1 year ago
class-evf-smart-tags.php
9 months ago
class-evf-template-loader.php
1 year ago
class-evf-validation.php
6 years ago
evf-conditional-functions.php
6 years ago
evf-core-functions.php
2 weeks ago
evf-deprecated-functions.php
6 years ago
evf-entry-functions.php
4 months ago
evf-formatting-functions.php
4 years ago
evf-notice-functions.php
4 years ago
evf-template-functions.php
4 years ago
evf-template-hooks.php
7 years ago
evf-update-functions.php
5 years ago
class-evf-validation.php
50 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Contains Validation functions |
| 4 | * |
| 5 | * @version 1.0.0 |
| 6 | * @package EverestForms/Classes |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Validation Class. |
| 13 | */ |
| 14 | class EVF_Validation { |
| 15 | |
| 16 | /** |
| 17 | * Validates an email using WordPress native is_email function. |
| 18 | * |
| 19 | * @param string $email Email address to validate. |
| 20 | * @return bool |
| 21 | */ |
| 22 | public static function is_email( $email ) { |
| 23 | return is_email( $email ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Validates a phone number using a regular expression. |
| 28 | * |
| 29 | * @param string $phone Phone number to validate. |
| 30 | * @return bool |
| 31 | */ |
| 32 | public static function is_phone( $phone ) { |
| 33 | if ( 0 < strlen( trim( preg_replace( '/[\s\#0-9_\-\+\/\(\)]/', '', $phone ) ) ) ) { |
| 34 | return false; |
| 35 | } |
| 36 | |
| 37 | return true; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Format the phone number. |
| 42 | * |
| 43 | * @param mixed $tel Phone number to format. |
| 44 | * @return string |
| 45 | */ |
| 46 | public static function format_phone( $tel ) { |
| 47 | return evf_format_phone_number( $tel ); |
| 48 | } |
| 49 | } |
| 50 |