aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-07-20 02:04:51 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-07-20 02:04:51 -0700
commit6645846ad30ed0689d5e2848f9ae337bf8f28219 (patch)
treecfe3e783f49e8b00e74a319e2254715aa57d948d /include
parent736db4992b37e4e54d85e5734157e62c6500c431 (diff)
downloadvolse-hubzilla-6645846ad30ed0689d5e2848f9ae337bf8f28219.tar.gz
volse-hubzilla-6645846ad30ed0689d5e2848f9ae337bf8f28219.tar.bz2
volse-hubzilla-6645846ad30ed0689d5e2848f9ae337bf8f28219.zip
allow per-connection content filter to specify a detected language to include/exclude (in addition to text, tags, and regexes)
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index 054008d58..a460c8fd2 100755
--- a/include/items.php
+++ b/include/items.php
@@ -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;
}