mirror of
https://github.com/friendica/friendica
synced 2025-04-25 21:10:11 +00:00
Adding tests
This commit is contained in:
parent
318a3ca785
commit
edd4f06ad0
8 changed files with 520 additions and 43 deletions
|
@ -838,7 +838,7 @@ class Network
|
|||
|
||||
|
||||
/**
|
||||
* @brief Switch the scheme of an url between http and https
|
||||
* Switch the scheme of an url between http and https
|
||||
*
|
||||
* @param string $url URL
|
||||
*
|
||||
|
@ -846,15 +846,17 @@ class Network
|
|||
*/
|
||||
public static function switchScheme($url)
|
||||
{
|
||||
$parts = parse_url($url, PHP_URL_SCHEME);
|
||||
if (!isset($parts['scheme'])) {
|
||||
$scheme = parse_url($url, PHP_URL_SCHEME);
|
||||
if (empty($scheme)) {
|
||||
return $url;
|
||||
}
|
||||
if ($parts['scheme'] == 'http') {
|
||||
|
||||
if ($scheme === 'http') {
|
||||
$url = str_replace('http://', 'https://', $url);
|
||||
} elseif ($parts['scheme'] == 'https') {
|
||||
} elseif ($scheme === 'https') {
|
||||
$url = str_replace('https://', 'http://', $url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue