don't use language detection if < php 5.3
This commit is contained in:
parent
10915b8feb
commit
8b6942c572
|
@ -816,12 +816,14 @@ 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'] : '');
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||
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());
|
||||
|
|
14
mod/item.php
14
mod/item.php
|
@ -219,12 +219,18 @@ function item_post(&$a) {
|
|||
|
||||
|
||||
$naked_body = preg_replace('/\[(.+?)\]/','',$body);
|
||||
$l = new Text_LanguageDetect;
|
||||
$lng = $l->detectConfidence($naked_body);
|
||||
|
||||
$postopts = (($lng['language']) ? 'lang=' . $lng['language'] . ';' . $lng['confidence'] : '');
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||
$l = new Text_LanguageDetect;
|
||||
$lng = $l->detectConfidence($naked_body);
|
||||
|
||||
$postopts = (($lng['language']) ? 'lang=' . $lng['language'] . ';' . $lng['confidence'] : '');
|
||||
|
||||
logger('mod_item: detect language' . print_r($lng,true) . $naked_body, LOGGER_DATA);
|
||||
}
|
||||
else
|
||||
$postopts = '';
|
||||
|
||||
logger('mod_item: detect language' . print_r($lng,true) . $naked_body, LOGGER_DATA);
|
||||
|
||||
$private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue