83% conditional-payments-for-woocommerce

Code Review | Conditional Payments for WooCommerce

WordPress plugin Conditional Payments for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: conditional-payme...
  • Plugin version: 3.0.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0.0-6.3
  • WordPress version: 6.3.1
  • First release: Sep 8, 2018
  • Latest release: Nov 3, 2023
  • Number of updates: 53
  • Update frequency: every 35.5 days
  • Top authors: wooelements (100%)

Code review

54 tests

User reviews

22 reviews

Install metrics

10,000+ active /102,316 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼5.78ms] Passed 4 tests

A check of server-side resources used by Conditional Payments for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0139.34 ▲4.34
Dashboard /wp-admin3.32 ▼0.0343.97 ▼12.64
Posts /wp-admin/edit.php3.37 ▲0.0148.14 ▲1.22
Add New Post /wp-admin/post-new.php5.90 ▲0.0189.97 ▼9.35
Media Library /wp-admin/upload.php3.24 ▲0.0134.11 ▼2.35

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Conditional Payments for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.72 ▲0.371.73 ▲0.2242.42 ▲1.87
Dashboard /wp-admin2,195 ▲175.61 ▲0.0384.61 ▼31.7539.27 ▼8.80
Posts /wp-admin/edit.php2,100 ▼31.95 ▼0.0039.65 ▲1.8535.87 ▲4.14
Add New Post /wp-admin/post-new.php1,530 ▲423.43 ▲0.20625.41 ▼46.3955.70 ▼7.59
Media Library /wp-admin/upload.php1,403 ▼04.20 ▲0.0397.91 ▼1.4447.02 ▲4.83

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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 take a closer look at the following
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/conditional-payments-for-woocommerce/includes/frontend/views/debug.html.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/conditional-payments-for-woocommerce/includes/class-woo-conditional-payments-updater.php:127

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes: You can look at the official readme.txt

conditional-payments-for-woocommerce/conditional-payments-for-woocommerce.php 85% from 13 tests

The principal PHP file in "Conditional Payments for WooCommerce" v. 3.0.2 is loaded by WordPress automatically on each request
It is important 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
  • Requires at least: The required version number must match the one declared in readme.txt ("4.5" instead of "6.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected4,231 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP126225302,828
CSS411910488
Sass2940461
JavaScript2112109452
SVG2002

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.50
Average class complexity42.88
▷ Minimum class complexity1.00
▷ Maximum class complexity98.00
Average method complexity4.15
▷ Minimum method complexity1.00
▷ Maximum method complexity47.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods106
▷ Static methods3936.79%
▷ Public methods8782.08%
▷ Protected methods00.00%
▷ Private methods1917.92%
Functions46
▷ Named functions3882.61%
▷ Anonymous functions817.39%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.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
3 PNG files occupy 0.15MB with 0.06MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png103.79KB40.73KB▼ 60.76%
assets/banner-772x250.png44.29KB20.40KB▼ 53.95%
assets/icon-128x128.png2.75KB2.32KB▼ 15.53%