<?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($adFNb, $fEpHF = true) { goto dqGel; dqGel: if (empty($adFNb)) { return $adFNb; } goto u3MCF; df8DZ: $iERFh = app('assetPathDriver')->getCDN($adFNb); goto wy32D; ACLx1: if (Str::startsWith($adFNb, '/')) { $adFNb = substr($adFNb, 1); } goto df8DZ; t4aUe: return $iERFh; goto T3o2n; u3MCF: if (Str::startsWith($adFNb, 'http://') || Str::startsWith($adFNb, 'https://') || Str::startsWith($adFNb, '//')) { return $adFNb; } goto ACLx1; wy32D: if ($fEpHF) { $iERFh .= app('assetPathDriver')->getPathWithHash($adFNb); } else { $iERFh .= $adFNb; } goto t4aUe; T3o2n: } public static function fixOrDefault($adFNb, $rCJvC) { if (empty($adFNb)) { return self::fix($rCJvC); } return self::fix($adFNb); } public static function url($sCmIC) { return app('assetPathDriver')->getCDN($sCmIC) . app('assetPathDriver')->getPathWithHash($sCmIC); } public static function fixCurrentDomain($adFNb) { goto n5QOi; p2rmT: return $jnEF2 . '://' . Request::server('HTTP_HOST') . $adFNb; goto b0sfc; n5QOi: if (is_array($adFNb)) { return array_values(array_map(function ($PhYE_) { return self::fixCurrentDomain($PhYE_); }, $adFNb)); } goto HKZBT; y34Ze: if (!Str::startsWith($adFNb, '/')) { $adFNb = '/' . $adFNb; } goto Q3asA; E8SRN: if (Str::startsWith($adFNb, '//')) { return $jnEF2 . ':' . $adFNb; } goto p2rmT; HKZBT: if (Str::startsWith($adFNb, 'http://') || Str::startsWith($adFNb, 'https://')) { return $adFNb; } goto y34Ze; Q3asA: if (Request::secure()) { $jnEF2 = 'https'; } else { $jnEF2 = 'http'; } goto E8SRN; b0sfc: } public static function fixFullFromConfig($j3Il3) { goto alMmN; alMmN: $mdHu1 = modstart_config($j3Il3); goto gDLXU; gDLXU: if (empty($mdHu1)) { return null; } goto pmU79; pmU79: return self::fixFull($mdHu1); goto F4H4J; F4H4J: } public static function fixFull($adFNb, $fEpHF = true) { goto qUIW0; qUIW0: if (is_array($adFNb)) { return array_values(array_map(function ($PhYE_) use($fEpHF) { return self::fixFull($PhYE_, $fEpHF); }, $adFNb)); } goto pho6o; L3zID: if (Request::secure()) { $jnEF2 = 'https'; } else { $jnEF2 = 'http'; } goto PKeYz; EH1uV: if (Str::startsWith($adFNb, 'http://') || Str::startsWith($adFNb, 'https://')) { return $adFNb; } goto L3zID; Zcswb: return $jnEF2 . '://' . Request::server('HTTP_HOST') . $adFNb; goto d5iny; PKeYz: if (Str::startsWith($adFNb, '//')) { return $jnEF2 . ':' . $adFNb; } goto Zcswb; pho6o: if (empty($adFNb)) { return $adFNb; } goto vVSxm; vVSxm: $adFNb = self::fix($adFNb, $fEpHF); goto EH1uV; d5iny: } public static function fixFullInJob($adFNb, $fEpHF = true) { goto HD4JN; xkk5T: return rtrim($Uxn1e, '/') . '/' . ltrim($adFNb, '/'); goto YRdAU; pqins: $adFNb = self::fix($adFNb, $fEpHF); goto r_iFs; aIcKJ: $Uxn1e = config('env.APP_URL'); goto ukej7; ukej7: BizException::throwsIfEmpty('APP_URL Required In Job', $Uxn1e); goto xkk5T; Yw7hE: if (Str::startsWith($adFNb, '//')) { return 'http:' . $adFNb; } goto aIcKJ; HD4JN: if (empty($adFNb)) { return $adFNb; } goto pqins; r_iFs: if (Str::startsWith($adFNb, 'http://') || Str::startsWith($adFNb, 'https://')) { return $adFNb; } goto Yw7hE; YRdAU: } public static function fixFullWithCdn($adFNb, $vL9Ql, $fEpHF = true) { goto Ux3IH; Ux3IH: if (is_array($adFNb)) { return array_values(array_map(function ($PhYE_) use($vL9Ql, $fEpHF) { return self::fixFullWithCdn($PhYE_, $vL9Ql, $fEpHF); }, $adFNb)); } goto iXYMf; XaGIQ: if (Str::startsWith($adFNb, 'http://') || Str::startsWith($adFNb, 'https://')) { return $adFNb; } goto HfjA4; iXYMf: if (empty($adFNb)) { return $adFNb; } goto XaGIQ; HfjA4: return $vL9Ql . ltrim($adFNb, '/'); goto UM3wA; UM3wA: } public static function fixFullOrDefault($adFNb, $rCJvC = null) { goto XkM_p; Z8D1s: if (empty($adFNb)) { return self::fixFull($rCJvC); } goto cgOto; XkM_p: if (is_array($adFNb)) { return array_values(array_map(function ($PhYE_) use($rCJvC) { return self::fixFullOrDefault($PhYE_, $rCJvC); }, $adFNb)); } goto Z8D1s; cgOto: return self::fixFull($adFNb); goto lQF5R; lQF5R: } public static function recordsFixFullOrDefault(&$PcG4B, $HQKqq, $rCJvC = null) { foreach ((array) $HQKqq as $KVZ4m) { foreach ($PcG4B as $Fkd1C => $pk5fc) { $PcG4B[$Fkd1C][$KVZ4m] = self::fixFullOrDefault($pk5fc[$KVZ4m], $rCJvC); } } } }