<?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($aurrr, $Ooi_1 = true) { goto STZ35; PwoEK: if ($Ooi_1) { $XVqXz .= app('assetPathDriver')->getPathWithHash($aurrr); } else { $XVqXz .= $aurrr; } goto Uzglp; Uzglp: return $XVqXz; goto IIv0h; o31lg: if (Str::startsWith($aurrr, 'http://') || Str::startsWith($aurrr, 'https://') || Str::startsWith($aurrr, '//')) { return $aurrr; } goto DNmiZ; DNmiZ: if (Str::startsWith($aurrr, '/')) { $aurrr = substr($aurrr, 1); } goto MUIfm; STZ35: if (empty($aurrr)) { return $aurrr; } goto o31lg; MUIfm: $XVqXz = app('assetPathDriver')->getCDN($aurrr); goto PwoEK; IIv0h: } public static function fixOrDefault($aurrr, $TGBtt) { if (empty($aurrr)) { return self::fix($TGBtt); } return self::fix($aurrr); } public static function url($fWBvH) { return app('assetPathDriver')->getCDN($fWBvH) . app('assetPathDriver')->getPathWithHash($fWBvH); } public static function fixCurrentDomain($aurrr) { goto wlIUe; RF1bd: if (Str::startsWith($aurrr, 'http://') || Str::startsWith($aurrr, 'https://')) { return $aurrr; } goto aOvRE; aOvRE: if (!Str::startsWith($aurrr, '/')) { $aurrr = '/' . $aurrr; } goto v0TOa; PWZKV: return $B1D_M . '://' . Request::server('HTTP_HOST') . $aurrr; goto Y6e0Z; v0TOa: if (Request::secure()) { $B1D_M = 'https'; } else { $B1D_M = 'http'; } goto cm2pU; cm2pU: if (Str::startsWith($aurrr, '//')) { return $B1D_M . ':' . $aurrr; } goto PWZKV; wlIUe: if (is_array($aurrr)) { return array_values(array_map(function ($UdtHk) { return self::fixCurrentDomain($UdtHk); }, $aurrr)); } goto RF1bd; Y6e0Z: } public static function fixFullFromConfig($ocIiW) { goto cj06a; cj06a: $ib3B9 = modstart_config($ocIiW); goto YnmJq; B1bMV: return self::fixFull($ib3B9); goto sQn2W; YnmJq: if (empty($ib3B9)) { return null; } goto B1bMV; sQn2W: } public static function fixFull($aurrr, $Ooi_1 = true) { goto SlVGq; pcAVu: $aurrr = self::fix($aurrr, $Ooi_1); goto NmGWz; KyIYX: return $B1D_M . '://' . Request::server('HTTP_HOST') . $aurrr; goto bpBdj; NmGWz: if (Str::startsWith($aurrr, 'http://') || Str::startsWith($aurrr, 'https://')) { return $aurrr; } goto OnFYc; OnFYc: if (Request::secure()) { $B1D_M = 'https'; } else { $B1D_M = 'http'; } goto aPzsR; o1dv3: if (empty($aurrr)) { return $aurrr; } goto pcAVu; aPzsR: if (Str::startsWith($aurrr, '//')) { return $B1D_M . ':' . $aurrr; } goto KyIYX; SlVGq: if (is_array($aurrr)) { return array_values(array_map(function ($UdtHk) use($Ooi_1) { return self::fixFull($UdtHk, $Ooi_1); }, $aurrr)); } goto o1dv3; bpBdj: } public static function fixFullInJob($aurrr, $Ooi_1 = true) { goto m6Xml; vvBnl: return rtrim($Ou9pI, '/') . '/' . ltrim($aurrr, '/'); goto eRPU9; yCWIX: if (Str::startsWith($aurrr, '//')) { return 'http:' . $aurrr; } goto kL1hI; m6Xml: if (empty($aurrr)) { return $aurrr; } goto gQ0BA; gQ0BA: $aurrr = self::fix($aurrr, $Ooi_1); goto VW89h; xs6px: BizException::throwsIfEmpty('APP_URL Required In Job', $Ou9pI); goto vvBnl; VW89h: if (Str::startsWith($aurrr, 'http://') || Str::startsWith($aurrr, 'https://')) { return $aurrr; } goto yCWIX; kL1hI: $Ou9pI = config('env.APP_URL'); goto xs6px; eRPU9: } public static function fixFullWithCdn($aurrr, $A9JhN, $Ooi_1 = true) { goto RGOxS; RGOxS: if (is_array($aurrr)) { return array_values(array_map(function ($UdtHk) use($A9JhN, $Ooi_1) { return self::fixFullWithCdn($UdtHk, $A9JhN, $Ooi_1); }, $aurrr)); } goto nbr8j; GiHL0: return $A9JhN . ltrim($aurrr, '/'); goto FMOkE; JhylY: if (Str::startsWith($aurrr, 'http://') || Str::startsWith($aurrr, 'https://')) { return $aurrr; } goto GiHL0; nbr8j: if (empty($aurrr)) { return $aurrr; } goto JhylY; FMOkE: } public static function fixFullOrDefault($aurrr, $TGBtt = null) { goto XTIPm; gVxV8: return self::fixFull($aurrr); goto ZltlA; XTIPm: if (is_array($aurrr)) { return array_values(array_map(function ($UdtHk) use($TGBtt) { return self::fixFullOrDefault($UdtHk, $TGBtt); }, $aurrr)); } goto DBkEv; DBkEv: if (empty($aurrr)) { return self::fixFull($TGBtt); } goto gVxV8; ZltlA: } public static function recordsFixFullOrDefault(&$laNjB, $GUcFO, $TGBtt = null) { foreach ((array) $GUcFO as $tviCL) { foreach ($laNjB as $F_a6B => $JiRHR) { $laNjB[$F_a6B][$tviCL] = self::fixFullOrDefault($JiRHR[$tviCL], $TGBtt); } } } }