78% btcpay-greenfield-for-woocommerce

Code Review | BTCPay for WooCommerce V2

WordPress plugin BTCPay for WooCommerce V2 scored78%from 54 tests.

About plugin

  • Plugin page: btcpay-greenfield...
  • Plugin version: 2.3.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.3
  • WordPress version: 6.3.1
  • First release: Feb 7, 2022
  • Latest release: Sep 6, 2023
  • Number of updates: 29
  • Update frequency: every 20.1 days
  • Top authors: ndeet (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

1,000+ active /20,609 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.16MB] [CPU: ▼6.25ms] Passed 4 tests

A check of server-side resources used by BTCPay for WooCommerce V2
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.61 ▲0.1540.12 ▼3.36
Dashboard /wp-admin3.48 ▲0.1451.83 ▼16.66
Posts /wp-admin/edit.php3.59 ▲0.2455.61 ▲5.38
Add New Post /wp-admin/post-new.php6.06 ▲0.1889.75 ▼9.34
Media Library /wp-admin/upload.php3.40 ▲0.1839.97 ▲4.38

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 138 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
btcpay_gf_version
widget_recent-posts
widget_recent-comments
db_upgraded
widget_theysaidso_widget
btcpaygf_permalinks_flushed
can_compress_scripts

Browser metrics Passed 4 tests

BTCPay for WooCommerce V2: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,855 ▲6914.47 ▲0.222.17 ▲0.1943.61 ▼0.79
Dashboard /wp-admin2,236 ▲365.90 ▲0.11110.59 ▼3.2739.76 ▼5.73
Posts /wp-admin/edit.php2,119 ▲192.17 ▲0.1444.90 ▲2.6236.07 ▼0.74
Add New Post /wp-admin/post-new.php1,560 ▲2423.18 ▲0.19645.88 ▲38.9555.55 ▲7.35
Media Library /wp-admin/upload.php1,415 ▲154.27 ▲0.05101.46 ▲0.7041.53 ▼2.43

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The uninstall procedure has failed, leaving 8 options in the database
    • db_upgraded
    • btcpay_gf_version
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • btcpaygf_permalinks_flushed

Smoke tests 50% 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 0% 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
Please take a closer look at the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/examples/manual_autoloading.php
  • 99× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/examples/lightning_store.php on line 3
    • > PHP Warning
      require(wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/examples/health.php on line 3
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/examples/payout_usage.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'BTCPayServer\\Result\\AbstractResult' not found in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/src/Result/ServerInfo.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'BTCPayServer\\Result\\Webhook' not found in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/src/Result/WebhookCreated.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'BTCPayServer\\Result\\AbstractResult' not found in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/src/Result/InvoiceCheckoutHTML.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'BTCPayServer\\Result\\AbstractResult' not found in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/src/Result/AbstractListResult.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'BTCPayServer\\Result\\AbstractResult' not found in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/src/Result/InvoicePayment.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'BTCPayServer\\Http\\ClientInterface' not found in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/src/Http/CurlClient.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'BTCPayServer\\Client\\AbstractClient' not found in wp-content/plugins/btcpay-greenfield-for-woocommerce/vendor/btcpayserver/btcpayserver-greenfield-php/src/Client/PullPayment.php:9

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% 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
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 13 tag instead of maximum 10
You can take inspiration from this readme.txt

btcpay-greenfield-for-woocommerce/btcpay-greenfield-for-woocommerce.php 92% from 13 tests

The principal PHP file in "BTCPay for WooCommerce V2" v. 2.3.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 183 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin7,238 lines of code in 122 files:
LanguageFilesBlank linesComment linesLines of code
PHP1151,4131,1856,952
JavaScript33549202
JSON10062
XML10015
CSS1006
SVG1001

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity6.97
▷ Minimum class complexity1.00
▷ Maximum class complexity76.00
Average method complexity2.22
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces10
Interfaces2
Traits0
Classes98
▷ Abstract classes55.10%
▷ Concrete classes9394.90%
▷ Final classes00.00%
Methods494
▷ Static methods5110.32%
▷ Public methods47495.95%
▷ Protected methods122.43%
▷ Private methods81.62%
Functions17
▷ Named functions15.88%
▷ Anonymous functions1694.12%
Constants39
▷ Global constants512.82%
▷ Class constants3487.18%
▷ Public constants34100.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
11 PNG files occupy 1.05MB with 0.67MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
.wordpress-org/screenshot-4.png52.62KB17.52KB▼ 66.70%
assets/images/btcpay-logo.png15.20KB2.65KB▼ 82.57%
.wordpress-org/banner-772x250.png19.36KB10.05KB▼ 48.09%
.wordpress-org/screenshot-2.png97.61KB27.75KB▼ 71.57%
.wordpress-org/banner-1544x500.png43.35KB21.84KB▼ 49.62%