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