]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix_url: support schema-less urls
authorAndrew Dolgov <noreply@fakecake.org>
Mon, 8 Jun 2015 11:18:49 +0000 (14:18 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Mon, 8 Jun 2015 11:18:49 +0000 (14:18 +0300)
include/functions2.php

index 314c128739425f88e41fa81f1b124f61b85747e9..e212609db2546665192a39b29ae19a23541f65e4 100644 (file)
         * @return string Fixed URL.
         */
        function fix_url($url) {
+
+               // support schema-less urls
+               if (strpos($url, '//') === 0) {
+                       $url = 'https:' . $url;
+               }
+
                if (strpos($url, '://') === false) {
                        $url = 'http://' . $url;
                } else if (substr($url, 0, 5) == 'feed:') {