<?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($LclBr, $a3qUm = true) { goto ct9ky; ct9ky: if (empty($LclBr)) { return $LclBr; } goto Rf3R1; WNJ4W: if (Str::startsWith($LclBr, '/')) { $LclBr = substr($LclBr, 1); } goto PdVLS; Rf3R1: if (Str::startsWith($LclBr, 'http://') || Str::startsWith($LclBr, 'https://') || Str::startsWith($LclBr, '//')) { return $LclBr; } goto WNJ4W; PdVLS: $VzVt9 = app('assetPathDriver')->getCDN($LclBr); goto g_KJ_; g_KJ_: if ($a3qUm) { $VzVt9 .= app('assetPathDriver')->getPathWithHash($LclBr); } else { $VzVt9 .= $LclBr; } goto Wv8Ju; Wv8Ju: return $VzVt9; goto bKHGT; bKHGT: } public static function fixOrDefault($LclBr, $QsoDW) { if (empty($LclBr)) { return self::fix($QsoDW); } return self::fix($LclBr); } public static function url($yHf3t) { return app('assetPathDriver')->getCDN($yHf3t) . app('assetPathDriver')->getPathWithHash($yHf3t); } public static function fixCurrentDomain($LclBr) { goto uPAIp; uPAIp: if (is_array($LclBr)) { return array_values(array_map(function ($v2qOY) { return self::fixCurrentDomain($v2qOY); }, $LclBr)); } goto nAm8g; nAm8g: if (Str::startsWith($LclBr, 'http://') || Str::startsWith($LclBr, 'https://')) { return $LclBr; } goto mz344; u66nL: if (Request::secure()) { $XQLUK = 'https'; } else { $XQLUK = 'http'; } goto nrjuS; mz344: if (!Str::startsWith($LclBr, '/')) { $LclBr = '/' . $LclBr; } goto u66nL; v7avP: return $XQLUK . '://' . Request::server('HTTP_HOST') . $LclBr; goto rc5Ih; nrjuS: if (Str::startsWith($LclBr, '//')) { return $XQLUK . ':' . $LclBr; } goto v7avP; rc5Ih: } public static function fixFullFromConfig($r22CX) { goto ElB5E; htHsY: if (empty($wvO30)) { return null; } goto n_uRm; n_uRm: return self::fixFull($wvO30); goto vXhHB; ElB5E: $wvO30 = modstart_config($r22CX); goto htHsY; vXhHB: } public static function fixFull($LclBr, $a3qUm = true) { goto lB490; Ju438: return $XQLUK . '://' . Request::server('HTTP_HOST') . $LclBr; goto aIVAh; S24E8: if (Request::secure()) { $XQLUK = 'https'; } else { $XQLUK = 'http'; } goto AYx9B; ZVDnT: $LclBr = self::fix($LclBr, $a3qUm); goto ZxZ3C; nR2wm: if (empty($LclBr)) { return $LclBr; } goto ZVDnT; AYx9B: if (Str::startsWith($LclBr, '//')) { return $XQLUK . ':' . $LclBr; } goto Ju438; ZxZ3C: if (Str::startsWith($LclBr, 'http://') || Str::startsWith($LclBr, 'https://')) { return $LclBr; } goto S24E8; lB490: if (is_array($LclBr)) { return array_values(array_map(function ($v2qOY) use($a3qUm) { return self::fixFull($v2qOY, $a3qUm); }, $LclBr)); } goto nR2wm; aIVAh: } public static function fixFullInJob($LclBr, $a3qUm = true) { goto aQYar; VtywT: if (Str::startsWith($LclBr, 'http://') || Str::startsWith($LclBr, 'https://')) { return $LclBr; } goto S6Fzx; GYOz4: BizException::throwsIfEmpty('APP_URL Required In Job', $LitNh); goto X10Oh; X10Oh: return rtrim($LitNh, '/') . '/' . ltrim($LclBr, '/'); goto ESEId; pnT5K: $LitNh = config('env.APP_URL'); goto GYOz4; aQYar: if (empty($LclBr)) { return $LclBr; } goto Pyee1; S6Fzx: if (Str::startsWith($LclBr, '//')) { return 'http:' . $LclBr; } goto pnT5K; Pyee1: $LclBr = self::fix($LclBr, $a3qUm); goto VtywT; ESEId: } public static function fixFullWithCdn($LclBr, $O0jOZ, $a3qUm = true) { goto AR6U7; AR6U7: if (is_array($LclBr)) { return array_values(array_map(function ($v2qOY) use($O0jOZ, $a3qUm) { return self::fixFullWithCdn($v2qOY, $O0jOZ, $a3qUm); }, $LclBr)); } goto qrNbB; qrNbB: if (empty($LclBr)) { return $LclBr; } goto RtRoW; RtRoW: if (Str::startsWith($LclBr, 'http://') || Str::startsWith($LclBr, 'https://')) { return $LclBr; } goto EuN0Y; EuN0Y: return $O0jOZ . ltrim($LclBr, '/'); goto H5rP9; H5rP9: } public static function fixFullOrDefault($LclBr, $QsoDW = null) { goto TWp2q; hJ2ds: if (empty($LclBr)) { return self::fixFull($QsoDW); } goto xF4jm; TWp2q: if (is_array($LclBr)) { return array_values(array_map(function ($v2qOY) use($QsoDW) { return self::fixFullOrDefault($v2qOY, $QsoDW); }, $LclBr)); } goto hJ2ds; xF4jm: return self::fixFull($LclBr); goto rzpcE; rzpcE: } public static function recordsFixFullOrDefault(&$J2nWJ, $dwwIV, $QsoDW = null) { foreach ((array) $dwwIV as $sxbpS) { foreach ($J2nWJ as $plrwN => $uTz0e) { $J2nWJ[$plrwN][$sxbpS] = self::fixFullOrDefault($uTz0e[$sxbpS], $QsoDW); } } } }