You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A difficult one to explain, but I'm trying to set up Purify to "allow" <u> tags, and transform them into <span style="text-decoration: underline">.
After I've done what I think is required, it works, but not on the first call to Purify::clean() in a given PHP request cycle, e.g.
$ tinker
Psy Shell v0.9.3 (PHP 7.1.16 — cli) by Justin Hileman
>>> Purify::clean('<u>Foo</u>');
PHP Warning: Element 'u' is not supported (for information on implementing this, see the support forums) in /private/tmp/purify-test/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLDefinition.php on line 311
>>> Purify::clean('<u>Foo</u>');
=> "<span style="text-decoration:underline;">Foo</span>"
I really had a hard time getting this to work, but I finally tracked it down. The issue is the "tidy" functionality. <u> (and in my case, <s>) is being "fixed" into a styled span, even if you're trying to manually allow the tag (link to source).
Using the example service provider, this is what's in my setupDefinitions:
A difficult one to explain, but I'm trying to set up Purify to "allow"
<u>
tags, and transform them into<span style="text-decoration: underline">
.After I've done what I think is required, it works, but not on the first call to Purify::clean() in a given PHP request cycle, e.g.
Whereas I'd expect:
Steps to reproduce:
laravel new test-project
cd test-project
composer require stevebauman/purify
php artisan vendor:publish --provider="Stevebauman\Purify\PurifyServiceProvider"
config/purify.php
and add "u" toHTML.Allowed
app/Providers/PurifyServiceProvider.php
as per https://gist.github.com/leewillis77/6c1fe0ad5448b1fae6b5412a2ee02502config/app.php
and addApp\Providers\PurifyServiceProvider::class
to the list of providersrm -fr storage/purify/
)Purify::clean('<u>Foo</u>');
in a tinker session[Sidenote, I'd be happy if I could get it just to allow as an alternative, but the same issue happens with that]
The text was updated successfully, but these errors were encountered: