Skip to content
Snippets Groups Projects
Commit cc41c22b authored by Alexander Hass's avatar Alexander Hass
Browse files

#1811908: Allow extracting protocol relative url's

parent e18b732a
No related branches found
No related tags found
No related merge requests found
...@@ -1294,6 +1294,12 @@ function _linkchecker_extract_links($text = '', $content_path = NULL) { ...@@ -1294,6 +1294,12 @@ function _linkchecker_extract_links($text = '', $content_path = NULL) {
// Decode HTML links into plain text links. // Decode HTML links into plain text links.
$url_decoded = decode_entities($url); $url_decoded = decode_entities($url);
// Prefix protocol relative urls with a protocol to allow link checking.
if (preg_match('!^//!', $url_decoded)) {
$http_protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$url_decoded = $http_protocol . ':' . $url_decoded;
}
// FIXME: #1149596 HACK - Encode spaces in URLs, so validation equals TRUE and link gets added. // FIXME: #1149596 HACK - Encode spaces in URLs, so validation equals TRUE and link gets added.
$url_encoded = str_replace(' ', '%20', $url_decoded); $url_encoded = str_replace(' ', '%20', $url_decoded);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment