Commit 45180574 authored by Jakob Moser's avatar Jakob Moser
Browse files

Escape width, height and url just to be sure

parent 5d2e7914
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -38,8 +38,9 @@ add_filter('upload_mimes', 'fscoli_mime_types', 1, 1);
// For more details on the parameters this function is called with, see also
// https://developer.wordpress.org/reference/classes/wp_embed/get_embed_handler_html/
function fscoli_embed_umap($regex_matches, $embed_attrs, $url, $raw_embed_attrs) {
    $width = $embed_attrs['width'].'px';
    $height = $embed_attrs['height'].'px';
    $width = esc_attr($embed_attrs['width'].'px');
    $height = esc_attr($embed_attrs['height'].'px');
    $url = esc_url($url);
    return "<iframe src='$url' style='width: $width; height: $height'></iframe>";
}
wp_embed_register_handler('umap', '#^https://umap.openstreetmap.de/[a-z]{2}/map/.*#', 'fscoli_embed_umap');