Thanks Michael.
Try adding elements and attributes to the whitelist using jrFramer - so set that active and allowed.
Replace jrFramer_html_purifier_listener with this:
function jrFramer_html_purifier_listener($_data,$_user,$_conf,$_args,$event)
{
if (isset($_conf['jrFramer_active']) && $_conf['jrFramer_active'] == 'on') {
$_data->set('HTML.SafeIframe', true);
$_data->set('URI.SafeIframeRegexp', '%(.*)%');
$_elem = $_data->get('HTML.AllowedElements');
$_elem['abbr'] = 1;
$_elem['blockquote'] = 1;
$_elem['cite'] = 1;
$_elem = implode(',', array_keys($_elem));
$_data->set('HTML.AllowedElements', $_elem);
$_attr = $_data->get('HTML.AllowedAttributes');
$_attr['abbr.title'] = 1;
$_attr['cite.title'] = 1;
$_attr['blockquote.class'] = 1;
$_attr['blockquote.data-content'] = 1;
$_attr = implode(',', array_keys($_attr));
$_data->set('HTML.AllowedAttributes', $_attr);
}
return $_data;
}
You will get the fatal error when visiting a page with an editor field in it.
To fix that error add this at line 1564 of util.php:
$pc->autoFinalize = false;
Then add blockquote and cite to your quota config Allowed HTML Tags if necessary.
Clear caches after each change to attributes or elements.
Then add this to an editor field and save:
<blockquote class="blockquote-reverse" data-content="test-content-12">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>
data-content="test-content-12" will be stripped out on save. Which isn't what I expected to happen.
You can test that the listener is adding the attributes in by commenting out
$_attr['blockquote.class'] = 1; then clearing caches, then saving the editor field again - the blockquote class will be stripped out. Remove the comment, clear caches, resave the editor field and the class will be saved.
So that is working fine with class, but not with data-content.
To get data-content to save it needs to be added in the listener, and ALSO in the jrCOre_strip_html function in util.php
Find this line:
$def->addAttribute('a', 'data-lightbox', 'Text');
and add this line after it:
$def->addAttribute('blockquote', 'data-content', 'Text');
Empty caches, save the editor field and the data-content attribute will be saved.
Comment out either the line whitelisting data-content in the jrCore_strip_html function OR jrFramer_html_purifier_listener (empty caches etc) and data-content will be stripped out. It needs to be allowed in both places.
This means that (once the fatal error has been fixed) with the current listener you cannot add to the attributes whitelist. Class, title etc can be whitelisted for an element, but not data elements, aria attributes, etc. They need to be allowed in BOTH places ('HTML.AllowedElements' and the HTML Definition), and adding via listener only adds in HTML.AllowedElements.
--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
updated by @ultrajam: 07/30/15 04:21:23AM