78% contact-form-7

Code Review | Contact Form 7

WordPress plugin Contact Form 7 scored 78% from 54 tests.

About plugin

  • Plugin page: contact-form-7
  • Plugin version: 5.5.6
  • PHP version: 7.4.16
  • WordPress compatibility: 5.7-5.9
  • WordPress version: 5.9.2
  • First release: Aug 2, 2007
  • Latest release: Feb 23, 2022
  • Number of updates: 3,281
  • Update frequency: every 1.6 days
  • Top authors: takayukister (100%)

Code review

54 tests

User reviews

1938 reviews

Install metrics

5,000,000+ active / 215,753,439 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲2.11MB] [CPU: ▼277.17ms] Passed 4 tests

An overview of server-side resources used by Contact Form 7
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /5.51 ▲2.0074.48 ▲19.07
Dashboard /wp-admin5.59 ▲2.1853.45 ▲15.78
Posts /wp-admin/edit.php5.81 ▲2.1854.81 ▲13.09
Add New Post /wp-admin/post-new.php9.06 ▲2.09112.24 ▼1,152.61
Media Library /wp-admin/upload.php5.48 ▲2.1940.19 ▲15.05
Contact Forms /wp-admin/admin.php?page=wpcf75.5041.43
Add New /wp-admin/admin.php?page=wpcf7-new5.5748.51
Integration /wp-admin/admin.php?page=wpcf7-integration5.4640.57

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 99 new files
Database: no new tables, 1 new option
New WordPress options
wpcf7

Browser metrics Passed 4 tests

This is an overview of browser requirements for Contact Form 7
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,835 ▲8015.90 ▲0.276.83 ▲0.972.29 ▼0.05
Dashboard /wp-admin2,927 ▲696.15 ▲0.07116.36 ▼29.78155.16 ▼12.99
Posts /wp-admin/edit.php2,726 ▲383.25 ▲0.0163.47 ▲0.41138.35 ▼2.08
Add New Post /wp-admin/post-new.php1,724 ▲6321.63 ▲5.53441.80 ▲25.73161.74 ▲10.19
Media Library /wp-admin/upload.php1,729 ▲285.50 ▼0.04144.08 ▲8.87190.65 ▲5.37
Contact Forms /wp-admin/admin.php?page=wpcf71,6392.9056.14158.61
Add New /wp-admin/admin.php?page=wpcf7-new5,0773.8387.63249.14
Integration /wp-admin/admin.php?page=wpcf7-integration1,2392.8655.39117.92

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 1 option in the database
    • wpcf7

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/contact-form-7/admin/edit-contact-form.php
  • 48× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'WPCF7_PLUGIN_DIR/includes/l10n.php' (include_path='.:/usr/share/php') in wp-content/plugins/contact-form-7/load.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wpcf7_include_module_file() in wp-content/plugins/contact-form-7/modules/sendinblue/sendinblue.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/contact-form-7/modules/listo.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/contact-form-7/includes/rest-api.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/contact-form-7/modules/textarea.php:8
    • > PHP Warning
      Use of undefined constant WPCF7_PLUGIN_DIR - assumed 'WPCF7_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/contact-form-7/load.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/contact-form-7/modules/doi-helper.php:9
    • > PHP Warning
      Use of undefined constant WPCF7_PLUGIN_DIR - assumed 'WPCF7_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/contact-form-7/admin/admin.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/contact-form-7/modules/really-simple-captcha.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/contact-form-7/modules/disallowed-list.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
9 plugin tags: form, contact form, captcha, ajax, email...

contact-form-7/wp-contact-form-7.php 92% from 13 tests

The main file in "Contact Form 7" v. 5.5.6 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("contact-form-7.php" instead of "wp-contact-form-7.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected16,085 lines of code in 84 files:
LanguageFilesBlank linesComment linesLines of code
PHP683,8731,22913,378
CSS81761212,241
JavaScript71234465
SVG1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity24.69
▷ Minimum class complexity1.00
▷ Maximum class complexity107.00
Average method complexity3.05
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes34
▷ Abstract classes25.88%
▷ Concrete classes3294.12%
▷ Final classes00.00%
Methods397
▷ Static methods328.06%
▷ Public methods29574.31%
▷ Protected methods4711.84%
▷ Private methods5513.85%
Functions304
▷ Named functions27891.45%
▷ Anonymous functions268.55%
Constants42
▷ Global constants1842.86%
▷ Class constants2457.14%
▷ Public constants24100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
12 PNG files occupy 0.06MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/js/jquery-ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png4.57KB4.18KB▼ 8.43%
includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png0.32KB0.16KB▼ 50.46%
assets/icon.png29.11KB8.95KB▼ 69.24%
includes/js/jquery-ui/themes/smoothness/images/ui-icons_888888_256x240.png6.94KB4.18KB▼ 39.78%
includes/js/jquery-ui/themes/smoothness/images/ui-icons_222222_256x240.png6.86KB4.18KB▼ 39.05%