<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class TagUtil { public static function seperated2Array($DEha7, $ifvdW = ',') { if (',' == $ifvdW) { $DEha7 = str_replace(array('，'), ',', $DEha7); } return array_filter(explode(',', $DEha7)); } public static function seperated2String($DEha7, $ifvdW = ',') { $VPJ9O = self::seperated2Array($DEha7, $ifvdW); return self::array2String($VPJ9O); } public static function array2String(array $DEha7) { goto jEkMB; jEkMB: $S3DuJ = array(); goto u6V8C; u6V8C: foreach ($DEha7 as &$vQMjV) { goto jTH1D; jTH1D: $vQMjV = trim($vQMjV); goto lOa1q; YV0pP: $S3DuJ[] = ':' . $vQMjV . ':'; goto AxsL9; lOa1q: if ($vQMjV == '' || Str::contains($vQMjV, ':')) { continue; } goto YV0pP; AxsL9: } goto HXGnK; HXGnK: return join('', array_unique($S3DuJ)); goto LkgeJ; LkgeJ: } public static function string2Array($DEha7, $pChQ9 = 'auto') { goto MH9HV; n5yYF: $S3DuJ = array(); goto H4NcS; H4NcS: foreach ($DEha7 as &$vQMjV) { goto Pfh4h; qSfCC: if ($pChQ9 == 'auto' && is_numeric($vQMjV)) { $S3DuJ[] = intval($vQMjV); } else { $S3DuJ[] = $vQMjV; } goto NrXUw; Gn1EQ: if (empty($vQMjV)) { continue; } goto qSfCC; Pfh4h: $vQMjV = trim($vQMjV); goto Gn1EQ; NrXUw: } goto dmS40; HpGru: $DEha7 = trim($DEha7, ':'); goto oQmI5; dmS40: return array_unique($S3DuJ); goto myu3h; oQmI5: $DEha7 = explode('::', $DEha7); goto n5yYF; MH9HV: if (is_array($DEha7)) { $DEha7 = join('::', $DEha7); if (!empty($DEha7)) { $DEha7 = ":{$DEha7}:"; } } goto HpGru; myu3h: } public static function recordsString2Array(&$d5ixK, $zMhql, $pChQ9 = 'auto') { goto Ferf5; vl52D: foreach ($d5ixK as &$IgPyb) { foreach ($zMhql as $oMJcb) { $IgPyb[$oMJcb] = self::string2Array($IgPyb[$oMJcb], $pChQ9); } } goto ZPcZL; NlGlF: if (is_string($zMhql)) { $zMhql = array($zMhql); } goto vl52D; Ferf5: if (empty($d5ixK)) { return; } goto NlGlF; ZPcZL: } public static function recordsArray2String(&$d5ixK, $zMhql) { goto S1kvr; SIVUZ: if (is_string($zMhql)) { $zMhql = array($zMhql); } goto Du9FY; Du9FY: foreach ($d5ixK as &$IgPyb) { foreach ($zMhql as $oMJcb) { $IgPyb[$oMJcb] = self::array2String($IgPyb[$oMJcb]); } } goto ELrFz; S1kvr: if (empty($d5ixK)) { return; } goto SIVUZ; ELrFz: } public static function mapInfo($DEha7, array $u95Cq = array()) { foreach ($DEha7 as &$vQMjV) { if (array_key_exists($vQMjV, $u95Cq)) { $vQMjV = $u95Cq[$vQMjV]; } } return $DEha7; } public static function map($DEha7, array $u95Cq = array()) { goto iMPLO; pL7Gx: return $smwHo; goto qaQoU; iMPLO: if (is_string($DEha7)) { $DEha7 = self::string2Array($DEha7); } goto bxAAm; bxAAm: $smwHo = array(); goto AEYYe; AEYYe: foreach ($DEha7 as $vQMjV) { if (array_key_exists($vQMjV, $u95Cq)) { $smwHo[$vQMjV] = $u95Cq[$vQMjV]; } else { $smwHo[$vQMjV] = null; } } goto pL7Gx; qaQoU: } public static function urlJoin($MiLaY, array $DEha7, $Kvi6m = null, $dG3XZ = 'number', $QBphe = '_') { goto Tb9bd; Tb9bd: if (null !== $Kvi6m) { foreach ($DEha7 as $C6OV7 => $vQMjV) { if ($vQMjV == $Kvi6m) { unset($DEha7[$C6OV7]); } } } goto SLH2y; gl5kZ: return join($QBphe, $DEha7); goto fHvPw; SLH2y: if ('number' == $dG3XZ) { sort($DEha7, SORT_NUMERIC); } else { sort($DEha7, SORT_STRING); } goto xLUJq; xLUJq: if ($MiLaY) { $DEha7 = array_merge(array($MiLaY), $DEha7); } goto gl5kZ; fHvPw: } }