Skip to content

Commit

Permalink
Updated CSSDefinition to pascal case CssDefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
wheatleym committed Nov 27, 2023
1 parent 100d643 commit 85f1506
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion config/purify.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use HTMLPurifier_CSSDefinition;

interface CSSDefinition
interface CssDefinition
{
/**
* Apply rules to the CSS Purifier definition.
Expand Down
4 changes: 2 additions & 2 deletions src/PurifyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/PurifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
'<p>Test</p>',
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 85f1506

Please sign in to comment.