<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; use ModStart\Core\Input\Request; class PathUtil { public static function isPublicNetPath($QTKvb) { goto xaAie; xaAie: $PRnJn = array('//', 'http://', 'https://'); goto ocPV4; yn7mP: return false; goto nGHsf; ocPV4: foreach ($PRnJn as $hyTx0) { if (Str::startsWith($QTKvb, $hyTx0)) { return true; } } goto yn7mP; nGHsf: } public static function fix($QTKvb, $WB5Kf = null) { goto a2Z4m; a2Z4m: if (Str::startsWith($QTKvb, 'http://') || Str::startsWith($QTKvb, 'https://') || Str::startsWith($QTKvb, '//')) { return $QTKvb; } goto JH8zt; JH8zt: if (!Str::startsWith($QTKvb, '/')) { $QTKvb = '/' . $QTKvb; } goto O1gay; W_Bl6: return $WB5Kf . $QTKvb; goto aRW2F; O1gay: if ($WB5Kf === null) { return $QTKvb; } goto j0tbT; j0tbT: if (Str::endsWith($WB5Kf, '/')) { $WB5Kf = substr($WB5Kf, 0, strlen($WB5Kf) - 1); } goto W_Bl6; aRW2F: } public static function fixOrDefault($QTKvb, $Rethz, $WB5Kf = null) { if (empty($QTKvb)) { return self::fix($Rethz, $WB5Kf); } return self::fix($QTKvb, $WB5Kf); } public static function fixFull($QTKvb, $WB5Kf = null, $WX6Oy = null) { goto g8r0G; JjVuq: if (null === $WX6Oy) { $WX6Oy = Request::schema(); } goto N3G1x; xgPr3: if ($WB5Kf === null) { $WB5Kf = $WX6Oy . '://' . Request::domain(); } goto d3Oqo; N3G1x: if (Str::startsWith($QTKvb, '//')) { return $WX6Oy . ':' . $QTKvb; } goto rUqZv; rUqZv: if (!Str::startsWith($QTKvb, '/')) { $QTKvb = '/' . $QTKvb; } goto xgPr3; d3Oqo: if (Str::endsWith($WB5Kf, '/')) { $WB5Kf = substr($WB5Kf, 0, strlen($WB5Kf) - 1); } goto QlkcB; QlkcB: return $WB5Kf . $QTKvb; goto qfR1q; g8r0G: if (Str::startsWith($QTKvb, 'http://') || Str::startsWith($QTKvb, 'https://')) { return $QTKvb; } goto JjVuq; qfR1q: } public static function fixFullOrDefault($QTKvb, $Rethz, $WB5Kf = null, $WX6Oy = null) { if (empty($QTKvb)) { return self::fixFull($Rethz, $WB5Kf, $WX6Oy); } return self::fixFull($QTKvb, $WB5Kf, $WX6Oy); } public static function convertPublicToInternal($QTKvb) { goto NJwpt; qdvHs: return $QTKvb; goto MEC4n; NpFhc: if (empty($h2tGi) || !is_array($h2tGi)) { return $QTKvb; } goto LMxwE; UJS7h: $h2tGi = modstart_config('Site_PublicInternalUrlMap', array()); goto NpFhc; NJwpt: if (empty($QTKvb)) { return $QTKvb; } goto UJS7h; LMxwE: foreach ($h2tGi as $NMIyT) { if (!isset($NMIyT['public']) || !isset($NMIyT['internal'])) { continue; } $QTKvb = str_replace($NMIyT['public'], $NMIyT['internal'], $QTKvb); } goto qdvHs; MEC4n: } }