MCPcopy Create free account
hub / github.com/error311/FileRise / sanitizeHttpUrl

Method sanitizeHttpUrl

src/FileRise/Domain/AdminModel.php:91–103  ·  view source on GitHub ↗

Allow only http(s) URLs; return '' for invalid input. */

($url)

Source from the content-addressed store, hash-verified

89
90 /** Allow only http(s) URLs; return '' for invalid input. */
91 private static function sanitizeHttpUrl($url): string
92 {
93 $url = trim((string)$url);
94 if ($url === '') {
95 return '';
96 }
97 $valid = filter_var($url, FILTER_VALIDATE_URL);
98 if (!$valid) {
99 return '';
100 }
101 $scheme = strtolower(parse_url($url, PHP_URL_SCHEME) ?: '');
102 return ($scheme === 'http' || $scheme === 'https') ? $url : '';
103 }
104
105 /** Allow logo URLs that are either site-relative or http(s). */
106 private static function sanitizeLogoUrl($url): string

Callers 3

sanitizeLogoUrlMethod · 0.95
updateConfigMethod · 0.95
getConfigMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected