<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class TagUtil { public static function seperated2Array($Cntbg, $BMcmy = ',') { if (',' == $BMcmy) { $Cntbg = str_replace(array('，'), ',', $Cntbg); } return array_filter(explode(',', $Cntbg)); } public static function seperated2String($Cntbg, $BMcmy = ',') { $DjVjC = self::seperated2Array($Cntbg, $BMcmy); return self::array2String($DjVjC); } public static function array2String(array $Cntbg) { goto JgXP4; JgXP4: $giyXn = array(); goto ceNrP; OXcgZ: return join('', array_unique($giyXn)); goto BdAhm; ceNrP: foreach ($Cntbg as &$niuq6) { goto jtMqr; PiiXO: $giyXn[] = ':' . $niuq6 . ':'; goto gH6Qn; PuOKI: if ($niuq6 == '' || Str::contains($niuq6, ':')) { continue; } goto PiiXO; jtMqr: $niuq6 = trim($niuq6); goto PuOKI; gH6Qn: } goto OXcgZ; BdAhm: } public static function string2Array($Cntbg, $UeI_l = 'auto') { goto oCKGf; UT12f: $Cntbg = explode('::', $Cntbg); goto H7Wwn; mux6M: $Cntbg = trim($Cntbg, ':'); goto UT12f; v9eq9: foreach ($Cntbg as &$niuq6) { goto tqweR; kllKU: if ($UeI_l == 'auto' && is_numeric($niuq6)) { $giyXn[] = intval($niuq6); } else { $giyXn[] = $niuq6; } goto HbP13; tqweR: $niuq6 = trim($niuq6); goto ikqnu; ikqnu: if (empty($niuq6)) { continue; } goto kllKU; HbP13: } goto UOuhk; UOuhk: return array_unique($giyXn); goto ARLEJ; oCKGf: if (is_array($Cntbg)) { $Cntbg = join('::', $Cntbg); if (!empty($Cntbg)) { $Cntbg = ":{$Cntbg}:"; } } goto mux6M; H7Wwn: $giyXn = array(); goto v9eq9; ARLEJ: } public static function recordsString2Array(&$AMtla, $Z25Ot, $UeI_l = 'auto') { goto Y2koZ; T4bFC: foreach ($AMtla as &$B1s6N) { foreach ($Z25Ot as $ax5t3) { $B1s6N[$ax5t3] = self::string2Array($B1s6N[$ax5t3], $UeI_l); } } goto HQJTg; vgfvo: if (is_string($Z25Ot)) { $Z25Ot = array($Z25Ot); } goto T4bFC; Y2koZ: if (empty($AMtla)) { return; } goto vgfvo; HQJTg: } public static function recordsArray2String(&$AMtla, $Z25Ot) { goto VmgbX; qiM7K: if (is_string($Z25Ot)) { $Z25Ot = array($Z25Ot); } goto JOAe9; VmgbX: if (empty($AMtla)) { return; } goto qiM7K; JOAe9: foreach ($AMtla as &$B1s6N) { foreach ($Z25Ot as $ax5t3) { $B1s6N[$ax5t3] = self::array2String($B1s6N[$ax5t3]); } } goto HeZQW; HeZQW: } public static function mapInfo($Cntbg, array $xzHEX = array()) { foreach ($Cntbg as &$niuq6) { if (array_key_exists($niuq6, $xzHEX)) { $niuq6 = $xzHEX[$niuq6]; } } return $Cntbg; } public static function map($Cntbg, array $xzHEX = array()) { goto WskUa; C5Ubl: foreach ($Cntbg as $niuq6) { if (array_key_exists($niuq6, $xzHEX)) { $DCed4[$niuq6] = $xzHEX[$niuq6]; } else { $DCed4[$niuq6] = null; } } goto o36Gi; WskUa: if (is_string($Cntbg)) { $Cntbg = self::string2Array($Cntbg); } goto FbSt9; o36Gi: return $DCed4; goto DZq4_; FbSt9: $DCed4 = array(); goto C5Ubl; DZq4_: } public static function urlJoin($xIfit, array $Cntbg, $KdL8M = null, $TdM4N = 'number', $RflRv = '_') { goto mmwzw; mmwzw: if (null !== $KdL8M) { foreach ($Cntbg as $vTPD6 => $niuq6) { if ($niuq6 == $KdL8M) { unset($Cntbg[$vTPD6]); } } } goto V6nbA; gfAx0: return join($RflRv, $Cntbg); goto krzad; h1E75: if ($xIfit) { $Cntbg = array_merge(array($xIfit), $Cntbg); } goto gfAx0; V6nbA: if ('number' == $TdM4N) { sort($Cntbg, SORT_NUMERIC); } else { sort($Cntbg, SORT_STRING); } goto h1E75; krzad: } }