SHARE
TWEET

Untitled

a guest Jul 17th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class FormValidator {
  4.     static function isEmpty($data) {
  5.         return '' == trim($data);
  6.     }
  7.  
  8.     static function isEmail($data) {
  9.         return 0 < preg_match('/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i', $data);
  10.     }
  11.  
  12.     static function isNumber($data) {
  13.         return is_numeric($data);
  14.     }
  15.  
  16.     static function isDomain($data) {
  17.         return 0 < preg_match('/^((?=[a-z0-9-]{1,63}\.)[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/ix', $data);
  18.     }
  19. }
  20.  
  21. ?>
RAW Paste Data
Top