Version Description
(released: 20 Jun 2021) * Bugfix: Removed composer.lock. It was locked on PHP 7.2, which caused server error on some sites (only some sites with old php were affected). Also deleted the library which required PHP 7.2 (onnov/detect-encoding/). The functionality is not really needed.
Download this release
Release Info
Developer | rosell.dk |
Plugin | WebP Express |
Version | 0.20.1 |
Comparing to | |
See all releases |
Code changes from version 0.20.0 to 0.20.1
- .github/FUNDING.yml +0 -2
- README.md +14 -0
- README.txt +12 -4
- changelog.txt +4 -0
- composer.json +0 -1
- composer.lock +0 -586
- docs/development.md +1 -0
- lib/classes/BulkConvert.php +10 -6
- lib/classes/ConvertHelperIndependent.php +1 -1
- vendor/composer/InstalledVersions.php +2 -12
- vendor/composer/autoload_classmap.php +0 -2
- vendor/composer/autoload_psr4.php +0 -1
- vendor/composer/autoload_static.php +0 -10
- vendor/composer/installed.json +0 -63
- vendor/composer/installed.php +2 -12
- vendor/composer/platform_check.php +2 -2
- vendor/onnov/detect-encoding/.travis.yml +0 -38
- vendor/onnov/detect-encoding/LICENSE +0 -21
- vendor/onnov/detect-encoding/README.md +0 -137
- vendor/onnov/detect-encoding/bin/testsRun.sh +0 -8
- vendor/onnov/detect-encoding/composer.json +0 -61
- vendor/onnov/detect-encoding/infection.json.dist +0 -17
- vendor/onnov/detect-encoding/phpbench.json +0 -3
- vendor/onnov/detect-encoding/src/CodePage.php +0 -96
- vendor/onnov/detect-encoding/src/EncodingDetector.php +0 -244
- webp-express.php +1 -1
.github/FUNDING.yml
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
github: rosell-dk
|
2 |
-
ko_fi: rosell
|
|
|
|
README.md
CHANGED
@@ -707,6 +707,20 @@ Here are my current plans ahead: 0.21 will probably be a file manager-like inter
|
|
707 |
|
708 |
If you wish to affect priorities, it is certainly possible. You can try to argue your case in the forum or you can simply let the money do the talking. By donating as little as a cup of coffee on [ko-fi.com/rosell](https://ko-fi.com/rosell), you can leave a wish. I shall take these wishes into account when prioritizing between new features.
|
709 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
710 |
## Changes in 0.19.0
|
711 |
*(released: 13 Nov 2020)*
|
712 |
* New convertion method: ffmpeg
|
707 |
|
708 |
If you wish to affect priorities, it is certainly possible. You can try to argue your case in the forum or you can simply let the money do the talking. By donating as little as a cup of coffee on [ko-fi.com/rosell](https://ko-fi.com/rosell), you can leave a wish. I shall take these wishes into account when prioritizing between new features.
|
709 |
|
710 |
+
## Changes in 0.20.1
|
711 |
+
*(released: 20 Jun 2021)*
|
712 |
+
* Bugfix: Removed composer.lock. It was locked on PHP 7.2, which caused server error on some sites.
|
713 |
+
|
714 |
+
## Changes in 0.20.0
|
715 |
+
*(released: 17 Jun 2021)*
|
716 |
+
* Added WP CLI support. Add "wp webp-express convert" to crontab for nightly conversions of new images! Thanks to Isuru Sampath Ratnayake from Sri Lanka for initializing this.
|
717 |
+
* Added "sharp-yuv" (not as option, but as always on). Better YUV->RGB color conversion at almost no price. [Read more here](https://www.ctrl.blog/entry/webp-sharp-yuv.html). Supported by cwebp, vips, gmagick, graphicsmagick, imagick and imagemagick
|
718 |
+
* Bumped cwebp binaries to 1.2.0
|
719 |
+
* cwebp now only validates hash of supplied precompiled binaries when necessary. This cuts down conversion time.
|
720 |
+
* Convert on upload now defaults to false, as it may impact upload experience in themes with many formats.
|
721 |
+
* bugfix: Alpha quality was saved incorrectly for PNG. Thanks to Chriss Gibbs from the UK for finding and fixing this.
|
722 |
+
* bugfix: wp-debug log could be flooded with "Undefined index: HTTP_ACCEPT". Thanks to @markusreis for finding and fixing this.
|
723 |
+
|
724 |
## Changes in 0.19.0
|
725 |
*(released: 13 Nov 2020)*
|
726 |
* New convertion method: ffmpeg
|
README.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: rosell.dk
|
|
3 |
Donate link: https://ko-fi.com/rosell
|
4 |
Tags: webp, images, performance
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 5.
|
7 |
Stable tag: 0.20.1
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3
|
@@ -174,9 +174,9 @@ Bread on the table don't come for free, even though this plugin does, and always
|
|
174 |
* Ruben Solvang
|
175 |
|
176 |
**Persons who recently contributed with [ko-fi](https://ko-fi.com/rosell) - Thanks!**
|
177 |
-
*
|
178 |
-
*
|
179 |
-
*
|
180 |
|
181 |
**Persons who contributed with extra generously amounts of coffee / lifetime backing (>30$) - thanks!:**
|
182 |
|
@@ -187,6 +187,7 @@ Bread on the table don't come for free, even though this plugin does, and always
|
|
187 |
* Tammy Lee ($90)
|
188 |
* Steven Sullivan ($51)
|
189 |
* Mathieu Gollain-Dupont ($50)
|
|
|
190 |
|
191 |
== Frequently Asked Questions ==
|
192 |
|
@@ -771,6 +772,10 @@ If you want to make sure that my coffee supplies don't run dry, you can even buy
|
|
771 |
|
772 |
== Changelog ==
|
773 |
|
|
|
|
|
|
|
|
|
774 |
= 0.20.0 =
|
775 |
*(released: 17 Jun 2021)*
|
776 |
* Added WP CLI support. Add "wp webp-express convert" to crontab for nightly conversions of new images! Thanks to Isuru Sampath Ratnayake from Sri Lanka for initializing this.
|
@@ -789,6 +794,9 @@ For older releases, check out changelog.txt
|
|
789 |
|
790 |
== Upgrade Notice ==
|
791 |
|
|
|
|
|
|
|
792 |
= 0.20.0 =
|
793 |
* Added WP CLI support. Add "wp webp-express convert" to crontab for nightly conversions of new images.
|
794 |
|
3 |
Donate link: https://ko-fi.com/rosell
|
4 |
Tags: webp, images, performance
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 5.8
|
7 |
Stable tag: 0.20.1
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3
|
174 |
* Ruben Solvang
|
175 |
|
176 |
**Persons who recently contributed with [ko-fi](https://ko-fi.com/rosell) - Thanks!**
|
177 |
+
* 8 Jul: Raj
|
178 |
+
* 18 Jun: Jerry Simmons
|
179 |
+
* 17 Jun: Erica Dreisbach
|
180 |
|
181 |
**Persons who contributed with extra generously amounts of coffee / lifetime backing (>30$) - thanks!:**
|
182 |
|
187 |
* Tammy Lee ($90)
|
188 |
* Steven Sullivan ($51)
|
189 |
* Mathieu Gollain-Dupont ($50)
|
190 |
+
* Erica Dreisbach ($50)
|
191 |
|
192 |
== Frequently Asked Questions ==
|
193 |
|
772 |
|
773 |
== Changelog ==
|
774 |
|
775 |
+
= 0.20.1 =
|
776 |
+
*(released: 20 Jun 2021)*
|
777 |
+
* Bugfix: Removed composer.lock. It was locked on PHP 7.2, which caused server error on some sites (only some sites with old php were affected). Also deleted the library which required PHP 7.2 (onnov/detect-encoding/). The functionality is not really needed.
|
778 |
+
|
779 |
= 0.20.0 =
|
780 |
*(released: 17 Jun 2021)*
|
781 |
* Added WP CLI support. Add "wp webp-express convert" to crontab for nightly conversions of new images! Thanks to Isuru Sampath Ratnayake from Sri Lanka for initializing this.
|
794 |
|
795 |
== Upgrade Notice ==
|
796 |
|
797 |
+
= 0.20.1 =
|
798 |
+
* Bugfix for PHP 7.1 and below
|
799 |
+
|
800 |
= 0.20.0 =
|
801 |
* Added WP CLI support. Add "wp webp-express convert" to crontab for nightly conversions of new images.
|
802 |
|
changelog.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
= 0.20.0 =
|
2 |
*(released: 17 Jun 2021)*
|
3 |
* Added WP CLI support. Add "wp webp-express convert" to crontab for nightly conversions of new images! Thanks to Isuru Sampath Ratnayake from Sri Lanka for initializing this.
|
1 |
+
= 0.20.1 =
|
2 |
+
*(released: 20 Jun 2021)*
|
3 |
+
* Bugfix: Removed composer.lock. It was locked on PHP 7.2, which caused server error on some sites (only some sites with old php were affected). Also deleted the library which required PHP 7.2 (onnov/detect-encoding/). The functionality is not really needed.
|
4 |
+
|
5 |
= 0.20.0 =
|
6 |
*(released: 17 Jun 2021)*
|
7 |
* Added WP CLI support. Add "wp webp-express convert" to crontab for nightly conversions of new images! Thanks to Isuru Sampath Ratnayake from Sri Lanka for initializing this.
|
composer.json
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
"rosell-dk/webp-convert": "^2.4.0",
|
9 |
"rosell-dk/webp-convert-cloud-service": "^2.0.0",
|
10 |
"rosell-dk/dom-util-for-webp": "^0.4.0",
|
11 |
-
"onnov/detect-encoding": "^1.0.0",
|
12 |
"rosell-dk/htaccess-capability-tester": "^0.9.0"
|
13 |
},
|
14 |
"require-dev": {
|
8 |
"rosell-dk/webp-convert": "^2.4.0",
|
9 |
"rosell-dk/webp-convert-cloud-service": "^2.0.0",
|
10 |
"rosell-dk/dom-util-for-webp": "^0.4.0",
|
|
|
11 |
"rosell-dk/htaccess-capability-tester": "^0.9.0"
|
12 |
},
|
13 |
"require-dev": {
|
composer.lock
DELETED
@@ -1,586 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_readme": [
|
3 |
-
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
-
"This file is @generated automatically"
|
6 |
-
],
|
7 |
-
"content-hash": "8d87b7a5fbf478fb9601a085868d82b5",
|
8 |
-
"packages": [
|
9 |
-
{
|
10 |
-
"name": "composer/installers",
|
11 |
-
"version": "v1.11.0",
|
12 |
-
"source": {
|
13 |
-
"type": "git",
|
14 |
-
"url": "https://github.com/composer/installers.git",
|
15 |
-
"reference": "ae03311f45dfe194412081526be2e003960df74b"
|
16 |
-
},
|
17 |
-
"dist": {
|
18 |
-
"type": "zip",
|
19 |
-
"url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b",
|
20 |
-
"reference": "ae03311f45dfe194412081526be2e003960df74b",
|
21 |
-
"shasum": ""
|
22 |
-
},
|
23 |
-
"require": {
|
24 |
-
"composer-plugin-api": "^1.0 || ^2.0"
|
25 |
-
},
|
26 |
-
"replace": {
|
27 |
-
"roundcube/plugin-installer": "*",
|
28 |
-
"shama/baton": "*"
|
29 |
-
},
|
30 |
-
"require-dev": {
|
31 |
-
"composer/composer": "1.6.* || ^2.0",
|
32 |
-
"composer/semver": "^1 || ^3",
|
33 |
-
"phpstan/phpstan": "^0.12.55",
|
34 |
-
"phpstan/phpstan-phpunit": "^0.12.16",
|
35 |
-
"symfony/phpunit-bridge": "^4.2 || ^5",
|
36 |
-
"symfony/process": "^2.3"
|
37 |
-
},
|
38 |
-
"type": "composer-plugin",
|
39 |
-
"extra": {
|
40 |
-
"class": "Composer\\Installers\\Plugin",
|
41 |
-
"branch-alias": {
|
42 |
-
"dev-main": "1.x-dev"
|
43 |
-
}
|
44 |
-
},
|
45 |
-
"autoload": {
|
46 |
-
"psr-4": {
|
47 |
-
"Composer\\Installers\\": "src/Composer/Installers"
|
48 |
-
}
|
49 |
-
},
|
50 |
-
"notification-url": "https://packagist.org/downloads/",
|
51 |
-
"license": [
|
52 |
-
"MIT"
|
53 |
-
],
|
54 |
-
"authors": [
|
55 |
-
{
|
56 |
-
"name": "Kyle Robinson Young",
|
57 |
-
"email": "kyle@dontkry.com",
|
58 |
-
"homepage": "https://github.com/shama"
|
59 |
-
}
|
60 |
-
],
|
61 |
-
"description": "A multi-framework Composer library installer",
|
62 |
-
"homepage": "https://composer.github.io/installers/",
|
63 |
-
"keywords": [
|
64 |
-
"Craft",
|
65 |
-
"Dolibarr",
|
66 |
-
"Eliasis",
|
67 |
-
"Hurad",
|
68 |
-
"ImageCMS",
|
69 |
-
"Kanboard",
|
70 |
-
"Lan Management System",
|
71 |
-
"MODX Evo",
|
72 |
-
"MantisBT",
|
73 |
-
"Mautic",
|
74 |
-
"Maya",
|
75 |
-
"OXID",
|
76 |
-
"Plentymarkets",
|
77 |
-
"Porto",
|
78 |
-
"RadPHP",
|
79 |
-
"SMF",
|
80 |
-
"Starbug",
|
81 |
-
"Thelia",
|
82 |
-
"Whmcs",
|
83 |
-
"WolfCMS",
|
84 |
-
"agl",
|
85 |
-
"aimeos",
|
86 |
-
"annotatecms",
|
87 |
-
"attogram",
|
88 |
-
"bitrix",
|
89 |
-
"cakephp",
|
90 |
-
"chef",
|
91 |
-
"cockpit",
|
92 |
-
"codeigniter",
|
93 |
-
"concrete5",
|
94 |
-
"croogo",
|
95 |
-
"dokuwiki",
|
96 |
-
"drupal",
|
97 |
-
"eZ Platform",
|
98 |
-
"elgg",
|
99 |
-
"expressionengine",
|
100 |
-
"fuelphp",
|
101 |
-
"grav",
|
102 |
-
"installer",
|
103 |
-
"itop",
|
104 |
-
"joomla",
|
105 |
-
"known",
|
106 |
-
"kohana",
|
107 |
-
"laravel",
|
108 |
-
"lavalite",
|
109 |
-
"lithium",
|
110 |
-
"magento",
|
111 |
-
"majima",
|
112 |
-
"mako",
|
113 |
-
"mediawiki",
|
114 |
-
"miaoxing",
|
115 |
-
"modulework",
|
116 |
-
"modx",
|
117 |
-
"moodle",
|
118 |
-
"osclass",
|
119 |
-
"phpbb",
|
120 |
-
"piwik",
|
121 |
-
"ppi",
|
122 |
-
"processwire",
|
123 |
-
"puppet",
|
124 |
-
"pxcms",
|
125 |
-
"reindex",
|
126 |
-
"roundcube",
|
127 |
-
"shopware",
|
128 |
-
"silverstripe",
|
129 |
-
"sydes",
|
130 |
-
"sylius",
|
131 |
-
"symfony",
|
132 |
-
"tastyigniter",
|
133 |
-
"typo3",
|
134 |
-
"wordpress",
|
135 |
-
"yawik",
|
136 |
-
"zend",
|
137 |
-
"zikula"
|
138 |
-
],
|
139 |
-
"support": {
|
140 |
-
"issues": "https://github.com/composer/installers/issues",
|
141 |
-
"source": "https://github.com/composer/installers/tree/v1.11.0"
|
142 |
-
},
|
143 |
-
"funding": [
|
144 |
-
{
|
145 |
-
"url": "https://packagist.com",
|
146 |
-
"type": "custom"
|
147 |
-
},
|
148 |
-
{
|
149 |
-
"url": "https://github.com/composer",
|
150 |
-
"type": "github"
|
151 |
-
},
|
152 |
-
{
|
153 |
-
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
154 |
-
"type": "tidelift"
|
155 |
-
}
|
156 |
-
],
|
157 |
-
"time": "2021-04-28T06:42:17+00:00"
|
158 |
-
},
|
159 |
-
{
|
160 |
-
"name": "onnov/detect-encoding",
|
161 |
-
"version": "v1.2.0",
|
162 |
-
"source": {
|
163 |
-
"type": "git",
|
164 |
-
"url": "https://github.com/onnov/detect-encoding.git",
|
165 |
-
"reference": "c88cea4f0c83d7f7e0675f2801e0995f328de1ce"
|
166 |
-
},
|
167 |
-
"dist": {
|
168 |
-
"type": "zip",
|
169 |
-
"url": "https://api.github.com/repos/onnov/detect-encoding/zipball/c88cea4f0c83d7f7e0675f2801e0995f328de1ce",
|
170 |
-
"reference": "c88cea4f0c83d7f7e0675f2801e0995f328de1ce",
|
171 |
-
"shasum": ""
|
172 |
-
},
|
173 |
-
"require": {
|
174 |
-
"ext-iconv": "*",
|
175 |
-
"php": ">=7.2"
|
176 |
-
},
|
177 |
-
"require-dev": {
|
178 |
-
"infection/infection": "*",
|
179 |
-
"phpbench/phpbench": "*",
|
180 |
-
"phpcompatibility/php-compatibility": "*",
|
181 |
-
"phpmd/phpmd": "*",
|
182 |
-
"phpstan/phpstan": "*",
|
183 |
-
"phpstan/phpstan-strict-rules": "*",
|
184 |
-
"phpunit/phpunit": "*",
|
185 |
-
"roave/backward-compatibility-check": "*",
|
186 |
-
"squizlabs/php_codesniffer": "*"
|
187 |
-
},
|
188 |
-
"type": "library",
|
189 |
-
"autoload": {
|
190 |
-
"psr-4": {
|
191 |
-
"Onnov\\DetectEncoding\\": "src/"
|
192 |
-
}
|
193 |
-
},
|
194 |
-
"notification-url": "https://packagist.org/downloads/",
|
195 |
-
"license": [
|
196 |
-
"MIT"
|
197 |
-
],
|
198 |
-
"authors": [
|
199 |
-
{
|
200 |
-
"name": "onnov",
|
201 |
-
"email": "oblnn@yandex.ru"
|
202 |
-
}
|
203 |
-
],
|
204 |
-
"description": "Text encoding definition class instead of mb_detect_encoding. Defines: utf-8, windows-1251, koi8-r, iso-8859-5, ibm866, .....",
|
205 |
-
"homepage": "https://github.com/onnov/detect-encoding",
|
206 |
-
"keywords": [
|
207 |
-
"cyrillic",
|
208 |
-
"encoding",
|
209 |
-
"ibm866",
|
210 |
-
"iconv",
|
211 |
-
"iso-8859-5",
|
212 |
-
"koi8-r",
|
213 |
-
"mb_detect_encoding",
|
214 |
-
"utf-8",
|
215 |
-
"windows-1251"
|
216 |
-
],
|
217 |
-
"support": {
|
218 |
-
"issues": "https://github.com/onnov/detect-encoding/issues",
|
219 |
-
"source": "https://github.com/onnov/detect-encoding/tree/master"
|
220 |
-
},
|
221 |
-
"time": "2019-09-20T16:11:46+00:00"
|
222 |
-
},
|
223 |
-
{
|
224 |
-
"name": "rosell-dk/dom-util-for-webp",
|
225 |
-
"version": "0.4.0",
|
226 |
-
"source": {
|
227 |
-
"type": "git",
|
228 |
-
"url": "https://github.com/rosell-dk/dom-util-for-webp.git",
|
229 |
-
"reference": "5928aecf64d59124b341dce23ce8ecf48a6eded6"
|
230 |
-
},
|
231 |
-
"dist": {
|
232 |
-
"type": "zip",
|
233 |
-
"url": "https://api.github.com/repos/rosell-dk/dom-util-for-webp/zipball/5928aecf64d59124b341dce23ce8ecf48a6eded6",
|
234 |
-
"reference": "5928aecf64d59124b341dce23ce8ecf48a6eded6",
|
235 |
-
"shasum": ""
|
236 |
-
},
|
237 |
-
"require-dev": {
|
238 |
-
"friendsofphp/php-cs-fixer": "^2.11",
|
239 |
-
"phpunit/phpunit": "5.7.27",
|
240 |
-
"squizlabs/php_codesniffer": "3.*"
|
241 |
-
},
|
242 |
-
"suggest": {
|
243 |
-
"phpstan/phpstan": "Suggested for dev, in order to analyse code before committing"
|
244 |
-
},
|
245 |
-
"type": "library",
|
246 |
-
"extra": {
|
247 |
-
"scripts-descriptions": {
|
248 |
-
"ci": "Run tests before CI",
|
249 |
-
"phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'",
|
250 |
-
"phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'",
|
251 |
-
"cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard",
|
252 |
-
"cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.",
|
253 |
-
"test": "Launches the preconfigured PHPUnit"
|
254 |
-
}
|
255 |
-
},
|
256 |
-
"autoload": {
|
257 |
-
"psr-4": {
|
258 |
-
"DOMUtilForWebP\\": "src/"
|
259 |
-
}
|
260 |
-
},
|
261 |
-
"notification-url": "https://packagist.org/downloads/",
|
262 |
-
"license": [
|
263 |
-
"MIT"
|
264 |
-
],
|
265 |
-
"authors": [
|
266 |
-
{
|
267 |
-
"name": "Bjørn Rosell",
|
268 |
-
"homepage": "https://www.bitwise-it.dk/contact",
|
269 |
-
"role": "Project Author"
|
270 |
-
}
|
271 |
-
],
|
272 |
-
"description": "Replace image URLs found in HTML",
|
273 |
-
"keywords": [
|
274 |
-
"Webp",
|
275 |
-
"html",
|
276 |
-
"images",
|
277 |
-
"replace"
|
278 |
-
],
|
279 |
-
"support": {
|
280 |
-
"issues": "https://github.com/rosell-dk/dom-util-for-webp/issues",
|
281 |
-
"source": "https://github.com/rosell-dk/dom-util-for-webp/tree/0.4.0"
|
282 |
-
},
|
283 |
-
"time": "2020-02-02T11:16:27+00:00"
|
284 |
-
},
|
285 |
-
{
|
286 |
-
"name": "rosell-dk/htaccess-capability-tester",
|
287 |
-
"version": "0.9",
|
288 |
-
"source": {
|
289 |
-
"type": "git",
|
290 |
-
"url": "https://github.com/rosell-dk/htaccess-capability-tester.git",
|
291 |
-
"reference": "2eb2cf38a9f42fc3aa647d6e9c896e124bfebf4c"
|
292 |
-
},
|
293 |
-
"dist": {
|
294 |
-
"type": "zip",
|
295 |
-
"url": "https://api.github.com/repos/rosell-dk/htaccess-capability-tester/zipball/2eb2cf38a9f42fc3aa647d6e9c896e124bfebf4c",
|
296 |
-
"reference": "2eb2cf38a9f42fc3aa647d6e9c896e124bfebf4c",
|
297 |
-
"shasum": ""
|
298 |
-
},
|
299 |
-
"require": {
|
300 |
-
"php": "^5.6 | ^7.0"
|
301 |
-
},
|
302 |
-
"require-dev": {
|
303 |
-
"phpunit/php-code-coverage": "dev-4.0-dev as 4.0.4",
|
304 |
-
"phpunit/phpunit": "^5.7",
|
305 |
-
"squizlabs/php_codesniffer": "3.*"
|
306 |
-
},
|
307 |
-
"suggest": {
|
308 |
-
"php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
|
309 |
-
},
|
310 |
-
"type": "library",
|
311 |
-
"extra": {
|
312 |
-
"scripts-descriptions": {
|
313 |
-
"ci": "Run tests before CI",
|
314 |
-
"phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'",
|
315 |
-
"phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'",
|
316 |
-
"cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard",
|
317 |
-
"cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.",
|
318 |
-
"test": "Launches the preconfigured PHPUnit"
|
319 |
-
}
|
320 |
-
},
|
321 |
-
"autoload": {
|
322 |
-
"psr-4": {
|
323 |
-
"HtaccessCapabilityTester\\": "src/"
|
324 |
-
}
|
325 |
-
},
|
326 |
-
"notification-url": "https://packagist.org/downloads/",
|
327 |
-
"license": [
|
328 |
-
"MIT"
|
329 |
-
],
|
330 |
-
"authors": [
|
331 |
-
{
|
332 |
-
"name": "Bjørn Rosell",
|
333 |
-
"homepage": "https://www.bitwise-it.dk/contact",
|
334 |
-
"role": "Project Author"
|
335 |
-
}
|
336 |
-
],
|
337 |
-
"description": "Test the capabilities of .htaccess files on the server using live tests",
|
338 |
-
"keywords": [
|
339 |
-
".htaccess",
|
340 |
-
"apache",
|
341 |
-
"litespeed"
|
342 |
-
],
|
343 |
-
"support": {
|
344 |
-
"issues": "https://github.com/rosell-dk/htaccess-capability-tester/issues",
|
345 |
-
"source": "https://github.com/rosell-dk/htaccess-capability-tester/tree/0.9"
|
346 |
-
},
|
347 |
-
"funding": [
|
348 |
-
{
|
349 |
-
"url": "https://github.com/rosell-dk",
|
350 |
-
"type": "github"
|
351 |
-
},
|
352 |
-
{
|
353 |
-
"url": "https://ko-fi.com/rosell",
|
354 |
-
"type": "ko_fi"
|
355 |
-
}
|
356 |
-
],
|
357 |
-
"time": "2020-11-04T10:29:38+00:00"
|
358 |
-
},
|
359 |
-
{
|
360 |
-
"name": "rosell-dk/image-mime-type-guesser",
|
361 |
-
"version": "0.3",
|
362 |
-
"source": {
|
363 |
-
"type": "git",
|
364 |
-
"url": "https://github.com/rosell-dk/image-mime-type-guesser.git",
|
365 |
-
"reference": "204fd61ca81e3b0ba46c6165dab8f74816b1fe99"
|
366 |
-
},
|
367 |
-
"dist": {
|
368 |
-
"type": "zip",
|
369 |
-
"url": "https://api.github.com/repos/rosell-dk/image-mime-type-guesser/zipball/204fd61ca81e3b0ba46c6165dab8f74816b1fe99",
|
370 |
-
"reference": "204fd61ca81e3b0ba46c6165dab8f74816b1fe99",
|
371 |
-
"shasum": ""
|
372 |
-
},
|
373 |
-
"require-dev": {
|
374 |
-
"friendsofphp/php-cs-fixer": "^2.11",
|
375 |
-
"phpunit/phpunit": "^5.7.27",
|
376 |
-
"squizlabs/php_codesniffer": "3.*"
|
377 |
-
},
|
378 |
-
"type": "library",
|
379 |
-
"extra": {
|
380 |
-
"scripts-descriptions": {
|
381 |
-
"ci": "Run tests before CI",
|
382 |
-
"phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'",
|
383 |
-
"phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'",
|
384 |
-
"cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard",
|
385 |
-
"cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.",
|
386 |
-
"test": "Launches the preconfigured PHPUnit"
|
387 |
-
}
|
388 |
-
},
|
389 |
-
"autoload": {
|
390 |
-
"psr-4": {
|
391 |
-
"ImageMimeTypeGuesser\\": "src/"
|
392 |
-
}
|
393 |
-
},
|
394 |
-
"notification-url": "https://packagist.org/downloads/",
|
395 |
-
"license": [
|
396 |
-
"MIT"
|
397 |
-
],
|
398 |
-
"authors": [
|
399 |
-
{
|
400 |
-
"name": "Bjørn Rosell",
|
401 |
-
"homepage": "https://www.bitwise-it.dk/contact",
|
402 |
-
"role": "Project Author"
|
403 |
-
}
|
404 |
-
],
|
405 |
-
"description": "Guess mime type of images",
|
406 |
-
"keywords": [
|
407 |
-
"image",
|
408 |
-
"images",
|
409 |
-
"mime",
|
410 |
-
"mime type"
|
411 |
-
],
|
412 |
-
"support": {
|
413 |
-
"issues": "https://github.com/rosell-dk/image-mime-type-guesser/issues",
|
414 |
-
"source": "https://github.com/rosell-dk/image-mime-type-guesser/tree/0.3"
|
415 |
-
},
|
416 |
-
"time": "2019-03-29T09:33:28+00:00"
|
417 |
-
},
|
418 |
-
{
|
419 |
-
"name": "rosell-dk/webp-convert",
|
420 |
-
"version": "2.6.0",
|
421 |
-
"source": {
|
422 |
-
"type": "git",
|
423 |
-
"url": "https://github.com/rosell-dk/webp-convert.git",
|
424 |
-
"reference": "ed230afe56d3157dc402c33585e3ab7f15c7ac80"
|
425 |
-
},
|
426 |
-
"dist": {
|
427 |
-
"type": "zip",
|
428 |
-
"url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/ed230afe56d3157dc402c33585e3ab7f15c7ac80",
|
429 |
-
"reference": "ed230afe56d3157dc402c33585e3ab7f15c7ac80",
|
430 |
-
"shasum": ""
|
431 |
-
},
|
432 |
-
"require": {
|
433 |
-
"php": "^5.6 | ^7.0 | ^8.0",
|
434 |
-
"rosell-dk/image-mime-type-guesser": "^0.3"
|
435 |
-
},
|
436 |
-
"require-dev": {
|
437 |
-
"friendsofphp/php-cs-fixer": "^2.11",
|
438 |
-
"phpunit/phpunit": "^9.3",
|
439 |
-
"squizlabs/php_codesniffer": "3.*"
|
440 |
-
},
|
441 |
-
"suggest": {
|
442 |
-
"ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support",
|
443 |
-
"ext-imagick": "to use Imagick extension for converting. Note: Gd must be compiled with webp support",
|
444 |
-
"ext-vips": "to use Vips extension for converting.",
|
445 |
-
"php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
|
446 |
-
},
|
447 |
-
"type": "library",
|
448 |
-
"extra": {
|
449 |
-
"scripts-descriptions": {
|
450 |
-
"ci": "Run tests before CI",
|
451 |
-
"phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'",
|
452 |
-
"phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'",
|
453 |
-
"cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard",
|
454 |
-
"cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.",
|
455 |
-
"test": "Launches the preconfigured PHPUnit"
|
456 |
-
}
|
457 |
-
},
|
458 |
-
"autoload": {
|
459 |
-
"psr-4": {
|
460 |
-
"WebPConvert\\": "src/"
|
461 |
-
}
|
462 |
-
},
|
463 |
-
"notification-url": "https://packagist.org/downloads/",
|
464 |
-
"license": [
|
465 |
-
"MIT"
|
466 |
-
],
|
467 |
-
"authors": [
|
468 |
-
{
|
469 |
-
"name": "Bjørn Rosell",
|
470 |
-
"homepage": "https://www.bitwise-it.dk/contact",
|
471 |
-
"role": "Project Author"
|
472 |
-
},
|
473 |
-
{
|
474 |
-
"name": "Martin Folkers",
|
475 |
-
"homepage": "https://twobrain.io",
|
476 |
-
"role": "Collaborator"
|
477 |
-
}
|
478 |
-
],
|
479 |
-
"description": "Convert JPEG & PNG to WebP with PHP",
|
480 |
-
"keywords": [
|
481 |
-
"Webp",
|
482 |
-
"cwebp",
|
483 |
-
"gd",
|
484 |
-
"image conversion",
|
485 |
-
"images",
|
486 |
-
"imagick",
|
487 |
-
"jpg",
|
488 |
-
"jpg2webp",
|
489 |
-
"png",
|
490 |
-
"png2webp"
|
491 |
-
],
|
492 |
-
"support": {
|
493 |
-
"issues": "https://github.com/rosell-dk/webp-convert/issues",
|
494 |
-
"source": "https://github.com/rosell-dk/webp-convert/tree/2.6.0"
|
495 |
-
},
|
496 |
-
"funding": [
|
497 |
-
{
|
498 |
-
"url": "https://github.com/rosell-dk",
|
499 |
-
"type": "github"
|
500 |
-
},
|
501 |
-
{
|
502 |
-
"url": "https://ko-fi.com/rosell",
|
503 |
-
"type": "ko_fi"
|
504 |
-
}
|
505 |
-
],
|
506 |
-
"time": "2021-05-20T10:56:47+00:00"
|
507 |
-
},
|
508 |
-
{
|
509 |
-
"name": "rosell-dk/webp-convert-cloud-service",
|
510 |
-
"version": "2.0.1",
|
511 |
-
"source": {
|
512 |
-
"type": "git",
|
513 |
-
"url": "https://github.com/rosell-dk/webp-convert-cloud-service.git",
|
514 |
-
"reference": "703c2f1c76d30468ee3977170bfa3da138d8c4ad"
|
515 |
-
},
|
516 |
-
"dist": {
|
517 |
-
"type": "zip",
|
518 |
-
"url": "https://api.github.com/repos/rosell-dk/webp-convert-cloud-service/zipball/703c2f1c76d30468ee3977170bfa3da138d8c4ad",
|
519 |
-
"reference": "703c2f1c76d30468ee3977170bfa3da138d8c4ad",
|
520 |
-
"shasum": ""
|
521 |
-
},
|
522 |
-
"require": {
|
523 |
-
"rosell-dk/webp-convert": "^2.0.0"
|
524 |
-
},
|
525 |
-
"require-dev": {
|
526 |
-
"friendsofphp/php-cs-fixer": "^2.11",
|
527 |
-
"phpunit/phpunit": "5.7.27",
|
528 |
-
"squizlabs/php_codesniffer": "3.*"
|
529 |
-
},
|
530 |
-
"type": "library",
|
531 |
-
"extra": {
|
532 |
-
"scripts-descriptions": {
|
533 |
-
"ci": "Run tests before CI",
|
534 |
-
"phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'",
|
535 |
-
"phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'",
|
536 |
-
"cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard",
|
537 |
-
"cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.",
|
538 |
-
"test": "Launches the preconfigured PHPUnit"
|
539 |
-
}
|
540 |
-
},
|
541 |
-
"autoload": {
|
542 |
-
"psr-4": {
|
543 |
-
"WebPConvertCloudService\\": "src/"
|
544 |
-
}
|
545 |
-
},
|
546 |
-
"notification-url": "https://packagist.org/downloads/",
|
547 |
-
"license": [
|
548 |
-
"MIT"
|
549 |
-
],
|
550 |
-
"authors": [
|
551 |
-
{
|
552 |
-
"name": "Bjørn Rosell",
|
553 |
-
"homepage": "https://www.bitwise-it.dk/contact",
|
554 |
-
"role": "Project Author"
|
555 |
-
}
|
556 |
-
],
|
557 |
-
"description": "Cloud service for converting JPEG & PNG to WebP",
|
558 |
-
"keywords": [
|
559 |
-
"Webp",
|
560 |
-
"cwebp",
|
561 |
-
"gd",
|
562 |
-
"image conversion",
|
563 |
-
"images",
|
564 |
-
"imagick",
|
565 |
-
"jpg",
|
566 |
-
"jpg2webp",
|
567 |
-
"png",
|
568 |
-
"png2webp"
|
569 |
-
],
|
570 |
-
"support": {
|
571 |
-
"issues": "https://github.com/rosell-dk/webp-convert-cloud-service/issues",
|
572 |
-
"source": "https://github.com/rosell-dk/webp-convert-cloud-service/tree/master"
|
573 |
-
},
|
574 |
-
"time": "2019-06-30T08:28:35+00:00"
|
575 |
-
}
|
576 |
-
],
|
577 |
-
"packages-dev": [],
|
578 |
-
"aliases": [],
|
579 |
-
"minimum-stability": "stable",
|
580 |
-
"stability-flags": [],
|
581 |
-
"prefer-stable": false,
|
582 |
-
"prefer-lowest": false,
|
583 |
-
"platform": [],
|
584 |
-
"platform-dev": [],
|
585 |
-
"plugin-api-version": "2.1.0"
|
586 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/development.md
CHANGED
@@ -14,6 +14,7 @@ It actually seems that the mappings are not needed. It seems to work fine when I
|
|
14 |
rm -r vendor/rosell-dk/webp-convert/docs
|
15 |
rm -r vendor/rosell-dk/webp-convert/src/Helpers/*.txt
|
16 |
rm vendor/rosell-dk/dom-util-for-webp/phpstan.neon
|
|
|
17 |
rmdir vendor/bin
|
18 |
```
|
19 |
|
14 |
rm -r vendor/rosell-dk/webp-convert/docs
|
15 |
rm -r vendor/rosell-dk/webp-convert/src/Helpers/*.txt
|
16 |
rm vendor/rosell-dk/dom-util-for-webp/phpstan.neon
|
17 |
+
rm composer.lock
|
18 |
rmdir vendor/bin
|
19 |
```
|
20 |
|
lib/classes/BulkConvert.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
namespace WebPExpress;
|
4 |
|
5 |
-
use \Onnov\DetectEncoding\EncodingDetector;
|
6 |
|
7 |
class BulkConvert
|
8 |
{
|
@@ -172,6 +172,10 @@ class BulkConvert
|
|
172 |
$encodedToUTF8 = false;
|
173 |
|
174 |
// First try library that claims to do better than mb_detect_encoding
|
|
|
|
|
|
|
|
|
175 |
if (!$encodedToUTF8) {
|
176 |
$detector = new EncodingDetector();
|
177 |
|
@@ -187,15 +191,15 @@ class BulkConvert
|
|
187 |
}
|
188 |
}
|
189 |
|
190 |
-
|
191 |
try {
|
192 |
-
//
|
193 |
-
|
194 |
$encodedToUTF8 = true;
|
195 |
} catch (\Exception $e) {
|
196 |
|
197 |
-
}
|
198 |
-
}
|
199 |
|
200 |
// Try mb_detect_encoding
|
201 |
if (!$encodedToUTF8) {
|
2 |
|
3 |
namespace WebPExpress;
|
4 |
|
5 |
+
//use \Onnov\DetectEncoding\EncodingDetector;
|
6 |
|
7 |
class BulkConvert
|
8 |
{
|
172 |
$encodedToUTF8 = false;
|
173 |
|
174 |
// First try library that claims to do better than mb_detect_encoding
|
175 |
+
/*
|
176 |
+
DISABLED, because Onnov EncodingDetector requires PHP 7.2
|
177 |
+
https://wordpress.org/support/topic/get-http-error-500-after-new-update-2/
|
178 |
+
|
179 |
if (!$encodedToUTF8) {
|
180 |
$detector = new EncodingDetector();
|
181 |
|
191 |
}
|
192 |
}
|
193 |
|
194 |
+
|
195 |
try {
|
196 |
+
// iconvXtoEncoding should work now hm, issue #5 has been fixed
|
197 |
+
$path = $detector->iconvXtoEncoding($path);
|
198 |
$encodedToUTF8 = true;
|
199 |
} catch (\Exception $e) {
|
200 |
|
201 |
+
}
|
202 |
+
}*/
|
203 |
|
204 |
// Try mb_detect_encoding
|
205 |
if (!$encodedToUTF8) {
|
lib/classes/ConvertHelperIndependent.php
CHANGED
@@ -571,7 +571,7 @@ APACHE
|
|
571 |
$text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
|
572 |
|
573 |
// TODO: Put version number somewhere else. Ie \WebPExpress\VersionNumber::version
|
574 |
-
$text = 'WebP Express 0.20.
|
575 |
|
576 |
$logFile = self::getLogFilename($source, $logDir);
|
577 |
|
571 |
$text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
|
572 |
|
573 |
// TODO: Put version number somewhere else. Ie \WebPExpress\VersionNumber::version
|
574 |
+
$text = 'WebP Express 0.20.1. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
|
575 |
|
576 |
$logFile = self::getLogFilename($source, $logDir);
|
577 |
|
vendor/composer/InstalledVersions.php
CHANGED
@@ -32,7 +32,7 @@ private static $installed = array (
|
|
32 |
'aliases' =>
|
33 |
array (
|
34 |
),
|
35 |
-
'reference' => '
|
36 |
'name' => 'rosell-dk/webp-express',
|
37 |
'dev' => true,
|
38 |
),
|
@@ -48,16 +48,6 @@ private static $installed = array (
|
|
48 |
'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
|
49 |
'dev-requirement' => false,
|
50 |
),
|
51 |
-
'onnov/detect-encoding' =>
|
52 |
-
array (
|
53 |
-
'pretty_version' => 'v1.2.0',
|
54 |
-
'version' => '1.2.0.0',
|
55 |
-
'aliases' =>
|
56 |
-
array (
|
57 |
-
),
|
58 |
-
'reference' => 'c88cea4f0c83d7f7e0675f2801e0995f328de1ce',
|
59 |
-
'dev-requirement' => false,
|
60 |
-
),
|
61 |
'rosell-dk/dom-util-for-webp' =>
|
62 |
array (
|
63 |
'pretty_version' => '0.4.0',
|
@@ -115,7 +105,7 @@ private static $installed = array (
|
|
115 |
'aliases' =>
|
116 |
array (
|
117 |
),
|
118 |
-
'reference' => '
|
119 |
'dev-requirement' => false,
|
120 |
),
|
121 |
'roundcube/plugin-installer' =>
|
32 |
'aliases' =>
|
33 |
array (
|
34 |
),
|
35 |
+
'reference' => '936c03c18aaf2ecd964705afb55866b9803bc713',
|
36 |
'name' => 'rosell-dk/webp-express',
|
37 |
'dev' => true,
|
38 |
),
|
48 |
'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
|
49 |
'dev-requirement' => false,
|
50 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
'rosell-dk/dom-util-for-webp' =>
|
52 |
array (
|
53 |
'pretty_version' => '0.4.0',
|
105 |
'aliases' =>
|
106 |
array (
|
107 |
),
|
108 |
+
'reference' => '936c03c18aaf2ecd964705afb55866b9803bc713',
|
109 |
'dev-requirement' => false,
|
110 |
),
|
111 |
'roundcube/plugin-installer' =>
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -143,8 +143,6 @@ return array(
|
|
143 |
'ImageMimeTypeGuesser\\Detectors\\Stack' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php',
|
144 |
'ImageMimeTypeGuesser\\GuessFromExtension' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php',
|
145 |
'ImageMimeTypeGuesser\\ImageMimeTypeGuesser' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/ImageMimeTypeGuesser.php',
|
146 |
-
'Onnov\\DetectEncoding\\CodePage' => $vendorDir . '/onnov/detect-encoding/src/CodePage.php',
|
147 |
-
'Onnov\\DetectEncoding\\EncodingDetector' => $vendorDir . '/onnov/detect-encoding/src/EncodingDetector.php',
|
148 |
'WebPConvertCloudService\\AccessCheck' => $vendorDir . '/rosell-dk/webp-convert-cloud-service/src/AccessCheck.php',
|
149 |
'WebPConvertCloudService\\Serve' => $vendorDir . '/rosell-dk/webp-convert-cloud-service/src/Serve.php',
|
150 |
'WebPConvertCloudService\\WebPConvertCloudService' => $vendorDir . '/rosell-dk/webp-convert-cloud-service/src/WebPConvertCloudService.php',
|
143 |
'ImageMimeTypeGuesser\\Detectors\\Stack' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php',
|
144 |
'ImageMimeTypeGuesser\\GuessFromExtension' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php',
|
145 |
'ImageMimeTypeGuesser\\ImageMimeTypeGuesser' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/ImageMimeTypeGuesser.php',
|
|
|
|
|
146 |
'WebPConvertCloudService\\AccessCheck' => $vendorDir . '/rosell-dk/webp-convert-cloud-service/src/AccessCheck.php',
|
147 |
'WebPConvertCloudService\\Serve' => $vendorDir . '/rosell-dk/webp-convert-cloud-service/src/Serve.php',
|
148 |
'WebPConvertCloudService\\WebPConvertCloudService' => $vendorDir . '/rosell-dk/webp-convert-cloud-service/src/WebPConvertCloudService.php',
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -8,7 +8,6 @@ $baseDir = dirname($vendorDir);
|
|
8 |
return array(
|
9 |
'WebPConvert\\' => array($vendorDir . '/rosell-dk/webp-convert/src'),
|
10 |
'WebPConvertCloudService\\' => array($vendorDir . '/rosell-dk/webp-convert-cloud-service/src'),
|
11 |
-
'Onnov\\DetectEncoding\\' => array($vendorDir . '/onnov/detect-encoding/src'),
|
12 |
'ImageMimeTypeGuesser\\' => array($vendorDir . '/rosell-dk/image-mime-type-guesser/src'),
|
13 |
'HtaccessCapabilityTester\\' => array($vendorDir . '/rosell-dk/htaccess-capability-tester/src'),
|
14 |
'DOMUtilForWebP\\' => array($vendorDir . '/rosell-dk/dom-util-for-webp/src'),
|
8 |
return array(
|
9 |
'WebPConvert\\' => array($vendorDir . '/rosell-dk/webp-convert/src'),
|
10 |
'WebPConvertCloudService\\' => array($vendorDir . '/rosell-dk/webp-convert-cloud-service/src'),
|
|
|
11 |
'ImageMimeTypeGuesser\\' => array($vendorDir . '/rosell-dk/image-mime-type-guesser/src'),
|
12 |
'HtaccessCapabilityTester\\' => array($vendorDir . '/rosell-dk/htaccess-capability-tester/src'),
|
13 |
'DOMUtilForWebP\\' => array($vendorDir . '/rosell-dk/dom-util-for-webp/src'),
|
vendor/composer/autoload_static.php
CHANGED
@@ -12,10 +12,6 @@ class ComposerStaticInit16597e36dd1bfcd787ed5a8e6d908243
|
|
12 |
'WebPConvert\\' => 12,
|
13 |
'WebPConvertCloudService\\' => 24,
|
14 |
),
|
15 |
-
'O' =>
|
16 |
-
array (
|
17 |
-
'Onnov\\DetectEncoding\\' => 21,
|
18 |
-
),
|
19 |
'I' =>
|
20 |
array (
|
21 |
'ImageMimeTypeGuesser\\' => 21,
|
@@ -43,10 +39,6 @@ class ComposerStaticInit16597e36dd1bfcd787ed5a8e6d908243
|
|
43 |
array (
|
44 |
0 => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src',
|
45 |
),
|
46 |
-
'Onnov\\DetectEncoding\\' =>
|
47 |
-
array (
|
48 |
-
0 => __DIR__ . '/..' . '/onnov/detect-encoding/src',
|
49 |
-
),
|
50 |
'ImageMimeTypeGuesser\\' =>
|
51 |
array (
|
52 |
0 => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src',
|
@@ -203,8 +195,6 @@ class ComposerStaticInit16597e36dd1bfcd787ed5a8e6d908243
|
|
203 |
'ImageMimeTypeGuesser\\Detectors\\Stack' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php',
|
204 |
'ImageMimeTypeGuesser\\GuessFromExtension' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php',
|
205 |
'ImageMimeTypeGuesser\\ImageMimeTypeGuesser' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/ImageMimeTypeGuesser.php',
|
206 |
-
'Onnov\\DetectEncoding\\CodePage' => __DIR__ . '/..' . '/onnov/detect-encoding/src/CodePage.php',
|
207 |
-
'Onnov\\DetectEncoding\\EncodingDetector' => __DIR__ . '/..' . '/onnov/detect-encoding/src/EncodingDetector.php',
|
208 |
'WebPConvertCloudService\\AccessCheck' => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src/AccessCheck.php',
|
209 |
'WebPConvertCloudService\\Serve' => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src/Serve.php',
|
210 |
'WebPConvertCloudService\\WebPConvertCloudService' => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src/WebPConvertCloudService.php',
|
12 |
'WebPConvert\\' => 12,
|
13 |
'WebPConvertCloudService\\' => 24,
|
14 |
),
|
|
|
|
|
|
|
|
|
15 |
'I' =>
|
16 |
array (
|
17 |
'ImageMimeTypeGuesser\\' => 21,
|
39 |
array (
|
40 |
0 => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src',
|
41 |
),
|
|
|
|
|
|
|
|
|
42 |
'ImageMimeTypeGuesser\\' =>
|
43 |
array (
|
44 |
0 => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src',
|
195 |
'ImageMimeTypeGuesser\\Detectors\\Stack' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php',
|
196 |
'ImageMimeTypeGuesser\\GuessFromExtension' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php',
|
197 |
'ImageMimeTypeGuesser\\ImageMimeTypeGuesser' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/ImageMimeTypeGuesser.php',
|
|
|
|
|
198 |
'WebPConvertCloudService\\AccessCheck' => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src/AccessCheck.php',
|
199 |
'WebPConvertCloudService\\Serve' => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src/Serve.php',
|
200 |
'WebPConvertCloudService\\WebPConvertCloudService' => __DIR__ . '/..' . '/rosell-dk/webp-convert-cloud-service/src/WebPConvertCloudService.php',
|
vendor/composer/installed.json
CHANGED
@@ -153,69 +153,6 @@
|
|
153 |
],
|
154 |
"install-path": "./installers"
|
155 |
},
|
156 |
-
{
|
157 |
-
"name": "onnov/detect-encoding",
|
158 |
-
"version": "v1.2.0",
|
159 |
-
"version_normalized": "1.2.0.0",
|
160 |
-
"source": {
|
161 |
-
"type": "git",
|
162 |
-
"url": "https://github.com/onnov/detect-encoding.git",
|
163 |
-
"reference": "c88cea4f0c83d7f7e0675f2801e0995f328de1ce"
|
164 |
-
},
|
165 |
-
"dist": {
|
166 |
-
"type": "zip",
|
167 |
-
"url": "https://api.github.com/repos/onnov/detect-encoding/zipball/c88cea4f0c83d7f7e0675f2801e0995f328de1ce",
|
168 |
-
"reference": "c88cea4f0c83d7f7e0675f2801e0995f328de1ce",
|
169 |
-
"shasum": ""
|
170 |
-
},
|
171 |
-
"require": {
|
172 |
-
"ext-iconv": "*",
|
173 |
-
"php": ">=7.2"
|
174 |
-
},
|
175 |
-
"require-dev": {
|
176 |
-
"infection/infection": "*",
|
177 |
-
"phpbench/phpbench": "*",
|
178 |
-
"phpcompatibility/php-compatibility": "*",
|
179 |
-
"phpmd/phpmd": "*",
|
180 |
-
"phpstan/phpstan": "*",
|
181 |
-
"phpstan/phpstan-strict-rules": "*",
|
182 |
-
"phpunit/phpunit": "*",
|
183 |
-
"roave/backward-compatibility-check": "*",
|
184 |
-
"squizlabs/php_codesniffer": "*"
|
185 |
-
},
|
186 |
-
"time": "2019-09-20T16:11:46+00:00",
|
187 |
-
"type": "library",
|
188 |
-
"installation-source": "dist",
|
189 |
-
"autoload": {
|
190 |
-
"psr-4": {
|
191 |
-
"Onnov\\DetectEncoding\\": "src/"
|
192 |
-
}
|
193 |
-
},
|
194 |
-
"notification-url": "https://packagist.org/downloads/",
|
195 |
-
"license": [
|
196 |
-
"MIT"
|
197 |
-
],
|
198 |
-
"authors": [
|
199 |
-
{
|
200 |
-
"name": "onnov",
|
201 |
-
"email": "oblnn@yandex.ru"
|
202 |
-
}
|
203 |
-
],
|
204 |
-
"description": "Text encoding definition class instead of mb_detect_encoding. Defines: utf-8, windows-1251, koi8-r, iso-8859-5, ibm866, .....",
|
205 |
-
"homepage": "https://github.com/onnov/detect-encoding",
|
206 |
-
"keywords": [
|
207 |
-
"cyrillic",
|
208 |
-
"encoding",
|
209 |
-
"ibm866",
|
210 |
-
"iconv",
|
211 |
-
"iso-8859-5",
|
212 |
-
"koi8-r",
|
213 |
-
"mb_detect_encoding",
|
214 |
-
"utf-8",
|
215 |
-
"windows-1251"
|
216 |
-
],
|
217 |
-
"install-path": "../onnov/detect-encoding"
|
218 |
-
},
|
219 |
{
|
220 |
"name": "rosell-dk/dom-util-for-webp",
|
221 |
"version": "0.4.0",
|
153 |
],
|
154 |
"install-path": "./installers"
|
155 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
{
|
157 |
"name": "rosell-dk/dom-util-for-webp",
|
158 |
"version": "0.4.0",
|
vendor/composer/installed.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
'aliases' =>
|
7 |
array (
|
8 |
),
|
9 |
-
'reference' => '
|
10 |
'name' => 'rosell-dk/webp-express',
|
11 |
'dev' => true,
|
12 |
),
|
@@ -22,16 +22,6 @@
|
|
22 |
'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
|
23 |
'dev-requirement' => false,
|
24 |
),
|
25 |
-
'onnov/detect-encoding' =>
|
26 |
-
array (
|
27 |
-
'pretty_version' => 'v1.2.0',
|
28 |
-
'version' => '1.2.0.0',
|
29 |
-
'aliases' =>
|
30 |
-
array (
|
31 |
-
),
|
32 |
-
'reference' => 'c88cea4f0c83d7f7e0675f2801e0995f328de1ce',
|
33 |
-
'dev-requirement' => false,
|
34 |
-
),
|
35 |
'rosell-dk/dom-util-for-webp' =>
|
36 |
array (
|
37 |
'pretty_version' => '0.4.0',
|
@@ -89,7 +79,7 @@
|
|
89 |
'aliases' =>
|
90 |
array (
|
91 |
),
|
92 |
-
'reference' => '
|
93 |
'dev-requirement' => false,
|
94 |
),
|
95 |
'roundcube/plugin-installer' =>
|
6 |
'aliases' =>
|
7 |
array (
|
8 |
),
|
9 |
+
'reference' => '936c03c18aaf2ecd964705afb55866b9803bc713',
|
10 |
'name' => 'rosell-dk/webp-express',
|
11 |
'dev' => true,
|
12 |
),
|
22 |
'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
|
23 |
'dev-requirement' => false,
|
24 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
'rosell-dk/dom-util-for-webp' =>
|
26 |
array (
|
27 |
'pretty_version' => '0.4.0',
|
79 |
'aliases' =>
|
80 |
array (
|
81 |
),
|
82 |
+
'reference' => '936c03c18aaf2ecd964705afb55866b9803bc713',
|
83 |
'dev-requirement' => false,
|
84 |
),
|
85 |
'roundcube/plugin-installer' =>
|
vendor/composer/platform_check.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
|
5 |
$issues = array();
|
6 |
|
7 |
-
if (!(PHP_VERSION_ID >=
|
8 |
-
$issues[] = 'Your Composer dependencies require a PHP version ">=
|
9 |
}
|
10 |
|
11 |
if ($issues) {
|
4 |
|
5 |
$issues = array();
|
6 |
|
7 |
+
if (!(PHP_VERSION_ID >= 50600)) {
|
8 |
+
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
|
9 |
}
|
10 |
|
11 |
if ($issues) {
|
vendor/onnov/detect-encoding/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
language: php
|
2 |
-
sudo: false
|
3 |
-
dist: trusty
|
4 |
-
|
5 |
-
cache:
|
6 |
-
directories:
|
7 |
-
- $HOME/.cache/composer/files
|
8 |
-
|
9 |
-
php:
|
10 |
-
- '7.2'
|
11 |
-
- '7.3'
|
12 |
-
|
13 |
-
matrix:
|
14 |
-
fast_finish: true
|
15 |
-
include:
|
16 |
-
- php: 7.4snapshot
|
17 |
-
env: NO_INFECTION=1
|
18 |
-
- php: nightly
|
19 |
-
env: NO_INFECTION=1
|
20 |
-
|
21 |
-
before_install:
|
22 |
-
- if [[ $NO_XDEBUG == 1 ]]; then phpenv config-rm xdebug.ini || echo 'No xdebug config.'; fi
|
23 |
-
- test "$TRAVIS_PHP_VERSION" != "nightly" || export COMPOSER_FLAGS="$COMPOSER_FLAGS --ignore-platform-reqs"
|
24 |
-
|
25 |
-
before_script:
|
26 |
-
- composer self-update
|
27 |
-
- COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --prefer-dist $COMPOSER_FLAGS
|
28 |
-
|
29 |
-
script:
|
30 |
-
- composer validate --no-check-all
|
31 |
-
- composer phpcs
|
32 |
-
- composer phpmd
|
33 |
-
- composer phpstan
|
34 |
-
- if [[ $NO_INFECTION != 1 ]]; then composer infection; fi
|
35 |
-
- composer coverage
|
36 |
-
|
37 |
-
notifications:
|
38 |
-
email: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/onnov/detect-encoding/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
MIT License
|
2 |
-
|
3 |
-
Copyright (c) 2019 onnov
|
4 |
-
|
5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
-
of this software and associated documentation files (the "Software"), to deal
|
7 |
-
in the Software without restriction, including without limitation the rights
|
8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
-
copies of the Software, and to permit persons to whom the Software is
|
10 |
-
furnished to do so, subject to the following conditions:
|
11 |
-
|
12 |
-
The above copyright notice and this permission notice shall be included in all
|
13 |
-
copies or substantial portions of the Software.
|
14 |
-
|
15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
-
SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/onnov/detect-encoding/README.md
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
[![Build Status](https://travis-ci.org/onnov/detect-encoding.svg?branch=master)](https://travis-ci.org/onnov/detect-encoding)
|
2 |
-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/onnov/detect-encoding/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/onnov/detect-encoding/?branch=master)
|
3 |
-
[![Code Coverage](https://scrutinizer-ci.com/g/onnov/detect-encoding/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/onnov/detect-encoding/?branch=master)
|
4 |
-
[![Latest Stable Version](https://poser.pugx.org/onnov/detect-encoding/v/stable)](https://packagist.org/packages/onnov/detect-encoding)
|
5 |
-
[![License](https://poser.pugx.org/onnov/detect-encoding/license)](https://packagist.org/packages/onnov/detect-encoding)
|
6 |
-
|
7 |
-
# Detect encoding
|
8 |
-
|
9 |
-
Text encoding definition class based on a range of code page character numbers.
|
10 |
-
|
11 |
-
So far, in PHP v7.* the `mb_detect_encoding` function does not work well.
|
12 |
-
Therefore, you have to somehow solve this problem.
|
13 |
-
This class is one solution.
|
14 |
-
|
15 |
-
Built-in encodings and accuracy:
|
16 |
-
|
17 |
-
letters -> | 5 | 15 | 30 | 60 | 120 | 180 | 270
|
18 |
-
--- | --- | --- | --- |--- |--- |--- |---
|
19 |
-
windows-1251 | 99.13 | 98.83 | 98.54 | 99.04 | 99.73 | 99.93 | 100.0
|
20 |
-
koi8-r | 99.89 | 99.98 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0
|
21 |
-
iso-8859-5 | 81.79 | 99.27 | 99.98 | 100.0 | 100.0 | 100.0 | 100.0
|
22 |
-
ibm866 | 99.81 | 99.99 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0
|
23 |
-
mac-cyrillic | 12.79 | 47.49 | 73.48 | 92.15 | 99.30 | 99.94 | 100.0
|
24 |
-
|
25 |
-
Worst accuracy with mac-cyrillic, you need at least 60 characters to determine this encoding with an accuracy of 92.15%. Windows-1251 encoding also has very poor accuracy. This is because the numbers of their characters in the tables overlap very much.
|
26 |
-
|
27 |
-
Fortunately, mac-cyrillic and ibm866 encodings are not used to encode web pages. By default, they are disabled in the script, but you can enable them if necessary.
|
28 |
-
|
29 |
-
letters -> | 5 | 10 | 15 | 30 | 60 |
|
30 |
-
--- | --- | --- | --- |--- |--- |
|
31 |
-
windows-1251 | 99.40 | 99.69 | 99.86 | 99.97 | 100.0 |
|
32 |
-
koi8-r | 99.89 | 99.98 | 99.98 | 100.0 | 100.0 |
|
33 |
-
iso-8859-5 | 81.79 | 96.41 | 99.27 | 99.98 | 100.0 |
|
34 |
-
|
35 |
-
The accuracy of the determination is high even in short sentences from 5 to 10 letters. And for phrases from 60 letters, the accuracy of determination reaches 100%.
|
36 |
-
|
37 |
-
Determining the encoding is very fast, for example, text longer than 1,300,000 Cyrillic characters is checked in 0.00096 sec. (on my computer)
|
38 |
-
|
39 |
-
Link to the idea: http://patttern.blogspot.com/2012/07/php-python.html
|
40 |
-
|
41 |
-
## Installation
|
42 |
-
[Composer](https://getcomposer.org) (recommended)
|
43 |
-
Use Composer to install this library from Packagist: onnov/captcha
|
44 |
-
|
45 |
-
Run the following command from your project directory to add the dependency:
|
46 |
-
```bash
|
47 |
-
composer require onnov/detect-encoding
|
48 |
-
```
|
49 |
-
|
50 |
-
Alternatively, add the dependency directly to your composer.json file:
|
51 |
-
```json
|
52 |
-
{
|
53 |
-
"require": {
|
54 |
-
"onnov/detect-encoding": "^1.0"
|
55 |
-
}
|
56 |
-
}
|
57 |
-
```
|
58 |
-
|
59 |
-
The classes in the project are structured according to the PSR-4 standard, so you can also use your own autoloader or require the needed files directly in your code.
|
60 |
-
|
61 |
-
## Usage
|
62 |
-
```php
|
63 |
-
use Onnov\DetectEncoding\EncodingDetector;
|
64 |
-
|
65 |
-
$detector = new EncodingDetector();
|
66 |
-
```
|
67 |
-
|
68 |
-
* Definition of text encoding:
|
69 |
-
```php
|
70 |
-
$text = 'Проверяемый текст';
|
71 |
-
$detector->getEncoding($text)
|
72 |
-
```
|
73 |
-
|
74 |
-
* Method for converting text of an unknown encoding into a given encoding, by default in utf-8
|
75 |
-
optional parameters:
|
76 |
-
```php
|
77 |
-
/**
|
78 |
-
* Method for converting text of an unknown encoding into a given encoding, by default in utf-8
|
79 |
-
* optional parameters:
|
80 |
-
* $extra = '//TRANSLIT' (default setting) , other options: '' or '//IGNORE'
|
81 |
-
* $encoding = 'utf-8' (default setting) , other options: any encoding that is available iconv
|
82 |
-
*
|
83 |
-
* @param string $text
|
84 |
-
* @param string $extra
|
85 |
-
* @param string $encoding
|
86 |
-
*
|
87 |
-
* @return string
|
88 |
-
* @throws RuntimeException
|
89 |
-
*/
|
90 |
-
|
91 |
-
$detector->iconvXtoEncoding($text)
|
92 |
-
```
|
93 |
-
|
94 |
-
* Method to enable encoding definition:
|
95 |
-
```php
|
96 |
-
$detector->enableEncoding([
|
97 |
-
$detector::IBM866,
|
98 |
-
$detector::MAC_CYRILLIC,
|
99 |
-
]);
|
100 |
-
```
|
101 |
-
|
102 |
-
* Method to disable encoding definition:
|
103 |
-
```php
|
104 |
-
$detector->disableEncoding([
|
105 |
-
$detector::ISO_8859_5,
|
106 |
-
]);
|
107 |
-
```
|
108 |
-
|
109 |
-
* Method for adding custom encoding:
|
110 |
-
```php
|
111 |
-
$detector->addEncoding([
|
112 |
-
'encodingName' => [
|
113 |
-
'upper' => '1-50,200-250,253', // uppercase character number range
|
114 |
-
'lower' => '55-100,120-180,199', // lowercase character number range
|
115 |
-
],
|
116 |
-
]);
|
117 |
-
```
|
118 |
-
|
119 |
-
* Method to get a custom encoding range:
|
120 |
-
```php
|
121 |
-
use Onnov\DetectEncoding\CodePage;
|
122 |
-
|
123 |
-
// utf-8 encoded alphabet
|
124 |
-
$cyrillicUppercase = 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФЧЦЧШЩЪЫЬЭЮЯ';
|
125 |
-
$cyrillicLowercase = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя';
|
126 |
-
|
127 |
-
$codePage = new CodePage();
|
128 |
-
$encodingRange = $codePage->getRange($cyrillicUppercase, $cyrillicLowercase, 'koi8-u'));
|
129 |
-
```
|
130 |
-
|
131 |
-
## Symfony use
|
132 |
-
Add in services.yaml file:
|
133 |
-
```yaml
|
134 |
-
services:
|
135 |
-
Onnov\DetectEncoding\EncodingDetector:
|
136 |
-
autowire: true
|
137 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/onnov/detect-encoding/bin/testsRun.sh
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
#!/usr/bin/env bash
|
2 |
-
|
3 |
-
vendor/bin/phpcs
|
4 |
-
vendor/bin/phpmd src text cleancode,codesize,controversial,design,naming,unusedcode
|
5 |
-
vendor/bin/phpstan analyse src/ -c phpstan.neon --level=7 --no-progress -vvv --memory-limit=-1
|
6 |
-
vendor/bin/phpbench run benchmarks --report=default
|
7 |
-
vendor/bin/infection --min-msi=50 --min-covered-msi=70 --log-verbosity=all
|
8 |
-
vendor/bin/phpunit --coverage-text --coverage-html ./build/coverage/html --coverage-clover ./build/coverage/clover.xml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/onnov/detect-encoding/composer.json
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "onnov/detect-encoding",
|
3 |
-
"description": "Text encoding definition class instead of mb_detect_encoding. Defines: utf-8, windows-1251, koi8-r, iso-8859-5, ibm866, .....",
|
4 |
-
"type": "library",
|
5 |
-
"keywords": [
|
6 |
-
"mb_detect_encoding",
|
7 |
-
"encoding",
|
8 |
-
"utf-8",
|
9 |
-
"windows-1251",
|
10 |
-
"koi8-r",
|
11 |
-
"iso-8859-5",
|
12 |
-
"ibm866",
|
13 |
-
"cyrillic",
|
14 |
-
"iconv"
|
15 |
-
],
|
16 |
-
"homepage": "https://github.com/onnov/detect-encoding",
|
17 |
-
"license": "MIT",
|
18 |
-
"authors": [
|
19 |
-
{
|
20 |
-
"name": "onnov",
|
21 |
-
"email": "oblnn@yandex.ru"
|
22 |
-
}
|
23 |
-
],
|
24 |
-
"require": {
|
25 |
-
"php": ">=7.2",
|
26 |
-
"ext-iconv": "*"
|
27 |
-
},
|
28 |
-
"autoload": {
|
29 |
-
"psr-4": {
|
30 |
-
"Onnov\\DetectEncoding\\": "src/"
|
31 |
-
}
|
32 |
-
},
|
33 |
-
"autoload-dev": {
|
34 |
-
"psr-4": {
|
35 |
-
"Onnov\\DetectEncoding\\Tests\\": "tests/"
|
36 |
-
}
|
37 |
-
},
|
38 |
-
"require-dev": {
|
39 |
-
"phpunit/phpunit": "*",
|
40 |
-
"phpbench/phpbench": "*",
|
41 |
-
"phpmd/phpmd": "*",
|
42 |
-
"phpstan/phpstan": "*",
|
43 |
-
"phpstan/phpstan-strict-rules": "*",
|
44 |
-
"squizlabs/php_codesniffer": "*",
|
45 |
-
"infection/infection": "*",
|
46 |
-
"phpcompatibility/php-compatibility": "*",
|
47 |
-
"roave/backward-compatibility-check": "*"
|
48 |
-
},
|
49 |
-
"scripts": {
|
50 |
-
"phpcs": "phpcs",
|
51 |
-
"phpcbf": "phpcbf",
|
52 |
-
"phpmd": "phpmd src text cleancode,codesize,controversial,design,naming,unusedcode",
|
53 |
-
"phpstan": "phpstan analyse src/ -c phpstan.neon --level=7 --no-progress -vvv --memory-limit=-1",
|
54 |
-
"phpunit": "phpunit",
|
55 |
-
"infection": "infection --min-msi=50 --min-covered-msi=70 --log-verbosity=all",
|
56 |
-
"coveragehtml": "phpunit --coverage-text --coverage-html ./build/coverage/html --coverage-clover ./build/coverage/clover.xml",
|
57 |
-
"coverage": "phpunit --coverage-text --coverage-clover clover.xml",
|
58 |
-
"phpbench": "phpbench run benchmarks --report=default",
|
59 |
-
"bccheck": "roave-backward-compatibility-check"
|
60 |
-
}
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/onnov/detect-encoding/infection.json.dist
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"timeout": 5,
|
3 |
-
"source": {
|
4 |
-
"directories": [
|
5 |
-
"src"
|
6 |
-
]
|
7 |
-
},
|
8 |
-
"logs": {
|
9 |
-
"text": "build/infection/text.log",
|
10 |
-
"summary": "build/infection/summary.log",
|
11 |
-
"debug": "build/infection/debug.log",
|
12 |
-
"perMutator": "build/infection/perMutator.md"
|
13 |
-
},
|
14 |
-
"mutators": {
|
15 |
-
"@default": true
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/onnov/detect-encoding/phpbench.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"bootstrap": "vendor/autoload.php"
|
3 |
-
}
|
|
|
|
|
|
vendor/onnov/detect-encoding/src/CodePage.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php declare(strict_types=1);
|
2 |
-
/**
|
3 |
-
* User: onnov
|
4 |
-
* Date: 02.09.2019
|
5 |
-
* Time: 18:25
|
6 |
-
*/
|
7 |
-
|
8 |
-
namespace Onnov\DetectEncoding;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Class CodePage
|
12 |
-
*
|
13 |
-
* @package Onnov\DetectEncoding
|
14 |
-
*/
|
15 |
-
class CodePage
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* Method to get a custom encoding range
|
19 |
-
*
|
20 |
-
* @param string $uppercaseLetters
|
21 |
-
* @param string $lowercaseLetters
|
22 |
-
* @param string $encoding
|
23 |
-
*
|
24 |
-
* @return array<string, array<string, string>>
|
25 |
-
*/
|
26 |
-
public function getRange(
|
27 |
-
string $uppercaseLetters,
|
28 |
-
string $lowercaseLetters,
|
29 |
-
string $encoding
|
30 |
-
): array {
|
31 |
-
return [
|
32 |
-
$encoding => [
|
33 |
-
'upper' => $this->getRangeStr($this->getLetterArr(
|
34 |
-
$uppercaseLetters,
|
35 |
-
$encoding
|
36 |
-
)),
|
37 |
-
'lower' => $this->getRangeStr($this->getLetterArr(
|
38 |
-
$lowercaseLetters,
|
39 |
-
$encoding
|
40 |
-
)),
|
41 |
-
],
|
42 |
-
];
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @param array $array
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
private function getRangeStr(array $array): string
|
51 |
-
{
|
52 |
-
$ranges = [];
|
53 |
-
$last = null;
|
54 |
-
foreach ($array as $current) {
|
55 |
-
if ($current > $last + 1) {
|
56 |
-
$lastKey = array_key_last($ranges);
|
57 |
-
if (null !== $lastKey) {
|
58 |
-
$ranges[$lastKey][1] = $last;
|
59 |
-
}
|
60 |
-
$ranges[] = [$current, null];
|
61 |
-
}
|
62 |
-
$last = $current;
|
63 |
-
}
|
64 |
-
$lastKey = array_key_last($ranges);
|
65 |
-
$ranges[$lastKey][1] = $last;
|
66 |
-
|
67 |
-
$stringIntervals = [];
|
68 |
-
foreach ($ranges as $interval) {
|
69 |
-
if (current($interval) < end($interval)) {
|
70 |
-
$stringIntervals[] = implode('-', $interval);
|
71 |
-
continue;
|
72 |
-
}
|
73 |
-
$stringIntervals[] = array_pop($interval);
|
74 |
-
}
|
75 |
-
$string = implode(', ', $stringIntervals);
|
76 |
-
|
77 |
-
return $string;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* @param string $strLetters
|
82 |
-
* @param string $encoding
|
83 |
-
*
|
84 |
-
* @return array<int, int|string>
|
85 |
-
*/
|
86 |
-
private function getLetterArr(string &$strLetters, string $encoding): array
|
87 |
-
{
|
88 |
-
$res = [];
|
89 |
-
$str = iconv('utf-8', $encoding . '//IGNORE', $strLetters);
|
90 |
-
if (is_string($str)) {
|
91 |
-
$res = array_keys(count_chars($str, 1));
|
92 |
-
}
|
93 |
-
|
94 |
-
return $res;
|
95 |
-
}
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/onnov/detect-encoding/src/EncodingDetector.php
DELETED
@@ -1,244 +0,0 @@
|
|
1 |
-
<?php declare(strict_types=1);
|
2 |
-
/**
|
3 |
-
* User: onnov
|
4 |
-
* Date: 27.08.2019
|
5 |
-
* Time: 21:59
|
6 |
-
*/
|
7 |
-
|
8 |
-
namespace Onnov\DetectEncoding;
|
9 |
-
|
10 |
-
use Exception;
|
11 |
-
use RuntimeException;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class EncodingDetector
|
15 |
-
*
|
16 |
-
* @package Onnov\DetectEncoding
|
17 |
-
*/
|
18 |
-
class EncodingDetector
|
19 |
-
{
|
20 |
-
const LOWER_FACTOR = 3;
|
21 |
-
|
22 |
-
const UTF_8 = 'utf-8';
|
23 |
-
const WINDOWS_1251 = 'windows-1251';
|
24 |
-
const KOI8_R = 'koi8-r';
|
25 |
-
const IBM866 = 'ibm866';
|
26 |
-
const ISO_8859_5 = 'iso-8859-5';
|
27 |
-
const MAC_CYRILLIC = 'mac-cyrillic';
|
28 |
-
|
29 |
-
/** @var array<string, array<string, string>> */
|
30 |
-
protected $rangeModel
|
31 |
-
= [
|
32 |
-
'windows-1251' => [
|
33 |
-
'upper' => '168,192-212,214-223',
|
34 |
-
'lower' => '184,224-255',
|
35 |
-
],
|
36 |
-
'koi8-r' => [
|
37 |
-
'upper' => '179,224-231, 233-255',
|
38 |
-
'lower' => '163,192-223',
|
39 |
-
],
|
40 |
-
'iso-8859-5' => [
|
41 |
-
'upper' => '161,176-196,198-207',
|
42 |
-
'lower' => '208-239,241',
|
43 |
-
],
|
44 |
-
'ibm866' => [
|
45 |
-
'upper' => '128-148,150-159,240',
|
46 |
-
'lower' => '160-175,224-239,241',
|
47 |
-
],
|
48 |
-
'mac-cyrillic' => [
|
49 |
-
'upper' => '128-148,150-159,221',
|
50 |
-
'lower' => '222-254',
|
51 |
-
],
|
52 |
-
];
|
53 |
-
|
54 |
-
/** @var array */
|
55 |
-
protected $ranges;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* EncodingDetector constructor.
|
59 |
-
*/
|
60 |
-
public function __construct()
|
61 |
-
{
|
62 |
-
// default setting
|
63 |
-
$this->enableEncoding(
|
64 |
-
[
|
65 |
-
$this::WINDOWS_1251,
|
66 |
-
$this::KOI8_R,
|
67 |
-
$this::ISO_8859_5,
|
68 |
-
]
|
69 |
-
);
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Method to enable encoding definition
|
74 |
-
* Example:
|
75 |
-
* $detector->enableEncoding([
|
76 |
-
* $detector::IBM866,
|
77 |
-
* $detector::MAC_CYRILLIC,
|
78 |
-
* ]);
|
79 |
-
*
|
80 |
-
* @param array $encodingList
|
81 |
-
*/
|
82 |
-
public function enableEncoding(array $encodingList): void
|
83 |
-
{
|
84 |
-
foreach ($encodingList as $encoding) {
|
85 |
-
if (isset($this->rangeModel[$encoding])) {
|
86 |
-
$this->ranges[$encoding]
|
87 |
-
= $this->getRanges($this->rangeModel[$encoding]);
|
88 |
-
}
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Method to disable encoding definition
|
94 |
-
* Example:
|
95 |
-
* $detector->disableEncoding([
|
96 |
-
* $detector::ISO_8859_5,
|
97 |
-
* ]);
|
98 |
-
*
|
99 |
-
* @param array $encodingList
|
100 |
-
*/
|
101 |
-
public function disableEncoding(array $encodingList): void
|
102 |
-
{
|
103 |
-
foreach ($encodingList as $encoding) {
|
104 |
-
unset($this->ranges[$encoding]);
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Method for adding custom encoding
|
110 |
-
* Example:
|
111 |
-
* $detector->addEncoding([
|
112 |
-
* 'encodingName' => [
|
113 |
-
* 'upper' => '1-50,200-250,253', // uppercase character number range
|
114 |
-
* 'lower' => '55-100,120-180,199', // lowercase character number range
|
115 |
-
* ],
|
116 |
-
* ]);
|
117 |
-
*
|
118 |
-
* @param array $ranges
|
119 |
-
*/
|
120 |
-
public function addEncoding(array $ranges): void
|
121 |
-
{
|
122 |
-
foreach ($ranges as $encoding => $config) {
|
123 |
-
if (isset($config['upper'], $config['lower'])) {
|
124 |
-
$this->ranges[$encoding] = $this->getRanges($config);
|
125 |
-
}
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Method for converting text of an unknown encoding into a given encoding, by default in utf-8
|
131 |
-
* optional parameters:
|
132 |
-
* $extra = '//TRANSLIT' (default setting) , other options: '' or '//IGNORE'
|
133 |
-
* $encoding = 'utf-8' (default setting) , other options: any encoding that is available iconv
|
134 |
-
*
|
135 |
-
* @param string $text
|
136 |
-
* @param string $extra
|
137 |
-
* @param string $encoding
|
138 |
-
*
|
139 |
-
* @return string
|
140 |
-
* @throws RuntimeException
|
141 |
-
*/
|
142 |
-
public function iconvXtoEncoding(
|
143 |
-
string &$text,
|
144 |
-
string $extra = '//TRANSLIT',
|
145 |
-
string $encoding = EncodingDetector::UTF_8
|
146 |
-
): string {
|
147 |
-
$res = $text;
|
148 |
-
$xec = $this->getEncoding($text);
|
149 |
-
if ($xec !== $encoding) {
|
150 |
-
$msg = 'iconv returned false';
|
151 |
-
try {
|
152 |
-
$res = iconv($xec, $encoding . $extra, $text);
|
153 |
-
if ($res === false) {
|
154 |
-
throw new RuntimeException($msg);
|
155 |
-
}
|
156 |
-
} catch (Exception $error) {
|
157 |
-
$msg = $error->getMessage();
|
158 |
-
throw new RuntimeException($msg);
|
159 |
-
}
|
160 |
-
}
|
161 |
-
|
162 |
-
return $res;
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Definition of text encoding
|
167 |
-
*
|
168 |
-
* @param string $text
|
169 |
-
*
|
170 |
-
* @return string
|
171 |
-
*/
|
172 |
-
public function getEncoding(string &$text): string
|
173 |
-
{
|
174 |
-
$result = $this::UTF_8;
|
175 |
-
if ($this->isUtf($text) == false) {
|
176 |
-
$res = [];
|
177 |
-
$text = count_chars($text, 1);
|
178 |
-
foreach ($this->ranges as $encoding => $config) {
|
179 |
-
$upc = array_intersect_key($text, $config['upper']);
|
180 |
-
$loc = array_intersect_key($text, $config['lower']);
|
181 |
-
$res[$encoding] = (array_sum($upc) + array_sum($loc)
|
182 |
-
* EncodingDetector::LOWER_FACTOR);
|
183 |
-
}
|
184 |
-
asort($res);
|
185 |
-
$result = (string)array_key_last($res);
|
186 |
-
}
|
187 |
-
|
188 |
-
return $result;
|
189 |
-
}
|
190 |
-
|
191 |
-
/**
|
192 |
-
* UTF Encoding Definition Method
|
193 |
-
*
|
194 |
-
* @param string $text
|
195 |
-
*
|
196 |
-
* @return bool
|
197 |
-
*/
|
198 |
-
private function isUtf(string &$text): bool
|
199 |
-
{
|
200 |
-
return (bool)preg_match('/./u', $text);
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* @param array $config
|
205 |
-
*
|
206 |
-
* @return array
|
207 |
-
*/
|
208 |
-
private function getRanges(array $config): array
|
209 |
-
{
|
210 |
-
return [
|
211 |
-
'upper' => $this->getRange($config['upper']),
|
212 |
-
'lower' => $this->getRange($config['lower']),
|
213 |
-
];
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Method to convert a range from a string to an array
|
218 |
-
*
|
219 |
-
* @param string $str
|
220 |
-
*
|
221 |
-
* @return array|null
|
222 |
-
*/
|
223 |
-
private function getRange(string &$str): ?array
|
224 |
-
{
|
225 |
-
$res = [];
|
226 |
-
foreach (explode(',', $str) as $item) {
|
227 |
-
$arr = explode('-', $item);
|
228 |
-
if (count($arr) > 1) {
|
229 |
-
$arr = range($arr[0], $arr[1]);
|
230 |
-
}
|
231 |
-
$res = array_merge($res, $arr);
|
232 |
-
}
|
233 |
-
|
234 |
-
return array_flip($res);
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* @return array<string, array<string, string>>
|
239 |
-
*/
|
240 |
-
public function getEncodingList(): array
|
241 |
-
{
|
242 |
-
return $this->ranges;
|
243 |
-
}
|
244 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
webp-express.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WebP Express
|
4 |
* Plugin URI: https://github.com/rosell-dk/webp-express
|
5 |
* Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
|
6 |
-
* Version: 0.20.
|
7 |
* Author: Bjørn Rosell
|
8 |
* Author URI: https://www.bitwise-it.dk
|
9 |
* License: GPL2
|
3 |
* Plugin Name: WebP Express
|
4 |
* Plugin URI: https://github.com/rosell-dk/webp-express
|
5 |
* Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
|
6 |
+
* Version: 0.20.1
|
7 |
* Author: Bjørn Rosell
|
8 |
* Author URI: https://www.bitwise-it.dk
|
9 |
* License: GPL2
|