Imagify Image Optimizer - Version 1.9.10

Version Description

  • 2020/05/26 =
  • Fix: Correctly optimize thumbnails during auto-optimization of image upload
  • Fix: Fix broken compatibility with Enable Media Replace plugin after WordPress 5.3
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Imagify Image Optimizer
Version 1.9.10
Comparing to
See all releases

Code changes from version 1.9.9 to 1.9.10

composer.json DELETED
@@ -1,64 +0,0 @@
1
- {
2
- "name": "wp-media/imagify-plugin",
3
- "description": "Image optimization plugin for WordPress by WP Media.",
4
- "keywords": [
5
- "wordpress",
6
- "images",
7
- "optimization",
8
- "performance"
9
- ],
10
- "homepage": "https://imagify.io",
11
- "license": "GPL-2.0",
12
- "authors": [
13
- {
14
- "name": "WP Media",
15
- "homepage": "https://wp-media.me/"
16
- },
17
- {
18
- "name": "Grégory Viguier",
19
- "role": "Developer"
20
- }
21
- ],
22
- "type": "wordpress-plugin",
23
- "config": {
24
- "classloader-suffix": "WPMediaImagifyWordPressPlugin",
25
- "classmap-authoritative": true,
26
- "sort-packages": true
27
- },
28
- "support": {
29
- "issues": "https://github.com/wp-media/imagify-plugin/issues",
30
- "source": "https://github.com/wp-media/imagify-plugin"
31
- },
32
- "require": {
33
- "php": ">=5.4.0",
34
- "a5hleyrich/wp-background-processing": "~1.0",
35
- "composer/installers": "~1.0",
36
- "dangoodman/composer-for-wordpress": "^2.0"
37
- },
38
- "require-dev": {
39
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
40
- "phpcompatibility/phpcompatibility-wp": "*",
41
- "squizlabs/php_codesniffer": "^3.2",
42
- "wp-coding-standards/wpcs": "~1.2"
43
- },
44
- "autoload": {
45
- "psr-4": {
46
- "Imagify\\": "classes/",
47
- "Imagify\\Deprecated\\Traits\\": "inc/deprecated/Traits/",
48
- "Imagify\\ThirdParty\\AS3CF\\": "inc/3rd-party/amazon-s3-and-cloudfront/classes/",
49
- "Imagify\\ThirdParty\\EnableMediaReplace\\": "inc/3rd-party/enable-media-replace/classes/",
50
- "Imagify\\ThirdParty\\FormidablePro\\": "inc/3rd-party/formidable-pro/classes/",
51
- "Imagify\\ThirdParty\\NGG\\": "inc/3rd-party/nextgen-gallery/classes/",
52
- "Imagify\\ThirdParty\\RegenerateThumbnails\\": "inc/3rd-party/regenerate-thumbnails/classes/",
53
- "Imagify\\ThirdParty\\WPRocket\\": "inc/3rd-party/wp-rocket/classes/"
54
- },
55
- "classmap": [
56
- "inc/classes",
57
- "inc/deprecated/classes"
58
- ],
59
- "exclude-from-classmap": [
60
- "inc/classes/class-imagify-plugin.php",
61
- "inc/classes/class-imagify-requirements-check.php"
62
- ]
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
composer.lock DELETED
@@ -1,526 +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#composer-lock-the-lock-file",
5
- "This file is @generated automatically"
6
- ],
7
- "content-hash": "cbcf7a4f4ebf8e66f1244021254449fe",
8
- "packages": [
9
- {
10
- "name": "a5hleyrich/wp-background-processing",
11
- "version": "1.0.1",
12
- "source": {
13
- "type": "git",
14
- "url": "https://github.com/A5hleyRich/wp-background-processing.git",
15
- "reference": "1f070aab5058dbaf45d5435a343033ddd8a641b1"
16
- },
17
- "dist": {
18
- "type": "zip",
19
- "url": "https://api.github.com/repos/A5hleyRich/wp-background-processing/zipball/1f070aab5058dbaf45d5435a343033ddd8a641b1",
20
- "reference": "1f070aab5058dbaf45d5435a343033ddd8a641b1",
21
- "shasum": ""
22
- },
23
- "require": {
24
- "php": ">=5.2"
25
- },
26
- "type": "library",
27
- "autoload": {
28
- "classmap": [
29
- "classes/"
30
- ]
31
- },
32
- "notification-url": "https://packagist.org/downloads/",
33
- "license": [
34
- "GPL-2.0-only"
35
- ],
36
- "authors": [
37
- {
38
- "name": "Ashley Rich",
39
- "email": "hello@ashleyrich.com"
40
- }
41
- ],
42
- "description": "WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.",
43
- "time": "2018-02-12T09:24:05+00:00"
44
- },
45
- {
46
- "name": "composer/installers",
47
- "version": "v1.6.0",
48
- "source": {
49
- "type": "git",
50
- "url": "https://github.com/composer/installers.git",
51
- "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
52
- },
53
- "dist": {
54
- "type": "zip",
55
- "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
56
- "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
57
- "shasum": ""
58
- },
59
- "require": {
60
- "composer-plugin-api": "^1.0"
61
- },
62
- "replace": {
63
- "roundcube/plugin-installer": "*",
64
- "shama/baton": "*"
65
- },
66
- "require-dev": {
67
- "composer/composer": "1.0.*@dev",
68
- "phpunit/phpunit": "^4.8.36"
69
- },
70
- "type": "composer-plugin",
71
- "extra": {
72
- "class": "Composer\\Installers\\Plugin",
73
- "branch-alias": {
74
- "dev-master": "1.0-dev"
75
- }
76
- },
77
- "autoload": {
78
- "psr-4": {
79
- "Composer\\Installers\\": "src/Composer/Installers"
80
- }
81
- },
82
- "notification-url": "https://packagist.org/downloads/",
83
- "license": [
84
- "MIT"
85
- ],
86
- "authors": [
87
- {
88
- "name": "Kyle Robinson Young",
89
- "email": "kyle@dontkry.com",
90
- "homepage": "https://github.com/shama"
91
- }
92
- ],
93
- "description": "A multi-framework Composer library installer",
94
- "homepage": "https://composer.github.io/installers/",
95
- "keywords": [
96
- "Craft",
97
- "Dolibarr",
98
- "Eliasis",
99
- "Hurad",
100
- "ImageCMS",
101
- "Kanboard",
102
- "Lan Management System",
103
- "MODX Evo",
104
- "Mautic",
105
- "Maya",
106
- "OXID",
107
- "Plentymarkets",
108
- "Porto",
109
- "RadPHP",
110
- "SMF",
111
- "Thelia",
112
- "WolfCMS",
113
- "agl",
114
- "aimeos",
115
- "annotatecms",
116
- "attogram",
117
- "bitrix",
118
- "cakephp",
119
- "chef",
120
- "cockpit",
121
- "codeigniter",
122
- "concrete5",
123
- "croogo",
124
- "dokuwiki",
125
- "drupal",
126
- "eZ Platform",
127
- "elgg",
128
- "expressionengine",
129
- "fuelphp",
130
- "grav",
131
- "installer",
132
- "itop",
133
- "joomla",
134
- "kohana",
135
- "laravel",
136
- "lavalite",
137
- "lithium",
138
- "magento",
139
- "majima",
140
- "mako",
141
- "mediawiki",
142
- "modulework",
143
- "modx",
144
- "moodle",
145
- "osclass",
146
- "phpbb",
147
- "piwik",
148
- "ppi",
149
- "puppet",
150
- "pxcms",
151
- "reindex",
152
- "roundcube",
153
- "shopware",
154
- "silverstripe",
155
- "sydes",
156
- "symfony",
157
- "typo3",
158
- "wordpress",
159
- "yawik",
160
- "zend",
161
- "zikula"
162
- ],
163
- "time": "2018-08-27T06:10:37+00:00"
164
- },
165
- {
166
- "name": "dangoodman/composer-for-wordpress",
167
- "version": "2.0.0",
168
- "source": {
169
- "type": "git",
170
- "url": "https://github.com/dangoodman/composer-for-wordpress.git",
171
- "reference": "be478117ee9b2fbcdb5a6580a5ec69b66e711e20"
172
- },
173
- "dist": {
174
- "type": "zip",
175
- "url": "https://api.github.com/repos/dangoodman/composer-for-wordpress/zipball/be478117ee9b2fbcdb5a6580a5ec69b66e711e20",
176
- "reference": "be478117ee9b2fbcdb5a6580a5ec69b66e711e20",
177
- "shasum": ""
178
- },
179
- "require": {
180
- "composer-plugin-api": "^1.0"
181
- },
182
- "type": "composer-plugin",
183
- "extra": {
184
- "class": "Dangoodman\\ComposerForWordpress\\ComposerForWordpress"
185
- },
186
- "autoload": {
187
- "psr-4": {
188
- "Dangoodman\\ComposerForWordpress\\": "."
189
- }
190
- },
191
- "notification-url": "https://packagist.org/downloads/",
192
- "time": "2018-06-20T15:01:37+00:00"
193
- }
194
- ],
195
- "packages-dev": [
196
- {
197
- "name": "dealerdirect/phpcodesniffer-composer-installer",
198
- "version": "v0.4.4",
199
- "source": {
200
- "type": "git",
201
- "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
202
- "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08"
203
- },
204
- "dist": {
205
- "type": "zip",
206
- "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08",
207
- "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08",
208
- "shasum": ""
209
- },
210
- "require": {
211
- "composer-plugin-api": "^1.0",
212
- "php": "^5.3|^7",
213
- "squizlabs/php_codesniffer": "*"
214
- },
215
- "require-dev": {
216
- "composer/composer": "*",
217
- "wimg/php-compatibility": "^8.0"
218
- },
219
- "suggest": {
220
- "dealerdirect/qa-tools": "All the PHP QA tools you'll need"
221
- },
222
- "type": "composer-plugin",
223
- "extra": {
224
- "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
225
- },
226
- "autoload": {
227
- "psr-4": {
228
- "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
229
- }
230
- },
231
- "notification-url": "https://packagist.org/downloads/",
232
- "license": [
233
- "MIT"
234
- ],
235
- "authors": [
236
- {
237
- "name": "Franck Nijhof",
238
- "email": "f.nijhof@dealerdirect.nl",
239
- "homepage": "http://workingatdealerdirect.eu",
240
- "role": "Developer"
241
- }
242
- ],
243
- "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
244
- "homepage": "http://workingatdealerdirect.eu",
245
- "keywords": [
246
- "PHPCodeSniffer",
247
- "PHP_CodeSniffer",
248
- "code quality",
249
- "codesniffer",
250
- "composer",
251
- "installer",
252
- "phpcs",
253
- "plugin",
254
- "qa",
255
- "quality",
256
- "standard",
257
- "standards",
258
- "style guide",
259
- "stylecheck",
260
- "tests"
261
- ],
262
- "time": "2017-12-06T16:27:17+00:00"
263
- },
264
- {
265
- "name": "phpcompatibility/php-compatibility",
266
- "version": "9.2.0",
267
- "source": {
268
- "type": "git",
269
- "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
270
- "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e"
271
- },
272
- "dist": {
273
- "type": "zip",
274
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/3db1bf1e28123fd574a4ae2e9a84072826d51b5e",
275
- "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e",
276
- "shasum": ""
277
- },
278
- "require": {
279
- "php": ">=5.3",
280
- "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
281
- },
282
- "conflict": {
283
- "squizlabs/php_codesniffer": "2.6.2"
284
- },
285
- "require-dev": {
286
- "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
287
- },
288
- "suggest": {
289
- "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
290
- "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
291
- },
292
- "type": "phpcodesniffer-standard",
293
- "notification-url": "https://packagist.org/downloads/",
294
- "license": [
295
- "LGPL-3.0-or-later"
296
- ],
297
- "authors": [
298
- {
299
- "name": "Contributors",
300
- "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
301
- },
302
- {
303
- "name": "Wim Godden",
304
- "homepage": "https://github.com/wimg",
305
- "role": "lead"
306
- },
307
- {
308
- "name": "Juliette Reinders Folmer",
309
- "homepage": "https://github.com/jrfnl",
310
- "role": "lead"
311
- }
312
- ],
313
- "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
314
- "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
315
- "keywords": [
316
- "compatibility",
317
- "phpcs",
318
- "standards"
319
- ],
320
- "time": "2019-06-27T19:58:56+00:00"
321
- },
322
- {
323
- "name": "phpcompatibility/phpcompatibility-paragonie",
324
- "version": "1.0.1",
325
- "source": {
326
- "type": "git",
327
- "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
328
- "reference": "9160de79fcd683b5c99e9c4133728d91529753ea"
329
- },
330
- "dist": {
331
- "type": "zip",
332
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/9160de79fcd683b5c99e9c4133728d91529753ea",
333
- "reference": "9160de79fcd683b5c99e9c4133728d91529753ea",
334
- "shasum": ""
335
- },
336
- "require": {
337
- "phpcompatibility/php-compatibility": "^9.0"
338
- },
339
- "require-dev": {
340
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4"
341
- },
342
- "suggest": {
343
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
344
- "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
345
- },
346
- "type": "phpcodesniffer-standard",
347
- "notification-url": "https://packagist.org/downloads/",
348
- "license": [
349
- "LGPL-3.0-or-later"
350
- ],
351
- "authors": [
352
- {
353
- "name": "Wim Godden",
354
- "role": "lead"
355
- },
356
- {
357
- "name": "Juliette Reinders Folmer",
358
- "role": "lead"
359
- }
360
- ],
361
- "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
362
- "homepage": "http://phpcompatibility.com/",
363
- "keywords": [
364
- "compatibility",
365
- "paragonie",
366
- "phpcs",
367
- "polyfill",
368
- "standards"
369
- ],
370
- "time": "2018-12-16T19:10:44+00:00"
371
- },
372
- {
373
- "name": "phpcompatibility/phpcompatibility-wp",
374
- "version": "2.0.0",
375
- "source": {
376
- "type": "git",
377
- "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
378
- "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd"
379
- },
380
- "dist": {
381
- "type": "zip",
382
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
383
- "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
384
- "shasum": ""
385
- },
386
- "require": {
387
- "phpcompatibility/php-compatibility": "^9.0",
388
- "phpcompatibility/phpcompatibility-paragonie": "^1.0"
389
- },
390
- "require-dev": {
391
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
392
- },
393
- "suggest": {
394
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
395
- "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
396
- },
397
- "type": "phpcodesniffer-standard",
398
- "notification-url": "https://packagist.org/downloads/",
399
- "license": [
400
- "LGPL-3.0-or-later"
401
- ],
402
- "authors": [
403
- {
404
- "name": "Wim Godden",
405
- "role": "lead"
406
- },
407
- {
408
- "name": "Juliette Reinders Folmer",
409
- "role": "lead"
410
- }
411
- ],
412
- "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
413
- "homepage": "http://phpcompatibility.com/",
414
- "keywords": [
415
- "compatibility",
416
- "phpcs",
417
- "standards",
418
- "wordpress"
419
- ],
420
- "time": "2018-10-07T18:31:37+00:00"
421
- },
422
- {
423
- "name": "squizlabs/php_codesniffer",
424
- "version": "3.4.2",
425
- "source": {
426
- "type": "git",
427
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
428
- "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8"
429
- },
430
- "dist": {
431
- "type": "zip",
432
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
433
- "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
434
- "shasum": ""
435
- },
436
- "require": {
437
- "ext-simplexml": "*",
438
- "ext-tokenizer": "*",
439
- "ext-xmlwriter": "*",
440
- "php": ">=5.4.0"
441
- },
442
- "require-dev": {
443
- "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
444
- },
445
- "bin": [
446
- "bin/phpcs",
447
- "bin/phpcbf"
448
- ],
449
- "type": "library",
450
- "extra": {
451
- "branch-alias": {
452
- "dev-master": "3.x-dev"
453
- }
454
- },
455
- "notification-url": "https://packagist.org/downloads/",
456
- "license": [
457
- "BSD-3-Clause"
458
- ],
459
- "authors": [
460
- {
461
- "name": "Greg Sherwood",
462
- "role": "lead"
463
- }
464
- ],
465
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
466
- "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
467
- "keywords": [
468
- "phpcs",
469
- "standards"
470
- ],
471
- "time": "2019-04-10T23:49:02+00:00"
472
- },
473
- {
474
- "name": "wp-coding-standards/wpcs",
475
- "version": "1.2.1",
476
- "source": {
477
- "type": "git",
478
- "url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
479
- "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c"
480
- },
481
- "dist": {
482
- "type": "zip",
483
- "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
484
- "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
485
- "shasum": ""
486
- },
487
- "require": {
488
- "php": ">=5.3",
489
- "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
490
- },
491
- "require-dev": {
492
- "phpcompatibility/php-compatibility": "^9.0"
493
- },
494
- "suggest": {
495
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
496
- },
497
- "type": "phpcodesniffer-standard",
498
- "notification-url": "https://packagist.org/downloads/",
499
- "license": [
500
- "MIT"
501
- ],
502
- "authors": [
503
- {
504
- "name": "Contributors",
505
- "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
506
- }
507
- ],
508
- "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
509
- "keywords": [
510
- "phpcs",
511
- "standards",
512
- "wordpress"
513
- ],
514
- "time": "2018-12-18T09:43:51+00:00"
515
- }
516
- ],
517
- "aliases": [],
518
- "minimum-stability": "stable",
519
- "stability-flags": [],
520
- "prefer-stable": false,
521
- "prefer-lowest": false,
522
- "platform": {
523
- "php": ">=5.4.0"
524
- },
525
- "platform-dev": []
526
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
imagify.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
- * Version: 1.9.9
7
  * Requires PHP: 5.4
8
  * Author: WP Media
9
  * Author URI: https://wp-media.me/
@@ -20,7 +20,7 @@
20
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
21
 
22
  // Imagify defines.
23
- define( 'IMAGIFY_VERSION', '1.9.9' );
24
  define( 'IMAGIFY_SLUG', 'imagify' );
25
  define( 'IMAGIFY_FILE', __FILE__ );
26
  define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
3
  * Plugin Name: Imagify
4
  * Plugin URI: https://wordpress.org/plugins/imagify/
5
  * Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
6
+ * Version: 1.9.10
7
  * Requires PHP: 5.4
8
  * Author: WP Media
9
  * Author URI: https://wp-media.me/
20
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
21
 
22
  // Imagify defines.
23
+ define( 'IMAGIFY_VERSION', '1.9.10' );
24
  define( 'IMAGIFY_SLUG', 'imagify' );
25
  define( 'IMAGIFY_FILE', __FILE__ );
26
  define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
inc/3rd-party/enable-media-replace/classes/Main.php CHANGED
@@ -1,89 +1,71 @@
1
  <?php
2
  namespace Imagify\ThirdParty\EnableMediaReplace;
3
 
 
 
 
 
4
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
5
 
6
  /**
7
  * Compat class for Enable Media Replace plugin.
8
  *
9
- * @since 1.6.9
10
- * @author Grégory Viguier
11
  */
12
- class Main extends \Imagify_Enable_Media_Replace_Deprecated {
13
- use \Imagify\Traits\InstanceGetterTrait;
14
-
15
- /**
16
- * Class version.
17
- *
18
- * @var string
19
- * @since 1.6.9
20
- * @author Grégory Viguier
21
- */
22
- const VERSION = '2.1';
23
 
24
  /**
25
  * The media ID.
26
  *
27
- * @var int
28
- * @since 1.9
29
- * @access protected
30
- * @author Grégory Viguier
31
  */
32
  protected $media_id;
33
 
34
  /**
35
  * The process instance for the current attachment.
36
  *
37
- * @var ProcessInterface
38
- * @since 1.9
39
- * @access protected
40
- * @author Grégory Viguier
41
  */
42
  protected $process;
43
 
44
  /**
45
  * The path to the old backup file.
46
  *
47
- * @var string
48
- * @since 1.6.9
49
- * @access protected
50
- * @author Grégory Viguier
51
  */
52
  protected $old_backup_path;
53
 
54
  /**
55
  * List of paths to the old webp files.
56
  *
57
- * @var array
58
- * @since 1.9.8
59
- * @access protected
60
- * @author Grégory Viguier
61
  */
62
  protected $old_webp_paths = [];
63
 
64
  /**
65
  * Launch the hooks before the files and data are replaced.
66
  *
67
- * @since 1.6.9
68
- * @author Grégory Viguier
69
  *
70
- * @param bool $unfiltered Whether to allow filters when retrieving the file path.
71
- * @return bool The same value.
72
  */
73
- public function init( $unfiltered = true ) {
74
- $this->media_id = (int) filter_input( INPUT_POST, 'ID' );
75
- $this->media_id = max( 0, $this->media_id );
76
-
77
- if ( ! $this->media_id || empty( $_FILES['userfile']['tmp_name'] ) ) {
78
- $this->media_id = 0;
79
- return $unfiltered;
80
- }
81
-
82
- $tmp_name = wp_unslash( $_FILES['userfile']['tmp_name'] );
83
 
84
- if ( ! is_uploaded_file( $tmp_name ) ) {
85
- $this->media_id = 0;
86
- return $unfiltered;
87
  }
88
 
89
  // Store the old backup file path.
@@ -91,23 +73,31 @@ class Main extends \Imagify_Enable_Media_Replace_Deprecated {
91
 
92
  if ( ! $this->process ) {
93
  $this->media_id = 0;
94
- return $unfiltered;
95
  }
96
 
97
  $this->old_backup_path = $this->process->get_media()->get_backup_path();
98
 
99
  if ( ! $this->old_backup_path ) {
100
  $this->media_id = 0;
101
- return $unfiltered;
102
  }
103
 
104
- // Store the old backup file path.
105
- add_filter( 'emr_unique_filename', [ $this, 'store_old_backup_path' ], 10, 3 );
106
- // Delete the old backup file.
 
 
 
 
 
 
 
 
 
 
107
  add_action( 'imagify_before_auto_optimization', [ $this, 'delete_backup' ] );
108
  add_action( 'imagify_not_optimized_attachment_updated', [ $this, 'delete_backup' ] );
109
-
110
- return $unfiltered;
111
  }
112
 
113
 
@@ -116,59 +106,10 @@ class Main extends \Imagify_Enable_Media_Replace_Deprecated {
116
  /** ----------------------------------------------------------------------------------------- */
117
 
118
  /**
119
- * When the user chooses to change the file name, store the old backup file path. This path will be used later to delete the file.
120
- *
121
- * @since 1.6.9
122
- * @access public
123
- * @author Grégory Viguier
124
- *
125
- * @param string $new_filename The new file name.
126
- * @param string $current_path The current file path.
127
- * @param int $post_id The attachment ID.
128
- * @return string The same file name.
129
- */
130
- public function store_old_backup_path( $new_filename, $current_path, $post_id ) {
131
- if ( ! $this->media_id || $post_id !== $this->media_id ) {
132
- return $new_filename;
133
- }
134
-
135
- $this->get_process();
136
-
137
- if ( ! $this->process ) {
138
- $this->media_id = 0;
139
- return $new_filename;
140
- }
141
-
142
- $media = $this->process->get_media();
143
- $backup_path = $media->get_backup_path();
144
-
145
- if ( $backup_path ) {
146
- $this->old_backup_path = $backup_path;
147
-
148
- // Keep track of existing webp files.
149
- $media_files = $media->get_media_files();
150
-
151
- if ( $media_files ) {
152
- foreach ( $media_files as $media_file ) {
153
- $this->old_webp_paths[] = imagify_path_to_webp( $media_file['path'] );
154
- }
155
- }
156
- } else {
157
- $this->media_id = 0;
158
- $this->old_backup_path = false;
159
- $this->old_webp_paths = [];
160
- }
161
-
162
- return $new_filename;
163
- }
164
-
165
- /**
166
- * Delete previous backup file. This is done after the images have been already replaced by Enable Media Replace.
167
- * It will prevent having a backup file not corresponding to the current images.
168
  *
169
- * @since 1.8.4
170
- * @access public
171
- * @author Grégory Viguier
172
  *
173
  * @param int $media_id The attachment ID.
174
  */
@@ -177,15 +118,16 @@ class Main extends \Imagify_Enable_Media_Replace_Deprecated {
177
  return;
178
  }
179
 
180
- $filesystem = \Imagify_Filesystem::get_instance();
181
 
182
  if ( $filesystem->exists( $this->old_backup_path ) ) {
 
183
  $filesystem->delete( $this->old_backup_path );
184
  $this->old_backup_path = false;
185
  }
186
 
187
- if ( $this->old_webp_paths ) {
188
- // If the files have been renamed, delete old webp files.
189
  $this->old_webp_paths = array_filter( $this->old_webp_paths, [ $filesystem, 'exists' ] );
190
  array_map( [ $filesystem, 'delete' ], $this->old_webp_paths );
191
  $this->old_webp_paths = [];
@@ -200,9 +142,7 @@ class Main extends \Imagify_Enable_Media_Replace_Deprecated {
200
  /**
201
  * Get the optimization process corresponding to the current media.
202
  *
203
- * @since 1.9
204
- * @author Grégory Viguier
205
- * @access protected
206
  *
207
  * @return ProcessInterface|bool False if invalid.
208
  */
1
  <?php
2
  namespace Imagify\ThirdParty\EnableMediaReplace;
3
 
4
+ use Imagify\Traits\InstanceGetterTrait;
5
+ use Imagify_Enable_Media_Replace_Deprecated;
6
+ use Imagify_Filesystem;
7
+
8
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
9
 
10
  /**
11
  * Compat class for Enable Media Replace plugin.
12
  *
13
+ * @since 1.6.9
 
14
  */
15
+ class Main extends Imagify_Enable_Media_Replace_Deprecated {
16
+ use InstanceGetterTrait;
 
 
 
 
 
 
 
 
 
17
 
18
  /**
19
  * The media ID.
20
  *
21
+ * @var int
22
+ * @since 1.9
 
 
23
  */
24
  protected $media_id;
25
 
26
  /**
27
  * The process instance for the current attachment.
28
  *
29
+ * @var ProcessInterface
30
+ * @since 1.9
 
 
31
  */
32
  protected $process;
33
 
34
  /**
35
  * The path to the old backup file.
36
  *
37
+ * @var string
38
+ * @since 1.6.9
 
 
39
  */
40
  protected $old_backup_path;
41
 
42
  /**
43
  * List of paths to the old webp files.
44
  *
45
+ * @var array
46
+ * @since 1.9.8
 
 
47
  */
48
  protected $old_webp_paths = [];
49
 
50
  /**
51
  * Launch the hooks before the files and data are replaced.
52
  *
53
+ * @since 1.6.9
54
+ * @since 1.9.10 The parameter changed from boolean to array. The method doesn’t return anything.
55
  *
56
+ * @param array $args An array containing the post ID.
 
57
  */
58
+ public function init( $args = [] ) {
59
+ if ( is_array( $args ) && ! empty( $args['post_id'] ) ) {
60
+ $this->media_id = $args['post_id'];
61
+ } else {
62
+ // Backward compatibility.
63
+ $this->media_id = (int) filter_input( INPUT_POST, 'ID' );
64
+ $this->media_id = max( 0, $this->media_id );
 
 
 
65
 
66
+ if ( ! $this->media_id ) {
67
+ return;
68
+ }
69
  }
70
 
71
  // Store the old backup file path.
73
 
74
  if ( ! $this->process ) {
75
  $this->media_id = 0;
76
+ return;
77
  }
78
 
79
  $this->old_backup_path = $this->process->get_media()->get_backup_path();
80
 
81
  if ( ! $this->old_backup_path ) {
82
  $this->media_id = 0;
83
+ return;
84
  }
85
 
86
+ /**
87
+ * Keep track of existing webp files.
88
+ *
89
+ * Whether the user chooses to rename the files or not, we will need to delete the current webp files before creating new ones:
90
+ * - Rename the files: the old ones must be removed, they are useless now.
91
+ * - Do not rename the files: the thumbnails may still get new names because of the suffix containing the image dimensions, which may differ (for example when thumbnails are scaled, not cropped).
92
+ * In this last case, the thumbnails with the old dimensions are removed from the drive and from the WP’s post meta, so there is no need of keeping orphan webp files that would stay on the drive for ever, even after the attachment is deleted from WP.
93
+ */
94
+ foreach ( $this->process->get_media()->get_media_files() as $media_file ) {
95
+ $this->old_webp_paths[] = imagify_path_to_webp( $media_file['path'] );
96
+ }
97
+
98
+ // Delete the old backup file and old webp files.
99
  add_action( 'imagify_before_auto_optimization', [ $this, 'delete_backup' ] );
100
  add_action( 'imagify_not_optimized_attachment_updated', [ $this, 'delete_backup' ] );
 
 
101
  }
102
 
103
 
106
  /** ----------------------------------------------------------------------------------------- */
107
 
108
  /**
109
+ * Delete previous backup file and webp files.
110
+ * This is done after the images have been already replaced by Enable Media Replace.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  *
112
+ * @since 1.8.4
 
 
113
  *
114
  * @param int $media_id The attachment ID.
115
  */
118
  return;
119
  }
120
 
121
+ $filesystem = Imagify_Filesystem::get_instance();
122
 
123
  if ( $filesystem->exists( $this->old_backup_path ) ) {
124
+ // Delete old backup file.
125
  $filesystem->delete( $this->old_backup_path );
126
  $this->old_backup_path = false;
127
  }
128
 
129
+ if ( ! empty( $this->old_webp_paths ) ) {
130
+ // Delete old webp files.
131
  $this->old_webp_paths = array_filter( $this->old_webp_paths, [ $filesystem, 'exists' ] );
132
  array_map( [ $filesystem, 'delete' ], $this->old_webp_paths );
133
  $this->old_webp_paths = [];
142
  /**
143
  * Get the optimization process corresponding to the current media.
144
  *
145
+ * @since 1.9
 
 
146
  *
147
  * @return ProcessInterface|bool False if invalid.
148
  */
inc/3rd-party/enable-media-replace/enable-media-replace.php CHANGED
@@ -5,6 +5,6 @@ if ( function_exists( 'enable_media_replace' ) || class_exists( '\\EnableMediaRe
5
 
6
  class_alias( '\\Imagify\\ThirdParty\\EnableMediaReplace\\Main', '\\Imagify_Enable_Media_Replace' );
7
 
8
- add_filter( 'emr_unfiltered_get_attached_file', [ \Imagify\ThirdParty\EnableMediaReplace\Main::get_instance(), 'init' ] );
9
 
10
  endif;
5
 
6
  class_alias( '\\Imagify\\ThirdParty\\EnableMediaReplace\\Main', '\\Imagify_Enable_Media_Replace' );
7
 
8
+ add_filter( 'wp_handle_replace', [ \Imagify\ThirdParty\EnableMediaReplace\Main::get_instance(), 'init' ] );
9
 
10
  endif;
inc/classes/class-imagify-auto-optimization.php CHANGED
@@ -1,95 +1,97 @@
1
  <?php
 
 
 
2
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
 
4
  /**
5
  * Class that handles the auto-optimization process.
6
  * This occurs when a new image is uploaded, and when an optimized image is worked with (resized, etc).
7
- * The process will work only if wp_update_attachment_metadata() is used.
8
  *
9
- * @since 1.8.4
10
- * @author Grégory Viguier
11
  */
12
- class Imagify_Auto_Optimization {
13
- use \Imagify\Traits\InstanceGetterTrait;
14
 
15
  /**
16
- * An array containing the IDs (as keys) of attachments just being uploaded.
17
- *
18
- * @var array
19
- * @since 1.8.4
20
- * @access protected
21
- * @author Grégory Viguier
 
 
 
 
 
 
 
 
22
  */
23
- protected $uploads = [];
24
 
25
  /**
26
- * An array containing the IDs (as keys) of attachments that must be optimized automatically.
27
- * The values tell if the attachment is a new upload.
28
  *
29
- * @var array
30
- * @since 1.8.4
31
- * @access protected
32
- * @author Grégory Viguier
33
  */
34
- protected $attachments = [];
35
 
36
  /**
37
  * The ID of the attachment that failed to be uploaded.
38
  *
39
- * @var int
40
- * @since 1.9.8
41
- * @access protected
42
- * @author Grégory Viguier
43
  */
44
  protected $upload_failure_id = 0;
45
 
46
  /**
47
  * Used to prevent an auto-optimization locally.
48
  *
49
- * @var array
50
- * @since 1.8.4
51
- * @access private
52
- * @author Grégory Viguier
53
  */
54
  private static $prevented = [];
55
 
56
  /**
57
  * Used to prevent an auto-optimization internally.
58
  *
59
- * @var array
60
- * @since 1.9.8
61
- * @access private
62
- * @author Grégory Viguier
63
  */
64
  private static $prevented_internally = [];
65
 
66
  /**
67
  * Init.
68
  *
69
- * @since 1.8.4
70
- * @access public
71
- * @author Grégory Viguier
72
  */
73
  public function init() {
74
  global $wp_version;
75
- $prio = IMAGIFY_INT_MAX - 30;
 
 
76
 
77
  // Automatic optimization tunel.
78
- add_action( 'add_attachment', [ $this, 'store_upload_ids' ], $prio );
79
- add_filter( 'wp_update_attachment_metadata', [ $this, 'store_ids_to_optimize' ], $prio, 2 );
80
- add_action( 'updated_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $prio, 4 );
81
- add_action( 'added_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $prio, 4 );
82
- add_action( 'deleted_post_meta', [ $this, 'unset_optimization' ], $prio, 3 );
83
 
84
- if ( version_compare( $wp_version, '5.3-alpha1' ) >= 0 ) {
85
  // WP 5.3+.
86
- add_filter( 'big_image_size_threshold', [ $this, 'prevent_auto_optimization_when_generating_thumbnails' ], $prio, 4 );
87
- add_filter( 'wp_generate_attachment_metadata', [ $this, 'allow_auto_optimization_when_generating_thumbnails' ], $prio, 3 );
88
- add_action( 'imagify_after_auto_optimization_init', [ $this, 'do_auto_optimization' ], $prio, 2 );
89
  // Upload failure recovering.
90
- add_action( 'wp_ajax_media-create-image-subsizes', [ $this, 'prevent_auto_optimization_when_recovering_from_upload_failure' ], -5 ); // Before WP’s hook (priority 1).
 
 
 
91
  }
92
 
 
 
93
  // Prevent to re-optimize when updating the image width and height (when resizing the full image).
94
  add_action( 'imagify_before_update_wp_media_data_dimensions', [ __CLASS__, 'prevent_optimization' ], 5 );
95
  add_action( 'imagify_after_update_wp_media_data_dimensions', [ __CLASS__, 'allow_optimization' ], 5 );
@@ -98,29 +100,28 @@ class Imagify_Auto_Optimization {
98
  /**
99
  * Remove the hooks.
100
  *
101
- * @since 1.8.4
102
- * @access public
103
- * @author Grégory Viguier
104
  */
105
  public function remove_hooks() {
106
- $prio = IMAGIFY_INT_MAX - 30;
107
 
108
  // Automatic optimization tunel.
109
- remove_action( 'add_attachment', [ $this, 'store_upload_ids' ], $prio );
110
- remove_filter( 'wp_update_attachment_metadata', [ $this, 'store_ids_to_optimize' ], $prio );
111
- remove_action( 'updated_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $prio );
112
- remove_action( 'added_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $prio );
113
- remove_action( 'deleted_post_meta', [ $this, 'unset_optimization' ], $prio );
114
 
115
- if ( version_compare( $wp_version, '5.3-alpha1' ) >= 0 ) {
116
  // WP 5.3+.
117
- remove_filter( 'big_image_size_threshold', [ $this, 'prevent_auto_optimization_when_generating_thumbnails' ], $prio );
118
- remove_filter( 'wp_generate_attachment_metadata', [ $this, 'allow_auto_optimization_when_generating_thumbnails' ], $prio );
119
- remove_action( 'imagify_after_auto_optimization_init', [ $this, 'do_auto_optimization' ], $prio );
120
- // Upload failure handling.
121
- remove_action( 'wp_ajax_media_create_image_subsizes', [ $this, 'prevent_auto_optimization_when_recovering_from_upload_failure' ], -5 );
 
122
  }
123
 
 
 
124
  // Prevent to re-optimize when updating the image width and height (when resizing the full image).
125
  remove_action( 'imagify_before_update_wp_media_data_dimensions', [ __CLASS__, 'prevent_optimization' ], 5 );
126
  remove_action( 'imagify_after_update_wp_media_data_dimensions', [ __CLASS__, 'allow_optimization' ], 5 );
@@ -132,32 +133,50 @@ class Imagify_Auto_Optimization {
132
  /** ----------------------------------------------------------------------------------------- */
133
 
134
  /**
135
- * Store the ID of attachments that just have been uploaded.
136
- * We use those IDs to tell the difference later in `wp_update_attachment_metadata()`.
137
  *
138
- * @since 1.8.4
139
- * @access public
140
- * @see $this->store_ids_to_optimize()
141
- * @author Grégory Viguier
142
  *
143
  * @param int $attachment_id Current attachment ID.
144
  */
145
  public function store_upload_ids( $attachment_id ) {
146
  if ( ! self::is_optimization_prevented( $attachment_id ) && imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
147
- $this->uploads[ $attachment_id ] = 1;
148
  }
149
  }
150
 
151
  /**
152
- * After the attachment meta data has been generated, launch an async optimization.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  * Two cases are possible to trigger the optimization:
154
  * - It's a new upload and auto-optimization is enabled.
155
  * - It's not a new upload (it is regenerated) and the attachment is already optimized.
156
  *
157
- * @since 1.8.4
158
- * @access public
159
- * @see $this->store_upload_ids()
160
- * @author Grégory Viguier
161
  *
162
  * @param array $metadata An array of attachment meta data.
163
  * @param int $attachment_id Current attachment ID.
@@ -170,13 +189,17 @@ class Imagify_Auto_Optimization {
170
  return $metadata;
171
  }
172
 
173
- $is_new_upload = ! empty( $this->uploads[ $attachment_id ] );
174
- unset( $this->uploads[ $attachment_id ] );
 
 
175
 
176
- if ( ! $metadata || ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
177
  return $metadata;
178
  }
179
 
 
 
180
  if ( $is_new_upload ) {
181
  // It's a new upload.
182
  if ( ! isset( $auto_optimize ) ) {
@@ -187,8 +210,7 @@ class Imagify_Auto_Optimization {
187
  /**
188
  * Fires when a new attachment is uploaded but auto-optimization is disabled.
189
  *
190
- * @since 1.8.4
191
- * @author Grégory Viguier
192
  *
193
  * @param int $attachment_id Attachment ID.
194
  * @param array $metadata An array of attachment meta data.
@@ -201,8 +223,7 @@ class Imagify_Auto_Optimization {
201
  /**
202
  * Allow to prevent automatic optimization for a specific attachment.
203
  *
204
- * @since 1.6.12
205
- * @author Grégory Viguier
206
  *
207
  * @param bool $optimize True to optimize, false otherwise.
208
  * @param int $attachment_id Attachment ID.
@@ -232,8 +253,7 @@ class Imagify_Auto_Optimization {
232
  /**
233
  * Fires when an attachment is updated but not optimized yet.
234
  *
235
- * @since 1.8.4
236
- * @author Grégory Viguier
237
  *
238
  * @param int $attachment_id Attachment ID.
239
  * @param array $metadata An array of attachment meta data.
@@ -246,8 +266,7 @@ class Imagify_Auto_Optimization {
246
  /**
247
  * Allow to prevent automatic reoptimization for a specific attachment.
248
  *
249
- * @since 1.8.4
250
- * @author Grégory Viguier
251
  *
252
  * @param bool $optimize True to optimize, false otherwise.
253
  * @param int $attachment_id Attachment ID.
@@ -265,13 +284,12 @@ class Imagify_Auto_Optimization {
265
  }
266
 
267
  // Ready for the next step.
268
- $this->attachments[ $attachment_id ] = $is_new_upload;
269
 
270
  /**
271
  * Triggered after a media auto-optimization init.
272
  *
273
- * @since 1.9.8
274
- * @author Grégory Viguier
275
  *
276
  * @param int $attachment_id The media ID.
277
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
@@ -284,10 +302,8 @@ class Imagify_Auto_Optimization {
284
  /**
285
  * Launch auto optimization immediately after the post meta '_wp_attachment_metadata' is added or updated.
286
  *
287
- * @since 1.9
288
- * @since 1.9 Previously named do_auto_optimization().
289
- * @access public
290
- * @author Grégory Viguier
291
  *
292
  * @param int $meta_id ID of the metadata entry.
293
  * @param int $attachment_id Current attachment ID.
@@ -299,39 +315,35 @@ class Imagify_Auto_Optimization {
299
  return;
300
  }
301
 
302
- if ( ! isset( $this->attachments[ $attachment_id ] ) ) {
303
  return;
304
  }
305
 
306
- if ( self::is_optimization_prevented( $attachment_id ) ) {
307
  return;
308
  }
309
 
310
- $is_new_upload = $this->attachments[ $attachment_id ];
311
- unset( $this->attachments[ $attachment_id ] );
312
-
313
- $this->do_auto_optimization( $attachment_id, $is_new_upload );
314
  }
315
 
316
  /**
317
  * Launch auto optimization immediately after the post meta '_wp_attachment_metadata' is added or updated.
318
  *
319
- * @since 1.8.4
320
- * @since 1.9.8 Changed signature.
321
- * @access public
322
- * @author Grégory Viguier
323
  *
324
  * @param int $attachment_id The media ID.
325
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
326
  */
327
  public function do_auto_optimization( $attachment_id, $is_new_upload ) {
 
 
328
  $process = imagify_get_optimization_process( $attachment_id, 'wp' );
329
 
330
  /**
331
  * Fires before an attachment auto-optimization is triggered.
332
  *
333
- * @since 1.8.4
334
- * @author Grégory Viguier
335
  *
336
  * @param int $attachment_id The attachment ID.
337
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
@@ -341,8 +353,7 @@ class Imagify_Auto_Optimization {
341
  /**
342
  * Triggered before a media is auto-optimized.
343
  *
344
- * @since 1.8.4
345
- * @author Grégory Viguier
346
  *
347
  * @param int $attachment_id The media ID.
348
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
@@ -391,8 +402,7 @@ class Imagify_Auto_Optimization {
391
  /**
392
  * Triggered after a media auto-optimization is launched.
393
  *
394
- * @since 1.8.4
395
- * @author Grégory Viguier
396
  *
397
  * @param int $attachment_id The media ID.
398
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
@@ -403,68 +413,18 @@ class Imagify_Auto_Optimization {
403
  /**
404
  * Remove the attachment ID from the $attachments property if the post meta '_wp_attachment_metadata' is deleted.
405
  *
406
- * @since 1.8.4
407
- * @access public
408
- * @author Grégory Viguier
409
  *
410
  * @param int $meta_ids An array of deleted metadata entry IDs.
411
  * @param int $attachment_id Current attachment ID.
412
  * @param string $meta_key Meta key.
413
  */
414
  public function unset_optimization( $meta_ids, $attachment_id, $meta_key ) {
415
- if ( '_wp_attachment_metadata' !== $meta_key || ! isset( $this->attachments[ $attachment_id ] ) ) {
416
  return;
417
  }
418
 
419
- unset( $this->attachments[ $attachment_id ] );
420
- }
421
-
422
-
423
- /** ----------------------------------------------------------------------------------------- */
424
- /** WP 5.3+ HOOKS =========================================================================== */
425
- /** ----------------------------------------------------------------------------------------- */
426
-
427
- /**
428
- * With WP 5.3+, prevent auto-optimization inside wp_generate_attachment_metadata() because it triggers a wp_update_attachment_metadata() for each thumbnail size.
429
- *
430
- * @since 1.9.8
431
- * @access public
432
- * @see wp_generate_attachment_metadata()
433
- * @see wp_create_image_subsizes()
434
- * @author Grégory Viguier
435
- *
436
- * @param int $threshold The threshold value in pixels. Default 2560.
437
- * @param array $imagesize Indexed array of the image width and height (in that order).
438
- * @param string $file Full path to the uploaded image file.
439
- * @param int $attachment_id Attachment post ID.
440
- * @return int The threshold value in pixels.
441
- */
442
- public function prevent_auto_optimization_when_generating_thumbnails( $threshold, $imagesize, $file, $attachment_id ) {
443
- static::prevent_optimization_internally( $attachment_id );
444
- return $threshold;
445
- }
446
-
447
- /**
448
- * With WP 5.3+, allow auto-optimization back after wp_generate_attachment_metadata().
449
- *
450
- * @since 1.9.8
451
- * @access public
452
- * @see $this->prevent_auto_optimization_when_generating_thumbnails()
453
- * @author Grégory Viguier
454
- *
455
- * @param array $metadata An array of attachment meta data.
456
- * @param int $attachment_id Current attachment ID.
457
- * @param string $context Additional context. Can be 'create' when metadata was initially created for new attachment or 'update' when the metadata was updated.
458
- * @return array An array of attachment meta data.
459
- */
460
- public function allow_auto_optimization_when_generating_thumbnails( $metadata, $attachment_id, $context = null ) {
461
- if ( ! empty( $context ) && 'create' !== $context ) {
462
- return $metadata;
463
- }
464
-
465
- // Fired from wp_generate_attachment_metadata(): $context is empty (WP < 5.3) or equal to 'create' (>P >= 5.3).
466
- static::allow_optimization_internally( $attachment_id );
467
- return $metadata;
468
  }
469
 
470
 
@@ -475,11 +435,9 @@ class Imagify_Auto_Optimization {
475
  /**
476
  * With WP 5.3+, prevent auto-optimization when WP tries to create thumbnails after an upload error, because it triggers wp_update_attachment_metadata() for each thumbnail size.
477
  *
478
- * @since 1.9.8
479
- * @access public
480
- * @see wp_ajax_media_create_image_subsizes()
481
- * @see wp_update_image_subsizes()
482
- * @author Grégory Viguier
483
  */
484
  public function prevent_auto_optimization_when_recovering_from_upload_failure() {
485
  if ( ! check_ajax_referer( 'media-form', false, false ) ) {
@@ -496,7 +454,7 @@ class Imagify_Auto_Optimization {
496
 
497
  $attachment_id = ! empty( $_POST['attachment_id'] ) ? (int) $_POST['attachment_id'] : 0;
498
 
499
- if ( ! $attachment_id ) {
500
  return;
501
  }
502
 
@@ -506,8 +464,6 @@ class Imagify_Auto_Optimization {
506
 
507
  $this->upload_failure_id = $attachment_id;
508
 
509
- static::prevent_optimization_internally( $attachment_id );
510
-
511
  // Auto-optimization will be done on shutdown.
512
  ob_start( [ $this, 'maybe_do_auto_optimization_after_recovering_from_upload_failure' ] );
513
  }
@@ -515,10 +471,8 @@ class Imagify_Auto_Optimization {
515
  /**
516
  * Maybe launch auto-optimization after recovering from an upload failure, when all thumbnails are created.
517
  *
518
- * @since 1.9.8
519
- * @access public
520
- * @see wp_ajax_media_create_image_subsizes()
521
- * @author Grégory Viguier
522
  *
523
  * @param string $content Buffer’s content.
524
  * @return string Buffer’s content.
@@ -528,7 +482,7 @@ class Imagify_Auto_Optimization {
528
  return $content;
529
  }
530
 
531
- if ( ! $this->upload_failure_id ) {
532
  // Uh?
533
  return $content;
534
  }
@@ -546,12 +500,9 @@ class Imagify_Auto_Optimization {
546
  $attachment_id = $this->upload_failure_id;
547
  $metadata = wp_get_attachment_metadata( $attachment_id );
548
 
549
- $this->upload_failure_id = 0;
550
- $this->uploads[ $attachment_id ] = 1; // New upload.
551
-
552
- static::allow_optimization_internally( $attachment_id );
553
-
554
  // Launch the process.
 
 
555
  $this->store_ids_to_optimize( $metadata, $attachment_id );
556
 
557
  return $content;
@@ -562,6 +513,66 @@ class Imagify_Auto_Optimization {
562
  /** TOOLS =================================================================================== */
563
  /** ----------------------------------------------------------------------------------------- */
564
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
565
  /**
566
  * Prevent an auto-optimization locally.
567
  * How to use it:
@@ -569,10 +580,8 @@ class Imagify_Auto_Optimization {
569
  * wp_update_attachment_metadata( $attachment_id );
570
  * Imagify_Auto_Optimization::allow_optimization( $attachment_id );
571
  *
572
- * @since 1.8.4
573
- * @since 1.9.8 Prevents/Allows can stack.
574
- * @access public
575
- * @author Grégory Viguier
576
  *
577
  * @param int $attachment_id Current attachment ID.
578
  */
@@ -591,10 +600,8 @@ class Imagify_Auto_Optimization {
591
  * wp_update_attachment_metadata( $attachment_id );
592
  * Imagify_Auto_Optimization::allow_optimization( $attachment_id );
593
  *
594
- * @since 1.8.4
595
- * @since 1.9.8 Prevents/Allows can stack.
596
- * @access public
597
- * @author Grégory Viguier
598
  *
599
  * @param int $attachment_id Current attachment ID.
600
  */
@@ -612,9 +619,7 @@ class Imagify_Auto_Optimization {
612
  /**
613
  * Tell if an auto-optimization is prevented locally.
614
  *
615
- * @since 1.8.4
616
- * @access public
617
- * @author Grégory Viguier
618
  *
619
  * @param int $attachment_id Current attachment ID.
620
  * @return bool
@@ -626,9 +631,7 @@ class Imagify_Auto_Optimization {
626
  /**
627
  * Prevent an auto-optimization internally.
628
  *
629
- * @since 1.9.8
630
- * @access protected
631
- * @author Grégory Viguier
632
  *
633
  * @param int $attachment_id Current attachment ID.
634
  */
@@ -639,9 +642,7 @@ class Imagify_Auto_Optimization {
639
  /**
640
  * Allow an auto-optimization internally.
641
  *
642
- * @since 1.9.8
643
- * @access protected
644
- * @author Grégory Viguier
645
  *
646
  * @param int $attachment_id Current attachment ID.
647
  */
1
  <?php
2
+
3
+ use Imagify\Traits\InstanceGetterTrait;
4
+
5
  defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
6
 
7
  /**
8
  * Class that handles the auto-optimization process.
9
  * This occurs when a new image is uploaded, and when an optimized image is worked with (resized, etc).
10
+ * The process will work only if wp_generate_attachment_metadata() and wp_update_attachment_metadata() are used.
11
  *
12
+ * @since 1.8.4
 
13
  */
14
+ class Imagify_Auto_Optimization extends Imagify_Auto_Optimization_Deprecated {
15
+ use InstanceGetterTrait;
16
 
17
  /**
18
+ * An array containing all the "steps" an attachment is going through.
19
+ * This is used to decide the behavior of the automatic optimization.
20
+ *
21
+ * @var array {
22
+ * An array of arrays with attachment ID as keys.
23
+ * Each array can contain the following:
24
+ *
25
+ * @type $upload int Set to 1 if the attachment is a new upload.
26
+ * @type $generate int Set to 1 when going though wp_generate_attachment_metadata().
27
+ * @type $update int Set to 1 when going though wp_update_attachment_metadata().
28
+ * }
29
+ * @since 1.8.4
30
+ * @since 1.9.10 Private.
31
+ * @since 1.9.10 Items are arrays instead of 1s.
32
  */
33
+ private $attachments = [];
34
 
35
  /**
36
+ * Tell if we’re using WP 5.3+.
 
37
  *
38
+ * @var bool
39
+ * @since 1.9.10
 
 
40
  */
41
+ private $is_wp_53;
42
 
43
  /**
44
  * The ID of the attachment that failed to be uploaded.
45
  *
46
+ * @var int
47
+ * @since 1.9.8
 
 
48
  */
49
  protected $upload_failure_id = 0;
50
 
51
  /**
52
  * Used to prevent an auto-optimization locally.
53
  *
54
+ * @var array
55
+ * @since 1.8.4
 
 
56
  */
57
  private static $prevented = [];
58
 
59
  /**
60
  * Used to prevent an auto-optimization internally.
61
  *
62
+ * @var array
63
+ * @since 1.9.8
 
 
64
  */
65
  private static $prevented_internally = [];
66
 
67
  /**
68
  * Init.
69
  *
70
+ * @since 1.8.4
 
 
71
  */
72
  public function init() {
73
  global $wp_version;
74
+
75
+ $priority = IMAGIFY_INT_MAX - 30;
76
+ $this->is_wp_53 = version_compare( $wp_version, '5.3-alpha1' ) >= 0;
77
 
78
  // Automatic optimization tunel.
79
+ add_action( 'add_attachment', [ $this, 'store_upload_ids' ], $priority );
80
+ add_filter( 'wp_generate_attachment_metadata', [ $this, 'maybe_store_generate_step' ], $priority, 2 );
81
+ add_filter( 'wp_update_attachment_metadata', [ $this, 'store_ids_to_optimize' ], $priority, 2 );
 
 
82
 
83
+ if ( $this->is_wp_53 ) {
84
  // WP 5.3+.
85
+ add_action( 'imagify_after_auto_optimization_init', [ $this, 'do_auto_optimization' ], $priority, 2 );
 
 
86
  // Upload failure recovering.
87
+ add_action( 'wp_ajax_media-create-image-subsizes', [ $this, 'prevent_auto_optimization_when_recovering_from_upload_failure' ], -5 ); // Before WP’s hook (priority 1).
88
+ } else {
89
+ add_action( 'updated_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $priority, 4 );
90
+ add_action( 'added_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $priority, 4 );
91
  }
92
 
93
+ add_action( 'deleted_post_meta', [ $this, 'unset_optimization' ], $priority, 3 );
94
+
95
  // Prevent to re-optimize when updating the image width and height (when resizing the full image).
96
  add_action( 'imagify_before_update_wp_media_data_dimensions', [ __CLASS__, 'prevent_optimization' ], 5 );
97
  add_action( 'imagify_after_update_wp_media_data_dimensions', [ __CLASS__, 'allow_optimization' ], 5 );
100
  /**
101
  * Remove the hooks.
102
  *
103
+ * @since 1.8.4
 
 
104
  */
105
  public function remove_hooks() {
106
+ $priority = IMAGIFY_INT_MAX - 30;
107
 
108
  // Automatic optimization tunel.
109
+ remove_action( 'add_attachment', [ $this, 'store_upload_ids' ], $priority );
110
+ remove_filter( 'wp_generate_attachment_metadata', [ $this, 'maybe_store_generate_step' ], $priority );
111
+ remove_filter( 'wp_update_attachment_metadata', [ $this, 'store_ids_to_optimize' ], $priority );
 
 
112
 
113
+ if ( $this->is_wp_53 ) {
114
  // WP 5.3+.
115
+ remove_action( 'imagify_after_auto_optimization_init', [ $this, 'do_auto_optimization' ], $priority );
116
+ // Upload failure recovering.
117
+ remove_action( 'wp_ajax_media-create-image-subsizes', [ $this, 'prevent_auto_optimization_when_recovering_from_upload_failure' ], -5 );
118
+ } else {
119
+ remove_action( 'updated_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $priority );
120
+ remove_action( 'added_post_meta', [ $this, 'do_auto_optimization_after_meta_update' ], $priority );
121
  }
122
 
123
+ remove_action( 'deleted_post_meta', [ $this, 'unset_optimization' ], $priority );
124
+
125
  // Prevent to re-optimize when updating the image width and height (when resizing the full image).
126
  remove_action( 'imagify_before_update_wp_media_data_dimensions', [ __CLASS__, 'prevent_optimization' ], 5 );
127
  remove_action( 'imagify_after_update_wp_media_data_dimensions', [ __CLASS__, 'allow_optimization' ], 5 );
133
  /** ----------------------------------------------------------------------------------------- */
134
 
135
  /**
136
+ * Store the "upload step" when an attachment has just been uploaded.
 
137
  *
138
+ * @since 1.8.4
139
+ * @see $this->store_ids_to_optimize()
 
 
140
  *
141
  * @param int $attachment_id Current attachment ID.
142
  */
143
  public function store_upload_ids( $attachment_id ) {
144
  if ( ! self::is_optimization_prevented( $attachment_id ) && imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
145
+ $this->set_step( $attachment_id, 'upload' );
146
  }
147
  }
148
 
149
  /**
150
+ * Store the "generate step" when wp_generate_attachment_metadata() is used.
151
+ *
152
+ * @since 1.9.10
153
+ *
154
+ * @param array $metadata An array of attachment meta data.
155
+ * @param int $attachment_id Current attachment ID.
156
+ * @return array
157
+ */
158
+ public function maybe_store_generate_step( $metadata, $attachment_id ) {
159
+ if ( self::is_optimization_prevented( $attachment_id ) ) {
160
+ return $metadata;
161
+ }
162
+
163
+ if ( empty( $metadata ) || ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
164
+ $this->unset_steps( $attachment_id );
165
+ return $metadata;
166
+ }
167
+
168
+ $this->set_step( $attachment_id, 'generate' );
169
+
170
+ return $metadata;
171
+ }
172
+
173
+ /**
174
+ * After the attachment meta data has been generated (partially, since WP 5.3), init the auto-optimization.
175
  * Two cases are possible to trigger the optimization:
176
  * - It's a new upload and auto-optimization is enabled.
177
  * - It's not a new upload (it is regenerated) and the attachment is already optimized.
178
  *
179
+ * @since 1.8.4
 
 
 
180
  *
181
  * @param array $metadata An array of attachment meta data.
182
  * @param int $attachment_id Current attachment ID.
189
  return $metadata;
190
  }
191
 
192
+ if ( empty( $metadata ) || ! imagify_is_attachment_mime_type_supported( $attachment_id ) ) {
193
+ $this->unset_steps( $attachment_id );
194
+ return $metadata;
195
+ }
196
 
197
+ if ( ! $this->has_step( $attachment_id, 'generate' ) ) {
198
  return $metadata;
199
  }
200
 
201
+ $is_new_upload = $this->has_step( $attachment_id, 'upload' );
202
+
203
  if ( $is_new_upload ) {
204
  // It's a new upload.
205
  if ( ! isset( $auto_optimize ) ) {
210
  /**
211
  * Fires when a new attachment is uploaded but auto-optimization is disabled.
212
  *
213
+ * @since 1.8.4
 
214
  *
215
  * @param int $attachment_id Attachment ID.
216
  * @param array $metadata An array of attachment meta data.
223
  /**
224
  * Allow to prevent automatic optimization for a specific attachment.
225
  *
226
+ * @since 1.6.12
 
227
  *
228
  * @param bool $optimize True to optimize, false otherwise.
229
  * @param int $attachment_id Attachment ID.
253
  /**
254
  * Fires when an attachment is updated but not optimized yet.
255
  *
256
+ * @since 1.8.4
 
257
  *
258
  * @param int $attachment_id Attachment ID.
259
  * @param array $metadata An array of attachment meta data.
266
  /**
267
  * Allow to prevent automatic reoptimization for a specific attachment.
268
  *
269
+ * @since 1.8.4
 
270
  *
271
  * @param bool $optimize True to optimize, false otherwise.
272
  * @param int $attachment_id Attachment ID.
284
  }
285
 
286
  // Ready for the next step.
287
+ $this->set_step( $attachment_id, 'update' );
288
 
289
  /**
290
  * Triggered after a media auto-optimization init.
291
  *
292
+ * @since 1.9.8
 
293
  *
294
  * @param int $attachment_id The media ID.
295
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
302
  /**
303
  * Launch auto optimization immediately after the post meta '_wp_attachment_metadata' is added or updated.
304
  *
305
+ * @since 1.9
306
+ * @since 1.9 Previously named do_auto_optimization().
 
 
307
  *
308
  * @param int $meta_id ID of the metadata entry.
309
  * @param int $attachment_id Current attachment ID.
315
  return;
316
  }
317
 
318
+ if ( self::is_optimization_prevented( $attachment_id ) ) {
319
  return;
320
  }
321
 
322
+ if ( ! $this->has_step( $attachment_id, 'update' ) ) {
323
  return;
324
  }
325
 
326
+ $this->do_auto_optimization( $attachment_id, $this->has_step( $attachment_id, 'upload' ) );
 
 
 
327
  }
328
 
329
  /**
330
  * Launch auto optimization immediately after the post meta '_wp_attachment_metadata' is added or updated.
331
  *
332
+ * @since 1.8.4
333
+ * @since 1.9.8 Changed signature.
 
 
334
  *
335
  * @param int $attachment_id The media ID.
336
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
337
  */
338
  public function do_auto_optimization( $attachment_id, $is_new_upload ) {
339
+ $this->unset_steps( $attachment_id );
340
+
341
  $process = imagify_get_optimization_process( $attachment_id, 'wp' );
342
 
343
  /**
344
  * Fires before an attachment auto-optimization is triggered.
345
  *
346
+ * @since 1.8.4
 
347
  *
348
  * @param int $attachment_id The attachment ID.
349
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
353
  /**
354
  * Triggered before a media is auto-optimized.
355
  *
356
+ * @since 1.8.4
 
357
  *
358
  * @param int $attachment_id The media ID.
359
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
402
  /**
403
  * Triggered after a media auto-optimization is launched.
404
  *
405
+ * @since 1.8.4
 
406
  *
407
  * @param int $attachment_id The media ID.
408
  * @param bool $is_new_upload True if it's a new upload. False otherwize.
413
  /**
414
  * Remove the attachment ID from the $attachments property if the post meta '_wp_attachment_metadata' is deleted.
415
  *
416
+ * @since 1.8.4
 
 
417
  *
418
  * @param int $meta_ids An array of deleted metadata entry IDs.
419
  * @param int $attachment_id Current attachment ID.
420
  * @param string $meta_key Meta key.
421
  */
422
  public function unset_optimization( $meta_ids, $attachment_id, $meta_key ) {
423
+ if ( '_wp_attachment_metadata' !== $meta_key ) {
424
  return;
425
  }
426
 
427
+ $this->unset_steps( $attachment_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  }
429
 
430
 
435
  /**
436
  * With WP 5.3+, prevent auto-optimization when WP tries to create thumbnails after an upload error, because it triggers wp_update_attachment_metadata() for each thumbnail size.
437
  *
438
+ * @since 1.9.8
439
+ * @see wp_ajax_media_create_image_subsizes()
440
+ * @see wp_update_image_subsizes()
 
 
441
  */
442
  public function prevent_auto_optimization_when_recovering_from_upload_failure() {
443
  if ( ! check_ajax_referer( 'media-form', false, false ) ) {
454
 
455
  $attachment_id = ! empty( $_POST['attachment_id'] ) ? (int) $_POST['attachment_id'] : 0;
456
 
457
+ if ( empty( $attachment_id ) ) {
458
  return;
459
  }
460
 
464
 
465
  $this->upload_failure_id = $attachment_id;
466
 
 
 
467
  // Auto-optimization will be done on shutdown.
468
  ob_start( [ $this, 'maybe_do_auto_optimization_after_recovering_from_upload_failure' ] );
469
  }
471
  /**
472
  * Maybe launch auto-optimization after recovering from an upload failure, when all thumbnails are created.
473
  *
474
+ * @since 1.9.8
475
+ * @see wp_ajax_media_create_image_subsizes()
 
 
476
  *
477
  * @param string $content Buffer’s content.
478
  * @return string Buffer’s content.
482
  return $content;
483
  }
484
 
485
+ if ( empty( $this->upload_failure_id ) ) {
486
  // Uh?
487
  return $content;
488
  }
500
  $attachment_id = $this->upload_failure_id;
501
  $metadata = wp_get_attachment_metadata( $attachment_id );
502
 
 
 
 
 
 
503
  // Launch the process.
504
+ $this->upload_failure_id = 0;
505
+ $this->set_step( $attachment_id, 'generate' );
506
  $this->store_ids_to_optimize( $metadata, $attachment_id );
507
 
508
  return $content;
513
  /** TOOLS =================================================================================== */
514
  /** ----------------------------------------------------------------------------------------- */
515
 
516
+ /**
517
+ * Set a "step" for an attachment.
518
+ *
519
+ * @since 1.9.10
520
+ * @see $this->attachments
521
+ *
522
+ * @param int $attachment_id Current attachment ID.
523
+ * @param string $step The step to add.
524
+ */
525
+ public function set_step( $attachment_id, $step ) {
526
+ if ( empty( $this->attachments[ $attachment_id ] ) ) {
527
+ $this->attachments[ $attachment_id ] = [];
528
+ }
529
+
530
+ $this->attachments[ $attachment_id ][ $step ] = 1;
531
+ }
532
+
533
+ /**
534
+ * Unset a "step" for an attachment.
535
+ *
536
+ * @since 1.9.10
537
+ * @see $this->attachments
538
+ *
539
+ * @param int $attachment_id Current attachment ID.
540
+ * @param string $step The step to add.
541
+ */
542
+ public function unset_step( $attachment_id, $step ) {
543
+ unset( $this->attachments[ $attachment_id ][ $step ] );
544
+
545
+ if ( empty( $this->attachments[ $attachment_id ] ) ) {
546
+ $this->unset_steps( $attachment_id );
547
+ }
548
+ }
549
+
550
+ /**
551
+ * Unset all "steps" for an attachment.
552
+ *
553
+ * @since 1.9.10
554
+ * @see $this->attachments
555
+ *
556
+ * @param int $attachment_id Current attachment ID.
557
+ */
558
+ public function unset_steps( $attachment_id ) {
559
+ unset( $this->attachments[ $attachment_id ] );
560
+ }
561
+
562
+ /**
563
+ * Tell if a "step" for an attachment exists.
564
+ *
565
+ * @since 1.9.10
566
+ * @see $this->attachments
567
+ *
568
+ * @param int $attachment_id Current attachment ID.
569
+ * @param string $step The step to add.
570
+ * @return bool
571
+ */
572
+ public function has_step( $attachment_id, $step ) {
573
+ return ! empty( $this->attachments[ $attachment_id ][ $step ] );
574
+ }
575
+
576
  /**
577
  * Prevent an auto-optimization locally.
578
  * How to use it:
580
  * wp_update_attachment_metadata( $attachment_id );
581
  * Imagify_Auto_Optimization::allow_optimization( $attachment_id );
582
  *
583
+ * @since 1.8.4
584
+ * @since 1.9.8 Prevents/Allows can stack.
 
 
585
  *
586
  * @param int $attachment_id Current attachment ID.
587
  */
600
  * wp_update_attachment_metadata( $attachment_id );
601
  * Imagify_Auto_Optimization::allow_optimization( $attachment_id );
602
  *
603
+ * @since 1.8.4
604
+ * @since 1.9.8 Prevents/Allows can stack.
 
 
605
  *
606
  * @param int $attachment_id Current attachment ID.
607
  */
619
  /**
620
  * Tell if an auto-optimization is prevented locally.
621
  *
622
+ * @since 1.8.4
 
 
623
  *
624
  * @param int $attachment_id Current attachment ID.
625
  * @return bool
631
  /**
632
  * Prevent an auto-optimization internally.
633
  *
634
+ * @since 1.9.8
 
 
635
  *
636
  * @param int $attachment_id Current attachment ID.
637
  */
642
  /**
643
  * Allow an auto-optimization internally.
644
  *
645
+ * @since 1.9.8
 
 
646
  *
647
  * @param int $attachment_id Current attachment ID.
648
  */
inc/deprecated/classes/class-imagify-auto-optimization-deprecated.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
+
4
+ /**
5
+ * Class that contains the deprecated methods of Imagify_Auto_Optimization.
6
+ *
7
+ * @since 1.9.10
8
+ */
9
+ abstract class Imagify_Auto_Optimization_Deprecated {
10
+
11
+ /**
12
+ * With WP 5.3+, prevent auto-optimization inside wp_generate_attachment_metadata() because it triggers a wp_update_attachment_metadata() for each thumbnail size.
13
+ *
14
+ * @since 1.9.8
15
+ * @since 1.9.10 Deprecated.
16
+ * @see wp_generate_attachment_metadata()
17
+ * @see wp_create_image_subsizes()
18
+ *
19
+ * @param int $threshold The threshold value in pixels. Default 2560.
20
+ * @param array $imagesize Indexed array of the image width and height (in that order).
21
+ * @param string $file Full path to the uploaded image file.
22
+ * @param int $attachment_id Attachment post ID.
23
+ * @return int The threshold value in pixels.
24
+ */
25
+ public function prevent_auto_optimization_when_generating_thumbnails( $threshold, $imagesize, $file, $attachment_id ) {
26
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.9.10' );
27
+
28
+ static::prevent_optimization_internally( $attachment_id );
29
+ return $threshold;
30
+ }
31
+
32
+ /**
33
+ * With WP 5.3+, allow auto-optimization back after wp_generate_attachment_metadata().
34
+ *
35
+ * @since 1.9.8
36
+ * @since 1.9.10 Deprecated.
37
+ * @see $this->prevent_auto_optimization_when_generating_thumbnails()
38
+ *
39
+ * @param array $metadata An array of attachment meta data.
40
+ * @param int $attachment_id Current attachment ID.
41
+ * @param string $context Additional context. Can be 'create' when metadata was initially created for new attachment or 'update' when the metadata was updated.
42
+ * @return array An array of attachment meta data.
43
+ */
44
+ public function allow_auto_optimization_when_generating_thumbnails( $metadata, $attachment_id, $context = null ) {
45
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.9.10' );
46
+
47
+ if ( ! empty( $context ) && 'create' !== $context ) {
48
+ return $metadata;
49
+ }
50
+
51
+ // Fired from wp_generate_attachment_metadata(): $context is empty (WP < 5.3) or equal to 'create' (>P >= 5.3).
52
+ static::allow_optimization_internally( $attachment_id );
53
+ return $metadata;
54
+ }
55
+ }
inc/deprecated/classes/class-imagify-enable-media-replace-deprecated.php CHANGED
@@ -4,8 +4,7 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
4
  /**
5
  * Compat class for Enable Media Replace plugin.
6
  *
7
- * @since 1.8.4
8
- * @author Grégory Viguier
9
  * @deprecated
10
  */
11
  class Imagify_Enable_Media_Replace_Deprecated {
@@ -13,11 +12,9 @@ class Imagify_Enable_Media_Replace_Deprecated {
13
  /**
14
  * The attachment ID.
15
  *
16
- * @var int
17
- * @since 1.6.9
18
- * @since 1.9 Deprecated
19
- * @access protected
20
- * @author Grégory Viguier
21
  * @deprecated
22
  */
23
  protected $attachment_id;
@@ -25,11 +22,9 @@ class Imagify_Enable_Media_Replace_Deprecated {
25
  /**
26
  * The attachment.
27
  *
28
- * @var Imagify_Attachment
29
- * @since 1.6.9
30
- * @since 1.9 Deprecated
31
- * @access protected
32
- * @author Grégory Viguier
33
  * @deprecated
34
  */
35
  protected $attachment;
@@ -38,11 +33,9 @@ class Imagify_Enable_Media_Replace_Deprecated {
38
  * Tell if the attachment has data.
39
  * No data means not processed by Imagify, or restored.
40
  *
41
- * @var bool
42
- * @since 1.8.4
43
- * @since 1.9 Deprecated
44
- * @access protected
45
- * @author Grégory Viguier
46
  * @deprecated
47
  */
48
  protected $attachment_has_data;
@@ -50,11 +43,9 @@ class Imagify_Enable_Media_Replace_Deprecated {
50
  /**
51
  * Filesystem object.
52
  *
53
- * @var object Imagify_Filesystem
54
- * @since 1.7.1
55
- * @since 1.8.4 Deprecated
56
- * @author Grégory Viguier
57
- * @access protected
58
  * @deprecated
59
  */
60
  protected $filesystem;
@@ -63,11 +54,9 @@ class Imagify_Enable_Media_Replace_Deprecated {
63
  * Optimize the attachment files if the old ones were also optimized.
64
  * Delete the old backup file.
65
  *
66
- * @since 1.6.9
67
- * @since 1.8.4 Deprecated
68
- * @author Grégory Viguier
69
- * @see $this->store_old_backup_path()
70
- * @access protected
71
  * @deprecated
72
  *
73
  * @param string $return_url The URL the user will be redirected to.
@@ -120,13 +109,60 @@ class Imagify_Enable_Media_Replace_Deprecated {
120
  return $return_url;
121
  }
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  /**
124
  * Get the attachment.
125
  *
126
- * @since 1.6.9
127
- * @since 1.9 Deprecated
128
- * @author Grégory Viguier
129
- * @access protected
130
  * @deprecated
131
  *
132
  * @return object A Imagify_Attachment object (or any class extending it).
4
  /**
5
  * Compat class for Enable Media Replace plugin.
6
  *
7
+ * @since 1.8.4
 
8
  * @deprecated
9
  */
10
  class Imagify_Enable_Media_Replace_Deprecated {
12
  /**
13
  * The attachment ID.
14
  *
15
+ * @var int
16
+ * @since 1.6.9
17
+ * @since 1.9 Deprecated
 
 
18
  * @deprecated
19
  */
20
  protected $attachment_id;
22
  /**
23
  * The attachment.
24
  *
25
+ * @var Imagify_Attachment
26
+ * @since 1.6.9
27
+ * @since 1.9 Deprecated
 
 
28
  * @deprecated
29
  */
30
  protected $attachment;
33
  * Tell if the attachment has data.
34
  * No data means not processed by Imagify, or restored.
35
  *
36
+ * @var bool
37
+ * @since 1.8.4
38
+ * @since 1.9 Deprecated
 
 
39
  * @deprecated
40
  */
41
  protected $attachment_has_data;
43
  /**
44
  * Filesystem object.
45
  *
46
+ * @var object Imagify_Filesystem
47
+ * @since 1.7.1
48
+ * @since 1.8.4 Deprecated
 
 
49
  * @deprecated
50
  */
51
  protected $filesystem;
54
  * Optimize the attachment files if the old ones were also optimized.
55
  * Delete the old backup file.
56
  *
57
+ * @since 1.6.9
58
+ * @since 1.8.4 Deprecated.
59
+ * @see $this->store_old_backup_path()
 
 
60
  * @deprecated
61
  *
62
  * @param string $return_url The URL the user will be redirected to.
109
  return $return_url;
110
  }
111
 
112
+ /**
113
+ * When the user chooses to change the file name, store the old backup file path. This path will be used later to delete the file.
114
+ *
115
+ * @since 1.6.9
116
+ * @since 1.9.10 Deprecated.
117
+ * @deprecated
118
+ *
119
+ * @param string $new_filename The new file name.
120
+ * @param string $current_path The current file path.
121
+ * @param int $post_id The attachment ID.
122
+ * @return string The same file name.
123
+ */
124
+ public function store_old_backup_path( $new_filename, $current_path, $post_id ) {
125
+ _deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.9.10' );
126
+
127
+ if ( ! $this->media_id || $post_id !== $this->media_id ) {
128
+ return $new_filename;
129
+ }
130
+
131
+ $this->get_process();
132
+
133
+ if ( ! $this->process ) {
134
+ $this->media_id = 0;
135
+ return $new_filename;
136
+ }
137
+
138
+ $media = $this->process->get_media();
139
+ $backup_path = $media->get_backup_path();
140
+
141
+ if ( $backup_path ) {
142
+ $this->old_backup_path = $backup_path;
143
+
144
+ // Keep track of existing webp files.
145
+ $media_files = $media->get_media_files();
146
+
147
+ if ( $media_files ) {
148
+ foreach ( $media_files as $media_file ) {
149
+ $this->old_webp_paths[] = imagify_path_to_webp( $media_file['path'] );
150
+ }
151
+ }
152
+ } else {
153
+ $this->media_id = 0;
154
+ $this->old_backup_path = false;
155
+ $this->old_webp_paths = [];
156
+ }
157
+
158
+ return $new_filename;
159
+ }
160
+
161
  /**
162
  * Get the attachment.
163
  *
164
+ * @since 1.6.9
165
+ * @since 1.9 Deprecated.
 
 
166
  * @deprecated
167
  *
168
  * @return object A Imagify_Attachment object (or any class extending it).
package.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "name": "imagify",
3
- "description": "Imagify Image Optimizer. Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.",
4
- "version": "1.9.8.1",
5
- "homepage": "https://wordpress.org/plugins/imagify/",
6
- "license": "GPL-2.0",
7
- "private": true,
8
- "author": {
9
- "name": "WP Media",
10
- "url": "http://wp-media.me"
11
- },
12
- "devDependencies": {
13
- "autoprefixer": "^7.0.1",
14
- "grunt": "^1.0.1",
15
- "grunt-contrib-cssmin": "^1.0.1",
16
- "grunt-contrib-uglify": "^2.1.0",
17
- "grunt-eslint": "^20.0.0",
18
- "grunt-postcss": "^0.8.0"
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Imagify – Convert WebP, Images Compression and Optimization ===
2
  Contributors: wp_media, GregLone
3
- Tags: optimize images, images, optimize, performance, webp
4
  Requires at least: 4.0.0
5
- Tested up to: 5.4
6
- Stable tag: 1.9.9
7
 
8
  Optimize images in one click: reduce image file sizes, convert WebP, keep your images beautiful… and boost your loading time and your SEO!
9
 
@@ -153,6 +153,10 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
153
  4. Other Media Page
154
 
155
  == Changelog ==
 
 
 
 
156
  = 1.9.9 - 2020/02/13 =
157
  * Fix: do not warn that all the quota has been consumed when it is not the case.
158
  * Fix: fix a "chunky upload" error that some users experienced.
1
+ === Imagify – WebP & Image Compression and Optimization ===
2
  Contributors: wp_media, GregLone
3
+ Tags: convert webp, optimize images, images, webp, resize
4
  Requires at least: 4.0.0
5
+ Tested up to: 5.4.1
6
+ Stable tag: 1.9.10
7
 
8
  Optimize images in one click: reduce image file sizes, convert WebP, keep your images beautiful… and boost your loading time and your SEO!
9
 
153
  4. Other Media Page
154
 
155
  == Changelog ==
156
+ = 1.9.10 - 2020/05/26 =
157
+ * Fix: Correctly optimize thumbnails during auto-optimization of image upload
158
+ * Fix: Fix broken compatibility with Enable Media Replace plugin after WordPress 5.3
159
+
160
  = 1.9.9 - 2020/02/13 =
161
  * Fix: do not warn that all the quota has been consumed when it is not the case.
162
  * Fix: fix a "chunky upload" error that some users experienced.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInita19538743745730476abc209df8266cb::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -181,6 +181,7 @@ return array(
181
  'Imagify_Assets_Deprecated' => $baseDir . '/inc/deprecated/classes/class-imagify-assets-deprecated.php',
182
  'Imagify_Attachment' => $baseDir . '/inc/deprecated/classes/class-imagify-attachment.php',
183
  'Imagify_Auto_Optimization' => $baseDir . '/inc/classes/class-imagify-auto-optimization.php',
 
184
  'Imagify_Cron_Library_Size' => $baseDir . '/inc/classes/class-imagify-cron-library-size.php',
185
  'Imagify_Cron_Rating' => $baseDir . '/inc/classes/class-imagify-cron-rating.php',
186
  'Imagify_Cron_Sync_Files' => $baseDir . '/inc/classes/class-imagify-cron-sync-files.php',
181
  'Imagify_Assets_Deprecated' => $baseDir . '/inc/deprecated/classes/class-imagify-assets-deprecated.php',
182
  'Imagify_Attachment' => $baseDir . '/inc/deprecated/classes/class-imagify-attachment.php',
183
  'Imagify_Auto_Optimization' => $baseDir . '/inc/classes/class-imagify-auto-optimization.php',
184
+ 'Imagify_Auto_Optimization_Deprecated' => $baseDir . '/inc/deprecated/classes/class-imagify-auto-optimization-deprecated.php',
185
  'Imagify_Cron_Library_Size' => $baseDir . '/inc/classes/class-imagify-cron-library-size.php',
186
  'Imagify_Cron_Rating' => $baseDir . '/inc/classes/class-imagify-cron-rating.php',
187
  'Imagify_Cron_Sync_Files' => $baseDir . '/inc/classes/class-imagify-cron-sync-files.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc
6
  {
7
  private static $loader;
8
 
@@ -13,21 +13,24 @@ class ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc
13
  }
14
  }
15
 
 
 
 
16
  public static function getLoader()
17
  {
18
  if (null !== self::$loader) {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::getInitializer($loader));
31
  } else {
32
  $classMap = require __DIR__ . '/autoload_classmap.php';
33
  if ($classMap) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInita19538743745730476abc209df8266cb
6
  {
7
  private static $loader;
8
 
13
  }
14
  }
15
 
16
+ /**
17
+ * @return \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader
18
+ */
19
  public static function getLoader()
20
  {
21
  if (null !== self::$loader) {
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInita19538743745730476abc209df8266cb', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInita19538743745730476abc209df8266cb', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInita19538743745730476abc209df8266cb::getInitializer($loader));
34
  } else {
35
  $classMap = require __DIR__ . '/autoload_classmap.php';
36
  if ($classMap) {
vendor/composer/autoload_static.php CHANGED
@@ -7,7 +7,7 @@ namespace Composer\Autoload;
7
  use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
8
 
9
 
10
- class ComposerStaticInitb97c519d24d95afd7d57037f5b53badc
11
  {
12
  public static $prefixLengthsPsr4 = array (
13
  'I' =>
@@ -250,6 +250,7 @@ class ComposerStaticInitb97c519d24d95afd7d57037f5b53badc
250
  'Imagify_Assets_Deprecated' => __DIR__ . '/../..' . '/inc/deprecated/classes/class-imagify-assets-deprecated.php',
251
  'Imagify_Attachment' => __DIR__ . '/../..' . '/inc/deprecated/classes/class-imagify-attachment.php',
252
  'Imagify_Auto_Optimization' => __DIR__ . '/../..' . '/inc/classes/class-imagify-auto-optimization.php',
 
253
  'Imagify_Cron_Library_Size' => __DIR__ . '/../..' . '/inc/classes/class-imagify-cron-library-size.php',
254
  'Imagify_Cron_Rating' => __DIR__ . '/../..' . '/inc/classes/class-imagify-cron-rating.php',
255
  'Imagify_Cron_Sync_Files' => __DIR__ . '/../..' . '/inc/classes/class-imagify-cron-sync-files.php',
@@ -283,9 +284,9 @@ class ComposerStaticInitb97c519d24d95afd7d57037f5b53badc
283
  public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
284
  {
285
  return \Closure::bind(function () use ($loader) {
286
- $loader->prefixLengthsPsr4 = ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::$prefixLengthsPsr4;
287
- $loader->prefixDirsPsr4 = ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::$prefixDirsPsr4;
288
- $loader->classMap = ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::$classMap;
289
 
290
  }, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
291
  }
7
  use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
8
 
9
 
10
+ class ComposerStaticInita19538743745730476abc209df8266cb
11
  {
12
  public static $prefixLengthsPsr4 = array (
13
  'I' =>
250
  'Imagify_Assets_Deprecated' => __DIR__ . '/../..' . '/inc/deprecated/classes/class-imagify-assets-deprecated.php',
251
  'Imagify_Attachment' => __DIR__ . '/../..' . '/inc/deprecated/classes/class-imagify-attachment.php',
252
  'Imagify_Auto_Optimization' => __DIR__ . '/../..' . '/inc/classes/class-imagify-auto-optimization.php',
253
+ 'Imagify_Auto_Optimization_Deprecated' => __DIR__ . '/../..' . '/inc/deprecated/classes/class-imagify-auto-optimization-deprecated.php',
254
  'Imagify_Cron_Library_Size' => __DIR__ . '/../..' . '/inc/classes/class-imagify-cron-library-size.php',
255
  'Imagify_Cron_Rating' => __DIR__ . '/../..' . '/inc/classes/class-imagify-cron-rating.php',
256
  'Imagify_Cron_Sync_Files' => __DIR__ . '/../..' . '/inc/classes/class-imagify-cron-sync-files.php',
284
  public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
285
  {
286
  return \Closure::bind(function () use ($loader) {
287
+ $loader->prefixLengthsPsr4 = ComposerStaticInita19538743745730476abc209df8266cb::$prefixLengthsPsr4;
288
+ $loader->prefixDirsPsr4 = ComposerStaticInita19538743745730476abc209df8266cb::$prefixDirsPsr4;
289
+ $loader->classMap = ComposerStaticInita19538743745730476abc209df8266cb::$classMap;
290
 
291
  }, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
292
  }