From 85f1506193920d125942f99115ec49b8c9b5e55d Mon Sep 17 00:00:00 2001 From: wheatleym Date: Mon, 27 Nov 2023 11:33:17 +0000 Subject: [PATCH] Updated CSSDefinition to pascal case CssDefinition --- README.md | 8 ++++---- config/purify.php | 2 +- src/Definitions/{CSSDefinition.php => CssDefinition.php} | 2 +- src/PurifyManager.php | 4 ++-- tests/PurifyTest.php | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) rename src/Definitions/{CSSDefinition.php => CssDefinition.php} (92%) diff --git a/README.md b/README.md index 938e855..83f9655 100644 --- a/README.md +++ b/README.md @@ -352,15 +352,15 @@ inline styles you allow and their properties and values. This can help fill in missing values for properties such as text-align, which by default is missing start and end values. You can do this by creating a CSS definition. -To create your own CSS definition, create a new class and have it implement `CSSDefinition`: +To create your own CSS definition, create a new class and have it implement `CssDefinition`: ```php namespace App; use HTMLPurifier_CSSDefinition; -use Stevebauman\Purify\Definitions\CSSDefinition; +use Stevebauman\Purify\Definitions\CssDefinition; -class CustomCSSDefinition implements CSSDefinition +class CustomCSSDefinition implements CssDefinition { /** * Apply rules to the CSS Purifier definition. @@ -385,7 +385,7 @@ Then, reference this class in the `config/purify.php` file in the `css-definitio ```php // config/purify.php -'css-definitions' => \App\CustomCSSDefinition::class, +'css-definitions' => \App\CustomCssDefinition::class, ``` See the class HTMLPurifier_CSSDefinition in the HTMLPurifier library for other examples of what can be changed. diff --git a/config/purify.php b/config/purify.php index c682b7b..15ee72a 100644 --- a/config/purify.php +++ b/config/purify.php @@ -79,7 +79,7 @@ | HTMLPurifier. When specifying a custom class, make sure it implements | the interface: | - | \Stevebauman\Purify\Definitions\CSSDefinition + | \Stevebauman\Purify\Definitions\CssDefinition | | Note that these definitions are applied to every Purifier instance. | diff --git a/src/Definitions/CSSDefinition.php b/src/Definitions/CssDefinition.php similarity index 92% rename from src/Definitions/CSSDefinition.php rename to src/Definitions/CssDefinition.php index c0bc1b4..6863d60 100644 --- a/src/Definitions/CSSDefinition.php +++ b/src/Definitions/CssDefinition.php @@ -4,7 +4,7 @@ use HTMLPurifier_CSSDefinition; -interface CSSDefinition +interface CssDefinition { /** * Apply rules to the CSS Purifier definition. diff --git a/src/PurifyManager.php b/src/PurifyManager.php index fbe4230..4ec8c1f 100644 --- a/src/PurifyManager.php +++ b/src/PurifyManager.php @@ -6,7 +6,7 @@ use Illuminate\Contracts\Container\Container; use Illuminate\Support\Manager; use InvalidArgumentException; -use Stevebauman\Purify\Definitions\CSSDefinition; +use Stevebauman\Purify\Definitions\CssDefinition; use Stevebauman\Purify\Definitions\Definition; class PurifyManager extends Manager @@ -205,7 +205,7 @@ protected function createHtmlConfig($config) if ($definition = $htmlConfig->getCSSDefinition()) { $definitionsClass = $this->config->get('purify.css-definitions'); - if ($definitionsClass && is_a($definitionsClass, CSSDefinition::class, true)) { + if ($definitionsClass && is_a($definitionsClass, CssDefinition::class, true)) { $definitionsClass::apply($definition); } } diff --git a/tests/PurifyTest.php b/tests/PurifyTest.php index ac3e427..7572b68 100644 --- a/tests/PurifyTest.php +++ b/tests/PurifyTest.php @@ -6,7 +6,7 @@ use HTMLPurifier_HTMLDefinition; use Illuminate\Support\Facades\File; use Stevebauman\Purify\Cache\CacheDefinitionCache; -use Stevebauman\Purify\Definitions\CSSDefinition; +use Stevebauman\Purify\Definitions\CssDefinition; use Stevebauman\Purify\Definitions\Definition; use Stevebauman\Purify\Facades\Purify; use Stevebauman\Purify\PurifyServiceProvider; @@ -136,7 +136,7 @@ public function test_custom_definitions_are_applied() public function test_custom_css_definitions_are_applied() { - $this->app['config']->set('purify.css-definitions', FooCSSDefinition::class); + $this->app['config']->set('purify.css-definitions', FooCssDefinition::class); $this->assertEquals( '

Test

', @@ -173,7 +173,7 @@ public static function apply(HTMLPurifier_HTMLDefinition $definition) } } -class FooCSSDefinition implements CSSDefinition +class FooCssDefinition implements CssDefinition { public static function apply(HTMLPurifier_CSSDefinition $definition) {