language detection - result is stored in item['postopts']
This commit is contained in:
parent
085b589468
commit
9a299920eb
3 changed files with 18 additions and 1 deletions
|
|
@ -816,6 +816,12 @@ function item_store($arr,$force_parent = false) {
|
|||
if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false))
|
||||
$arr['body'] = strip_tags($arr['body']);
|
||||
|
||||
require_once('Text/LanguageDetect.php');
|
||||
$naked_body = preg_replace('/\[(.+?)\]/','',$arr['body']);
|
||||
$l = new Text_LanguageDetect;
|
||||
$lng = $l->detectConfidence($naked_body);
|
||||
$arr['postopts'] = (($lng['language']) ? 'lang=' . $lng['language'] . ';' . $lng['confidence'] : '');
|
||||
|
||||
|
||||
$arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0);
|
||||
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : random_string());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue