<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; use ModStart\Core\Input\Request; class PathUtil { public static function isPublicNetPath($LclBr) { goto JX3oh; JX3oh: $AIQdT = array('//', 'http://', 'https://'); goto TfFf1; kQmKB: return false; goto BvUyP; TfFf1: foreach ($AIQdT as $sGiaY) { if (Str::startsWith($LclBr, $sGiaY)) { return true; } } goto kQmKB; BvUyP: } public static function fix($LclBr, $O0jOZ = null) { goto NMow4; NMow4: if (Str::startsWith($LclBr, 'http://') || Str::startsWith($LclBr, 'https://') || Str::startsWith($LclBr, '//')) { return $LclBr; } goto qbwla; qbwla: if (!Str::startsWith($LclBr, '/')) { $LclBr = '/' . $LclBr; } goto GC916; hbqgk: if (Str::endsWith($O0jOZ, '/')) { $O0jOZ = substr($O0jOZ, 0, strlen($O0jOZ) - 1); } goto RTZ1i; GC916: if ($O0jOZ === null) { return $LclBr; } goto hbqgk; RTZ1i: return $O0jOZ . $LclBr; goto BpoGW; BpoGW: } public static function fixOrDefault($LclBr, $QsoDW, $O0jOZ = null) { if (empty($LclBr)) { return self::fix($QsoDW, $O0jOZ); } return self::fix($LclBr, $O0jOZ); } public static function fixFull($LclBr, $O0jOZ = null, $XQLUK = null) { goto t21P8; wCuzH: if (!Str::startsWith($LclBr, '/')) { $LclBr = '/' . $LclBr; } goto G9oOh; G9oOh: if ($O0jOZ === null) { $O0jOZ = $XQLUK . '://' . Request::domain(); } goto Dutvn; NSi9X: return $O0jOZ . $LclBr; goto T7AUf; NO4rg: if (Str::startsWith($LclBr, '//')) { return $XQLUK . ':' . $LclBr; } goto wCuzH; Dutvn: if (Str::endsWith($O0jOZ, '/')) { $O0jOZ = substr($O0jOZ, 0, strlen($O0jOZ) - 1); } goto NSi9X; t21P8: if (Str::startsWith($LclBr, 'http://') || Str::startsWith($LclBr, 'https://')) { return $LclBr; } goto zZ1s9; zZ1s9: if (null === $XQLUK) { $XQLUK = Request::schema(); } goto NO4rg; T7AUf: } public static function fixFullOrDefault($LclBr, $QsoDW, $O0jOZ = null, $XQLUK = null) { if (empty($LclBr)) { return self::fixFull($QsoDW, $O0jOZ, $XQLUK); } return self::fixFull($LclBr, $O0jOZ, $XQLUK); } }