<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class FormatUtil { public static function mainDomain($a1F4H) { goto Nsqau; zk1bv: return null; goto dTRF1; Nsqau: if (strpos($a1F4H, '//') === 0 || strpos($a1F4H, 'http://') === 0 || strpos($a1F4H, 'https://') === 0) { } else { $a1F4H = 'http://' . $a1F4H; } goto b98f2; t_Ui5: if (isset($pTwJr['host'])) { goto Z_xRY; Z_xRY: $a1F4H = $pTwJr['host']; goto yha6P; XAHsf: foreach (array_reverse(explode('.', $a1F4H)) as $v2qOY) { if (in_array($v2qOY, array('cn', 'com', 'org', 'gov', 'edu'))) { $yQ4Wg[] = $v2qOY; continue; } else { $yQ4Wg[] = $v2qOY; } if (count($yQ4Wg) >= 2) { break; } } goto lHCbq; F2ALB: $yQ4Wg = array(); goto XAHsf; lHCbq: return join('.', array_reverse($yQ4Wg)); goto oCFId; yha6P: if (preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $a1F4H)) { return $a1F4H; } goto F2ALB; oCFId: } goto zk1bv; b98f2: $pTwJr = parse_url($a1F4H); goto t_Ui5; dTRF1: } public static function telephone($f6hAA) { goto fYQ4J; kDjPB: $f6hAA = trim($f6hAA); goto ZIjvM; fYQ4J: $f6hAA = str_replace(array('+86', '+', ' ', '(', ')', '-', '（', '）', '', ' ', '　', '"', ';', '	'), '', $f6hAA); goto kDjPB; ZIjvM: if (!preg_match('/^[0-9]{3,20}$/', $f6hAA)) { return null; } goto PDv2x; PDv2x: return $f6hAA; goto mEZIJ; mEZIJ: } public static function isPhone($V_Df2) { return preg_match('/^1[0-9]{10}$/', $V_Df2); } public static function isUUID($N3lEQ) { return preg_match('/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/', $N3lEQ); } public static function isUrl($VzVt9) { return preg_match('/^(http|https):\\/\\//', $VzVt9); } public static function isEmail($QrJPi) { return preg_match('/^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-]+[\\.a-zA-Z0-9_\\-]+$/ ', $QrJPi); } public static function isDomain($a1F4H) { return preg_match('/([a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?\\.)+[a-z]{2,10}/i', $a1F4H); } public static function isMoney($OL1A6) { goto gpA9p; tWHx1: if ($OL1A6 > 10000 * 100) { return false; } goto athD1; athD1: return true; goto AksrY; gpA9p: if ($OL1A6 < 0.01) { return false; } goto tWHx1; AksrY: } }