<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class FormatUtil { public static function mainDomain($xk3Sl) { goto UYRu1; KC3Db: if (isset($JOw_A['host'])) { goto hnY5h; qm37M: foreach (array_reverse(explode('.', $xk3Sl)) as $Mc7y1) { if (in_array($Mc7y1, array('cn', 'com', 'org', 'gov', 'edu'))) { $jT5GX[] = $Mc7y1; continue; } else { $jT5GX[] = $Mc7y1; } if (count($jT5GX) >= 2) { break; } } goto WIKYX; LHumv: if (preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $xk3Sl)) { return $xk3Sl; } goto zpX11; zpX11: $jT5GX = array(); goto qm37M; hnY5h: $xk3Sl = $JOw_A['host']; goto LHumv; WIKYX: return join('.', array_reverse($jT5GX)); goto Fbu8w; Fbu8w: } goto KLc5N; UYRu1: if (strpos($xk3Sl, '//') === 0 || strpos($xk3Sl, 'http://') === 0 || strpos($xk3Sl, 'https://') === 0) { } else { $xk3Sl = 'http://' . $xk3Sl; } goto Rhw_z; Rhw_z: $JOw_A = parse_url($xk3Sl); goto KC3Db; KLc5N: return null; goto BkzTz; BkzTz: } public static function telephone($ap_Vy) { goto xiYJ6; iq7Gs: $ap_Vy = trim($ap_Vy); goto FSoZm; xiYJ6: $ap_Vy = str_replace(array('+86', '+', ' ', '(', ')', '-', '（', '）', '', ' ', '　', '"', ';', '	'), '', $ap_Vy); goto iq7Gs; BoSoj: return $ap_Vy; goto WtlSD; FSoZm: if (!preg_match('/^[0-9]{3,20}$/', $ap_Vy)) { return null; } goto BoSoj; WtlSD: } public static function isPhone($nOaAD) { return preg_match('/^1[0-9]{10}$/', $nOaAD); } public static function isUUID($nisDw) { return preg_match('/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/', $nisDw); } public static function isUrl($xIfit) { return preg_match('/^(http|https):\\/\\//', $xIfit); } public static function isEmail($RF3C5) { return preg_match('/^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-]+[\\.a-zA-Z0-9_\\-]+$/ ', $RF3C5); } public static function isDomain($xk3Sl) { return preg_match('/([a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?\\.)+[a-z]{2,10}/i', $xk3Sl); } public static function isMoney($bYgtr) { goto bDsQT; bDsQT: if ($bYgtr < 0.01) { return false; } goto a1hzv; cKQEa: return true; goto Wkhbv; a1hzv: if ($bYgtr > 10000 * 100) { return false; } goto cKQEa; Wkhbv: } }