78% cf7-gated-content

Code Review | Contact Form 7 Gated Content

WordPress plugin Contact Form 7 Gated Content scored78%from 54 tests.

About plugin

  • Plugin page: cf7-gated-content
  • Plugin version: 1.4.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.4.1
  • WordPress version: 6.3.1
  • First release: Sep 8, 2018
  • Latest release: May 22, 2020
  • Number of updates: 53
  • Update frequency: every 11.8 days
  • Top authors: odisant (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

1,000+ active /12,799 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: ▲0.03MB] [CPU: ▼1.70ms] Passed 4 tests

An overview of server-side resources used by Contact Form 7 Gated Content
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0340.16 ▼3.01
Dashboard /wp-admin3.34 ▲0.0451.99 ▲5.33
Posts /wp-admin/edit.php3.46 ▲0.1049.74 ▲5.71
Add New Post /wp-admin/post-new.php5.92 ▲0.0480.22 ▼13.55
Media Library /wp-admin/upload.php3.25 ▲0.0236.16 ▲4.42

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 11 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Contact Form 7 Gated Content
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,944 ▲18714.66 ▲0.071.71 ▼0.5347.84 ▲3.99
Dashboard /wp-admin2,353 ▲1686.42 ▲0.54141.43 ▲28.2142.14 ▼5.15
Posts /wp-admin/edit.php2,253 ▲1643.33 ▲1.2947.74 ▲8.5030.28 ▼3.88
Add New Post /wp-admin/post-new.php1,523 ▼1423.03 ▼0.41639.89 ▲24.6636.99 ▼15.42
Media Library /wp-admin/upload.php1,392 ▲14.13 ▼0.0981.05 ▼19.5241.62 ▲0.27

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

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
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
Please fix the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/cf7-gated-content/templates/download_button.php
  • 6× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Notice
      Undefined variable: button_text in wp-content/plugins/cf7-gated-content/templates/download_button.php on line 8
    • > PHP Notice
      Undefined variable: button_classes in wp-content/plugins/cf7-gated-content/templates/download_button.php on line 7
    • > PHP Notice
      Undefined variable: url in wp-content/plugins/cf7-gated-content/templates/download_button.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/cf7-gated-content/templates/metabox.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Apsis\\add_action() in wp-content/plugins/cf7-gated-content/cf7_gated_content.php:31
    • > PHP Notice
      Undefined variable: target in wp-content/plugins/cf7-gated-content/templates/download_button.php on line 7

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 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: contact form 7, gated file, cf7, form, gated content...

cf7-gated-content/cf7_gated_content.php 92% from 13 tests

The main PHP script in "Contact Form 7 Gated Content" version 1.4.4 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("cf7-gated-content.php" instead of "cf7_gated_content.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin715 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP372146386
JavaScript2307138
CSS216084
Bourne Shell1241075
Markdown126032

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity33.00
▷ Minimum class complexity33.00
▷ Maximum class complexity33.00
Average method complexity3.07
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods16
▷ Static methods16100.00%
▷ Public methods16100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.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
There are no PNG files in this plugin