<?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($nAf_0, $I4NE6 = true) { goto kNi_Z; rfX30: if (Str::startsWith($nAf_0, '/')) { $nAf_0 = substr($nAf_0, 1); } goto YWZdX; NDOxL: return $tpgiq; goto Y5oiY; kNi_Z: if (empty($nAf_0)) { return $nAf_0; } goto TOinp; YWZdX: $tpgiq = app('assetPathDriver')->getCDN($nAf_0); goto if0p7; TOinp: if (Str::startsWith($nAf_0, 'http://') || Str::startsWith($nAf_0, 'https://') || Str::startsWith($nAf_0, '//')) { return $nAf_0; } goto rfX30; if0p7: if ($I4NE6) { $tpgiq .= app('assetPathDriver')->getPathWithHash($nAf_0); } else { $tpgiq .= $nAf_0; } goto NDOxL; Y5oiY: } public static function fixOrDefault($nAf_0, $yJQAj) { if (empty($nAf_0)) { return self::fix($yJQAj); } return self::fix($nAf_0); } public static function url($Jtt5u) { return app('assetPathDriver')->getCDN($Jtt5u) . app('assetPathDriver')->getPathWithHash($Jtt5u); } public static function fixCurrentDomain($nAf_0) { goto E_pHG; L230z: if (Str::startsWith($nAf_0, 'http://') || Str::startsWith($nAf_0, 'https://')) { return $nAf_0; } goto R3vpE; Xi792: if (Str::startsWith($nAf_0, '//')) { return $M5TqJ . ':' . $nAf_0; } goto KTtGp; KTtGp: return $M5TqJ . '://' . Request::server('HTTP_HOST') . $nAf_0; goto YQuwN; gcH0z: if (Request::secure()) { $M5TqJ = 'https'; } else { $M5TqJ = 'http'; } goto Xi792; R3vpE: if (!Str::startsWith($nAf_0, '/')) { $nAf_0 = '/' . $nAf_0; } goto gcH0z; E_pHG: if (is_array($nAf_0)) { return array_values(array_map(function ($qwcyu) { return self::fixCurrentDomain($qwcyu); }, $nAf_0)); } goto L230z; YQuwN: } public static function fixFullFromConfig($XYXxF) { goto PAvuj; PAvuj: $HDpl6 = modstart_config($XYXxF); goto ZTzXT; CH232: return self::fixFull($HDpl6); goto egp6u; ZTzXT: if (empty($HDpl6)) { return null; } goto CH232; egp6u: } public static function fixFull($nAf_0, $I4NE6 = true) { goto CUFpi; CUFpi: if (is_array($nAf_0)) { return array_values(array_map(function ($qwcyu) use($I4NE6) { return self::fixFull($qwcyu, $I4NE6); }, $nAf_0)); } goto EHI4B; VevOg: if (Str::startsWith($nAf_0, 'http://') || Str::startsWith($nAf_0, 'https://')) { return $nAf_0; } goto ArdFh; ArdFh: if (Request::secure()) { $M5TqJ = 'https'; } else { $M5TqJ = 'http'; } goto Z9ON4; EHI4B: if (empty($nAf_0)) { return $nAf_0; } goto UMuUd; UMuUd: $nAf_0 = self::fix($nAf_0, $I4NE6); goto VevOg; Z9ON4: if (Str::startsWith($nAf_0, '//')) { return $M5TqJ . ':' . $nAf_0; } goto gSQ_n; gSQ_n: return $M5TqJ . '://' . Request::server('HTTP_HOST') . $nAf_0; goto ifTaI; ifTaI: } public static function fixFullInJob($nAf_0, $I4NE6 = true) { goto naNLD; Ylr46: if (Str::startsWith($nAf_0, '//')) { return 'http:' . $nAf_0; } goto zpDN2; L_7wJ: return rtrim($r9Z1w, '/') . '/' . ltrim($nAf_0, '/'); goto B5uwS; qhSJf: if (Str::startsWith($nAf_0, 'http://') || Str::startsWith($nAf_0, 'https://')) { return $nAf_0; } goto Ylr46; zpDN2: $r9Z1w = config('env.APP_URL'); goto IYSex; rsyRg: $nAf_0 = self::fix($nAf_0, $I4NE6); goto qhSJf; IYSex: BizException::throwsIfEmpty('APP_URL Required In Job', $r9Z1w); goto L_7wJ; naNLD: if (empty($nAf_0)) { return $nAf_0; } goto rsyRg; B5uwS: } public static function fixFullWithCdn($nAf_0, $VYiXQ, $I4NE6 = true) { goto xXAIe; xXAIe: if (is_array($nAf_0)) { return array_values(array_map(function ($qwcyu) use($VYiXQ, $I4NE6) { return self::fixFullWithCdn($qwcyu, $VYiXQ, $I4NE6); }, $nAf_0)); } goto HpVVK; HpVVK: if (empty($nAf_0)) { return $nAf_0; } goto GXW_j; Qrmvt: return $VYiXQ . ltrim($nAf_0, '/'); goto UnRDm; GXW_j: if (Str::startsWith($nAf_0, 'http://') || Str::startsWith($nAf_0, 'https://')) { return $nAf_0; } goto Qrmvt; UnRDm: } public static function fixFullOrDefault($nAf_0, $yJQAj = null) { goto oUzAT; tLhz3: return self::fixFull($nAf_0); goto X14CL; oUzAT: if (is_array($nAf_0)) { return array_values(array_map(function ($qwcyu) use($yJQAj) { return self::fixFullOrDefault($qwcyu, $yJQAj); }, $nAf_0)); } goto bCQ_L; bCQ_L: if (empty($nAf_0)) { return self::fixFull($yJQAj); } goto tLhz3; X14CL: } public static function recordsFixFullOrDefault(&$lz_pk, $VFU9l, $yJQAj = null) { foreach ((array) $VFU9l as $SN341) { foreach ($lz_pk as $pztz4 => $Q0rz2) { $lz_pk[$pztz4][$SN341] = self::fixFullOrDefault($Q0rz2[$SN341], $yJQAj); } } } }