84% autoptimize

Code Review | Autoptimize

WordPress plugin Autoptimize scored84%from 54 tests.

About plugin

  • Plugin page: autoptimize
  • Plugin version: 3.1.10
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4
  • WordPress version: 6.3.1
  • First release: Jul 9, 2009
  • Latest release: Nov 14, 2023
  • Number of updates: 490
  • Update frequency: every 10.7 days
  • Top authors: futtta (83.06%)turl (17.14%)

Code review

54 tests

User reviews

1396 reviews

Install metrics

1,000,000+ active /37,441,746 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲1.40MB] [CPU: ▲16.90ms] 75% from 4 tests

A check of server-side resources used by Autoptimize
Please fix the following
  • CPU: Total CPU usage should be kept under 500.00ms (currently 705.82ms on /wp-admin/options-general.php?page=autoptimize)
PageMemory (MB)CPU Time (ms)
Home /4.67 ▲1.2061.96 ▲20.66
Dashboard /wp-admin4.81 ▲1.4670.64 ▲9.42
Posts /wp-admin/edit.php4.86 ▲1.5076.82 ▲30.12
Add New Post /wp-admin/post-new.php7.36 ▲1.46105.06 ▲7.41
Media Library /wp-admin/upload.php4.69 ▲1.4665.47 ▲31.94
autoptimize_extra /wp-admin/admin.php?page=autoptimize_extra4.6657.32
Autoptimize /wp-admin/options-general.php?page=autoptimize6.03705.82
AO pro /wp-admin/admin.php?page=ao_protab4.70224.02
AO partner /wp-admin/admin.php?page=ao_partners5.78408.59
autoptimize_imgopt /wp-admin/admin.php?page=autoptimize_imgopt4.6656.99
Critical CSS /wp-admin/admin.php?page=ao_critcss5.10204.88

Server storage [IO: ▲0.88MB] [DB: ▲0.09MB] 67% from 3 tests

Input-output and database impact of this plugin
It is recommended to fix the following issues
  • There were 21 files (183.01KB) illegally modified outside of "wp-content/plugins/autoptimize/" and "wp-content/uploads/"
    • (new file) wp-content/autoptimize_404_handler.php
    • (new file) wp-content/cache/autoptimize/autoptimize_single_75d7822d25873fd727beecf0744affa4.php.deflate
    • (new file) wp-content/cache/autoptimize/autoptimize_single_75d7822d25873fd727beecf0744affa4.php
    • (new file) wp-content/cache/autoptimize/autoptimize_single_005c2eb210a376d583ea312a6c0756f0.php.none
    • (new file) wp-content/cache/autoptimize/.htaccess
    • (new file) wp-content/cache/autoptimize/autoptimize_d41d8cd98f00b204e9800998ecf8427e.php
    • (new file) wp-content/cache/autoptimize/autoptimize_single_005c2eb210a376d583ea312a6c0756f0.php.deflate
    • (new file) wp-content/cache/autoptimize/autoptimize_single_005c2eb210a376d583ea312a6c0756f0.php
    • (new file) wp-content/cache/autoptimize/autoptimize_single_005c2eb210a376d583ea312a6c0756f0.php.gzip
    • (new file) wp-content/cache/autoptimize/autoptimize_d41d8cd98f00b204e9800998ecf8427e.php.none
    • ...
Filesystem: 80 new files
Database: no new tables, 10 new options
New WordPress options
db_upgraded
autoptimize_imgopt_launched
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
autoptimize_version
autoptimize_service_availablity
can_compress_scripts
widget_recent-posts
autoptimize_ccss_version

Browser metrics Passed 4 tests

A check of browser resources used by Autoptimize
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,005 ▲24313.44 ▼0.919.05 ▲7.4938.66 ▼4.98
Dashboard /wp-admin2,258 ▲815.65 ▲0.0298.61 ▲10.0041.13 ▲3.33
Posts /wp-admin/edit.php2,160 ▲602.20 ▲0.1840.87 ▲7.4036.39 ▲1.91
Add New Post /wp-admin/post-new.php6,340 ▲4,81426.29 ▲3.22909.02 ▲296.6067.26 ▲10.86
Media Library /wp-admin/upload.php1,457 ▲604.27 ▲0.07100.54 ▲1.3146.58 ▲4.23
autoptimize_extra /wp-admin/admin.php?page=autoptimize_extra1,0862.2428.6952.72
Autoptimize /wp-admin/options-general.php?page=autoptimize1,5902.3652.7444.24
AO pro /wp-admin/admin.php?page=ao_protab1,1292.2327.7059.84
AO partner /wp-admin/admin.php?page=ao_partners1,0452.2527.9537.96
autoptimize_imgopt /wp-admin/admin.php?page=autoptimize_imgopt1,1002.2430.4143.96
Critical CSS /wp-admin/admin.php?page=ao_critcss1,8712.2931.4257.11

Uninstaller [IO: ▲0.00MB] [DB: ▲0.09MB] 75% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Notice
      Undefined variable: ao_ccss_debug in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_rules.js.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_create_nonce() in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_impexp.js.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_queue.js.php:76
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_rules.js.php:43
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_debug.php:10
    • > PHP Notice
      Undefined variable: ao_ccss_debug in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_queue.js.php on line 23
    • > PHP Notice
      Undefined variable: ao_ccss_debug in wp-content/plugins/autoptimize/classes/critcss-inc/admin_settings_rules.js.php on line 26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
8 plugin tags: core web vitals, pagespeed, minify, optimize, performance...

autoptimize/autoptimize.php Passed 13 tests

The main PHP file in "Autoptimize" ver. 3.1.10 adds more information about the plugin and also serves as the entry point for this plugin
76 characters long description:
Makes your site faster by optimizing CSS, JS, Images, Google fonts and more.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin12,876 lines of code in 67 files:
LanguageFilesBlank linesComment linesLines of code
PHP461,9783,88611,859
CSS77122692
JavaScript114473237
Markdown131086
HTML2002

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity61.92
▷ Minimum class complexity1.00
▷ Maximum class complexity307.00
Average method complexity5.87
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes37
▷ Abstract classes12.70%
▷ Concrete classes3697.30%
▷ Final classes00.00%
Methods460
▷ Static methods12326.74%
▷ Public methods35677.39%
▷ Protected methods5311.52%
▷ Private methods5111.09%
Functions24
▷ Named functions1041.67%
▷ Anonymous functions1458.33%
Constants48
▷ Global constants3266.67%
▷ Class constants1633.33%
▷ Public constants16100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
classes/external/do_not_donate_smallest.png9.36KB3.91KB▼ 58.24%