diff options
| author | 2016-02-24 21:08:24 +0100 | |
|---|---|---|
| committer | 2016-02-24 21:08:24 +0100 | |
| commit | 9d4a4457587d04030118447847a5c99d9095b937 (patch) | |
| tree | 402f82f6716e94b660d2e37807019dbf7d384a9d | |
| parent | 1f7647f4dfe7030dfb4be1d823ebbd7b45dd0bef (diff) | |
Work in progress HTTPS
| -rw-r--r-- | data/force-https.txt | 3 | ||||
| -rw-r--r-- | lib/SimplePie/SimplePie/Misc.php | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/data/force-https.txt b/data/force-https.txt new file mode 100644 index 000000000..3da802d01 --- /dev/null +++ b/data/force-https.txt @@ -0,0 +1,3 @@ +dailymotion.com +tumblr.com +youtube.com diff --git a/lib/SimplePie/SimplePie/Misc.php b/lib/SimplePie/SimplePie/Misc.php index 4c9f8cff6..b9d74f894 100644 --- a/lib/SimplePie/SimplePie/Misc.php +++ b/lib/SimplePie/SimplePie/Misc.php @@ -83,7 +83,13 @@ class SimplePie_Misc */ public static function https_url($url) { - return preg_replace('%^http://((?:[^/]*?\.)?(?:youtube|dailymotion|tumblr)\.com/)%i', 'https://$1', $url); + if (strtolower(substr($url, 0, 7)) === 'http://') + { + $domain = parse_url($url, PHP_URL_HOST); + return preg_replace('%^http://((?:[^/]*?\.)?(?:youtube|dailymotion|tumblr)\.com/)%i', 'https://$1', $url); + return substr_replace($url, 's', 4, 0); //Add the 's' to HTTPS + } + return $url; } public static function absolutize_url($relative, $base) |
