mirror of
https://github.com/friendica/friendica
synced 2024-11-19 10:23:41 +00:00
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:
commit
65c3013643
1 changed files with 14 additions and 8 deletions
|
@ -1003,20 +1003,26 @@ class HTML
|
|||
'_blank' => true,
|
||||
]);
|
||||
|
||||
/* Uncomment to debug HTMLPurifier behavior
|
||||
$config->set('Core.CollectErrors', true);
|
||||
$config->set('Core.MaintainLineNumbers', true);
|
||||
*/
|
||||
$config->set('AutoFormat.RemoveEmpty.Predicate', [
|
||||
'colgroup' => [], // |
|
||||
'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);
|
||||
|
||||
$text = $HTMLPurifier->purify($text);
|
||||
|
||||
/** @var \HTMLPurifier_ErrorCollector $errorCollector */
|
||||
/* Uncomment to debug HTML Purifier behavior
|
||||
$errorCollector = $HTMLPurifier->context->get('ErrorCollector');
|
||||
var_dump($errorCollector->getRaw());
|
||||
*/
|
||||
// Uncomment to debug HTML Purifier behavior
|
||||
//$errorCollector = $HTMLPurifier->context->get('ErrorCollector');
|
||||
//var_dump($errorCollector->getRaw());
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue