84% woo-media-api

Code Review | WooCommerce Media API

WordPress plugin WooCommerce Media API scored84%from 54 tests.

About plugin

  • Plugin page: woo-media-api
  • Plugin version: 2.8
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.9.3
  • WordPress version: 6.3.1
  • First release: May 28, 2018
  • Latest release: May 18, 2022
  • Number of updates: 51
  • Update frequency: every 28.5 days
  • Top authors: woopos (100%)

Code review

54 tests

User reviews

1 review

Install metrics

600+ active /5,260 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▼0.65MB] [CPU: ▼20.07ms] Passed 4 tests

Analyzing server-side resources used by WooCommerce Media API
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0240.95 ▲4.02
Dashboard /wp-admin3.32 ▼0.0241.26 ▼16.72
Posts /wp-admin/edit.php3.37 ▲0.0247.98 ▲1.73
Add New Post /wp-admin/post-new.php3.26 ▼2.6235.26 ▼66.29
Media Library /wp-admin/upload.php3.24 ▲0.0136.21 ▲1.01

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 5 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
db_upgraded
recovery_mode_email_last_sent
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

WooCommerce Media API: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲2913.23 ▼1.151.94 ▼0.2043.00 ▲3.39
Dashboard /wp-admin2,209 ▲204.87 ▼0.09104.71 ▼14.6437.60 ▼4.14
Posts /wp-admin/edit.php2,092 ▼02.02 ▲0.0135.22 ▼9.6531.22 ▼5.98
Add New Post /wp-admin/post-new.php45 ▼1,4740.44 ▼22.550.09 ▼701.7510.39 ▼46.74
Media Library /wp-admin/upload.php1,388 ▼04.25 ▲0.05106.24 ▲3.0367.81 ▲21.08

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • recovery_mode_email_last_sent
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 3× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'WC_REST_CRUD_Controller' not found in wp-content/plugins/woo-media-api/class-woocommerce-media-api-controller.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WC_REST_CRUD_Controller' not found in wp-content/plugins/woo-media-api/class-woocommerce-metadata-api-controller.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WC_REST_CRUD_Controller' not found in wp-content/plugins/woo-media-api/class-woocommerce-list-items-api-controller.php:2

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% from 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
5 plugin tags: media library, wordpress rest api, woocommerce api, woopos, woocommerce point of sale

woo-media-api/woocommerce-media-api.php 92% from 13 tests

The main file in "WooCommerce Media API" v. 2.8 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("woo-media-api.php" instead of "woocommerce-media-api.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected673 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP46012673

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity17.00
▷ Minimum class complexity3.00
▷ Maximum class complexity35.00
Average method complexity3.78
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods24
▷ Static methods00.00%
▷ Public methods24100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions450.00%
▷ Anonymous functions450.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG files were detected