mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-20 02:11:52 -04:00
Introduce url_remove_credentials() function
See https://github.com/FreshRSS/FreshRSS/issues/711
This commit is contained in:
1 parent
40f45c92ed
commit
e078f9fdac
1 file changed
+10
@@ -429,3 +429,13 @@ function array_push_unique(&$array, $value) {
|
||||
function array_remove(&$array, $value) {
|
||||
$array = array_diff($array, array($value));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sanitize a URL by removing HTTP credentials.
|
||||
* @param $url the URL to sanitize.
|
||||
* @return the same URL without HTTP credentials.
|
||||
*/
|
||||
function url_remove_credentials($url) {
|
||||
return preg_replace('#((.+)://)((.+)@)?(.+)#', '${1}${5}', $url);
|
||||
}
|
||||
Reference in new issue
Block a user