58% cf7-message-filter

Code Review | Message Filter for Contact Form 7

WordPress plugin Message Filter for Contact Form 7 scored58%from 54 tests.

About plugin

  • Plugin page: cf7-message-filter
  • Plugin version: 1.5.3.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2-6.4
  • WordPress version: 6.3.1
  • First release: Aug 30, 2018
  • Latest release: Nov 29, 2023
  • Number of updates: 60
  • Update frequency: every 32.0 days
  • Top authors: kofimokome (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

2,000+ active /23,869 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲5.64MB] [CPU: ▲35.39ms] 75% from 4 tests

Server-side resources used by Message Filter for Contact Form 7
The following require your attention
  • Extra RAM: Extra memory usage should kept under 5MB (currently 5.64MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.25 ▲5.7976.97 ▲36.51
Dashboard /wp-admin9.27 ▲5.9687.54 ▲39.51
Posts /wp-admin/edit.php9.27 ▲5.9191.43 ▲42.51
Add New Post /wp-admin/post-new.php10.77 ▲4.88127.60 ▲23.03
Media Library /wp-admin/upload.php9.27 ▲6.0482.96 ▲50.09
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius9.2769.67

Server storage [IO: ▲15.52MB] [DB: ▲0.01MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 315 new files
Database: 3 new tables, 19 new options
New tables
wp_kmcf7_statistics
wp_kmcf7_messages
wp_kmcf7_migrations
New WordPress options
kmcfmf_tags_by_name
kmcfmf_emails_blocked_today
kmcfmf_updated_to_1_3_0
theysaidso_admin_options
kmcfmf_restricted_words
kmcfmf_contact_form_7_textarea_fields
widget_recent-posts
kmcfmf_enable_contact_form_7_toggle
kmcfmf_updated_to_1_4_0
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

An overview of browser requirements for Message Filter for Contact Form 7
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,864 ▲10214.44 ▲0.161.79 ▼0.0126.88 ▼16.61
Dashboard /wp-admin2,244 ▲665.83 ▲0.11102.07 ▼11.8345.15 ▲1.02
Posts /wp-admin/edit.php2,150 ▲502.46 ▲0.4441.71 ▲1.8537.59 ▼0.22
Add New Post /wp-admin/post-new.php1,556 ▲2623.05 ▼0.15664.80 ▼16.1769.96 ▲5.65
Media Library /wp-admin/upload.php1,449 ▲494.44 ▲0.2599.30 ▲2.3743.93 ▲2.57
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius1,1041.9329.1529.45

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/cf7-message-filter/freemius/includes/class-freemius.php+8546
    Undefined property: stdClass::$plugins
  • Zombie tables were found after uninstall: 3 tables
    • wp_kmcf7_migrations
    • wp_kmcf7_statistics
    • wp_kmcf7_messages
  • Zombie WordPress options were found after uninstall: 19 options
    • kmcfmf_report_email
    • widget_recent-posts
    • kmcfmf_restricted_words
    • kmcfmf_contact_form_7_textarea_fields
    • kmcfmf_updated_to_1_4_0
    • kmcfmf_contact_form_7_email_fields
    • fs_accounts
    • kmcfmf_tags_by_name
    • kmcfmf_restricted_emails
    • widget_theysaidso_widget
    • ...

Smoke tests 50% 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 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/cf7-message-filter/cf7-message-filter.php
  • 32× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/cf7-message-filter/core/requires.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function km_message_filter\\esc_html_e() in wp-content/plugins/cf7-message-filter/views/settings/plugins.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function km_message_filter\\apply_filters() in wp-content/plugins/cf7-message-filter/views/settings/extensions.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/cf7-message-filter/lib/requires.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/cf7-message-filter/views/mails/index.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function km_message_filter\\sanitize_text_field() in wp-content/plugins/cf7-message-filter/views/messages/message.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'KMModel' not found in wp-content/plugins/cf7-message-filter/models/Message.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'km_message_filter\\Module' not found in wp-content/plugins/cf7-message-filter/modules/dashboard/DashboardModule.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function km_message_filter\\esc_html_e() in wp-content/plugins/cf7-message-filter/views/settings/data_collection.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function km_message_filter\\esc_html_e() in wp-content/plugins/cf7-message-filter/views/settings/filters.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
7 plugin tags: contact-form-7, spam, wp forms, contact form 7, wpforms...

cf7-message-filter/cf7-message-filter.php Passed 13 tests

The main file in "Message Filter for Contact Form 7" v. 1.5.3.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
102 characters long description:
Filters messages submitted from contact form seven if it has words or email marked as spam by the user

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected95,321 lines of code in 246 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript3310,77714,39549,587
PHP1759,13518,61639,128
JSON2003,997
CSS301911151,920
Markdown32180644
Sass12021
XML10016
HTML1008

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 3,096)
Cyclomatic complexity
Average complexity per logical line of code0.58
Average class complexity62.16
▷ Minimum class complexity1.00
▷ Maximum class complexity3,096.00
Average method complexity4.29
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces2
Interfaces1
Traits0
Classes80
▷ Abstract classes33.75%
▷ Concrete classes7796.25%
▷ Final classes00.00%
Methods1,518
▷ Static methods22114.56%
▷ Public methods1,07770.95%
▷ Protected methods291.91%
▷ Private methods41227.14%
Functions141
▷ Named functions12085.11%
▷ Anonymous functions2114.89%
Constants161
▷ Global constants10363.98%
▷ Class constants5836.02%
▷ Public constants58100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
17 PNG files occupy 3.60MB with 2.59MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/upgrade3.png174.58KB47.68KB▼ 72.69%
assets/images/upgrade1.png176.54KB47.77KB▼ 72.94%
assets/csv_sample.png33.60KB8.64KB▼ 74.27%
assets/images/upgrade7.png276.33KB77.64KB▼ 71.90%
assets/images/black_friday.png51.06KB16.25KB▼ 68.17%