83% crush-pics

Code Review | Crush.pics Image Optimizer – Image Compression and Optimization

WordPress plugin Crush.pics Image Optimizer – Image Compression and Optimization scored 83% from 54 tests.

About plugin

  • Plugin page: crush-pics
  • Plugin version: 1.8.7
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.0-5.5
  • WordPress version: 6.3.1
  • First release: Jan 8, 2020
  • Latest release: Aug 10, 2020
  • Number of updates: 8
  • Update frequency: every 28.7 days
  • Top authors: crushpics (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active / 1,316 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.61MB] [CPU: ▼17.49ms] Passed 4 tests

This is a short check of server-side resources used by Crush.pics Image Optimizer – Image Compression and Optimization
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0739.37 ▼0.74
Dashboard /wp-admin3.37 ▲0.0743.92 ▼4.87
Posts /wp-admin/edit.php3.49 ▲0.1346.86 ▼1.98
Add New Post /wp-admin/post-new.php3.25 ▼2.6436.58 ▼62.35
Media Library /wp-admin/upload.php3.30 ▲0.0740.58 ▲8.17

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 46 new files
Database: 2 new tables, 6 new options
New tables
wp_crush_image_all_sizes
wp_crush_image_actions
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Crush.pics Image Optimizer – Image Compression and Optimization
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,873 ▲13813.31 ▼1.062.04 ▼0.0444.50 ▼5.42
Dashboard /wp-admin2,254 ▲665.12 ▼0.79103.51 ▼12.0170.67 ▲20.83
Posts /wp-admin/edit.php2,140 ▲511.98 ▼0.0634.89 ▲0.1933.91 ▲1.39
Add New Post /wp-admin/post-new.php1,713 ▲17922.52 ▼0.64701.49 ▲44.7050.89 ▲5.44
Media Library /wp-admin/upload.php1,487 ▲1024.40 ▲0.19103.43 ▲2.2967.57 ▲25.16

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 19× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      Use of undefined constant WPIC_PATH - assumed 'WPIC_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/crush-pics/inc/class-crush-all-process.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/crush-pics/inc/views/settings.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/crush-pics/inc/views/dashboard.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/crush-pics/inc/views/image-list-template.php:9
    • > PHP Warning
      Use of undefined constant WPIC_URL - assumed 'WPIC_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/crush-pics/inc/views/validate-create-account.php on line 15
    • > PHP Notice
      Undefined variable: api_key_added in wp-content/plugins/crush-pics/inc/views/settings.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/crush-pics/inc/views/media-list.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/crush-pics/inc/views/validate-create-account.php:16
    • > PHP Notice
      Undefined variable: is_register_done in wp-content/plugins/crush-pics/inc/views/validate-create-account.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/crush-pics/inc/views/single-media-page.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need to be fixed:
  • License uri: Invalid url: ""
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can take inspiration from this readme.txt

crush-pics/image-compression.php 85% from 13 tests

The main file in "Crush.pics Image Optimizer – Image Compression and Optimization" v. 1.8.7 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("crush-pics.php" instead of "image-compression.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin7,789 lines of code in 41 files:
LanguageFilesBlank linesComment linesLines of code
PHP191,1174853,950
JavaScript73181511,850
CSS5317351,781
SVG909206
Markdown1002

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity37.55
▷ Minimum class complexity4.00
▷ Maximum class complexity218.00
Average method complexity4.41
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes218.18%
▷ Concrete classes981.82%
▷ Final classes00.00%
Methods121
▷ Static methods4033.06%
▷ Public methods9981.82%
▷ Protected methods2016.53%
▷ Private methods21.65%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants7
▷ Global constants457.14%
▷ Class constants342.86%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
2 compressed PNG files occupy 0.20MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/crush-color-bg.png203.42KB226.06KB0.00%
assets/img/info-icon-01.png0.16KB0.11KB▼ 28.40%