*** Note added in 2016 – htmLawed version with HTML5 support is now available. Do NOT use or go by the information below ***
I have been delaying the release of the new htmLawed with HTML5 support as I am not getting enough time to thoroughly test it. Anyway, hopefully soon...
For your case, below are the instructions to modify htmLawed (version 1.1.14) to add support for the new HTML5 audio/video tags (namely, 'audio', 'video', 'source' and 'track'). I have also uploaded an htmLawed.php file with these modifications; you can get it here [link removed] (rename the file and extension as appropriate). I have not tested these modifications but they should work. Let me know if there is an issue.
//// - htmLawed modified for support for audio, video, source and track elements
//// ---- Usage note: (1) The $spec argument to htmLawed() must be specified with rules for the new 'audio,' 'video,' 'source' and 'track' elements to allow attributes within. Below are two examples of a $spec value that will allow use of all attributes of the new elements. Note that one could have other rules (separated by semi-colons [;]) for other elements in $spec. See htmLawed documentation for $spec for more. Rules are not required for permitting use of universal attributes like 'id' and 'class.' (2) Any new-in-HTML5 on* type of attribute in these new elements will still get filtered out.
//// ---- $spec = 'audio = src, preload, autoplay, mediagroup, loop, muted, controls; video = src, poster, preload, autoplay, mediagroup, loop, muted, controls, width, height; source = src, type, media; track = kind, src, srclang, label, default'; // all standards-permitted attributes are allowed in the elements
//// ---- $spec = 'audio = src, preload, autoplay, mediagroup, loop, muted, controls; video = src, poster, preload, autoplay, mediagroup, loop, muted, controls, width, height, -style; source = src, type, media; track = kind, src, srclang, label, default'; // all standards-permitted attributes are allowed in the elements except for 'style' in 'video'
//// ---- code modifications
// --- in function htmLawed()
// file line# 20: add to the list of elements 'audio', 'video', 'source', 'track' so that
$e = array('a'=>1, ... , 'audio'=>1, 'video'=>1, 'source'=>1, 'track'=>1);
// file line# 23: add 'audio' and 'video' to the list to have
unset($e['applet'], $e['canvas'], $e['embed'], $e['iframe'], $e['object'], $e['script'], $e['audio'], $e['video']);
// -- function hl_bal()
// file line# 147: add 'source', 'track' to the list of empty elements
$cE = array('area'=>1, ... , 'source'=>1, 'track'=>1);
// file line# 148: add 'audio', 'video' to the list of flow-type elements
$cF = array('button'=>1, ... , 'audio'=>1, 'video'=>1);
// file line# 155: add 'audio, 'video' to the list of parent-child specifications
$cO = array('address' ... , 'audio'=>array('source'=>1, 'track'=>1), 'video'=>array('source'=>1, 'track'=>1));
// file line# 159: add 'audio, 'video' to the list of inline elements
$eI = array('#pcdata'=>1, ... , 'audio'=>1, 'video'=>1);
// file line# 161: add 'source', 'track' to the list of elements
$eO = array('area'=>1, ... , 'source'=>1, 'track'=>1);
// --- function hl_tag()
// file line# 431: add 'source', 'track' to the list of empty elements
static $eE = array('area'=>1, ... , 'source', 'track');
// --- function hl_tidy()
// file line# 656: add 'audio, 'video' to the list of elements
$c = array('caption'=>1, ... , 'audio'=>1, 'video'=>1);