83% cf7-2checkout

Code Review | Contact Form 7 2Checkout

WordPress plugin Contact Form 7 2Checkout scored 83% from 54 tests.

About plugin

  • Plugin page: cf7-2checkout
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-4.9.6
  • WordPress version: 6.3.1
  • First release: Jul 9, 2018
  • Latest release: Jul 9, 2018
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: codeincept (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,117 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

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

This is a short check of server-side resources used by Contact Form 7 2Checkout
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0135.62 ▼7.41
Dashboard /wp-admin3.31 ▲0.0143.16 ▼6.99
Posts /wp-admin/edit.php3.36 ▲0.0047.34 ▲4.24
Add New Post /wp-admin/post-new.php5.89 ▲0.0081.75 ▼13.74
Media Library /wp-admin/upload.php3.23 ▲0.0033.30 ▼2.86

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Contact Form 7 2Checkout
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6913.24 ▼1.144.68 ▲2.9239.81 ▼4.51
Dashboard /wp-admin2,213 ▲255.88 ▲0.97105.58 ▼2.3239.86 ▼5.73
Posts /wp-admin/edit.php2,092 ▲32.04 ▲0.0440.04 ▲4.4036.87 ▲3.74
Add New Post /wp-admin/post-new.php1,537 ▲2023.41 ▲5.86677.83 ▼11.3157.68 ▲9.28
Media Library /wp-admin/upload.php1,386 ▼54.26 ▲0.0693.82 ▼5.5340.82 ▼3.24

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 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 13× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/TwocheckoutReturn.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/TwocheckoutNotification.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/Api/TwocheckoutProduct.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/Api/TwocheckoutCoupon.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/TwocheckoutCharge.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/Api/TwocheckoutOption.php:3
    • > PHP Notice
      Undefined variable: currency in wp-content/plugins/cf7-2checkout/includes/template/cf7-2checkout-form.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/Api/TwocheckoutPayment.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/cf7-2checkout/includes/template/cf7-2checkout-form.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Twocheckout' not found in wp-content/plugins/cf7-2checkout/lib/Twocheckout/Api/TwocheckoutUtil.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 86% 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: There are too many tags (12 tag instead of maximum 10)
The official readme.txt is a good inspiration

cf7-2checkout/contact-form-7-2checkout.php 77% from 13 tests

The main PHP script in "Contact Form 7 2Checkout" version 1.0.0 is automatically included on every request by WordPress
The following require your attention:
  • Requires at least: The required version number must match the one declared in readme.txt ("4.5.0" instead of "4.5")
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("cf7-2checkout.php" instead of "contact-form-7-2checkout.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin1,217 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
PHP19128401,091
HTML111125
CSS1051

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity7.94
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.81
▷ Minimum method complexity1.00
▷ Maximum method complexity36.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes15.56%
▷ Concrete classes1794.44%
▷ Final classes00.00%
Methods69
▷ Static methods4362.32%
▷ Public methods69100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants266.67%
▷ Class constants133.33%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.31MB with 0.21MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
Documentation/assets/form.png318.19KB102.23KB▼ 67.87%