<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class TagUtil { public static function seperated2Array($GcUxl, $MHwUG = ',') { if (',' == $MHwUG) { $GcUxl = str_replace(array('，'), ',', $GcUxl); } return array_filter(explode(',', $GcUxl)); } public static function seperated2String($GcUxl, $MHwUG = ',') { $K5pxT = self::seperated2Array($GcUxl, $MHwUG); return self::array2String($K5pxT); } public static function array2String(array $GcUxl) { goto puksq; fCElw: return join('', array_unique($fPpso)); goto hZdDu; puksq: $fPpso = array(); goto KyJtQ; KyJtQ: foreach ($GcUxl as &$AK4fC) { goto oHP7a; wCf0U: if ($AK4fC == '' || Str::contains($AK4fC, ':')) { continue; } goto En0TO; En0TO: $fPpso[] = ':' . $AK4fC . ':'; goto sMBOp; oHP7a: $AK4fC = trim($AK4fC); goto wCf0U; sMBOp: } goto fCElw; hZdDu: } public static function string2Array($GcUxl, $oUwSO = 'auto') { goto z1tJN; UhD9q: $fPpso = array(); goto jpP8i; YYHS4: $GcUxl = explode('::', $GcUxl); goto UhD9q; nhpFH: return array_unique($fPpso); goto y84ye; jpP8i: foreach ($GcUxl as &$AK4fC) { goto E81Sa; T15kN: if (empty($AK4fC)) { continue; } goto oamB4; E81Sa: $AK4fC = trim($AK4fC); goto T15kN; oamB4: if ($oUwSO == 'auto' && is_numeric($AK4fC)) { $fPpso[] = intval($AK4fC); } else { $fPpso[] = $AK4fC; } goto CFz24; CFz24: } goto nhpFH; RGfO3: $GcUxl = trim($GcUxl, ':'); goto YYHS4; z1tJN: if (is_array($GcUxl)) { $GcUxl = join('::', $GcUxl); if (!empty($GcUxl)) { $GcUxl = ":{$GcUxl}:"; } } goto RGfO3; y84ye: } public static function recordsString2Array(&$YDsPC, $G0WFn, $oUwSO = 'auto') { goto BHcop; VlVbM: foreach ($YDsPC as &$X8gVP) { foreach ($G0WFn as $l6tBV) { $X8gVP[$l6tBV] = self::string2Array($X8gVP[$l6tBV], $oUwSO); } } goto toq3u; mjzsO: if (is_string($G0WFn)) { $G0WFn = array($G0WFn); } goto VlVbM; BHcop: if (empty($YDsPC)) { return; } goto mjzsO; toq3u: } public static function recordsArray2String(&$YDsPC, $G0WFn) { goto NpENd; Y4x2L: if (is_string($G0WFn)) { $G0WFn = array($G0WFn); } goto CzVhK; NpENd: if (empty($YDsPC)) { return; } goto Y4x2L; CzVhK: foreach ($YDsPC as &$X8gVP) { foreach ($G0WFn as $l6tBV) { $X8gVP[$l6tBV] = self::array2String($X8gVP[$l6tBV]); } } goto RC6Yp; RC6Yp: } public static function mapInfo($GcUxl, array $hHycs = array()) { foreach ($GcUxl as &$AK4fC) { if (array_key_exists($AK4fC, $hHycs)) { $AK4fC = $hHycs[$AK4fC]; } } return $GcUxl; } public static function map($GcUxl, array $hHycs = array()) { goto iJ0mJ; VOObl: return $bwof1; goto FQh_c; XzWAJ: foreach ($GcUxl as $AK4fC) { if (array_key_exists($AK4fC, $hHycs)) { $bwof1[$AK4fC] = $hHycs[$AK4fC]; } else { $bwof1[$AK4fC] = null; } } goto VOObl; iJ0mJ: if (is_string($GcUxl)) { $GcUxl = self::string2Array($GcUxl); } goto qwKeU; qwKeU: $bwof1 = array(); goto XzWAJ; FQh_c: } public static function urlJoin($ik1Qg, array $GcUxl, $JW3Oj = null, $c_2Hx = 'number', $ilzDr = '_') { goto kBwdb; hJE9R: return join($ilzDr, $GcUxl); goto iKrrA; Fs2h6: if ($ik1Qg) { $GcUxl = array_merge(array($ik1Qg), $GcUxl); } goto hJE9R; vx2KK: if ('number' == $c_2Hx) { sort($GcUxl, SORT_NUMERIC); } else { sort($GcUxl, SORT_STRING); } goto Fs2h6; kBwdb: if (null !== $JW3Oj) { foreach ($GcUxl as $EqYVi => $AK4fC) { if ($AK4fC == $JW3Oj) { unset($GcUxl[$EqYVi]); } } } goto vx2KK; iKrrA: } }