abstracts
4 years ago
admin
4 years ago
elementor
4 years ago
export
4 years ago
fields
4 years ago
interfaces
8 years ago
libraries
7 years ago
log-handlers
4 years ago
shortcodes
4 years ago
templates
5 years ago
class-everest-forms.php
4 years ago
class-evf-ajax.php
4 years ago
class-evf-autoloader.php
7 years ago
class-evf-background-updater.php
7 years ago
class-evf-cache-helper.php
6 years ago
class-evf-deprecated-action-hooks.php
6 years ago
class-evf-deprecated-filter-hooks.php
5 years ago
class-evf-emails.php
5 years ago
class-evf-fields.php
6 years ago
class-evf-form-block.php
4 years ago
class-evf-form-handler.php
4 years ago
class-evf-form-task.php
4 years ago
class-evf-forms-features.php
4 years ago
class-evf-frontend-scripts.php
4 years ago
class-evf-install.php
5 years ago
class-evf-integrations.php
7 years ago
class-evf-log-levels.php
8 years ago
class-evf-logger.php
5 years ago
class-evf-post-types.php
5 years ago
class-evf-privacy.php
6 years ago
class-evf-session-handler.php
7 years ago
class-evf-shortcodes.php
4 years ago
class-evf-smart-tags.php
4 years ago
class-evf-template-loader.php
4 years ago
class-evf-validation.php
6 years ago
evf-conditional-functions.php
6 years ago
evf-core-functions.php
4 years ago
evf-deprecated-functions.php
6 years ago
evf-entry-functions.php
4 years 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 |