<?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($VF_G6, $rCzZc = true) { goto m6aZP; m6aZP: if (empty($VF_G6)) { return $VF_G6; } goto CzIai; FR9T1: $m2Dmo = app('assetPathDriver')->getCDN($VF_G6); goto GS50g; GS50g: if ($rCzZc) { $m2Dmo .= app('assetPathDriver')->getPathWithHash($VF_G6); } else { $m2Dmo .= $VF_G6; } goto C1B_g; Cffeq: if (Str::startsWith($VF_G6, '/')) { $VF_G6 = substr($VF_G6, 1); } goto FR9T1; CzIai: if (Str::startsWith($VF_G6, 'http://') || Str::startsWith($VF_G6, 'https://') || Str::startsWith($VF_G6, '//')) { return $VF_G6; } goto Cffeq; C1B_g: return $m2Dmo; goto V7UQx; V7UQx: } public static function fixOrDefault($VF_G6, $TCqsx) { if (empty($VF_G6)) { return self::fix($TCqsx); } return self::fix($VF_G6); } public static function url($aYJAK) { return app('assetPathDriver')->getCDN($aYJAK) . app('assetPathDriver')->getPathWithHash($aYJAK); } public static function fixCurrentDomain($VF_G6) { goto z2eGC; dBZVV: if (Request::secure()) { $EcRQH = 'https'; } else { $EcRQH = 'http'; } goto t4JNz; wIGvc: return $EcRQH . '://' . Request::server('HTTP_HOST') . $VF_G6; goto vCB0p; iIcUQ: if (Str::startsWith($VF_G6, 'http://') || Str::startsWith($VF_G6, 'https://')) { return $VF_G6; } goto Z1cvm; Z1cvm: if (!Str::startsWith($VF_G6, '/')) { $VF_G6 = '/' . $VF_G6; } goto dBZVV; t4JNz: if (Str::startsWith($VF_G6, '//')) { return $EcRQH . ':' . $VF_G6; } goto wIGvc; z2eGC: if (is_array($VF_G6)) { return array_values(array_map(function ($z8JHA) { return self::fixCurrentDomain($z8JHA); }, $VF_G6)); } goto iIcUQ; vCB0p: } public static function fixFullFromConfig($Vp0oX) { goto ACH4i; TDJB7: return self::fixFull($Gttsd); goto QCOzl; ACH4i: $Gttsd = modstart_config($Vp0oX); goto N_pNk; N_pNk: if (empty($Gttsd)) { return null; } goto TDJB7; QCOzl: } public static function fixFull($VF_G6, $rCzZc = true) { goto PJGby; mciat: if (Request::secure()) { $EcRQH = 'https'; } else { $EcRQH = 'http'; } goto Kx3Oh; TrBSo: if (empty($VF_G6)) { return $VF_G6; } goto AEv85; PJGby: if (is_array($VF_G6)) { return array_values(array_map(function ($z8JHA) use($rCzZc) { return self::fixFull($z8JHA, $rCzZc); }, $VF_G6)); } goto TrBSo; AEv85: $VF_G6 = self::fix($VF_G6, $rCzZc); goto UM98o; UM98o: if (Str::startsWith($VF_G6, 'http://') || Str::startsWith($VF_G6, 'https://')) { return $VF_G6; } goto mciat; MY0Eq: return $EcRQH . '://' . Request::server('HTTP_HOST') . $VF_G6; goto AX582; Kx3Oh: if (Str::startsWith($VF_G6, '//')) { return $EcRQH . ':' . $VF_G6; } goto MY0Eq; AX582: } public static function fixFullInJob($VF_G6, $rCzZc = true) { goto bNPX7; vcRPs: BizException::throwsIfEmpty('APP_URL Required In Job', $f4_aa); goto aSbhz; nOcZA: $VF_G6 = self::fix($VF_G6, $rCzZc); goto tSRCU; tSRCU: if (Str::startsWith($VF_G6, 'http://') || Str::startsWith($VF_G6, 'https://')) { return $VF_G6; } goto LF7me; aSbhz: return rtrim($f4_aa, '/') . '/' . ltrim($VF_G6, '/'); goto JbfMc; cR2aJ: $f4_aa = config('env.APP_URL'); goto vcRPs; LF7me: if (Str::startsWith($VF_G6, '//')) { return 'http:' . $VF_G6; } goto cR2aJ; bNPX7: if (empty($VF_G6)) { return $VF_G6; } goto nOcZA; JbfMc: } public static function fixFullWithCdn($VF_G6, $QU75f, $rCzZc = true) { goto J71Bv; riXOj: return $QU75f . ltrim($VF_G6, '/'); goto odi_u; sxkak: if (Str::startsWith($VF_G6, 'http://') || Str::startsWith($VF_G6, 'https://')) { return $VF_G6; } goto riXOj; J71Bv: if (is_array($VF_G6)) { return array_values(array_map(function ($z8JHA) use($QU75f, $rCzZc) { return self::fixFullWithCdn($z8JHA, $QU75f, $rCzZc); }, $VF_G6)); } goto GoVlM; GoVlM: if (empty($VF_G6)) { return $VF_G6; } goto sxkak; odi_u: } public static function fixFullOrDefault($VF_G6, $TCqsx = null) { goto Wr93x; Wr93x: if (is_array($VF_G6)) { return array_values(array_map(function ($z8JHA) use($TCqsx) { return self::fixFullOrDefault($z8JHA, $TCqsx); }, $VF_G6)); } goto Gr5O_; IKwLi: return self::fixFull($VF_G6); goto QozTn; Gr5O_: if (empty($VF_G6)) { return self::fixFull($TCqsx); } goto IKwLi; QozTn: } public static function recordsFixFullOrDefault(&$bcEDt, $jPfeB, $TCqsx = null) { foreach ((array) $jPfeB as $oky1p) { foreach ($bcEDt as $RTHJ6 => $F6Fus) { $bcEDt[$RTHJ6][$oky1p] = self::fixFullOrDefault($F6Fus[$oky1p], $TCqsx); } } } }