File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 18
18
use PKP \config \Config ;
19
19
use PKP \core \PKPString ;
20
20
use PKP \search \SearchFileParser ;
21
- use Symfony \Component \HtmlSanitizer \HtmlSanitizer ;
22
- use Symfony \Component \HtmlSanitizer \HtmlSanitizerConfig ;
23
21
24
22
class ArticleBody extends \DOMDocument
25
23
{
@@ -49,12 +47,15 @@ public function create(Submission $submission):\DOMNode
49
47
$ filepath = $ fileService ->get ($ galleyFile ->getData ('fileId ' ))->path ;
50
48
$ mimeType = $ fileService ->fs ->mimeType ($ filepath );
51
49
if (in_array ($ mimeType , ['text/html ' ])) {
52
- static $ sanitizer = null ;
53
- if (!$ sanitizer ) {
54
- $ sanitizer = new \PKP \core \PKPHtmlSanitizer ('p ' );
50
+ static $ purifier ;
51
+ if (!$ purifier ) {
52
+ $ config = \HTMLPurifier_Config::createDefault ();
53
+ $ config ->set ('HTML.Allowed ' , 'p ' );
54
+ $ config ->set ('Cache.SerializerPath ' , 'cache ' );
55
+ $ purifier = new \HTMLPurifier ($ config );
55
56
}
56
57
// Remove non-paragraph content
57
- $ text = $ sanitizer -> sanitize (file_get_contents (Config::getVar ('files ' , 'files_dir ' ) . '/ ' . $ filepath ));
58
+ $ text = $ purifier -> purify (file_get_contents (Config::getVar ('files ' , 'files_dir ' ) . '/ ' . $ filepath ));
58
59
59
60
// Remove empty paragraphs
60
61
} else {
You can’t perform that action at this time.
0 commit comments