Merge pull request #10122 from MrPetovan/bug/10106-restore-shared-post-external-link

[frio] Prevent HTMLPurify from removing ForkAwesome icon tags
This commit is contained in:
Tobias Diekershoff 2021-04-05 07:20:30 +02:00 committed by GitHub
commit 65c3013643
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1003,20 +1003,26 @@ class HTML
'_blank' => true, '_blank' => true,
]); ]);
/* Uncomment to debug HTMLPurifier behavior $config->set('AutoFormat.RemoveEmpty.Predicate', [
$config->set('Core.CollectErrors', true); 'colgroup' => [], // |
$config->set('Core.MaintainLineNumbers', true); 'th' => [], // |
*/ 'td' => [], // |
'iframe' => ['src'], // ↳ Default HTMLPurify values
'i' => ['class'], // Allows forkawesome icons
]);
// Uncomment to debug HTMLPurifier behavior
//$config->set('Core.CollectErrors', true);
//$config->set('Core.MaintainLineNumbers', true);
$HTMLPurifier = new \HTMLPurifier($config); $HTMLPurifier = new \HTMLPurifier($config);
$text = $HTMLPurifier->purify($text); $text = $HTMLPurifier->purify($text);
/** @var \HTMLPurifier_ErrorCollector $errorCollector */ /** @var \HTMLPurifier_ErrorCollector $errorCollector */
/* Uncomment to debug HTML Purifier behavior // Uncomment to debug HTML Purifier behavior
$errorCollector = $HTMLPurifier->context->get('ErrorCollector'); //$errorCollector = $HTMLPurifier->context->get('ErrorCollector');
var_dump($errorCollector->getRaw()); //var_dump($errorCollector->getRaw());
*/
return $text; return $text;
} }