<?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($S3tfG, $THL2f = true) { goto LDTsa; LDTsa: if (empty($S3tfG)) { return $S3tfG; } goto sn2PU; jjZWL: if ($THL2f) { $YjgEW .= app('assetPathDriver')->getPathWithHash($S3tfG); } else { $YjgEW .= $S3tfG; } goto W5vsp; sn2PU: if (Str::startsWith($S3tfG, 'http://') || Str::startsWith($S3tfG, 'https://') || Str::startsWith($S3tfG, '//')) { return $S3tfG; } goto Pwos7; W5vsp: return $YjgEW; goto klR3H; SL28b: $YjgEW = app('assetPathDriver')->getCDN($S3tfG); goto jjZWL; Pwos7: if (Str::startsWith($S3tfG, '/')) { $S3tfG = substr($S3tfG, 1); } goto SL28b; klR3H: } public static function fixOrDefault($S3tfG, $A0QpK) { if (empty($S3tfG)) { return self::fix($A0QpK); } return self::fix($S3tfG); } public static function url($RLMU5) { return app('assetPathDriver')->getCDN($RLMU5) . app('assetPathDriver')->getPathWithHash($RLMU5); } public static function fixCurrentDomain($S3tfG) { goto Feg44; Feg44: if (is_array($S3tfG)) { return array_values(array_map(function ($ju0cF) { return self::fixCurrentDomain($ju0cF); }, $S3tfG)); } goto GYyOY; mkd4R: if (!Str::startsWith($S3tfG, '/')) { $S3tfG = '/' . $S3tfG; } goto lQWnq; QfIGt: return $r3NMl . '://' . Request::server('HTTP_HOST') . $S3tfG; goto mRCsw; GYyOY: if (Str::startsWith($S3tfG, 'http://') || Str::startsWith($S3tfG, 'https://')) { return $S3tfG; } goto mkd4R; W0bO_: if (Str::startsWith($S3tfG, '//')) { return $r3NMl . ':' . $S3tfG; } goto QfIGt; lQWnq: if (Request::secure()) { $r3NMl = 'https'; } else { $r3NMl = 'http'; } goto W0bO_; mRCsw: } public static function fixFullFromConfig($mVGem) { goto RjXs2; wqupo: return self::fixFull($gwXrh); goto vREDY; XatYJ: if (empty($gwXrh)) { return null; } goto wqupo; RjXs2: $gwXrh = modstart_config($mVGem); goto XatYJ; vREDY: } public static function fixFull($S3tfG, $THL2f = true) { goto UQbRv; J6n_0: $S3tfG = self::fix($S3tfG, $THL2f); goto XYpOJ; z7LS4: if (Str::startsWith($S3tfG, '//')) { return $r3NMl . ':' . $S3tfG; } goto wJOZ5; ODZ87: if (Request::secure()) { $r3NMl = 'https'; } else { $r3NMl = 'http'; } goto z7LS4; XYpOJ: if (Str::startsWith($S3tfG, 'http://') || Str::startsWith($S3tfG, 'https://')) { return $S3tfG; } goto ODZ87; wJOZ5: return $r3NMl . '://' . Request::server('HTTP_HOST') . $S3tfG; goto Lnjkm; ShyFC: if (empty($S3tfG)) { return $S3tfG; } goto J6n_0; UQbRv: if (is_array($S3tfG)) { return array_values(array_map(function ($ju0cF) use($THL2f) { return self::fixFull($ju0cF, $THL2f); }, $S3tfG)); } goto ShyFC; Lnjkm: } public static function fixFullInJob($S3tfG, $THL2f = true) { goto SVuDn; A3utT: BizException::throwsIfEmpty('APP_URL Required In Job', $of91U); goto MtyGw; YocyW: $of91U = config('env.APP_URL'); goto A3utT; SVuDn: if (empty($S3tfG)) { return $S3tfG; } goto xJxzH; f3Gjv: if (Str::startsWith($S3tfG, 'http://') || Str::startsWith($S3tfG, 'https://')) { return $S3tfG; } goto Ii2Jb; Ii2Jb: if (Str::startsWith($S3tfG, '//')) { return 'http:' . $S3tfG; } goto YocyW; MtyGw: return rtrim($of91U, '/') . '/' . ltrim($S3tfG, '/'); goto KAYzL; xJxzH: $S3tfG = self::fix($S3tfG, $THL2f); goto f3Gjv; KAYzL: } public static function fixFullWithCdn($S3tfG, $pvQ34, $THL2f = true) { goto nDL0a; XdcPR: if (empty($S3tfG)) { return $S3tfG; } goto mmJ4M; D2H7x: return $pvQ34 . ltrim($S3tfG, '/'); goto K5YwW; nDL0a: if (is_array($S3tfG)) { return array_values(array_map(function ($ju0cF) use($pvQ34, $THL2f) { return self::fixFullWithCdn($ju0cF, $pvQ34, $THL2f); }, $S3tfG)); } goto XdcPR; mmJ4M: if (Str::startsWith($S3tfG, 'http://') || Str::startsWith($S3tfG, 'https://')) { return $S3tfG; } goto D2H7x; K5YwW: } public static function fixFullOrDefault($S3tfG, $A0QpK = null) { goto dsdjl; SkDu6: if (empty($S3tfG)) { return self::fixFull($A0QpK); } goto CK4Qm; CK4Qm: return self::fixFull($S3tfG); goto khdpD; dsdjl: if (is_array($S3tfG)) { return array_values(array_map(function ($ju0cF) use($A0QpK) { return self::fixFullOrDefault($ju0cF, $A0QpK); }, $S3tfG)); } goto SkDu6; khdpD: } public static function recordsFixFullOrDefault(&$feJuE, $rvTrU, $A0QpK = null) { foreach ((array) $rvTrU as $Bll1I) { foreach ($feJuE as $GBNIv => $VFelt) { $feJuE[$GBNIv][$Bll1I] = self::fixFullOrDefault($VFelt[$Bll1I], $A0QpK); } } } }