protected function JuiceboxGallery::filterMarkup in Juicebox HTML5 Responsive Image Galleries 7.2
Filter markup for valid display in a Juicebox gallery.
Some markup that validates fine via external filters will not be syntactically valid once rendered within Juicebox. This is because Juicebox will wrap titles and captions in block-level tags, like <p>, making any block-level elements they contain invalid. This filter accommodates for this and is meant to be applied AFTER any external filters. Note that this process does NOT do any sanitization.
Parameters
string $markup: The markup to be filtered after it has been processed externally.
Return value
string Valid filtered markup ready for display in a Juicebox gallery.
1 call to JuiceboxGallery::filterMarkup()
- JuiceboxGallery::getImages in includes/
JuiceboxGallery.inc - Getter method for the gallery images.
File
- includes/
JuiceboxGallery.inc, line 352 - A php-only set of methods to create the script and markup components of a Juicebox gallery.
Class
- JuiceboxGallery
- Class to generate the script and markup for a Juicebox gallery.
Code
protected function filterMarkup($markup) {
// Set inline html5 elements that are safe in a Juicebox gallery. Ref:
// http://www.w3.org/html/wg/drafts/html/master/single-page.html#phrasing-content
$valid_elements = "<a><abbr><area><audio><b><bdi><bdo><br><button><canvas><cite><code><data><del><dfn><em><embed><i><iframe><img><input><ins><kbd><keygen><label><link><map><mark><math><meta><meter><noscript><object><output><progress><q><ruby><s><samp><script><select><small><span><strong><sub><sup><svg><template><textarea><time><u><var><video><wbr>";
// Add some html4 additions for legacy support.
// Ref: http://www.htmlhelp.com/reference/html40/inline.html
$valid_elements .= "<acronym><basefont><big><font><rp><rt><strike><tt>";
$markup = strip_tags($markup, $valid_elements);
// Also remove newlines to keep the output concise.
$markup = str_replace(array(
"\r",
"\n",
), '', $markup);
return $markup;
}