<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Assets; use Illuminate\Support\Facades\Request; use Illuminate\Support\Str; use ModStart\Core\Exception\BizException; class AssetsUtil { public static function cdn() { return app('assetPathDriver')->getCDN(''); } public static function fix($tGXA6, $p1Hjz = true) { goto vp781; hWpSl: return $xIfit; goto Y9naL; qf83R: $xIfit = app('assetPathDriver')->getCDN($tGXA6); goto JGlXq; V_2Sc: if (Str::startsWith($tGXA6, 'http://') || Str::startsWith($tGXA6, 'https://') || Str::startsWith($tGXA6, '//')) { return $tGXA6; } goto wtShM; JGlXq: if ($p1Hjz) { $xIfit .= app('assetPathDriver')->getPathWithHash($tGXA6); } else { $xIfit .= $tGXA6; } goto hWpSl; wtShM: if (Str::startsWith($tGXA6, '/')) { $tGXA6 = substr($tGXA6, 1); } goto qf83R; vp781: if (empty($tGXA6)) { return $tGXA6; } goto V_2Sc; Y9naL: } public static function fixOrDefault($tGXA6, $u9k5U) { if (empty($tGXA6)) { return self::fix($u9k5U); } return self::fix($tGXA6); } public static function url($qsQD8) { return app('assetPathDriver')->getCDN($qsQD8) . app('assetPathDriver')->getPathWithHash($qsQD8); } public static function fixCurrentDomain($tGXA6) { goto BL2Pf; lnLbp: if (!Str::startsWith($tGXA6, '/')) { $tGXA6 = '/' . $tGXA6; } goto mFchw; KZz2J: if (Str::startsWith($tGXA6, '//')) { return $iJrrH . ':' . $tGXA6; } goto TIIG5; mFchw: if (Request::secure()) { $iJrrH = 'https'; } else { $iJrrH = 'http'; } goto KZz2J; TIIG5: return $iJrrH . '://' . Request::server('HTTP_HOST') . $tGXA6; goto FWYZJ; BL2Pf: if (is_array($tGXA6)) { return array_values(array_map(function ($Mc7y1) { return self::fixCurrentDomain($Mc7y1); }, $tGXA6)); } goto ms0Xy; ms0Xy: if (Str::startsWith($tGXA6, 'http://') || Str::startsWith($tGXA6, 'https://')) { return $tGXA6; } goto lnLbp; FWYZJ: } public static function fixFull($tGXA6, $p1Hjz = true) { goto wqIsX; K33pw: return $iJrrH . '://' . Request::server('HTTP_HOST') . $tGXA6; goto aOwBn; gJuog: if (empty($tGXA6)) { return $tGXA6; } goto pp_PZ; n6mCa: if (Str::startsWith($tGXA6, '//')) { return $iJrrH . ':' . $tGXA6; } goto K33pw; wqIsX: if (is_array($tGXA6)) { return array_values(array_map(function ($Mc7y1) use($p1Hjz) { return self::fixFull($Mc7y1, $p1Hjz); }, $tGXA6)); } goto gJuog; DuWwa: if (Str::startsWith($tGXA6, 'http://') || Str::startsWith($tGXA6, 'https://')) { return $tGXA6; } goto vM71R; pp_PZ: $tGXA6 = self::fix($tGXA6, $p1Hjz); goto DuWwa; vM71R: if (Request::secure()) { $iJrrH = 'https'; } else { $iJrrH = 'http'; } goto n6mCa; aOwBn: } public static function fixFullInJob($tGXA6, $p1Hjz = true) { goto cfdwG; cjXdo: return rtrim($RDcyG, '/') . '/' . ltrim($tGXA6, '/'); goto x_z8F; XzIA7: $tGXA6 = self::fix($tGXA6, $p1Hjz); goto qvf02; cfdwG: if (empty($tGXA6)) { return $tGXA6; } goto XzIA7; nptid: $RDcyG = config('env.APP_URL'); goto qDLhL; MM0tx: if (Str::startsWith($tGXA6, '//')) { return 'http:' . $tGXA6; } goto nptid; qvf02: if (Str::startsWith($tGXA6, 'http://') || Str::startsWith($tGXA6, 'https://')) { return $tGXA6; } goto MM0tx; qDLhL: BizException::throwsIfEmpty('APP_URL Required In Job', $RDcyG); goto cjXdo; x_z8F: } public static function fixFullWithCdn($tGXA6, $rkYME, $p1Hjz = true) { goto cp52v; cp52v: if (is_array($tGXA6)) { return array_values(array_map(function ($Mc7y1) use($rkYME, $p1Hjz) { return self::fixFullWithCdn($Mc7y1, $rkYME, $p1Hjz); }, $tGXA6)); } goto Wowdk; le14z: if (Str::startsWith($tGXA6, 'http://') || Str::startsWith($tGXA6, 'https://')) { return $tGXA6; } goto jlr4A; Wowdk: if (empty($tGXA6)) { return $tGXA6; } goto le14z; jlr4A: return $rkYME . ltrim($tGXA6, '/'); goto p2nD4; p2nD4: } public static function fixFullOrDefault($tGXA6, $u9k5U = null) { goto TwCWM; wan0D: return self::fixFull($tGXA6); goto N2Vor; sstMd: if (empty($tGXA6)) { return self::fixFull($u9k5U); } goto wan0D; TwCWM: if (is_array($tGXA6)) { return array_values(array_map(function ($Mc7y1) use($u9k5U) { return self::fixFullOrDefault($Mc7y1, $u9k5U); }, $tGXA6)); } goto sstMd; N2Vor: } public static function recordsFixFullOrDefault(&$AMtla, $ax5t3, $u9k5U = null) { foreach ((array) $ax5t3 as $wshTC) { foreach ($AMtla as $kh68j => $tHq0l) { $AMtla[$kh68j][$wshTC] = self::fixFullOrDefault($tHq0l[$wshTC], $u9k5U); } } } }