<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class StrUtil { public static function mask($Yhs9S, $sOpBS = null, $UGEw3 = null, $hCmdU = '*') { goto ybJ9U; QG3uc: if (null == $UGEw3) { $UGEw3 = $sOpBS + floor($atix_ / 2); } goto wF8tq; N0zkA: if ($UGEw3 < $atix_ - 1) { $xiYxe .= mb_substr($Yhs9S, $UGEw3 + 1); } goto ZUdQp; wF8tq: if ($sOpBS < 0) { $sOpBS = 0; } goto gdZ3y; MPK_a: if (null == $sOpBS) { $sOpBS = floor($atix_ / 2); } goto QG3uc; udK8J: $xiYxe .= str_repeat($hCmdU, $UGEw3 - $sOpBS + 1); goto N0zkA; OpuTi: if ($sOpBS > 0) { $xiYxe .= mb_substr($Yhs9S, 0, $sOpBS); } goto udK8J; Wfl3D: $xiYxe = ''; goto OpuTi; ybJ9U: $atix_ = mb_strlen($Yhs9S); goto MPK_a; gdZ3y: if ($UGEw3 >= $atix_ - 1) { $UGEw3 = $atix_ - 1; } goto Wfl3D; ZUdQp: return $xiYxe; goto YX7sg; YX7sg: } public static function passwordStrength($SQma7) { goto j4EE2; j4EE2: $gWgvB = 0; goto wuuxH; sMREr: return $gWgvB; goto uTElO; My3tp: $SQma7 = preg_replace('/[a-z]+/', '', $SQma7); goto s1xyX; wuuxH: if (!empty($SQma7)) { $gWgvB++; } goto X3bbJ; s1xyX: if (!empty($SQma7)) { $gWgvB++; } goto PxZ8X; mZU75: if (!empty($SQma7)) { $gWgvB++; } goto sMREr; i_sJC: if (!empty($SQma7)) { $gWgvB++; } goto My3tp; PxZ8X: $SQma7 = preg_replace('/[A-Z]+/', '', $SQma7); goto mZU75; X3bbJ: $SQma7 = preg_replace('/\\d+/', '', $SQma7); goto i_sJC; uTElO: } public static function camelize($nrJTq, $L2Div = '_') { $nrJTq = $L2Div . str_replace($L2Div, ' ', strtolower($nrJTq)); return ltrim(str_replace(' ', '', ucwords($nrJTq)), $L2Div); } public static function uncamelize($Nt99D, $L2Div = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', '$1' . $L2Div . '$2', $Nt99D)); } public static function startWith($fzTC_, $xvVNR) { foreach ((array) $xvVNR as $HBSq_) { if ($HBSq_ != '' && mb_strpos($fzTC_, $HBSq_) === 0) { return true; } } return false; } public static function filterSpecialChars($gwXrh) { $YU710 = array('​', '‌', '‍'); return str_replace($YU710, '', $gwXrh); } public static function limit($nvOlQ, $Cq2Q4 = 100, $s3Bxz = '...') { return Str::limit($nvOlQ, $Cq2Q4, $s3Bxz); } public static function mbLimit($nvOlQ, $Cq2Q4) { return Str::limit($nvOlQ, $Cq2Q4, ''); } public static function mbLimitChars($nvOlQ, $Cq2Q4) { goto e754B; A_0aB: $RZlQE = 0; goto CuK92; Ft_01: return $M37j0; goto nn0h_; EnnE9: foreach ($YU710 as $aE__R) { goto qoACh; YC6Y7: $M37j0 .= $aE__R; goto R3ifg; qoACh: $RZlQE += strlen($aE__R); goto CFY00; CFY00: if ($RZlQE > $Cq2Q4) { break; } goto YC6Y7; R3ifg: } goto Ft_01; CuK92: $M37j0 = ''; goto EnnE9; e754B: $YU710 = mb_str_split($nvOlQ, 1, 'UTF-8'); goto A_0aB; nn0h_: } public static function mbLength($nvOlQ) { if (empty($nvOlQ)) { return 0; } return intval(mb_strlen($nvOlQ, 'UTF-8')); } public static function mbLengthGt($nvOlQ, $Cq2Q4) { return self::mbLength($nvOlQ) > $Cq2Q4; } public static function mbWordwrap($T5Bna, $r3IZu = 75, $Eb5cd = '
') { goto zoed8; xWoe5: $UCTL0 = $Fxn03 = 0; goto MZ5dF; OtT5b: if (strlen($T5Bna) === mb_strlen($T5Bna)) { return wordwrap($T5Bna, $r3IZu, $Eb5cd, true); } goto r4Dtm; tCe1d: return $Iy3i6; goto W44yG; eDUzy: $e2WMc = mb_strlen($Eb5cd); goto uj81G; uj81G: $Iy3i6 = ''; goto xWoe5; r4Dtm: $c21r3 = mb_strlen($T5Bna); goto eDUzy; zoed8: if ($T5Bna === '') { return ''; } goto OtT5b; y0eL0: if ($UCTL0 !== $kyrro) { $Iy3i6 .= mb_substr($T5Bna, $UCTL0, $kyrro - $UCTL0); } goto tCe1d; MZ5dF: for ($kyrro = 0; $kyrro < $c21r3; $kyrro++) { $aE__R = mb_substr($T5Bna, $kyrro, 1); $OIc5W = $aE__R; if ($e2WMc !== 1) { $OIc5W = mb_substr($T5Bna, $kyrro, $e2WMc); } if ($OIc5W === $Eb5cd) { goto Cjuzn; Cjuzn: $Iy3i6 .= mb_substr($T5Bna, $UCTL0, $kyrro - $UCTL0 + $e2WMc); goto ilEfP; bTNB8: continue; goto NN1en; ilEfP: $kyrro += $e2WMc - 1; goto zzHmy; zzHmy: $UCTL0 = $Fxn03 = $kyrro + 1; goto bTNB8; NN1en: } if ($aE__R === ' ') { goto XHS8F; ggACl: continue; goto AzFXl; XHS8F: if ($kyrro - $UCTL0 >= $r3IZu) { $Iy3i6 .= mb_substr($T5Bna, $UCTL0, $kyrro - $UCTL0) . $Eb5cd; $UCTL0 = $kyrro + 1; } goto vtlD9; vtlD9: $Fxn03 = $kyrro; goto ggACl; AzFXl: } if ($kyrro - $UCTL0 >= $r3IZu && $UCTL0 >= $Fxn03) { goto Y2CuE; eP1Hh: continue; goto DglWu; FPETR: $UCTL0 = $Fxn03 = $kyrro; goto eP1Hh; Y2CuE: $Iy3i6 .= mb_substr($T5Bna, $UCTL0, $kyrro - $UCTL0) . $Eb5cd; goto FPETR; DglWu: } if ($kyrro - $UCTL0 >= $r3IZu && $UCTL0 < $Fxn03) { goto wuF1S; wuF1S: $Iy3i6 .= mb_substr($T5Bna, $UCTL0, $Fxn03 - $UCTL0) . $Eb5cd; goto TDikm; TDikm: $UCTL0 = $Fxn03 = $Fxn03 + 1; goto zyOvL; zyOvL: continue; goto m4mo4; m4mo4: } } goto y0eL0; W44yG: } public static function split($nvOlQ, $awhCu = ',', $DB9Zy = array('，', ';', '；')) { goto ONLGD; jdp9L: return $i5Ynu; goto U8bha; LKBL_: $i5Ynu = array_filter($i5Ynu); goto jdp9L; GG4YN: $i5Ynu = explode($awhCu, $nvOlQ); goto muwiI; muwiI: $i5Ynu = array_map('trim', $i5Ynu); goto LKBL_; ONLGD: $nvOlQ = str_replace($DB9Zy, $awhCu, $nvOlQ); goto GG4YN; U8bha: } public static function wordSplit($DTnPC) { if (modstart_module_enabled('WordSpliter')) { $kaMU7 = \Module\WordSpliter\Util\WordSpliterUtil::cut($DTnPC); } else { preg_match_all('/[\\x{4e00}-\\x{9fa5}]|\\b[A-Za-z]+\\b/u', $DTnPC, $FH50y); $kaMU7 = array_filter($FH50y[0]); } return $kaMU7; } }