mirror of
https://github.com/friendica/friendica
synced 2025-04-28 08:24:23 +02:00
Check more fields for the language
This commit is contained in:
parent
8968c63fcc
commit
0c82974986
4 changed files with 23 additions and 20 deletions
|
@ -125,7 +125,7 @@ class Relay
|
|||
}
|
||||
}
|
||||
|
||||
if (!self::isWantedLanguage($body)) {
|
||||
if (!self::isWantedLanguage($body, 0, $authorid)) {
|
||||
Logger::info('Unwanted or Undetected language found - rejected', ['network' => $network, 'url' => $url, 'causer' => $causer, 'tags' => $tags]);
|
||||
return false;
|
||||
}
|
||||
|
@ -166,12 +166,14 @@ class Relay
|
|||
* Detect the language of a post and decide if the post should be accepted
|
||||
*
|
||||
* @param string $body
|
||||
* @param int $uri_id
|
||||
* @param int $author_id
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isWantedLanguage(string $body)
|
||||
public static function isWantedLanguage(string $body, int $uri_id = 0, int $author_id = 0)
|
||||
{
|
||||
$languages = [];
|
||||
foreach (Item::getLanguageArray($body, 10) as $language => $reliability) {
|
||||
foreach (Item::getLanguageArray($body, 10, $uri_id, $author_id) as $language => $reliability) {
|
||||
if ($reliability > 0) {
|
||||
$languages[] = $language;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue