allow per-connection content filter to specify a detected language to include/exclude (in addition to text, tags, and regexes)

This commit is contained in:
redmatrix 2015-07-20 02:04:51 -07:00
parent 736db4992b
commit 6645846ad3
2 changed files with 7 additions and 1 deletions

View File

@ -3381,6 +3381,8 @@ function post_is_importable($item,$abook) {
$text = prepare_text($item['body'],$item['mimetype']);
$text = html2plain($text);
$lang = detect_language($text);
$tags = ((count($item['term'])) ? $item['term'] : false);
// exclude always has priority
@ -3397,6 +3399,8 @@ function post_is_importable($item,$abook) {
}
elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return false;
elseif((strpos($word,'lang=') === 0) && ($lang) && (stricmp($lang,trim(substr($word,5))) == 0))
return false;
elseif(stristr($text,$word) !== false)
return false;
}
@ -3414,6 +3418,8 @@ function post_is_importable($item,$abook) {
}
elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return true;
elseif((strpos($word,'lang=') === 0) && ($lang) && (stricmp($lang,trim(substr($word,5))) == 0))
return true;
elseif(stristr($text,$word) !== false)
return true;
}

View File

@ -1 +1 @@
2015-07-19.1098
2015-07-20.1099