<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class StrUtil { public static function mask($OIDSk, $BmLXj = null, $L0Uph = null, $MTP2g = '*') { goto YFWkF; dv169: $TTawp = ''; goto ouhV9; ouhV9: if ($BmLXj > 0) { $TTawp .= mb_substr($OIDSk, 0, $BmLXj); } goto ARm98; RSP1G: if ($BmLXj < 0) { $BmLXj = 0; } goto KO5OW; KO5OW: if ($L0Uph >= $bA3hr - 1) { $L0Uph = $bA3hr - 1; } goto dv169; YFWkF: $bA3hr = mb_strlen($OIDSk); goto LxpO8; LxpO8: if (null == $BmLXj) { $BmLXj = floor($bA3hr / 2); } goto EwLXO; LFzfi: if ($L0Uph < $bA3hr - 1) { $TTawp .= mb_substr($OIDSk, $L0Uph + 1); } goto XY06r; ARm98: $TTawp .= str_repeat($MTP2g, $L0Uph - $BmLXj + 1); goto LFzfi; XY06r: return $TTawp; goto hxU42; EwLXO: if (null == $L0Uph) { $L0Uph = $BmLXj + floor($bA3hr / 2); } goto RSP1G; hxU42: } public static function passwordStrength($Y6QUz) { goto N8sg3; cAQ7N: if (!empty($Y6QUz)) { $QZG5A++; } goto fn_wq; qL3lt: if (!empty($Y6QUz)) { $QZG5A++; } goto L_4vu; PCGTH: if (!empty($Y6QUz)) { $QZG5A++; } goto HTonA; tA8wZ: $Y6QUz = preg_replace('/\\d+/', '', $Y6QUz); goto cAQ7N; fn_wq: $Y6QUz = preg_replace('/[a-z]+/', '', $Y6QUz); goto qL3lt; mghTL: if (!empty($Y6QUz)) { $QZG5A++; } goto tA8wZ; L_4vu: $Y6QUz = preg_replace('/[A-Z]+/', '', $Y6QUz); goto PCGTH; N8sg3: $QZG5A = 0; goto mghTL; HTonA: return $QZG5A; goto gU70p; gU70p: } public static function camelize($r8gOh, $MIO20 = '_') { $r8gOh = $MIO20 . str_replace($MIO20, ' ', strtolower($r8gOh)); return ltrim(str_replace(' ', '', ucwords($r8gOh)), $MIO20); } public static function uncamelize($sB7W2, $MIO20 = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', '$1' . $MIO20 . '$2', $sB7W2)); } public static function startWith($wtaX4, $ETFTF) { foreach ((array) $ETFTF as $ZVRty) { if ($ZVRty != '' && mb_strpos($wtaX4, $ZVRty) === 0) { return true; } } return false; } public static function filterSpecialChars($wvO30) { $bkSg1 = array('​', '‌', '‍'); return str_replace($bkSg1, '', $wvO30); } public static function limit($fF8o4, $ORgwx = 100, $kJ2hw = '...') { return Str::limit($fF8o4, $ORgwx, $kJ2hw); } public static function mbLimit($fF8o4, $ORgwx) { return Str::limit($fF8o4, $ORgwx, ''); } public static function mbLimitChars($fF8o4, $ORgwx) { goto mVo1L; gzadE: return $ef7q7; goto P2rmP; lOBbO: $ef7q7 = ''; goto QabMm; QabMm: foreach ($bkSg1 as $lIgOR) { goto mzEWO; mzEWO: $mp0hs += strlen($lIgOR); goto TGkq5; MZBWs: $ef7q7 .= $lIgOR; goto TTUgA; TGkq5: if ($mp0hs > $ORgwx) { break; } goto MZBWs; TTUgA: } goto gzadE; mVo1L: $bkSg1 = mb_str_split($fF8o4, 1, 'UTF-8'); goto jQoU2; jQoU2: $mp0hs = 0; goto lOBbO; P2rmP: } public static function mbLength($fF8o4) { if (empty($fF8o4)) { return 0; } return intval(mb_strlen($fF8o4, 'UTF-8')); } public static function mbLengthGt($fF8o4, $ORgwx) { return self::mbLength($fF8o4) > $ORgwx; } public static function mbWordwrap($cgHv6, $aI0SX = 75, $ilgBO = '
') { goto jSdPR; jSdPR: if ($cgHv6 === '') { return ''; } goto iyOQG; gEMe4: return $h2tHc; goto NbSMD; uX1VY: $GR0Ed = $kGVgG = 0; goto zzlW0; iVOlt: $JN38z = mb_strlen($ilgBO); goto fPhLA; fPhLA: $h2tHc = ''; goto uX1VY; iyOQG: if (strlen($cgHv6) === mb_strlen($cgHv6)) { return wordwrap($cgHv6, $aI0SX, $ilgBO, true); } goto VXQ1M; VXQ1M: $LtZZN = mb_strlen($cgHv6); goto iVOlt; zzlW0: for ($irwTt = 0; $irwTt < $LtZZN; $irwTt++) { $lIgOR = mb_substr($cgHv6, $irwTt, 1); $v1ct_ = $lIgOR; if ($JN38z !== 1) { $v1ct_ = mb_substr($cgHv6, $irwTt, $JN38z); } if ($v1ct_ === $ilgBO) { goto KPyJP; KPyJP: $h2tHc .= mb_substr($cgHv6, $GR0Ed, $irwTt - $GR0Ed + $JN38z); goto jfzvl; bj6uR: $GR0Ed = $kGVgG = $irwTt + 1; goto nYZWB; jfzvl: $irwTt += $JN38z - 1; goto bj6uR; nYZWB: continue; goto ybBYs; ybBYs: } if ($lIgOR === ' ') { goto rPiw5; rPiw5: if ($irwTt - $GR0Ed >= $aI0SX) { $h2tHc .= mb_substr($cgHv6, $GR0Ed, $irwTt - $GR0Ed) . $ilgBO; $GR0Ed = $irwTt + 1; } goto rAi_V; rAi_V: $kGVgG = $irwTt; goto JbGT9; JbGT9: continue; goto p531Z; p531Z: } if ($irwTt - $GR0Ed >= $aI0SX && $GR0Ed >= $kGVgG) { goto b5m_j; ZMG6a: $GR0Ed = $kGVgG = $irwTt; goto xu1Rc; xu1Rc: continue; goto pc3Ig; b5m_j: $h2tHc .= mb_substr($cgHv6, $GR0Ed, $irwTt - $GR0Ed) . $ilgBO; goto ZMG6a; pc3Ig: } if ($irwTt - $GR0Ed >= $aI0SX && $GR0Ed < $kGVgG) { goto Ksc5A; mnpJA: continue; goto l4ec5; kh25N: $GR0Ed = $kGVgG = $kGVgG + 1; goto mnpJA; Ksc5A: $h2tHc .= mb_substr($cgHv6, $GR0Ed, $kGVgG - $GR0Ed) . $ilgBO; goto kh25N; l4ec5: } } goto WnId5; WnId5: if ($GR0Ed !== $irwTt) { $h2tHc .= mb_substr($cgHv6, $GR0Ed, $irwTt - $GR0Ed); } goto gEMe4; NbSMD: } public static function split($fF8o4, $La4pa = ',', $fSYRp = array('，', ';', '；')) { goto kzKuD; qujRw: $kB0Us = array_map('trim', $kB0Us); goto hV8Jt; hV8Jt: $kB0Us = array_filter($kB0Us); goto hr0Yu; kzKuD: $fF8o4 = str_replace($fSYRp, $La4pa, $fF8o4); goto hwtTb; hwtTb: $kB0Us = explode($La4pa, $fF8o4); goto qujRw; hr0Yu: return $kB0Us; goto BhlZJ; BhlZJ: } public static function wordSplit($cgjRu) { if (modstart_module_enabled('WordSpliter')) { $yQ4Wg = \Module\WordSpliter\Util\WordSpliterUtil::cut($cgjRu); } else { preg_match_all('/[\\x{4e00}-\\x{9fa5}]|\\b[A-Za-z]+\\b/u', $cgjRu, $eG2e9); $yQ4Wg = array_filter($eG2e9[0]); } return $yQ4Wg; } }