<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class FormatUtil { public static function mainDomain($esWXv) { goto FcIh6; eOebB: if (isset($UdQ1p['host'])) { goto tT5Jx; tT5Jx: $esWXv = $UdQ1p['host']; goto xEfa8; Cw9Rr: foreach (array_reverse(explode('.', $esWXv)) as $ju0cF) { if (in_array($ju0cF, array('cn', 'com', 'org', 'gov', 'edu'))) { $kaMU7[] = $ju0cF; continue; } else { $kaMU7[] = $ju0cF; } if (count($kaMU7) >= 2) { break; } } goto OKtqV; xEfa8: if (preg_match('/^\\d+\\.\\d+\\.\\d+\\.\\d+$/', $esWXv)) { return $esWXv; } goto VKgcv; OKtqV: return join('.', array_reverse($kaMU7)); goto GOzkv; VKgcv: $kaMU7 = array(); goto Cw9Rr; GOzkv: } goto cr7jd; cr7jd: return null; goto Ku8BS; FcIh6: if (strpos($esWXv, '//') === 0 || strpos($esWXv, 'http://') === 0 || strpos($esWXv, 'https://') === 0) { } else { $esWXv = 'http://' . $esWXv; } goto Jcgtl; Jcgtl: $UdQ1p = parse_url($esWXv); goto eOebB; Ku8BS: } public static function telephone($TmsXf) { goto ANVEs; ANVEs: $TmsXf = str_replace(array('+86', '+', ' ', '(', ')', '-', '（', '）', '', ' ', '　', '"', ';', '	'), '', $TmsXf); goto aO2Xi; eVgHQ: if (!preg_match('/^[0-9]{3,20}$/', $TmsXf)) { return null; } goto HJiL9; HJiL9: return $TmsXf; goto wbKnR; aO2Xi: $TmsXf = trim($TmsXf); goto eVgHQ; wbKnR: } public static function isPhone($HXMAB) { return preg_match('/^1[0-9]{10}$/', $HXMAB); } public static function isUUID($vgKyE) { return preg_match('/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/', $vgKyE); } public static function isUrl($YjgEW) { return preg_match('/^(http|https):\\/\\//', $YjgEW); } public static function isEmail($H56bz) { return preg_match('/^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-]+[\\.a-zA-Z0-9_\\-]+$/ ', $H56bz); } public static function isDomain($esWXv) { return preg_match('/([a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?\\.)+[a-z]{2,10}/i', $esWXv); } public static function isMoney($lLmV3) { goto ZBSUM; mgnHF: return true; goto Nl4xm; DP74I: if ($lLmV3 > 10000 * 100) { return false; } goto mgnHF; ZBSUM: if ($lLmV3 < 0.01) { return false; } goto DP74I; Nl4xm: } }