<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class FormatUtil { public static function mainDomain($keY2T) { goto xD0iB; sZsbw: return null; goto PI7eC; xD0iB: if (strpos($keY2T, '//') === 0 || strpos($keY2T, 'http://') === 0 || strpos($keY2T, 'https://') === 0) { } else { $keY2T = 'http://' . $keY2T; } goto QOLde; mJp_f: if (isset($bCCWW['host'])) { goto wFgNX; cmW31: return join('.', array_reverse($TsqdX)); goto TccSE; Jw9hi: foreach (array_reverse(explode('.', $keY2T)) as $bW0Md) { if (in_array($bW0Md, array('cn', 'com', 'org', 'gov', 'edu'))) { $TsqdX[] = $bW0Md; continue; } else { $TsqdX[] = $bW0Md; } if (count($TsqdX) >= 2) { break; } } goto cmW31; cI_4I: $TsqdX = array(); goto Jw9hi; wFgNX: $keY2T = $bCCWW['host']; goto nwRiA; nwRiA: if (preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $keY2T)) { return $keY2T; } goto cI_4I; TccSE: } goto sZsbw; QOLde: $bCCWW = parse_url($keY2T); goto mJp_f; PI7eC: } public static function telephone($ZQCyb) { goto B1qKM; yRFow: return $ZQCyb; goto pJYKz; hnC5P: if (!preg_match('/^[0-9]{3,20}$/', $ZQCyb)) { return null; } goto yRFow; B1qKM: $ZQCyb = str_replace(array('+86', '+', ' ', '(', ')', '-', '（', '）', '', ' ', '　', '"', ';', '	'), '', $ZQCyb); goto UYzuk; UYzuk: $ZQCyb = trim($ZQCyb); goto hnC5P; pJYKz: } public static function isPhone($Bg448) { return preg_match('/^1[0-9]{10}$/', $Bg448); } public static function isUUID($edka5) { return preg_match('/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/', $edka5); } public static function isUrl($MiLaY) { return preg_match('/^(http|https):\\/\\//', $MiLaY); } public static function isEmail($NfPqW) { return preg_match('/^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-]+[\\.a-zA-Z0-9_\\-]+$/ ', $NfPqW); } public static function isDomain($keY2T) { return preg_match('/([a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?\\.)+[a-z]{2,10}/i', $keY2T); } public static function isMoney($HwM9n) { goto mcBLo; ibv0G: if ($HwM9n > 10000 * 100) { return false; } goto m42Lw; m42Lw: return true; goto NtVdX; mcBLo: if ($HwM9n < 0.01) { return false; } goto ibv0G; NtVdX: } }