From 5ddd2705ca0c2729d4a5a6e37b6df8ad8b67379d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 27 Sep 2013 13:45:21 +0400 Subject: make language detection optional (closes #779) --- include/rssfuncs.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'include/rssfuncs.php') diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 6d067065e..13d6baeab 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -356,10 +356,12 @@ $rss->init(); } - require_once "lib/languagedetect/LanguageDetect.php"; + if (DETECT_ARTICLE_LANGUAGE) { + require_once "lib/languagedetect/LanguageDetect.php"; - $lang = new Text_LanguageDetect(); - $lang->setNameMode(2); + $lang = new Text_LanguageDetect(); + $lang->setNameMode(2); + } // print_r($rss); @@ -572,15 +574,17 @@ print "\n"; } - $entry_language = $lang->detect($entry_title . " " . $entry_content, 1); + $entry_language = ""; + + if (DETECT_ARTICLE_LANGUAGE) { + $entry_language = $lang->detect($entry_title . " " . $entry_content, 1); - if (count($entry_language) > 0) { - $entry_language = array_keys($entry_language); - $entry_language = db_escape_string(substr($entry_language[0], 0, 2)); + if (count($entry_language) > 0) { + $entry_language = array_keys($entry_language); + $entry_language = db_escape_string(substr($entry_language[0], 0, 2)); - _debug("detected language: $entry_language", $debug_enabled); - } else{ - $entry_language = ""; + _debug("detected language: $entry_language", $debug_enabled); + } } $entry_comments = $item->get_comments_url(); -- cgit v1.2.3