<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class FormatUtil { public static function mainDomain($ft_KC) { goto COfel; q9OWo: return null; goto KPjdx; COfel: if (strpos($ft_KC, '//') === 0 || strpos($ft_KC, 'http://') === 0 || strpos($ft_KC, 'https://') === 0) { } else { $ft_KC = 'http://' . $ft_KC; } goto XZPf3; XZPf3: $gbVzz = parse_url($ft_KC); goto t3C97; t3C97: if (isset($gbVzz['host'])) { goto JU2AW; f093u: if (preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $ft_KC)) { return $ft_KC; } goto XA7mP; XA7mP: $FSrde = array(); goto xQ0gu; xQ0gu: foreach (array_reverse(explode('.', $ft_KC)) as $UdtHk) { if (in_array($UdtHk, array('cn', 'com', 'org', 'gov', 'edu'))) { $FSrde[] = $UdtHk; continue; } else { $FSrde[] = $UdtHk; } if (count($FSrde) >= 2) { break; } } goto qddOR; JU2AW: $ft_KC = $gbVzz['host']; goto f093u; qddOR: return join('.', array_reverse($FSrde)); goto UJiJC; UJiJC: } goto q9OWo; KPjdx: } public static function telephone($euPEd) { goto fsEh6; rJpBG: if (!preg_match('/^[0-9]{3,20}$/', $euPEd)) { return null; } goto cQ1nC; cQ1nC: return $euPEd; goto gsBtI; fsEh6: $euPEd = str_replace(array('+86', '+', ' ', '(', ')', '-', '（', '）', '', ' ', '　', '"', ';', '	'), '', $euPEd); goto RTtOd; RTtOd: $euPEd = trim($euPEd); goto rJpBG; gsBtI: } public static function isPhone($OSyGK) { return preg_match('/^1[0-9]{10}$/', $OSyGK); } public static function isUUID($M9_n3) { return preg_match('/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/', $M9_n3); } public static function isUrl($XVqXz) { return preg_match('/^(http|https):\\/\\//', $XVqXz); } public static function isEmail($Nb6OF) { return preg_match('/^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-]+[\\.a-zA-Z0-9_\\-]+$/ ', $Nb6OF); } public static function isDomain($ft_KC) { return preg_match('/([a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?\\.)+[a-z]{2,10}/i', $ft_KC); } public static function isMoney($WNgCL) { goto x8SFk; x8SFk: if ($WNgCL < 0.01) { return false; } goto S8cvu; oIveV: return true; goto SWluC; S8cvu: if ($WNgCL > 10000 * 100) { return false; } goto oIveV; SWluC: } }