<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class FormatUtil { public static function mainDomain($BlTXG) { goto yU5zf; uIyry: if (isset($ZIe4d['host'])) { goto zz_tT; toUWJ: foreach (array_reverse(explode('.', $BlTXG)) as $NKf8K) { if (in_array($NKf8K, array('cn', 'com', 'org', 'gov', 'edu'))) { $q26cr[] = $NKf8K; continue; } else { $q26cr[] = $NKf8K; } if (count($q26cr) >= 2) { break; } } goto wcRFj; oGsLy: if (preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $BlTXG)) { return $BlTXG; } goto Szz9N; zz_tT: $BlTXG = $ZIe4d['host']; goto oGsLy; Szz9N: $q26cr = array(); goto toUWJ; wcRFj: return join('.', array_reverse($q26cr)); goto vTcrd; vTcrd: } goto iz7DN; yU5zf: if (strpos($BlTXG, '//') === 0 || strpos($BlTXG, 'http://') === 0 || strpos($BlTXG, 'https://') === 0) { } else { $BlTXG = 'http://' . $BlTXG; } goto AZwRF; AZwRF: $ZIe4d = parse_url($BlTXG); goto uIyry; iz7DN: return null; goto KMEhD; KMEhD: } public static function telephone($YVPBs) { goto fW0an; fX7DA: $YVPBs = trim($YVPBs); goto VZ2jB; fW0an: $YVPBs = str_replace(array('+86', '+', ' ', '(', ')', '-', '（', '）', '', ' ', '　', '"', ';', '	'), '', $YVPBs); goto fX7DA; BeNOR: return $YVPBs; goto uvQDP; VZ2jB: if (!preg_match('/^[0-9]{3,20}$/', $YVPBs)) { return null; } goto BeNOR; uvQDP: } public static function isPhone($Nkzfq) { return preg_match('/^1[0-9]{10}$/', $Nkzfq); } public static function isUUID($fKbvE) { return preg_match('/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/', $fKbvE); } public static function isUrl($ik1Qg) { return preg_match('/^(http|https):\\/\\//', $ik1Qg); } public static function isEmail($OMx8L) { return preg_match('/^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-]+[\\.a-zA-Z0-9_\\-]+$/ ', $OMx8L); } public static function isDomain($BlTXG) { return preg_match('/([a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?\\.)+[a-z]{2,10}/i', $BlTXG); } public static function isMoney($RmnUG) { goto gaWjE; jy4Di: if ($RmnUG > 10000 * 100) { return false; } goto XA0i8; XA0i8: return true; goto Je1M1; gaWjE: if ($RmnUG < 0.01) { return false; } goto jy4Di; Je1M1: } }