<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class TagUtil { public static function seperated2String($YTFCB, $c93pL = ',') { goto wB42u; wB42u: if (',' == $c93pL) { $YTFCB = str_replace(array('，'), ',', $YTFCB); } goto MJuBg; F7Z1L: return self::array2String($RgydD); goto V2QHj; MJuBg: $RgydD = array_filter(explode(',', $YTFCB)); goto F7Z1L; V2QHj: } public static function array2String(array $YTFCB) { goto Y9Tw4; c1dZY: foreach ($YTFCB as &$pDSQm) { goto m_JTg; nwGDE: if ($pDSQm == '' || Str::contains($pDSQm, ':')) { continue; } goto F_6Jp; F_6Jp: $DYwEH[] = ':' . $pDSQm . ':'; goto DUivn; m_JTg: $pDSQm = trim($pDSQm); goto nwGDE; DUivn: } goto PziSQ; PziSQ: return join('', array_unique($DYwEH)); goto fPKvX; Y9Tw4: $DYwEH = array(); goto c1dZY; fPKvX: } public static function string2Array($YTFCB, $FpVuW = 'auto') { goto rzcGs; hF23k: $YTFCB = explode('::', $YTFCB); goto PjwDs; rzcGs: $YTFCB = trim($YTFCB, ':'); goto hF23k; PjwDs: $DYwEH = array(); goto jcc9w; jcc9w: foreach ($YTFCB as &$pDSQm) { goto RkdLA; ynlQX: if (empty($pDSQm)) { continue; } goto EtKvc; EtKvc: if ($FpVuW == 'auto' && is_numeric($pDSQm)) { $DYwEH[] = intval($pDSQm); } else { $DYwEH[] = $pDSQm; } goto Fnow4; RkdLA: $pDSQm = trim($pDSQm); goto ynlQX; Fnow4: } goto luECP; luECP: return array_unique($DYwEH); goto Bqz58; Bqz58: } public static function mapInfo($YTFCB, array $oEw19 = array()) { foreach ($YTFCB as &$pDSQm) { if (array_key_exists($pDSQm, $oEw19)) { $pDSQm = $oEw19[$pDSQm]; } } return $YTFCB; } public static function map($YTFCB, array $oEw19 = array()) { goto QD8wR; PHfLB: return $eXgRb; goto IPesG; PZdMg: foreach ($YTFCB as $pDSQm) { if (array_key_exists($pDSQm, $oEw19)) { $eXgRb[$pDSQm] = $oEw19[$pDSQm]; } else { $eXgRb[$pDSQm] = null; } } goto PHfLB; KPyVT: $eXgRb = array(); goto PZdMg; QD8wR: if (is_string($YTFCB)) { $YTFCB = self::string2Array($YTFCB); } goto KPyVT; IPesG: } public static function urlJoin($BV17G, array $YTFCB, $cGr63 = null, $cs6iE = 'number', $kgNbL = '_') { goto pO9WA; DBpJF: if ('number' == $cs6iE) { sort($YTFCB, SORT_NUMERIC); } else { sort($YTFCB, SORT_STRING); } goto P_jWg; P_jWg: if ($BV17G) { $YTFCB = array_merge(array($BV17G), $YTFCB); } goto qYTkY; pO9WA: if (null !== $cGr63) { foreach ($YTFCB as $XIWRg => $pDSQm) { if ($pDSQm == $cGr63) { unset($YTFCB[$XIWRg]); } } } goto DBpJF; qYTkY: return join($kgNbL, $YTFCB); goto jCRKq; jCRKq: } }