Updated DOM element matching to allow for "//" urls in images

This commit is contained in:
Peter Burnett
2021-01-18 15:47:30 +10:00
parent ca6c48d0f3
commit 7cd10ab05c
2 changed files with 19 additions and 6 deletions

View File

@@ -44,11 +44,13 @@ defined('MOODLE_INTERNAL') || die();
class maintenance_static_page_io {
/**
* Checks if the given string starts with "http://" or "https://".
* Also checks for "//" at the start of image, which setting_file_url still uses.
*
* @param $url
* @return bool
*/
public static function is_url($url) {
return (bool)preg_match('#^http(s)?://#', $url);
return ((bool) preg_match('#^http(s)?://#', $url) || (bool) preg_match('#^//#', $url));
}
/**