Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.

Commit e14b56f

Browse files
committed
Merge pull request #24 from burzum/develop
Bug fixes and CS fixes
2 parents 5481f5d + 4bd147d commit e14b56f

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"minimum-stability": "stable",
1515
"require": {
16-
"cakephp/cakephp": "~3.0",
16+
"cakephp/cakephp": "3.*",
1717
"ezyang/htmlpurifier": "*"
1818
},
1919
"autoload": {

docs/Usage.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ Configuration
2323

2424
Important: Before you start declaring a configuration you should lookup how HTML Purifier can be configured. http://htmlpurifier.org/docs
2525

26-
In `config/boostrap.php` you can either set the purifier config as an array or pass a native config object.
26+
In `config/bootstrap.php` you can either set the purifier config as an array or pass a native config object.
2727

2828
The array style would look like this:
2929

3030
```php
31+
// Don't forget to add the `use` statement
32+
use Burzum\HtmlPurifier\Lib\Purifier;
33+
3134
Purifier::config('ConfigName', array(
3235
'HTML.AllowedElements' => 'a, em, blockquote, p, strong, pre, code, span,ul,ol,li,img',
3336
'HTML.AllowedAttributes' => 'a.href, a.title, img.src, img.alt'

src/Lib/Purifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static function clean($markup, $configName = null)
102102
$_this = Purifier::getInstance();
103103

104104
if (!isset($_this->_configs[$configName])) {
105-
throw new \InvalidArgumentException(sprintf('Invalid configuration %s!', $configName));
105+
throw new \InvalidArgumentException(sprintf('Invalid HtmlPurifier configuration "%s"!', $configName));
106106
}
107107

108108
return $_this->getPurifierInstance($configName)->purify($markup);

src/View/Helper/HtmlPurifierHelper.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class HtmlPurifierHelper extends Helper {
1818
*
1919
* @var array
2020
*/
21-
public $_defaultConfig = [
22-
'config' => ''
23-
];
21+
public $_defaultConfig = [
22+
'config' => 'default'
23+
];
2424

2525
/**
2626
* Clean markup
@@ -29,10 +29,11 @@ class HtmlPurifierHelper extends Helper {
2929
* @param string $config
3030
* @return string
3131
*/
32-
public function clean($markup, $config = null) {
33-
if (empty($config) && !empty($this->_config['config'])) {
34-
$config = $this->settings['config'];
35-
}
36-
return Purifier::clean($markup, $config);
37-
}
32+
public function clean($markup, $config = null)
33+
{
34+
if (empty($config) && !empty($this->_config['config'])) {
35+
$config = $this->config('config');
36+
}
37+
return Purifier::clean($markup, $config);
38+
}
3839
}

0 commit comments

Comments
 (0)