diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 00000000..74331c35 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,14 @@ +## Version 2.0 (08/2018) + + * Added compatibility for Symfony 5 and Twig 3 + * Updated minimum requirement of Twig to 1.35 and 2.4 to support runtime + * [BC break] Dropped support for Symfony 2. Symfony 3.4 minimum required. + * [BC break] Removed classes parameters. + * [BC break] Removed the form data transformer. + * Added an `HTMLPurifierTextTypeExtension` to add `purify_html` and + `purify_html_profile` options to all `TextType` children. + * Added an `HTMLPurifierListener` to purify submitted form data. + * Added an `HTMLPurifiersRegistryInterface` to lazy load purifiers by profile. + * Added a Twig `HTMLPurifierRuntime` to lazy load purifiers in templates. + * Added a pass to use custom `\HTMLPurifier` classes as custom profiles using + a new `exercise.html_purifier` tag. diff --git a/README.md b/README.md index 5f88b2d6..0249313b 100644 --- a/README.md +++ b/README.md @@ -90,9 +90,10 @@ exercise_html_purifier: Cache.SerializerPath: '%kernel.cache_dir%/htmlpurifier' ``` -The `default` profile is special in that it is used as the configuration for the -`exercise_html_purifier.default` service as well as the base configuration for -other profiles you might define. +The `default` profile is special, it is *always* defined and its configuration +is inherited by all custom profiles. +`exercise_html_purifier.default` is the default service using the base +configuration. ```yaml # config/packages/exercise_html_purifier.yaml @@ -115,13 +116,24 @@ this in you `app/config/services.yml` or `config/services.yaml`: services: # ... - \HTMLPurifier: - alias: exercise_html_purifier.custom - - # or the equivalent as of Symfony 3.3 - \HTMLPurifier: '@exercise_html_purifier.custom' + exercise_html_purifier.default: '@exercise_html_purifier.custom' +``` + +## Using a custom purifier class as default + +If you want to use your own class as default purifier, define a new alias: + +```yaml +# config/services.yaml +services: + # ... + + exercise_html_purifier.default: '@App\Html\CustomHtmlPurifier' ``` +In such case, the custom purifier will use its own defined configuration, +ignoring the bundle configuration. + ## Form Type Extension This bundles provides a form type extension for filtering form fields with @@ -212,5 +224,7 @@ $builder {{ html_string|purify('custom') }} ``` -Your class will inherit the default config or the one from the same profile -used in the tag. +## Contributing + +PRs are welcomed :). Please target the `2.0` branch for bug fixes and `master` +for new features.