<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class StrUtil { public static function mask($u5SPM, $mSH31 = null, $AKoef = null, $CNfHx = '*') { goto uDgtx; uDgtx: $jLnS0 = mb_strlen($u5SPM); goto x5wsC; BbCS_: return $mbw6e; goto cgLUP; rN9_I: if ($mSH31 > 0) { $mbw6e .= mb_substr($u5SPM, 0, $mSH31); } goto XwdBa; fKzyO: if ($AKoef < $jLnS0 - 1) { $mbw6e .= mb_substr($u5SPM, $AKoef + 1); } goto BbCS_; x5wsC: if (null == $mSH31) { $mSH31 = floor($jLnS0 / 2); } goto ALVR2; AmL0Q: if ($AKoef >= $jLnS0 - 1) { $AKoef = $jLnS0 - 1; } goto ieE8E; ALVR2: if (null == $AKoef) { $AKoef = $mSH31 + floor($jLnS0 / 2); } goto LK2W9; ieE8E: $mbw6e = ''; goto rN9_I; LK2W9: if ($mSH31 < 0) { $mSH31 = 0; } goto AmL0Q; XwdBa: $mbw6e .= str_repeat($CNfHx, $AKoef - $mSH31 + 1); goto fKzyO; cgLUP: } public static function passwordStrength($njstY) { goto vCAcU; CLUbT: if (!empty($njstY)) { $hhs49++; } goto r3iSp; ovcy3: $njstY = preg_replace('/[A-Z]+/', '', $njstY); goto CLUbT; vCAcU: $hhs49 = 0; goto tuTOA; IEmtz: if (!empty($njstY)) { $hhs49++; } goto ovcy3; zOchr: $njstY = preg_replace('/[a-z]+/', '', $njstY); goto IEmtz; iInwF: if (!empty($njstY)) { $hhs49++; } goto zOchr; tuTOA: if (!empty($njstY)) { $hhs49++; } goto JFfQ7; JFfQ7: $njstY = preg_replace('/\\d+/', '', $njstY); goto iInwF; r3iSp: return $hhs49; goto fJAcK; fJAcK: } public static function camelize($NUoyv, $K0Zph = '_') { $NUoyv = $K0Zph . str_replace($K0Zph, ' ', strtolower($NUoyv)); return ltrim(str_replace(' ', '', ucwords($NUoyv)), $K0Zph); } public static function uncamelize($h4ERr, $K0Zph = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', '$1' . $K0Zph . '$2', $h4ERr)); } public static function startWith($g8qpO, $Sofrh) { foreach ((array) $Sofrh as $a2drh) { if ($a2drh != '' && mb_strpos($g8qpO, $a2drh) === 0) { return true; } } return false; } public static function filterSpecialChars($HDpl6) { $kCoeg = array('​', '‌', '‍'); return str_replace($kCoeg, '', $HDpl6); } public static function limit($QvR6j, $D8igw = 100, $HBrrp = '...') { return Str::limit($QvR6j, $D8igw, $HBrrp); } public static function mbLimit($QvR6j, $D8igw) { return Str::limit($QvR6j, $D8igw, ''); } public static function mbLimitChars($QvR6j, $D8igw) { goto KXP42; nMCTo: $QaAPh = ''; goto ieVVH; KXP42: $kCoeg = mb_str_split($QvR6j, 1, 'UTF-8'); goto L2Fcd; UkLao: return $QaAPh; goto k1PVY; L2Fcd: $C6Thv = 0; goto nMCTo; ieVVH: foreach ($kCoeg as $OIDEb) { goto iYOc3; FCtgm: if ($C6Thv > $D8igw) { break; } goto Hh9vW; Hh9vW: $QaAPh .= $OIDEb; goto B0_im; iYOc3: $C6Thv += strlen($OIDEb); goto FCtgm; B0_im: } goto UkLao; k1PVY: } public static function mbLength($QvR6j) { if (empty($QvR6j)) { return 0; } return intval(mb_strlen($QvR6j, 'UTF-8')); } public static function mbLengthGt($QvR6j, $D8igw) { return self::mbLength($QvR6j) > $D8igw; } public static function mbWordwrap($WLl1X, $GLdhF = 75, $FEZDZ = '
') { goto P63Kc; aXlWd: $hsKlY = $tCfqE = 0; goto iGbSR; mm4Xy: return $GlTLE; goto hkCq2; zC1W9: if ($hsKlY !== $bjcIl) { $GlTLE .= mb_substr($WLl1X, $hsKlY, $bjcIl - $hsKlY); } goto mm4Xy; MLqjL: $GlTLE = ''; goto aXlWd; P63Kc: if ($WLl1X === '') { return ''; } goto dkvPj; iGbSR: for ($bjcIl = 0; $bjcIl < $aryfn; $bjcIl++) { $OIDEb = mb_substr($WLl1X, $bjcIl, 1); $KXgO8 = $OIDEb; if ($qZJbb !== 1) { $KXgO8 = mb_substr($WLl1X, $bjcIl, $qZJbb); } if ($KXgO8 === $FEZDZ) { goto NK_Ip; mFOhy: $bjcIl += $qZJbb - 1; goto dedMF; NK_Ip: $GlTLE .= mb_substr($WLl1X, $hsKlY, $bjcIl - $hsKlY + $qZJbb); goto mFOhy; dedMF: $hsKlY = $tCfqE = $bjcIl + 1; goto HpLYw; HpLYw: continue; goto AZYJs; AZYJs: } if ($OIDEb === ' ') { goto ggzxv; ggzxv: if ($bjcIl - $hsKlY >= $GLdhF) { $GlTLE .= mb_substr($WLl1X, $hsKlY, $bjcIl - $hsKlY) . $FEZDZ; $hsKlY = $bjcIl + 1; } goto M8j5M; BfLKc: continue; goto Pl8W8; M8j5M: $tCfqE = $bjcIl; goto BfLKc; Pl8W8: } if ($bjcIl - $hsKlY >= $GLdhF && $hsKlY >= $tCfqE) { goto mKrnZ; mKrnZ: $GlTLE .= mb_substr($WLl1X, $hsKlY, $bjcIl - $hsKlY) . $FEZDZ; goto SJTB9; ZjcgD: continue; goto kFz7L; SJTB9: $hsKlY = $tCfqE = $bjcIl; goto ZjcgD; kFz7L: } if ($bjcIl - $hsKlY >= $GLdhF && $hsKlY < $tCfqE) { goto lF_Qr; lF_Qr: $GlTLE .= mb_substr($WLl1X, $hsKlY, $tCfqE - $hsKlY) . $FEZDZ; goto aiHWV; Fw7M9: continue; goto LCX92; aiHWV: $hsKlY = $tCfqE = $tCfqE + 1; goto Fw7M9; LCX92: } } goto zC1W9; dkvPj: if (strlen($WLl1X) === mb_strlen($WLl1X)) { return wordwrap($WLl1X, $GLdhF, $FEZDZ, true); } goto gkTq3; gkTq3: $aryfn = mb_strlen($WLl1X); goto WuIcq; WuIcq: $qZJbb = mb_strlen($FEZDZ); goto MLqjL; hkCq2: } public static function split($QvR6j, $uyHs9 = ',', $yhga6 = array('，', ';', '；')) { goto CnIAX; VStBI: return $c6Fiz; goto Tby_y; CPRpq: $c6Fiz = array_map('trim', $c6Fiz); goto hvp73; zLWE0: $c6Fiz = explode($uyHs9, $QvR6j); goto CPRpq; CnIAX: $QvR6j = str_replace($yhga6, $uyHs9, $QvR6j); goto zLWE0; hvp73: $c6Fiz = array_filter($c6Fiz); goto VStBI; Tby_y: } public static function wordSplit($BWI89) { if (modstart_module_enabled('WordSpliter')) { $QhMxe = \Module\WordSpliter\Util\WordSpliterUtil::cut($BWI89); } else { preg_match_all('/[\\x{4e00}-\\x{9fa5}]|\\b[A-Za-z]+\\b/u', $BWI89, $S8gta); $QhMxe = array_filter($S8gta[0]); } return $QhMxe; } }