<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class FormatUtil { public static function mainDomain($tYHk2) { goto DeEet; zLywE: if (isset($Z5nZL['host'])) { goto jvzfS; Nq0Rd: $QhMxe = array(); goto j8kmU; jvzfS: $tYHk2 = $Z5nZL['host']; goto kIYYU; j8kmU: foreach (array_reverse(explode('.', $tYHk2)) as $qwcyu) { if (in_array($qwcyu, array('cn', 'com', 'org', 'gov', 'edu'))) { $QhMxe[] = $qwcyu; continue; } else { $QhMxe[] = $qwcyu; } if (count($QhMxe) >= 2) { break; } } goto DLEee; kIYYU: if (preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $tYHk2)) { return $tYHk2; } goto Nq0Rd; DLEee: return join('.', array_reverse($QhMxe)); goto oJmF5; oJmF5: } goto iSlxH; K2yl0: $Z5nZL = parse_url($tYHk2); goto zLywE; iSlxH: return null; goto N3bH4; DeEet: if (strpos($tYHk2, '//') === 0 || strpos($tYHk2, 'http://') === 0 || strpos($tYHk2, 'https://') === 0) { } else { $tYHk2 = 'http://' . $tYHk2; } goto K2yl0; N3bH4: } public static function telephone($M5tgr) { goto iUU9Y; UwlTw: if (!preg_match('/^[0-9]{3,20}$/', $M5tgr)) { return null; } goto AOGPz; h_2Ma: $M5tgr = trim($M5tgr); goto UwlTw; iUU9Y: $M5tgr = str_replace(array('+86', '+', ' ', '(', ')', '-', '（', '）', '', ' ', '　', '"', ';', '	'), '', $M5tgr); goto h_2Ma; AOGPz: return $M5tgr; goto ja5_R; ja5_R: } public static function isPhone($smSwn) { return preg_match('/^1[0-9]{10}$/', $smSwn); } public static function isUUID($LGDMt) { return preg_match('/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/', $LGDMt); } public static function isUrl($tpgiq) { return preg_match('/^(http|https):\\/\\//', $tpgiq); } public static function isEmail($SdVik) { return preg_match('/^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-]+[\\.a-zA-Z0-9_\\-]+$/ ', $SdVik); } public static function isDomain($tYHk2) { return preg_match('/([a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?\\.)+[a-z]{2,10}/i', $tYHk2); } public static function isMoney($HQHZD) { goto mzkly; CtUpP: return true; goto w3CCn; mzkly: if ($HQHZD < 0.01) { return false; } goto sF9aI; sF9aI: if ($HQHZD > 10000 * 100) { return false; } goto CtUpP; w3CCn: } }