83% sagepay-form-gateway-for-woocommerce

Code Review | SagePay Form Gateway for WooCommerce

WordPress plugin SagePay Form Gateway for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: sagepay-form-gate...
  • Plugin version: 1.4.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.2.3
  • WordPress version: 6.3.1
  • First release: Sep 22, 2015
  • Latest release: Sep 18, 2019
  • Number of updates: 23
  • Update frequency: every 63.3 days
  • Top authors: patsatech (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active /4,853 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.01MB] [CPU: ▼8.56ms] Passed 4 tests

This is a short check of server-side resources used by SagePay Form Gateway for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0039.45 ▼1.82
Dashboard /wp-admin3.31 ▼0.0450.97 ▼11.59
Posts /wp-admin/edit.php3.36 ▲0.0050.84 ▼2.54
Add New Post /wp-admin/post-new.php5.89 ▲0.0090.26 ▼18.27
Media Library /wp-admin/upload.php3.23 ▲0.0037.76 ▲5.78

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 8 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for SagePay Form Gateway for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲1814.37 ▼0.151.82 ▼0.4240.18 ▼3.69
Dashboard /wp-admin2,198 ▲215.64 ▼0.1082.49 ▼2.9738.59 ▼3.07
Posts /wp-admin/edit.php2,097 ▼32.00 ▼0.0335.61 ▼5.7633.68 ▼3.89
Add New Post /wp-admin/post-new.php1,545 ▲1923.22 ▲5.38680.12 ▲50.0752.72 ▲1.92
Media Library /wp-admin/upload.php1,397 ▲34.22 ▼0.05101.67 ▼11.5546.81 ▼1.56

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

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
Even though everything seems fine, this is not an exhaustive test

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
The following issues need your attention
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sagepay-form-gateway-for-woocommerce/sagepayform.php:22

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 90% from 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
6 plugin tags: sagepay form, wordpress, ecommerce, sagepay go, woocommerce...

sagepay-form-gateway-for-woocommerce/sagepayform.php 77% from 13 tests

The primary PHP file in "SagePay Form Gateway for WooCommerce" version 1.4.5 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("sagepay-form-gateway-for-woocommerce.php" instead of "sagepayform.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Domain Path: The domain path is invalid: folder "/lang/" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected412 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP110878412

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity35.00
▷ Minimum class complexity35.00
▷ Maximum class complexity35.00
Average method complexity3.27
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods15
▷ Static methods00.00%
▷ Public methods1066.67%
▷ Protected methods00.00%
▷ Private methods533.33%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
6 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/card-amex.png4.45KB1.65KB▼ 62.79%
images/card-disc.png4.49KB1.47KB▼ 67.30%
images/card-visa.png4.73KB1.66KB▼ 64.98%
images/card-jcb.png5.54KB1.72KB▼ 69.02%
images/card-mc.png5.42KB1.77KB▼ 67.41%