<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class StrUtil { public static function mask($tTDuu, $vodmB = null, $ophAP = null, $Uh287 = '*') { goto ZD8HA; vskHR: if ($vodmB < 0) { $vodmB = 0; } goto N6inJ; ezDBu: if ($ophAP < $av7KV - 1) { $yFvCf .= mb_substr($tTDuu, $ophAP + 1); } goto M3SCo; ls_OP: if (null == $vodmB) { $vodmB = floor($av7KV / 2); } goto NO8Bs; N6inJ: if ($ophAP >= $av7KV - 1) { $ophAP = $av7KV - 1; } goto rNrwO; ZD8HA: $av7KV = mb_strlen($tTDuu); goto ls_OP; tKnWY: $yFvCf .= str_repeat($Uh287, $ophAP - $vodmB + 1); goto ezDBu; NO8Bs: if (null == $ophAP) { $ophAP = $vodmB + floor($av7KV / 2); } goto vskHR; M3SCo: return $yFvCf; goto t_I5q; rNrwO: $yFvCf = ''; goto WK8OU; WK8OU: if ($vodmB > 0) { $yFvCf .= mb_substr($tTDuu, 0, $vodmB); } goto tKnWY; t_I5q: } public static function passwordStrength($cv0ME) { goto Rz04L; RI_4o: if (!empty($cv0ME)) { $nx3od++; } goto yjTjN; Xd3vC: if (!empty($cv0ME)) { $nx3od++; } goto sFtQZ; vPyAb: return $nx3od; goto M1VPb; VmuoY: if (!empty($cv0ME)) { $nx3od++; } goto vPyAb; Rz04L: $nx3od = 0; goto RI_4o; yjTjN: $cv0ME = preg_replace('/\\d+/', '', $cv0ME); goto B1j4O; sFtQZ: $cv0ME = preg_replace('/[A-Z]+/', '', $cv0ME); goto VmuoY; AjiTd: $cv0ME = preg_replace('/[a-z]+/', '', $cv0ME); goto Xd3vC; B1j4O: if (!empty($cv0ME)) { $nx3od++; } goto AjiTd; M1VPb: } public static function camelize($h_lLs, $oQWUt = '_') { $h_lLs = $oQWUt . str_replace($oQWUt, ' ', strtolower($h_lLs)); return ltrim(str_replace(' ', '', ucwords($h_lLs)), $oQWUt); } public static function uncamelize($wD8ZA, $oQWUt = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', '$1' . $oQWUt . '$2', $wD8ZA)); } public static function startWith($SKr38, $m_fpE) { foreach ((array) $m_fpE as $DrQac) { if ($DrQac != '' && mb_strpos($SKr38, $DrQac) === 0) { return true; } } return false; } public static function filterSpecialChars($ib3B9) { $hXuQ_ = array('​', '‌', '‍'); return str_replace($hXuQ_, '', $ib3B9); } public static function limit($BaGNs, $P4x0J = 100, $o6kkl = '...') { return Str::limit($BaGNs, $P4x0J, $o6kkl); } public static function mbLimit($BaGNs, $P4x0J) { return Str::limit($BaGNs, $P4x0J, ''); } public static function mbLimitChars($BaGNs, $P4x0J) { goto NOySM; n9pCb: foreach ($hXuQ_ as $SsOcT) { goto G6J_h; zjS9O: if ($cE0Z8 > $P4x0J) { break; } goto tbzZ4; tbzZ4: $mrt0K .= $SsOcT; goto s1gjX; G6J_h: $cE0Z8 += strlen($SsOcT); goto zjS9O; s1gjX: } goto qmyfX; htpII: $mrt0K = ''; goto n9pCb; NOySM: $hXuQ_ = mb_str_split($BaGNs, 1, 'UTF-8'); goto Xi3X1; qmyfX: return $mrt0K; goto Z2j9d; Xi3X1: $cE0Z8 = 0; goto htpII; Z2j9d: } public static function mbLength($BaGNs) { if (empty($BaGNs)) { return 0; } return intval(mb_strlen($BaGNs, 'UTF-8')); } public static function mbLengthGt($BaGNs, $P4x0J) { return self::mbLength($BaGNs) > $P4x0J; } public static function mbWordwrap($HrIWB, $gCaaD = 75, $jobHr = '
') { goto wewqS; Ku2SR: $Jl09v = mb_strlen($jobHr); goto g2JMb; VOi0O: return $XPCCC; goto ZFmko; k9sim: $rYW3m = mb_strlen($HrIWB); goto Ku2SR; urTKm: if ($UxKRV !== $HeDTO) { $XPCCC .= mb_substr($HrIWB, $UxKRV, $HeDTO - $UxKRV); } goto VOi0O; rpfTk: $UxKRV = $D3vlk = 0; goto UOXQ2; wewqS: if ($HrIWB === '') { return ''; } goto H5ErV; UOXQ2: for ($HeDTO = 0; $HeDTO < $rYW3m; $HeDTO++) { $SsOcT = mb_substr($HrIWB, $HeDTO, 1); $xKyS2 = $SsOcT; if ($Jl09v !== 1) { $xKyS2 = mb_substr($HrIWB, $HeDTO, $Jl09v); } if ($xKyS2 === $jobHr) { goto NQFtE; cvBf5: continue; goto LdfID; SfErC: $HeDTO += $Jl09v - 1; goto xsRFk; NQFtE: $XPCCC .= mb_substr($HrIWB, $UxKRV, $HeDTO - $UxKRV + $Jl09v); goto SfErC; xsRFk: $UxKRV = $D3vlk = $HeDTO + 1; goto cvBf5; LdfID: } if ($SsOcT === ' ') { goto U_sqP; tIJ57: $D3vlk = $HeDTO; goto Cy9Gu; U_sqP: if ($HeDTO - $UxKRV >= $gCaaD) { $XPCCC .= mb_substr($HrIWB, $UxKRV, $HeDTO - $UxKRV) . $jobHr; $UxKRV = $HeDTO + 1; } goto tIJ57; Cy9Gu: continue; goto f2MLB; f2MLB: } if ($HeDTO - $UxKRV >= $gCaaD && $UxKRV >= $D3vlk) { goto XEqg5; LYvCT: $UxKRV = $D3vlk = $HeDTO; goto GskV1; XEqg5: $XPCCC .= mb_substr($HrIWB, $UxKRV, $HeDTO - $UxKRV) . $jobHr; goto LYvCT; GskV1: continue; goto SADrw; SADrw: } if ($HeDTO - $UxKRV >= $gCaaD && $UxKRV < $D3vlk) { goto hOfB_; aPGH2: continue; goto JSKoy; hOfB_: $XPCCC .= mb_substr($HrIWB, $UxKRV, $D3vlk - $UxKRV) . $jobHr; goto r9eK5; r9eK5: $UxKRV = $D3vlk = $D3vlk + 1; goto aPGH2; JSKoy: } } goto urTKm; g2JMb: $XPCCC = ''; goto rpfTk; H5ErV: if (strlen($HrIWB) === mb_strlen($HrIWB)) { return wordwrap($HrIWB, $gCaaD, $jobHr, true); } goto k9sim; ZFmko: } public static function split($BaGNs, $qUQoN = ',', $pZRj0 = array('，', ';', '；')) { goto MSbgq; yseY3: $bP0d3 = explode($qUQoN, $BaGNs); goto OdXV1; M9JC4: return $bP0d3; goto A0enM; XqEJ0: $bP0d3 = array_filter($bP0d3); goto M9JC4; MSbgq: $BaGNs = str_replace($pZRj0, $qUQoN, $BaGNs); goto yseY3; OdXV1: $bP0d3 = array_map('trim', $bP0d3); goto XqEJ0; A0enM: } public static function wordSplit($ohNZt) { if (modstart_module_enabled('WordSpliter')) { $FSrde = \Module\WordSpliter\Util\WordSpliterUtil::cut($ohNZt); } else { preg_match_all('/[\\x{4e00}-\\x{9fa5}]|\\b[A-Za-z]+\\b/u', $ohNZt, $wsKBJ); $FSrde = array_filter($wsKBJ[0]); } return $FSrde; } }