Page 1 of 1

Can't using fancybox plugin

Posted: Tue Jun 30, 2020 10:45 am
by evilfossa
Script URL: https://fancyapps.com/fancybox/3/
Version of script: 3.5.7
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below: Does somebody know how to add rules to HTML Purifier? I need to add some attributes, such as data-fancybox, data-caption, etc. I would like to use Fancybox plugin in our Knowledge Base because some pictures too small. But HTML Purifier deleting fancybox attributes after saving.

Re: Can't using fancybox plugin

Posted: Wed Jul 01, 2020 7:06 pm
by Klemen
You will need to add custom definitions. Try this:

1. open file \inc\htmlpurifier\HeskHTMLPurifier.php in Notepad++ or other powerful editor

2. find line

Code: Select all

$purifier = new HTMLPurifier($config);
3. just ABOVE that line add definitions, like:

Code: Select all

$def = $config->getHTMLDefinition(true);
$def->addAttribute('a', 'data-fancybox', 'Text');
$def->addAttribute('a', 'data-caption', 'Text');
(add additional data attributes and also for other HTML elements than "a" if you need them).

4. save, upload and test

Re: Can't using fancybox plugin

Posted: Thu Jul 02, 2020 2:54 pm
by evilfossa
It works like a charm. You are the best. Thanks a lot :)
I've been trying this definition below

Code: Select all

$config = HTMLPurifier_Config::createDefault();
and it doesn't worked.
Have a nice day!