Skip to content
  • Richard Mansfield's avatar
    Use htmlpurifier in external media block (bug #971289) · c5753d29
    Richard Mansfield authored
    Now that SafeEmbed and SafeIframe options of htmlpurifier are enabled,
    the external media block can make use of them, rather than always
    trying to parse and generate iframe and embed code for the supported
    sites.
    
    Any html pasted into the block configuration form is now allowed to
    fall through to be sanitised by htmlpurfier, so the site-wide list of
    allowed iframe sites will be used rather than the existing list of
    supported sites in the external media block.
    
    Valid URLs pasted into the configuration form are still processed by
    the various media_sources regular expressions in
    blocktype/externalvideo/media_sources/*/mediasource.php, but the
    regexes that were previously designed to operate on embed/iframe code
    have been removed, and the remaining ones have been modified to match
    at the beginning of a url only.
    
    When a URL is entered, and the block saved, the embed/iframe code to
    be used when rendering the block is generated immediately, and
    subsequent edits of the block will reveal only the generated
    embed/iframe html.  The render_instance function will still generate
    the required embed code for old blocks that haven't been reconfigured
    yet.
    
    The glogster scraping code is also tightened slightly to ensure that a
    URL is returned.
    
    See https://wiki.mahara.org/index.php/Developer_Area/Specifications_in_Development/External_media_block_extension
    
    
    
    Change-Id: I7024ab946f8a6965e78730eb1daa3441f220a10b
    Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
    c5753d29