Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Given that FreeScout has its `purifier.php` configuration file, you have an advantage since you can make use of Laravel's configuration overriding mechanism to make your customizations without directly modifying the core files. This way, you won't lose your changes during updates.
- Here's how you can achieve this:
- 1. **Service Provider**: Create a custom service provider. This provider will be responsible for overriding the default purifier configuration.
- 2. **Steps to Create a Custom Service Provider**:
- 1. Navigate to your FreeScout root directory.
- 2. Use the artisan command to create a new service provider:
- ```
- php artisan make:provider CustomPurifierServiceProvider
- ```
- 3. Open the newly created service provider located in `app/Providers/CustomPurifierServiceProvider.php`.
- 4. In the `register` method of your service provider, override the purifier configuration:
- ```php
- public function register()
- {
- $this->app->when('purifier')
- ->needs('$config')
- ->give(function () {
- $config = \HTMLPurifier_Config::createDefault();
- // Customize the config as needed
- $config->set('CSS.AllowedProperties', null);
- return $config;
- });
- }
- ```
- 3. **Register the Service Provider**: Once your custom service provider is set up, you need to register it. Open `config/app.php` and add your service provider to the `providers` array:
- ```php
- 'providers' => [
- // ...
- App\Providers\CustomPurifierServiceProvider::class,
- ],
- ```
- 4. **Test**: Once you've made these changes, clear the configuration cache and test to ensure the emails are displayed as you expect:
- ```
- php artisan config:clear
- ```
- 5. **Consider Security**: Remember that changing the behavior of HTML purification can introduce security risks. Ensure you understand the implications of any modifications you make.
- 6. **Updates**: The beauty of this method is that your changes are in a separate service provider and not directly in the core FreeScout files, so they should persist through updates. However, always backup before updating and check after updating to ensure your customizations are still working as expected.
- This method leverages Laravel's service container binding to provide your custom configuration to the purifier. This way, you're not editing the core functionality but are providing your configuration when the purifier is used.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement