mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-10 02:18:48 +00:00
Merge pull request #591 from MrPetovan/task/4867-guess-language-from-plaintext
Guess language from plaintext
This commit is contained in:
commit
9d33ccac28
4 changed files with 14 additions and 10 deletions
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
|
@ -134,12 +135,15 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
return;
|
||||
}
|
||||
|
||||
$naked_body = BBCode::toPlaintext($hook_data['item']['body'], false);
|
||||
|
||||
// Don't filter if body lenght is below minimum
|
||||
$minlen = PConfig::get(local_user(), 'langfilter', 'minlength');
|
||||
$minlen = PConfig::get(local_user(), 'langfilter', 'minlength', 32);
|
||||
if (!$minlen) {
|
||||
$minlen = 32;
|
||||
}
|
||||
if (strlen($hook_data['item']['body']) < $minlen) {
|
||||
|
||||
if (strlen($naked_body) < $minlen) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue