Merge pull request #1146 from annando/langfilter-speed

Langfilter: Improve performance by using pre rendered content
This commit is contained in:
Tobias Diekershoff 2021-07-18 07:02:06 +02:00 committed by GitHub
commit 4ff458ecf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,11 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
return; return;
} }
$naked_body = BBCode::toPlaintext($hook_data['item']['body'], false); if (!empty($hook_data['item']['rendered-html'])) {
$naked_body = strip_tags($hook_data['item']['rendered-html']);
} else {
$naked_body = BBCode::toPlaintext($hook_data['item']['body'], false);
}
// Don't filter if body lenght is below minimum // Don't filter if body lenght is below minimum
$minlen = DI::pConfig()->get(local_user(), 'langfilter', 'minlength', 32); $minlen = DI::pConfig()->get(local_user(), 'langfilter', 'minlength', 32);