-
Notifications
You must be signed in to change notification settings - Fork 41
relative URLs #28
Comments
Hi @alartigue, created temporary solution if you need |
Hello @olegatro and @alartigue! I think this could be a setting inside the A and Image extensions, something like If you are interested in providing a PR for this, I would be glad to give you a hand :) . |
@olegatro if you have a few minutes to create a Composer package for your work, it could be a nice way to let @alartigue use the feature easily perhaps :) ? I'm glad you found a good solution for this! |
@tgalopin @olegatro I'd really be interested in seeing this effort resolved with a new config feature. I try to use sanitizer with my Symfony project, and having a config option For those wondering about integration of fix by @olegatro (Thanks!), I made the following configurations in my Symfony 5 project to adopt the solution:
"autoload": {
"psr-4": {
"App\\": "src/",
"Sanitizer\\": "src/Sanitizer/"
}
},
# Read at: https://github.com/tgalopin/html-sanitizer-bundle#registering-an-extension
Sanitizer\Extension\A\AExtension:
tags: [{ name: 'html_sanitizer.extension' }]
# Read at: https://github.com/tgalopin/html-sanitizer-bundle#registering-an-extension
Sanitizer\Extension\Image\ImageExtension:
tags: [{ name: 'html_sanitizer.extension' }]
html_sanitizer:
default_sanitizer: 'default'
sanitizers:
default:
# Read https://github.com/tgalopin/html-sanitizer/blob/master/docs/1-getting-started.md#extensions
# to learn more about which extensions you would like to enable.
extensions:
- 'basic'
- 'list'
- 'table'
#- 'image'
# - 'code'
# - 'iframe'
- 'extra'
# https://github.com/tgalopin/html-sanitizer-bundle#registering-an-extension
# https://github.com/olegatro/html-sanitizer_local_uri
# See classes in src/Sanitizer/Extension directory
- 'custom-a'
- 'custom-image' |
@voltel maybe on the next week |
Hello. Has anyone else used this extension ? I'm trying to get it running, I'm still a "rookie" at playing with these packages and extensions. I can't seem to get this to work, my guess is that autoload does not find the Sanitizer namespace. I've tried adding it manually to composer.json. I've tried putting the extension files in various places, nothing seems to work, my code fails when it reaches the $builder->registerExtension(new ImageExtension()); I don't use Symfony, I'm just in "basic" mode. Any help would be appreciated !! |
@Phroggy78 Hi! You can write issue here https://github.com/olegatro/html-sanitizer_local_uri |
I think the problem is with your composer.json
To better understand what might be the problem, join chat room on Slack (
https://phpchat.co/) and share details of your problem there including the
composer.json "autoload" key.
Mine is below. If you're placing your package under "vendor" directory,
your namespaces should be pointing to the vendor directory. I have
"Sanitizer\\": "src/Sanitizer/"
because I placed the downloaded folder under my src/Sanitizer directory. You should change it accordingly.
"autoload": {
"psr-4": {
"App\\": "src/",
"Sanitizer\\": "src/Sanitizer/"
}
},
|
I tried the following :
{
} It still does not work. What am I doing wrong ? Do I need a specific composer.json for the extension? PhR |
@olegatro |
@S-DICKSON Hi.
unfortunately no
unfortunately no Sorry about that. I hope that in future find some time to add this feature to the this package or publish a separate composer project. |
ping @tgalopin , @Phroggy78 , @S-DICKSON , @voltel , @alartigue Hi all. A small announcement - I published composer version of the relative urls https://github.com/olegatro/html-sanitizer-relative For those of you who used my old repository (https://github.com/olegatro/html-sanitizer_local_uri) and would like to migrate - read below The composer version implements the same logic as the code in the old repository Composer version has two differences: Namespace: before after Tag names in the settings: before after Because repositories have different namespaces and tag names, it will be more easily migrate from one version to other. Be aware - it is still temporary solution - in the future I hope we find time to add this feature to the main repository |
@olegatro great work, thanks! Would you be down to open a PR on this repo with the option? |
Yes, on the next week (I hope). The code will be a little different and will be include |
Awesome! You can also ping me at galopintitouan [at] gmail [dot] com if you want to chat about it before opening the PR, if you're not sure about certain things. |
ping @tgalopin what do you think ? |
Any chance to disable this setting ?
The text was updated successfully, but these errors were encountered: