84% woo-free-product-sample

Code Review | Free Product Sample for WooCommerce

WordPress plugin Free Product Sample for WooCommerce scored 84% from 54 tests.

About plugin

  • Plugin page: woo-free-product-...
  • Plugin version: 2.3.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.1.1
  • WordPress version: 6.3.1
  • First release: Dec 25, 2018
  • Latest release: Jun 21, 2023
  • Number of updates: 120
  • Update frequency: every 13.7 days
  • Top authors: hossain88 (76.67%)scott.deluzio (21.67%)ampmode (3.33%)

Code review

54 tests

User reviews

33 reviews

Install metrics

500+ active / 22,224 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.05MB] [CPU: ▼5.86ms] Passed 4 tests

Server-side resources used by Free Product Sample for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0541.17 ▲2.54
Dashboard /wp-admin3.35 ▲0.0544.25 ▼5.12
Posts /wp-admin/edit.php3.46 ▲0.1149.56 ▼8.81
Add New Post /wp-admin/post-new.php5.93 ▲0.0594.33 ▼9.34
Media Library /wp-admin/upload.php3.27 ▲0.0535.08 ▼0.15

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 63 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_recent-posts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Free Product Sample for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7914.48 ▲0.201.95 ▲0.0943.18 ▲4.51
Dashboard /wp-admin2,209 ▲214.85 ▼0.04110.75 ▲6.9442.00 ▲0.41
Posts /wp-admin/edit.php2,089 ▼01.99 ▲0.0038.95 ▼2.9633.94 ▼2.65
Add New Post /wp-admin/post-new.php1,521 ▼2123.22 ▲4.93567.40 ▼21.9550.86 ▼2.36
Media Library /wp-admin/upload.php1,388 ▲64.22 ▲0.0594.55 ▼4.7342.76 ▼1.15

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

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
  • 20× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_errors() in wp-content/plugins/woo-free-product-sample/admin/partials/woo-free-product-sample-message.php:4
    • > PHP Notice
      Undefined variable: value in wp-content/plugins/woo-free-product-sample/admin/includes/fields/checkbox.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woo-free-product-sample/admin/includes/fields/number.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woo-free-product-sample/admin/includes/fields/checkbox.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woo-free-product-sample/admin/includes/fields/select.php:2
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/woo-free-product-sample/admin/includes/fields/checkbox.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/woo-free-product-sample/admin/partials/footer.php:6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/woo-free-product-sample/admin/includes/fields/double-repeater.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woo-free-product-sample/admin/includes/fields/multi-select.php:2
    • > PHP Notice
      Undefined variable: is_pro in wp-content/plugins/woo-free-product-sample/admin/includes/fields/checkbox.php on line 8

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
10 plugin tags: free, free-product-sample, e-commerce, free-sample, dokan...

woo-free-product-sample/woo-free-product-sample.php Passed 13 tests

The main PHP script in "Free Product Sample for WooCommerce" version 2.3.1 is automatically included on every request by WordPress
62 characters long description:
It allows customers to order a product sample in a simple way.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected3,494 lines of code in 41 files:
LanguageFilesBlank linesComment linesLines of code
PHP344971,0722,085
CSS2191311,025
PO File2123176328
JavaScript17044
JSON20012

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity19.75
▷ Minimum class complexity1.00
▷ Maximum class complexity119.00
Average method complexity3.06
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes12
▷ Abstract classes00.00%
▷ Concrete classes12100.00%
▷ Final classes00.00%
Methods110
▷ Static methods2421.82%
▷ Public methods9586.36%
▷ Protected methods10.91%
▷ Private methods1412.73%
Functions6
▷ Named functions583.33%
▷ Anonymous functions116.67%
Constants13
▷ Global constants13100.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
14 PNG files occupy 0.18MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/img/bg_horiz.png38.64KB23.73KB▼ 38.59%
admin/img/wfps-rocket.png17.60KB7.93KB▼ 54.97%
admin/img/wfps-tick.png0.38KB0.33KB▼ 12.99%
admin/img/tick.png0.38KB0.33KB▼ 12.99%
admin/img/bg_premium.png64.64KB48.04KB▼ 25.68%