<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class StrUtil { public static function mask($n02gs, $F15DJ = null, $i7_ma = null, $jPaoE = '*') { goto XD1kz; qFoo4: if (null == $F15DJ) { $F15DJ = floor($biJqN / 2); } goto SRo2Q; awQQS: if ($i7_ma >= $biJqN - 1) { $i7_ma = $biJqN - 1; } goto Gv27U; tYeT0: return $Xsls1; goto hkaX1; mPCk4: if ($i7_ma < $biJqN - 1) { $Xsls1 .= mb_substr($n02gs, $i7_ma + 1); } goto tYeT0; jFmYX: $Xsls1 .= str_repeat($jPaoE, $i7_ma - $F15DJ + 1); goto mPCk4; XD1kz: $biJqN = mb_strlen($n02gs); goto qFoo4; HqHnM: if ($F15DJ < 0) { $F15DJ = 0; } goto awQQS; Gv27U: $Xsls1 = ''; goto BWPU5; BWPU5: if ($F15DJ > 0) { $Xsls1 .= mb_substr($n02gs, 0, $F15DJ); } goto jFmYX; SRo2Q: if (null == $i7_ma) { $i7_ma = $F15DJ + floor($biJqN / 2); } goto HqHnM; hkaX1: } public static function passwordStrength($wjfbs) { goto NsAPg; LasLO: if (!empty($wjfbs)) { $eZ9k4++; } goto NrrjF; CNPeV: if (!empty($wjfbs)) { $eZ9k4++; } goto gyMA0; ryzF0: if (!empty($wjfbs)) { $eZ9k4++; } goto DDQZJ; NrrjF: return $eZ9k4; goto QGxS9; P25ea: $wjfbs = preg_replace('/\\d+/', '', $wjfbs); goto CNPeV; gyMA0: $wjfbs = preg_replace('/[a-z]+/', '', $wjfbs); goto ryzF0; NsAPg: $eZ9k4 = 0; goto udiHX; udiHX: if (!empty($wjfbs)) { $eZ9k4++; } goto P25ea; DDQZJ: $wjfbs = preg_replace('/[A-Z]+/', '', $wjfbs); goto LasLO; QGxS9: } public static function camelize($ZLgui, $r0Ni_ = '_') { $ZLgui = $r0Ni_ . str_replace($r0Ni_, ' ', strtolower($ZLgui)); return ltrim(str_replace(' ', '', ucwords($ZLgui)), $r0Ni_); } public static function uncamelize($D87OL, $r0Ni_ = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', '$1' . $r0Ni_ . '$2', $D87OL)); } public static function startWith($GzCiy, $kNlfo) { foreach ((array) $kNlfo as $xkBic) { if ($xkBic != '' && mb_strpos($GzCiy, $xkBic) === 0) { return true; } } return false; } public static function filterSpecialChars($cBDsM) { $eDoQe = array('​', '‌', '‍'); return str_replace($eDoQe, '', $cBDsM); } public static function limit($uujLm, $XIqI9 = 100, $bWtXG = '...') { return Str::limit($uujLm, $XIqI9, $bWtXG); } public static function mbLimit($uujLm, $XIqI9) { return Str::limit($uujLm, $XIqI9, ''); } public static function mbLimitChars($uujLm, $XIqI9) { goto my_za; uARsH: $KSl7j = 0; goto Ql45w; nGmnw: return $AWlMZ; goto q8yLB; Ql45w: $AWlMZ = ''; goto VkMJn; VkMJn: foreach ($eDoQe as $rB0Os) { goto pODQR; TQYzJ: if ($KSl7j > $XIqI9) { break; } goto gHuUJ; gHuUJ: $AWlMZ .= $rB0Os; goto TX1zP; pODQR: $KSl7j += strlen($rB0Os); goto TQYzJ; TX1zP: } goto nGmnw; my_za: $eDoQe = mb_str_split($uujLm, 1, 'UTF-8'); goto uARsH; q8yLB: } public static function mbLength($uujLm) { if (empty($uujLm)) { return 0; } return intval(mb_strlen($uujLm, 'UTF-8')); } public static function mbLengthGt($uujLm, $XIqI9) { return self::mbLength($uujLm) > $XIqI9; } public static function mbWordwrap($CzxDH, $g_1Yr = 75, $INJnS = '
') { goto LvwhK; LvwhK: if ($CzxDH === '') { return ''; } goto EQiDL; T4BhH: $j9Bnb = ''; goto iwL_w; ozml1: return $j9Bnb; goto gFFZy; EQiDL: if (strlen($CzxDH) === mb_strlen($CzxDH)) { return wordwrap($CzxDH, $g_1Yr, $INJnS, true); } goto SL8Qb; Gxm63: for ($ewlJ7 = 0; $ewlJ7 < $IWF43; $ewlJ7++) { $rB0Os = mb_substr($CzxDH, $ewlJ7, 1); $L_Jwl = $rB0Os; if ($f57HP !== 1) { $L_Jwl = mb_substr($CzxDH, $ewlJ7, $f57HP); } if ($L_Jwl === $INJnS) { goto zGZ0Y; gzBRC: $ewlJ7 += $f57HP - 1; goto ueCHX; ueCHX: $Pt4pp = $in2mv = $ewlJ7 + 1; goto LRosw; zGZ0Y: $j9Bnb .= mb_substr($CzxDH, $Pt4pp, $ewlJ7 - $Pt4pp + $f57HP); goto gzBRC; LRosw: continue; goto Y9wlo; Y9wlo: } if ($rB0Os === ' ') { goto j0g92; Uowt2: $in2mv = $ewlJ7; goto zazJX; j0g92: if ($ewlJ7 - $Pt4pp >= $g_1Yr) { $j9Bnb .= mb_substr($CzxDH, $Pt4pp, $ewlJ7 - $Pt4pp) . $INJnS; $Pt4pp = $ewlJ7 + 1; } goto Uowt2; zazJX: continue; goto cngvN; cngvN: } if ($ewlJ7 - $Pt4pp >= $g_1Yr && $Pt4pp >= $in2mv) { goto i7ynN; igA7W: $Pt4pp = $in2mv = $ewlJ7; goto BLTts; i7ynN: $j9Bnb .= mb_substr($CzxDH, $Pt4pp, $ewlJ7 - $Pt4pp) . $INJnS; goto igA7W; BLTts: continue; goto UOdKh; UOdKh: } if ($ewlJ7 - $Pt4pp >= $g_1Yr && $Pt4pp < $in2mv) { goto SQpgO; lq5ub: continue; goto fcp8S; SQpgO: $j9Bnb .= mb_substr($CzxDH, $Pt4pp, $in2mv - $Pt4pp) . $INJnS; goto C0EUz; C0EUz: $Pt4pp = $in2mv = $in2mv + 1; goto lq5ub; fcp8S: } } goto T00qU; iwL_w: $Pt4pp = $in2mv = 0; goto Gxm63; T00qU: if ($Pt4pp !== $ewlJ7) { $j9Bnb .= mb_substr($CzxDH, $Pt4pp, $ewlJ7 - $Pt4pp); } goto ozml1; SL8Qb: $IWF43 = mb_strlen($CzxDH); goto oVyER; oVyER: $f57HP = mb_strlen($INJnS); goto T4BhH; gFFZy: } public static function split($uujLm, $ZGzzy = ',', $yYvz4 = array('，', ';', '；')) { goto x5Hs1; x5Hs1: $uujLm = str_replace($yYvz4, $ZGzzy, $uujLm); goto sUeTR; sUeTR: $aJd3g = explode($ZGzzy, $uujLm); goto aZxYB; jbn_e: return $aJd3g; goto kBvHP; aZxYB: $aJd3g = array_map('trim', $aJd3g); goto UdCzi; UdCzi: $aJd3g = array_filter($aJd3g); goto jbn_e; kBvHP: } public static function wordSplit($gP2DQ) { if (modstart_module_enabled('WordSpliter')) { $TsqdX = \Module\WordSpliter\Util\WordSpliterUtil::cut($gP2DQ); } else { preg_match_all('/[\\x{4e00}-\\x{9fa5}]|[A-Za-z]+/u', $gP2DQ, $YANPA); $TsqdX = array_filter($YANPA[0]); } return $TsqdX; } }