From 3b865d432ff24532b4a5e6917e23fc42b0d7fcaf Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 22 Aug 2020 21:32:06 +0200 Subject: Revert "composer update pear/text_languagedetect" This reverts commit 646dce7765b36afab5c1688c51ebab48a214864e --- vendor/pear/text_languagedetect/.gitignore | 6 -- vendor/pear/text_languagedetect/.travis.yml | 14 ----- vendor/pear/text_languagedetect/README.rst | 9 --- .../text_languagedetect/Text/LanguageDetect.php | 42 +++++++------ vendor/pear/text_languagedetect/composer.json | 2 +- .../pear/text_languagedetect/docs/confidence.php | 18 ------ .../text_languagedetect/docs/errorhandling.php | 15 ----- .../pear/text_languagedetect/docs/example_clui.php | 35 ----------- .../pear/text_languagedetect/docs/example_web.php | 72 ---------------------- vendor/pear/text_languagedetect/docs/iso.php | 19 ------ vendor/pear/text_languagedetect/docs/languages.php | 11 ---- vendor/pear/text_languagedetect/docs/simple.php | 10 --- vendor/pear/text_languagedetect/phpcs.xml | 10 --- 13 files changed, 25 insertions(+), 238 deletions(-) delete mode 100644 vendor/pear/text_languagedetect/.gitignore delete mode 100644 vendor/pear/text_languagedetect/.travis.yml delete mode 100644 vendor/pear/text_languagedetect/docs/confidence.php delete mode 100644 vendor/pear/text_languagedetect/docs/errorhandling.php delete mode 100644 vendor/pear/text_languagedetect/docs/example_clui.php delete mode 100644 vendor/pear/text_languagedetect/docs/example_web.php delete mode 100644 vendor/pear/text_languagedetect/docs/iso.php delete mode 100644 vendor/pear/text_languagedetect/docs/languages.php delete mode 100644 vendor/pear/text_languagedetect/docs/simple.php delete mode 100644 vendor/pear/text_languagedetect/phpcs.xml (limited to 'vendor/pear') diff --git a/vendor/pear/text_languagedetect/.gitignore b/vendor/pear/text_languagedetect/.gitignore deleted file mode 100644 index d83ad3973..000000000 --- a/vendor/pear/text_languagedetect/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# composer related -composer.lock -composer.phar -vendor -/README.html -/dist diff --git a/vendor/pear/text_languagedetect/.travis.yml b/vendor/pear/text_languagedetect/.travis.yml deleted file mode 100644 index 7cb79a61f..000000000 --- a/vendor/pear/text_languagedetect/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: php -sudo: false -php: - - 7.2 - - 7.3 - - 7.4 -install: - - pear install pear/PHP_CodeSniffer - - composer install - - phpenv rehash -script: - - composer validate - - ./vendor/bin/phpunit --coverage-text tests - - phpcs Text/ diff --git a/vendor/pear/text_languagedetect/README.rst b/vendor/pear/text_languagedetect/README.rst index 15fbd87bb..9381c7f7e 100644 --- a/vendor/pear/text_languagedetect/README.rst +++ b/vendor/pear/text_languagedetect/README.rst @@ -155,12 +155,3 @@ Unit test status .. image:: https://travis-ci.org/pear/Text_LanguageDetect.svg?branch=master :target: https://travis-ci.org/pear/Text_LanguageDetect - - -Notes -===== -Where are the data from? - - I don't recall where I got the original data set. - It's just the frequencies of 3-letter combinations in each supported language. - It could be generated from a few random wikipedia pages from each language. diff --git a/vendor/pear/text_languagedetect/Text/LanguageDetect.php b/vendor/pear/text_languagedetect/Text/LanguageDetect.php index 850b1beaf..420faa941 100644 --- a/vendor/pear/text_languagedetect/Text/LanguageDetect.php +++ b/vendor/pear/text_languagedetect/Text/LanguageDetect.php @@ -12,9 +12,9 @@ * @link http://pear.php.net/package/Text_LanguageDetect/ */ -require_once 'Text/LanguageDetect/Exception.php'; -require_once 'Text/LanguageDetect/Parser.php'; -require_once 'Text/LanguageDetect/ISO639.php'; +//require_once 'Text/LanguageDetect/Exception.php'; +//require_once 'Text/LanguageDetect/Parser.php'; +//require_once 'Text/LanguageDetect/ISO639.php'; /** * Detects the language of a given piece of text. @@ -189,7 +189,7 @@ class Text_LanguageDetect */ protected function _get_data_loc($fname) { - if ($fname[0] == '/' || $fname[0] == '.') { + if ($fname{0} == '/' || $fname{0} == '.') { // if filename starts with a slash, assume it's an absolute pathname // and skip whatever is in $this->_data_dir return $fname; @@ -247,6 +247,12 @@ class Text_LanguageDetect protected function _checkTrigram($trigram) { if (!is_array($trigram)) { + if (ini_get('magic_quotes_runtime')) { + throw new Text_LanguageDetect_Exception( + 'Error loading database. Try turning magic_quotes_runtime off.', + Text_LanguageDetect_Exception::MAGIC_QUOTES + ); + } throw new Text_LanguageDetect_Exception( 'Language database is not an array.', Text_LanguageDetect_Exception::DB_NOT_ARRAY @@ -1464,31 +1470,31 @@ class Text_LanguageDetect case 1: // normal ASCII-7 byte // 0xxxxxxx --> 0xxxxxxx - return ord($char[0]); + return ord($char{0}); case 2: // 2 byte unicode // 110zzzzx 10xxxxxx --> 00000zzz zxxxxxxx - $z = (ord($char[0]) & 0x000001F) << 6; - $x = (ord($char[1]) & 0x0000003F); + $z = (ord($char{0}) & 0x000001F) << 6; + $x = (ord($char{1}) & 0x0000003F); return ($z | $x); case 3: // 3 byte unicode // 1110zzzz 10zxxxxx 10xxxxxx --> zzzzzxxx xxxxxxxx - $z = (ord($char[0]) & 0x0000000F) << 12; - $x1 = (ord($char[1]) & 0x0000003F) << 6; - $x2 = (ord($char[2]) & 0x0000003F); + $z = (ord($char{0}) & 0x0000000F) << 12; + $x1 = (ord($char{1}) & 0x0000003F) << 6; + $x2 = (ord($char{2}) & 0x0000003F); return ($z | $x1 | $x2); case 4: // 4 byte unicode // 11110zzz 10zzxxxx 10xxxxxx 10xxxxxx --> // 000zzzzz xxxxxxxx xxxxxxxx - $z1 = (ord($char[0]) & 0x00000007) << 18; - $z2 = (ord($char[1]) & 0x0000003F) << 12; - $x1 = (ord($char[2]) & 0x0000003F) << 6; - $x2 = (ord($char[3]) & 0x0000003F); + $z1 = (ord($char{0}) & 0x00000007) << 18; + $z2 = (ord($char{1}) & 0x0000003F) << 12; + $x1 = (ord($char{2}) & 0x0000003F) << 6; + $x2 = (ord($char{3}) & 0x0000003F); return ($z1 | $z2 | $x1 | $x2); } } @@ -1508,7 +1514,7 @@ class Text_LanguageDetect */ protected static function _next_char($str, &$counter, $special_convert = false) { - $char = $str[$counter++]; + $char = $str{$counter++}; $ord = ord($char); // for a description of the utf8 system see @@ -1532,7 +1538,7 @@ class Text_LanguageDetect } elseif ($ord >> 5 == 6) { // two-byte char // multi-byte chars - $nextchar = $str[$counter++]; // get next byte + $nextchar = $str{$counter++}; // get next byte // lower-casing of non-ascii characters is still incomplete @@ -1574,12 +1580,12 @@ class Text_LanguageDetect } elseif ($ord >> 4 == 14) { // three-byte char // tag on next 2 bytes - return $char . $str[$counter++] . $str[$counter++]; + return $char . $str{$counter++} . $str{$counter++}; } elseif ($ord >> 3 == 30) { // four-byte char // tag on next 3 bytes - return $char . $str[$counter++] . $str[$counter++] . $str[$counter++]; + return $char . $str{$counter++} . $str{$counter++} . $str{$counter++}; } else { // error? diff --git a/vendor/pear/text_languagedetect/composer.json b/vendor/pear/text_languagedetect/composer.json index a65a17d40..fc94c6506 100644 --- a/vendor/pear/text_languagedetect/composer.json +++ b/vendor/pear/text_languagedetect/composer.json @@ -27,6 +27,6 @@ "ext-mbstring": "May require the mbstring PHP extension" }, "require-dev": { - "phpunit/phpunit": "8.*|9.*" + "phpunit/phpunit": "*" } } diff --git a/vendor/pear/text_languagedetect/docs/confidence.php b/vendor/pear/text_languagedetect/docs/confidence.php deleted file mode 100644 index 5be0fb9b6..000000000 --- a/vendor/pear/text_languagedetect/docs/confidence.php +++ /dev/null @@ -1,18 +0,0 @@ -detect($text, 3); - -foreach ($results as $language => $confidence) { - echo $language . ': ' . number_format($confidence, 2) . "\n"; -} - -//output: -//german: 0.35 -//dutch: 0.25 -//swedish: 0.20 -?> \ No newline at end of file diff --git a/vendor/pear/text_languagedetect/docs/errorhandling.php b/vendor/pear/text_languagedetect/docs/errorhandling.php deleted file mode 100644 index b68e42476..000000000 --- a/vendor/pear/text_languagedetect/docs/errorhandling.php +++ /dev/null @@ -1,15 +0,0 @@ -detectSimple('Das ist ein kleiner Text'); - echo "Language is: $lang\n"; -} catch (Text_LanguageDetect_Exception $e) { - echo 'An error occured! Message: ' . $e . "\n"; -} -?> \ No newline at end of file diff --git a/vendor/pear/text_languagedetect/docs/example_clui.php b/vendor/pear/text_languagedetect/docs/example_clui.php deleted file mode 100644 index 210b0eec4..000000000 --- a/vendor/pear/text_languagedetect/docs/example_clui.php +++ /dev/null @@ -1,35 +0,0 @@ -getLanguages(); -sort($langs); -echo join(', ', $langs); - -echo "\ntotal ", count($langs), "\n\n"; - -while ($line = fgets($stdin)) { - $result = $l->detect($line, 4); - print_r($result); - $blocks = $l->detectUnicodeBlocks($line, true); - print_r($blocks); -} - -fclose($stdin); -unset($l); - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -?> diff --git a/vendor/pear/text_languagedetect/docs/example_web.php b/vendor/pear/text_languagedetect/docs/example_web.php deleted file mode 100644 index bee8f51a4..000000000 --- a/vendor/pear/text_languagedetect/docs/example_web.php +++ /dev/null @@ -1,72 +0,0 @@ - - - -Text_LanguageDetect demonstration - - -

Text_LanguageDetect

-Supported languages:\n"; -$langs = $l->getLanguages(); -sort($langs); -foreach ($langs as $lang) { - echo ucfirst($lang), ', '; - $i++; -} - -echo "
total $i

"; - -?> -
-Enter text to identify language (at least a couple of sentences):
- -
- -
-utf8strlen($q); - if ($len < 20) { // this value picked somewhat arbitrarily - echo "Warning: string not very long ($len chars)
\n"; - } - - $result = $l->detectConfidence($q); - - if ($result == null) { - echo "Text_LanguageDetect cannot identify this piece of text.

\n"; - } else { - echo "Text_LanguageDetect thinks this text is written in {$result['language']} ({$result['similarity']}, {$result['confidence']})

\n"; - } - - $result = $l->detectUnicodeBlocks($q, false); - if (!empty($result)) { - arsort($result); - echo "Unicode blocks present: ", join(', ', array_keys($result)), "\n

"; - } -} - -unset($l); - -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ - -?> - diff --git a/vendor/pear/text_languagedetect/docs/iso.php b/vendor/pear/text_languagedetect/docs/iso.php deleted file mode 100644 index 547316313..000000000 --- a/vendor/pear/text_languagedetect/docs/iso.php +++ /dev/null @@ -1,19 +0,0 @@ -setNameMode(2); -echo $ld->detectSimple('Das ist ein kleiner Text') . "\n"; - -//will output the ISO 639-2 three-letter language code -// "deu" -$ld->setNameMode(3); -echo $ld->detectSimple('Das ist ein kleiner Text') . "\n"; -?> diff --git a/vendor/pear/text_languagedetect/docs/languages.php b/vendor/pear/text_languagedetect/docs/languages.php deleted file mode 100644 index f6d022c22..000000000 --- a/vendor/pear/text_languagedetect/docs/languages.php +++ /dev/null @@ -1,11 +0,0 @@ -getLanguages() as $lang) { - echo $lang . "\n"; -} -?> diff --git a/vendor/pear/text_languagedetect/docs/simple.php b/vendor/pear/text_languagedetect/docs/simple.php deleted file mode 100644 index 0bfc11eb0..000000000 --- a/vendor/pear/text_languagedetect/docs/simple.php +++ /dev/null @@ -1,10 +0,0 @@ -detectSimple($text); -var_dump($result); -//output: german -?> diff --git a/vendor/pear/text_languagedetect/phpcs.xml b/vendor/pear/text_languagedetect/phpcs.xml deleted file mode 100644 index 9eeccf534..000000000 --- a/vendor/pear/text_languagedetect/phpcs.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - -- cgit v1.2.3