diff options
| author | 2015-01-29 10:47:33 +0100 | |
|---|---|---|
| committer | 2015-01-29 10:47:33 +0100 | |
| commit | e078f9fdac8f666e2d2aad1b1cc8ba3aadb68ab2 (patch) | |
| tree | f7738c8534eac0f1dd3deb09a178cbba43571afa | |
| parent | 40f45c92ed96c34e1342cb50b3582b587e36a9bb (diff) | |
Introduce url_remove_credentials() function
See https://github.com/FreshRSS/FreshRSS/issues/711
| -rw-r--r-- | lib/lib_rss.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 68abe602c..d4f41cf5c 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -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); +} |
