<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Str; class PathUtil { public static function isPublicNetPath($ceAjB) { goto yG_zD; yG_zD: $OBeAn = array('//', 'http://', 'https://'); goto LE41i; LE41i: foreach ($OBeAn as $DRhsw) { if (Str::startsWith($ceAjB, $DRhsw)) { return true; } } goto nf7nH; nf7nH: return false; goto TjcE8; TjcE8: } public static function fix($ceAjB, $TsMjQ = null) { goto l234W; NGm4I: return $TsMjQ . $ceAjB; goto hhFi_; l234W: if (Str::startsWith($ceAjB, 'http://') || Str::startsWith($ceAjB, 'https://') || Str::startsWith($ceAjB, '//')) { return $ceAjB; } goto Ep1MQ; QpJSi: if ($TsMjQ === null) { return $ceAjB; } goto RXIy1; Ep1MQ: if (!Str::startsWith($ceAjB, '/')) { $ceAjB = '/' . $ceAjB; } goto QpJSi; RXIy1: if (Str::endsWith($TsMjQ, '/')) { $TsMjQ = substr($TsMjQ, 0, strlen($TsMjQ) - 1); } goto NGm4I; hhFi_: } public static function fixOrDefault($ceAjB, $abOlZ, $TsMjQ = null) { if (empty($ceAjB)) { return self::fix($abOlZ, $TsMjQ); } return self::fix($ceAjB, $TsMjQ); } public static function fixFull($ceAjB, $TsMjQ = null, $xSuYc = null) { goto osfHi; h9w4h: if (Str::startsWith($ceAjB, '//')) { return $xSuYc . ':' . $ceAjB; } goto NiJzJ; wIJe7: return $TsMjQ . $ceAjB; goto wpwrC; etRQI: if (Str::endsWith($TsMjQ, '/')) { $TsMjQ = substr($TsMjQ, 0, strlen($TsMjQ) - 1); } goto wIJe7; IHRV8: if ($TsMjQ === null) { $TsMjQ = $xSuYc . '://' . RequestHelper::domain(); } goto etRQI; iC9H7: if (null === $xSuYc) { $xSuYc = RequestHelper::schema(); } goto h9w4h; osfHi: if (Str::startsWith($ceAjB, 'http://') || Str::startsWith($ceAjB, 'https://')) { return $ceAjB; } goto iC9H7; NiJzJ: if (!Str::startsWith($ceAjB, '/')) { $ceAjB = '/' . $ceAjB; } goto IHRV8; wpwrC: } public static function fixFullOrDefault($ceAjB, $abOlZ, $TsMjQ = null, $xSuYc = null) { if (empty($ceAjB)) { return self::fixFull($abOlZ, $TsMjQ, $xSuYc); } return self::fixFull($ceAjB, $TsMjQ, $xSuYc); } }