10% shortpixel-adaptive-images

Code Review | ShortPixel Adaptive Images - WebP, AVIF, CDN, Image Optimization

WordPress plugin ShortPixel Adaptive Images - WebP, AVIF, CDN, Image Optimization scored10%from 54 tests.

About plugin

  • Plugin page: shortpixel-adapti...
  • Plugin version: 3.8.0
  • PHP compatiblity: 5.6.40+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.3
  • WordPress version: 6.3.1
  • First release: Dec 9, 2018
  • Latest release: Aug 22, 2023
  • Number of updates: 158
  • Update frequency: every 10.9 days
  • Top authors: petredobrescu (54.43%)ShortPixel (46.2%)

Code review

54 tests

User reviews

128 reviews

Install metrics

20,000+ active /1,186,929 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Please fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Notice in wp-content/plugins/shortpixel-adaptive-images/includes/controllers/short-pixel-ai.class.php+1695
    Trying to get property 'exclusions' of non-object

Server metrics [RAM: ▲2.45MB] [CPU: ▲12.46ms] Passed 4 tests

Server-side resources used by ShortPixel Adaptive Images - WebP, AVIF, CDN, Image Optimization
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /6.01 ▲2.5163.07 ▲21.20
Dashboard /wp-admin5.83 ▲2.4866.70 ▲16.86
Posts /wp-admin/edit.php5.88 ▲2.4867.93 ▲17.89
Add New Post /wp-admin/post-new.php8.36 ▲2.43100.88 ▼5.43
Media Library /wp-admin/upload.php5.68 ▲2.4159.50 ▲20.51
ShortPixel AI /wp-admin/options-general.php?page=shortpixel-ai-settings6.36254.86
ShortPixel AI On-Boarding /wp-admin/admin.php?page=shortpixel-ai-on-boarding5.7051.39
/wp-admin/admin.php?page=shortpixel-ai-import-settings5.6448.18
/wp-admin/admin.php?page=shortpixel-ai-export-settings5.6449.87

Server storage [IO: ▲3.15MB] [DB: ▲0.00MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 183 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
short_pixel_ai_options
widget_recent-comments
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for ShortPixel Adaptive Images - WebP, AVIF, CDN, Image Optimization
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,150 ▲40413.81 ▼0.4718.70 ▲17.0645.42 ▲5.53
Dashboard /wp-admin2,204 ▲265.62 ▲0.0286.59 ▼22.7872.99 ▲27.07
Posts /wp-admin/edit.php2,127 ▲302.16 ▲0.2140.12 ▲4.3434.33 ▼0.57
Add New Post /wp-admin/post-new.php1,419 ▼10718.11 ▼4.80646.66 ▼55.9856.19 ▼3.65
Media Library /wp-admin/upload.php1,421 ▲214.24 ▲0.0493.51 ▼21.7575.78 ▲28.81
ShortPixel AI /wp-admin/options-general.php?page=shortpixel-ai-settings1,6092.7039.4147.92
ShortPixel AI On-Boarding /wp-admin/admin.php?page=shortpixel-ai-on-boarding9512.0824.4734.40
/wp-admin/admin.php?page=shortpixel-ai-import-settings7271.127.3713.60
/wp-admin/admin.php?page=shortpixel-ai-export-settings7431.127.3814.55

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-content/plugins/shortpixel-adaptive-images/includes/controllers/logger.class.php+124
    unlink(wp-content/uploads/shortpixel-ai.log): No such file or directory
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • short_pixel_ai_options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=shortpixel-ai-export-settings
    • > Warning in wp-content/plugins/shortpixel-adaptive-images/includes/controllers/page.class.php+237
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 17× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CLI_Command' not found in wp-content/plugins/shortpixel-adaptive-images/includes/controllers/cli.class.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'MatthiasMullie\\PathConverter\\ConverterInterface' not found in wp-content/plugins/shortpixel-adaptive-images/includes/libs/path-converter/src/NoConverter.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'MatthiasMullie\\Minify\\Exceptions\\BasicException' not found in wp-content/plugins/shortpixel-adaptive-images/includes/libs/minify/src/Exceptions/IOException.php:19
    • > PHP Fatal error
      require_once(): Failed opening required 'SHORTPIXEL_AI_PLUGIN_DIR/includes/libs/psr/cache/src/CacheException.php' (include_path='.:/usr/share/php') in wp-content/plugins/shortpixel-adaptive-images/includes/controllers/js-parser.class.php on line 7
    • > PHP Warning
      Use of undefined constant SHORTPIXEL_AI_PLUGIN_DIR - assumed 'SHORTPIXEL_AI_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/shortpixel-adaptive-images/includes/controllers/js-parser.class.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'MatthiasMullie\\PathConverter\\ConverterInterface' not found in wp-content/plugins/shortpixel-adaptive-images/includes/libs/path-converter/src/Converter.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'MatthiasMullie\\Minify\\Minify' not found in wp-content/plugins/shortpixel-adaptive-images/includes/libs/minify/src/CSS.php:29
    • > PHP Warning
      require_once(SHORTPIXEL_AI_PLUGIN_DIR/includes/libs/psr/cache/src/CacheException.php): failed to open stream: No such file or directory in wp-content/plugins/shortpixel-adaptive-images/includes/controllers/js-parser.class.php on line 7
    • > PHP Fatal error
      Uncaught Error: Class 'ShortPixel\\AI\\JsLoader' not found in wp-content/plugins/shortpixel-adaptive-images/includes/front/jquery-js-loader.class.php:9
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/shortpixel-adaptive-images/includes/views/front-checker.tpl.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
8 plugin tags: webp, lazy load, responsive images, convert, cdn...

shortpixel-adaptive-images/short-pixel-ai.php 92% from 13 tests

The principal PHP file in "ShortPixel Adaptive Images - WebP, AVIF, CDN, Image Optimization" v. 3.8.0 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("shortpixel-adaptive-images.php" instead of "short-pixel-ai.php")

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 plugin33,609 lines of code in 114 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript323,8193,22818,975
PHP581,9753,26211,313
CSS94161082,780
SVG1404533
HTML1008

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.54
Average class complexity40.87
▷ Minimum class complexity1.00
▷ Maximum class complexity448.00
Average method complexity5.80
▷ Minimum method complexity1.00
▷ Maximum method complexity70.00
Code structure
Namespaces11
Interfaces5
Traits0
Classes48
▷ Abstract classes48.33%
▷ Concrete classes4491.67%
▷ Final classes00.00%
Methods443
▷ Static methods12628.44%
▷ Public methods28464.11%
▷ Protected methods6214.00%
▷ Private methods9721.90%
Functions47
▷ Named functions00.00%
▷ Anonymous functions47100.00%
Constants69
▷ Global constants1318.84%
▷ Class constants5681.16%
▷ Public constants56100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
26 PNG files occupy 0.28MB with 0.19MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/robo-happy.png8.49KB2.83KB▼ 66.67%
assets/img/robo-rtl-scared@2x.png21.03KB4.61KB▼ 78.08%
assets/img/robo-wink.png8.17KB2.76KB▼ 66.20%
assets/img/robo-notes@2x.png13.11KB4.90KB▼ 62.64%
assets/img/robo@2x.png10.58KB4.23KB▼ 60.04%