comparison core/lib/Drupal/Component/Utility/Html.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
449 * 449 *
450 * @return string 450 * @return string
451 * The updated (X)HTML snippet. 451 * The updated (X)HTML snippet.
452 */ 452 */
453 public static function transformRootRelativeUrlsToAbsolute($html, $scheme_and_host) { 453 public static function transformRootRelativeUrlsToAbsolute($html, $scheme_and_host) {
454 assert('empty(array_diff(array_keys(parse_url($scheme_and_host)), ["scheme", "host", "port"]))', '$scheme_and_host contains scheme, host and port at most.'); 454 assert(empty(array_diff(array_keys(parse_url($scheme_and_host)), ["scheme", "host", "port"])), '$scheme_and_host contains scheme, host and port at most.');
455 assert('isset(parse_url($scheme_and_host)["scheme"])', '$scheme_and_host is absolute and hence has a scheme.'); 455 assert(isset(parse_url($scheme_and_host)["scheme"]), '$scheme_and_host is absolute and hence has a scheme.');
456 assert('isset(parse_url($scheme_and_host)["host"])', '$base_url is absolute and hence has a host.'); 456 assert(isset(parse_url($scheme_and_host)["host"]), '$base_url is absolute and hence has a host.');
457 457
458 $html_dom = Html::load($html); 458 $html_dom = Html::load($html);
459 $xpath = new \DOMXpath($html_dom); 459 $xpath = new \DOMXpath($html_dom);
460 460
461 // Update all root-relative URLs to absolute URLs in the given HTML. 461 // Update all root-relative URLs to absolute URLs in the given HTML.