61% shortpixel-image-optimiser

Code Review | ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF

WordPress plugin ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF scored61%from 54 tests.

About plugin

  • Plugin page: shortpixel-image-...
  • Plugin version: 5.5.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8.0-6.4
  • WordPress version: 6.3.1
  • First release: Nov 5, 2014
  • Latest release: Nov 24, 2023
  • Number of updates: 371
  • Update frequency: every 8.9 days
  • Top authors: ShortPixel (75.47%)petredobrescu (24.8%)

Code review

54 tests

User reviews

735 reviews

Install metrics

300,000+ active /12,751,928 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

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

Server-side resources used by ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /5.29 ▲1.8353.55 ▲11.31
Dashboard /wp-admin5.73 ▲2.3873.35 ▲8.73
Posts /wp-admin/edit.php6.15 ▲2.7982.73 ▲34.93
Add New Post /wp-admin/post-new.php8.70 ▲2.81134.00 ▲39.35
Media Library /wp-admin/upload.php6.24 ▲3.0185.11 ▲48.96
Bulk ShortPixel /wp-admin/upload.php?page=wp-short-pixel-bulk7.22117.01
Custom Media /wp-admin/upload.php?page=wp-short-pixel-custom6.1278.77
ShortPixel /wp-admin/options-general.php?page=wp-shortpixel-settings6.39126.45

Server storage [IO: ▲2.69MB] [DB: ▲0.01MB] 67% from 3 tests

Filesystem and database footprint
Just a few items left to fix
  • Illegal file modification found: 1 file (0.79KB) outside of "wp-content/plugins/shortpixel-image-optimiser/" and "wp-content/uploads/"
    • (modified) .htaccess
Filesystem: 277 new files
Database: 4 new tables, 14 new options
New tables
wp_shortpixel_meta
wp_shortpixel_folders
wp_shortpixel_queue
wp_shortpixel_postmeta
New WordPress options
widget_recent-posts
wp-short-pixel-redirected-settings
can_compress_scripts
ShortPixel-notices
wp-short-pixel-current-total-files
shortqwp_SPIO
widget_theysaidso_widget
widget_recent-comments
wp-short-pixel-apiKey
wp-short-pixel-currentVersion
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,828 ▲8114.21 ▼0.061.74 ▼0.0342.95 ▼0.57
Dashboard /wp-admin2,221 ▲475.69 ▲0.0794.68 ▼6.7874.23 ▲29.38
Posts /wp-admin/edit.php2,193 ▲932.46 ▲0.5039.66 ▼2.3734.48 ▲0.05
Add New Post /wp-admin/post-new.php1,764 ▲22822.35 ▼0.80745.12 ▲80.8029.58 ▼29.60
Media Library /wp-admin/upload.php1,440 ▲402.28 ▼1.9532.35 ▼83.3833.21 ▼16.39
Bulk ShortPixel /wp-admin/upload.php?page=wp-short-pixel-bulk2,4732.1939.0547.20
Custom Media /wp-admin/upload.php?page=wp-short-pixel-custom1,1272.2628.7729.94
ShortPixel /wp-admin/options-general.php?page=wp-shortpixel-settings1,1602.6040.5447.21

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • The plugin did not uninstall successfully, leaving 3 tables in the database
    • wp_shortpixel_folders
    • wp_shortpixel_postmeta
    • wp_shortpixel_meta
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • wp-short-pixel-view-mode
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • shortqwp_SPIO
    • widget_recent-comments
    • wp-short-pixel-currentVersion
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
    • > GET request to /wp-admin/upload.php?page=wp-short-pixel-custom
    • > Notice in wp-content/plugins/shortpixel-image-optimiser/class/view/view-other-media.php+49
    Undefined index: sortable

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/shortpixel-image-optimiser/wp-shortpixel.php
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function ShortPixel\\ShortPixelLogger\\wp_enqueue_script() in wp-content/plugins/shortpixel-image-optimiser/build/shortpixel/log/src/view-debug-box.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'ShortPixel\\ShortQ\\DataProvider\\DataProvider' not found in wp-content/plugins/shortpixel-image-optimiser/build/shortpixel/shortq/src/DataProvider/MysqlDataProvider.php:10
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/shortpixel-image-optimiser/class/view/snippets/part-single-actions.php:2
    • > PHP Fatal error
      Uncaught Error: Interface 'ShortPixel\\ShortQ\\Queue\\Queue' not found in wp-content/plugins/shortpixel-image-optimiser/build/shortpixel/shortq/src/Queue/WPQ.php:7

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 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Tags: Too many tags (19 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

shortpixel-image-optimiser/wp-shortpixel.php 77% from 13 tests

"ShortPixel Image Optimizer - Optimize Images, Convert WebP & AVIF" version 5.5.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • Main file name: The principal plugin file should be the same as the plugin slug ("shortpixel-image-optimiser.php" instead of "wp-shortpixel.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 295 characters long)
  • Domain Path: The domain path is invalid: folder "/lang" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin39,783 lines of code in 219 files:
LanguageFilesBlank linesComment linesLines of code
PHP1457,3283,12127,639
JavaScript221,1875615,514
CSS1371633,248
Sass223901093,048
SVG1011137
Markdown1420111
JSON61086

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity34.89
▷ Minimum class complexity1.00
▷ Maximum class complexity480.00
Average method complexity4.06
▷ Minimum method complexity1.00
▷ Maximum method complexity64.00
Code structure
Namespaces22
Interfaces2
Traits0
Classes110
▷ Abstract classes65.45%
▷ Concrete classes10494.55%
▷ Final classes21.92%
Methods1,282
▷ Static methods1209.36%
▷ Public methods87768.41%
▷ Protected methods26920.98%
▷ Private methods13610.61%
Functions7
▷ Named functions114.29%
▷ Anonymous functions685.71%
Constants140
▷ Global constants1812.86%
▷ Class constants12287.14%
▷ Public constants122100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
33 PNG files occupy 0.56MB with 0.31MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
res/img/robo-cool@x2.png12.27KB4.90KB▼ 60.10%
res/img/robo-winky.png3.24KB1.89KB▼ 41.70%
res/img/robo-cool@2x.png12.27KB4.90KB▼ 60.10%
res/img/robo-magnifier@2x.png11.49KB4.56KB▼ 60.28%
res/img/resize-inner@2x.png38.81KB16.27KB▼ 58.08%