77% xunhu-wechat-payment-for-woocommerce

Code Review | WordPress WooCommerce微信支付个人版

WordPress plugin WordPress WooCommerce微信支付个人版 scored77%from 54 tests.

About plugin

  • Plugin page: xunhu-wechat-paym...
  • Plugin version: 1.0.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.3.4
  • WordPress version: 6.3.1
  • First release: Dec 26, 2016
  • Latest release: Feb 19, 2022
  • Number of updates: 47
  • Update frequency: every 40.0 days
  • Top authors: xunhuweb (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active /14,605 total downloads

Benchmarks

Plugin footprint 82% 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.00MB] [CPU: ▼8.54ms] Passed 4 tests

This is a short check of server-side resources used by WordPress WooCommerce微信支付个人版
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.13 ▼3.82
Dashboard /wp-admin3.31 ▼0.0344.50 ▼14.78
Posts /wp-admin/edit.php3.36 ▲0.0145.70 ▼4.19
Add New Post /wp-admin/post-new.php5.89 ▲0.0185.79 ▼11.37
Media Library /wp-admin/upload.php3.23 ▲0.0136.79 ▲3.11

Server storage [IO: ▲0.23MB] [DB: ▲0.00MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Please try to fix the following items
  • Illegal file modification found: 1 file (0.00KB) outside of "wp-content/plugins/xunhu-wechat-payment-for-woocommerce/" and "wp-content/uploads/"
    • (new file) "wp-content/plugins/xunhu-wechat-payment-for-woocommerce/\344\275\277\347\224\250\350\257\264\346\230\216.txt"
Filesystem: 19 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-comments
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for WordPress WooCommerce微信支付个人版
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.22 ▼1.141.50 ▼0.1437.61 ▼2.62
Dashboard /wp-admin2,206 ▲185.81 ▲0.93100.57 ▼14.2437.88 ▼3.92
Posts /wp-admin/edit.php2,089 ▼02.02 ▼0.0338.20 ▲3.1133.52 ▼3.70
Add New Post /wp-admin/post-new.php1,533 ▲1923.24 ▲5.75682.60 ▲18.0753.24 ▼4.86
Media Library /wp-admin/upload.php1,388 ▼04.16 ▼0.2193.27 ▼1.6841.61 ▲0.05

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/xunhu-wechat-payment-for-woocommerce/views/notify.php
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'XH_Wechat_Payment_WC_Payment_Gateway' not found in wp-content/plugins/xunhu-wechat-payment-for-woocommerce/h5.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'XH_Wechat_Payment_WC_Payment_Gateway' not found in wp-content/plugins/xunhu-wechat-payment-for-woocommerce/views/query.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need your attention:
  • Screenshots: Add images for these screenshots: #4 (Pay screen in wechat), #5 (wechat mobile Screenshots)
The official readme.txt is a good inspiration

xunhu-wechat-payment-for-woocommerce/init.php 85% from 13 tests

The main PHP script in "WordPress WooCommerce微信支付个人版" version 1.0.7 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("xunhu-wechat-payment-for-woocommerce.php" instead of "init.php")
  • Text Domain: Please use dashes and lowercase characters for text domains

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 plugin1,685 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript279130725
PHP55545605
CSS12623298
PO File1171857

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity63.00
▷ Minimum class complexity63.00
▷ Maximum class complexity63.00
Average method complexity4.88
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods16
▷ Static methods212.50%
▷ Public methods1593.75%
▷ Protected methods00.00%
▷ Private methods16.25%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants9
▷ Global constants9100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/weixin.png3.57KB2.02KB▼ 43.49%
images/wechat.png3.09KB2.47KB▼ 20.10%
images/logo/wechat.png3.09KB2.47KB▼ 20.10%
images/img_14.png3.23KB1.85KB▼ 42.84%
images/ep_new_sprites1.png2.89KB0.20KB▼ 92.93%