62% cryptocurrency-payments-using-metamask-for-woocommerce

Code Review | Pay With MetaMask For WooCommerce - Cryptocurrency Payment Gateway

WordPress plugin Pay With MetaMask For WooCommerce - Cryptocurrency Payment Gateway scored62%from 54 tests.

About plugin

  • Plugin page: cryptocurrency-pa...
  • Plugin version: 1.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.2
  • WordPress version: 6.3.1
  • First release: Dec 30, 2021
  • Latest release: Oct 18, 2023
  • Number of updates: 34
  • Update frequency: every 19.4 days
  • Top authors: Narinder singh (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

1,000+ active /27,714 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼5.60ms] Passed 4 tests

Server-side resources used by Pay With MetaMask For WooCommerce - Cryptocurrency Payment Gateway
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0738.19 ▼0.78
Dashboard /wp-admin3.37 ▲0.0644.78 ▲0.38
Posts /wp-admin/edit.php3.48 ▲0.1246.00 ▲1.35
Add New Post /wp-admin/post-new.php5.96 ▲0.0780.86 ▼21.62
Media Library /wp-admin/upload.php3.29 ▲0.0636.21 ▼0.37
MetaMask /wp-admin/admin.php?page=wc-settings&tab=checkout§ion=cpmw3.0624.01
↳ Settings /wp-admin/admin.php?page=cpmw-metamask-settings3.0623.62
↳ Transaction /wp-admin/admin.php?page=cpmw-metamask3.2427.28

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 145 new files
Database: 1 new table, 14 new options
New tables
wp_cpmw_transaction
New WordPress options
CPMW_FREE_VERSION
widget_theysaidso_widget
widget_recent-comments
cpmw-already-rated
can_compress_scripts
cpmw_migarte_settings
widget_recent-posts
cpmw-installDate
theysaidso_admin_options
cpmw-v
...

Browser metrics Passed 4 tests

A check of browser resources used by Pay With MetaMask For WooCommerce - Cryptocurrency Payment Gateway
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,351 ▲1,59014.61 ▲0.242.06 ▲0.4138.67 ▼1.95
Dashboard /wp-admin3,744 ▲1,5676.30 ▲0.7077.03 ▼13.4856.80 ▲10.65
Posts /wp-admin/edit.php3,644 ▲1,5443.58 ▲1.6345.71 ▲9.7983.29 ▲40.09
Add New Post /wp-admin/post-new.php7,815 ▲6,28928.00 ▲4.51903.44 ▲222.2170.40 ▲2.20
Media Library /wp-admin/upload.php2,946 ▲1,5465.98 ▲1.80120.88 ▲27.7066.42 ▲25.84
MetaMask /wp-admin/admin.php?page=wc-settings&tab=checkout§ion=cpmw280.420.113.73
↳ Settings /wp-admin/admin.php?page=cpmw-metamask-settings280.420.073.80
↳ Transaction /wp-admin/admin.php?page=cpmw-metamask2,3193.3433.2238.53

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_cpmw_transaction
  • Zombie WordPress options were found after uninstall: 10 options
    • CPMW_FREE_VERSION
    • db_upgraded
    • cpmw_activation_time
    • can_compress_scripts
    • cpmw_migarte_settings
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • wp_cpmw_transaction_db_version

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=cpmw-metamask
    • > Warning in wp-includes/class-wp-hook.php+310
    call_user_func_array() expects parameter 1 to be a valid callback, class 'CPMW_TRANSACTION_TABLE' not found

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 11× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Trait 'CPMW_HELPER' not found in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/includes/class-rest-api.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/includes/cpmw-list-table.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/admin/table/cpmw-list-table.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/admin/class.review-notice.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function CPMW\\feedback\\add_action() in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/admin/feedback/admin-feedback-form.php:18
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/includes/cpmw-list-table.php on line 3
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/admin/table/cpmw-list-table.php on line 3
    • > PHP Warning
      Use of undefined constant CPMW_URL - assumed 'CPMW_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/admin/feedback/admin-feedback-form.php on line 167
    • > PHP Warning
      Use of undefined constant CPMW_VERSION - assumed 'CPMW_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/admin/feedback/admin-feedback-form.php on line 167
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/admin/table/cpmw-list-table.php on line 3

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=wc-settings&tab=checkout§ion=cpmw
    • > Network (severe)
    wp-admin/admin.php?page=wc-settings&tab=checkout&section=cpmw - Failed to load resource: the server responded with a status of 403 (Forbidden)
    • > GET request to /wp-admin/admin.php?page=cpmw-metamask-settings
    • > Network (severe)
    wp-admin/admin.php?page=cpmw-metamask-settings - Failed to load resource: the server responded with a status of 403 (Forbidden)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=cpmw-metamask
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of null (reading 'querySelector')" "TypeError: Cannot read properties of null (reading 'querySelector')\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/cryptocurrency-payments-using-metamask-for-woocommerce/assets/js/cpmw-admin.js?ver=1.4:16:43)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=cpmw-metamask
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of null (reading 'querySelector')

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
10 plugin tags: crypto, crypto payments, cryptocurrency, web3, payment...

cryptocurrency-payments-using-metamask-for-woocommerce/cryptocurrency-payments-using-metamask-for-woocommerce.php 85% from 13 tests

This is the main PHP file of "Pay With MetaMask For WooCommerce - Cryptocurrency Payment Gateway" version 1.4, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Domain Path: The domain path points to a folder that does not exist ("/languages")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

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
There were no executable files found in this plugin16,680 lines of code in 120 files:
LanguageFilesBlank linesComment linesLines of code
PHP792,1711,1328,629
JavaScript253492217,054
CSS810435984
SVG80013

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.56
Average class complexity21.13
▷ Minimum class complexity1.00
▷ Maximum class complexity151.00
Average method complexity6.04
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces1
Interfaces0
Traits1
Classes66
▷ Abstract classes23.03%
▷ Concrete classes6496.97%
▷ Final classes11.56%
Methods268
▷ Static methods4014.93%
▷ Public methods25595.15%
▷ Protected methods124.48%
▷ Private methods10.37%
Functions31
▷ Named functions3096.77%
▷ Anonymous functions13.23%
Constants20
▷ Global constants630.00%
▷ Class constants1470.00%
▷ Public constants14100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
10 compressed PNG files occupy 0.22MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/pro-features.png40.66KB40.32KB▼ 0.84%
assets/images/icon-256x256.png9.55KB10.00KB0.00%
assets/images/default-logo.png0.59KB0.53KB▼ 9.44%
assets/images/wallets-promotion.png3.83KB3.82KB0.28%
assets/images/metamask-pay.png6.37KB6.76KB0.00%