]> git.mxchange.org Git - friendica-addons.git/commitdiff
Add checks for CLD2Detector ans CLD2Encoding classes
authorArt4 <art4@wlabs.de>
Tue, 26 Nov 2024 07:55:01 +0000 (07:55 +0000)
committerArt4 <art4@wlabs.de>
Tue, 26 Nov 2024 07:55:01 +0000 (07:55 +0000)
cld/cld.php

index 5ca4c932b7e8f8ff20acbcf5356989ca6540624e..83361e2bba740e080e396b91b7381e34d90445e6 100644 (file)
@@ -22,6 +22,16 @@ function cld_detect_languages(array &$data)
                return;
        }
 
+       if (!class_exists('CLD2Detector')) {
+               Logger::warning('CLD2Detector class does not exist.');
+               return;
+       }
+
+       if (!class_exists('CLD2Encoding')) {
+               Logger::warning('CLD2Encoding class does not exist.');
+               return;
+       }
+
        $cld2 = new \CLD2Detector();
 
        $cld2->setEncodingHint(CLD2Encoding::UTF8); // optional, hints about text encoding