73% sw-contact-form

Code Review | SW Contact Form

WordPress plugin SW Contact Form scored73%from 54 tests.

About plugin

  • Plugin page: sw-contact-form
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.3.1
  • WordPress version: 6.3.1
  • First release: Dec 13, 2015
  • Latest release: Dec 13, 2015
  • Number of updates: 2
  • Update frequency: every 6.0 days
  • Top authors: InfoTuts (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /877 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.15MB] [CPU: ▼3.05ms] Passed 4 tests

A check of server-side resources used by SW Contact Form
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1645.51 ▲3.33
Dashboard /wp-admin3.46 ▲0.1253.65 ▼16.39
Posts /wp-admin/edit.php3.58 ▲0.2254.05 ▲1.58
Add New Post /wp-admin/post-new.php6.06 ▲0.1899.18 ▼0.70
Media Library /wp-admin/upload.php3.39 ▲0.1644.43 ▲7.85
SW Contact Form /wp-admin/admin.php?page=swcf-plugin-menu3.3737.19
Contact Form Data Leads /wp-admin/admin.php?page=show-cn-form-leads3.3539.34

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 32 new files
Database: 2 new tables, 8 new options
New tables
wp_sw_formdata
wp_sw_formfieldtbl
New WordPress options
db_upgraded
cn_plugin_control
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_sidemenuwidget
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for SW Contact Form
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,936 ▲17513.52 ▼0.729.02 ▲7.2832.89 ▼10.28
Dashboard /wp-admin2,238 ▲615.72 ▲0.0984.64 ▼3.1880.58 ▲35.10
Posts /wp-admin/edit.php2,149 ▲522.03 ▲0.0147.74 ▲12.6633.74 ▼5.77
Add New Post /wp-admin/post-new.php1,558 ▲3023.64 ▲0.77751.07 ▲86.2163.85 ▲4.36
Media Library /wp-admin/upload.php1,434 ▲344.11 ▼0.08104.90 ▲8.0480.87 ▲36.20
SW Contact Form /wp-admin/admin.php?page=swcf-plugin-menu1,0831.6929.8932.69
Contact Form Data Leads /wp-admin/admin.php?page=show-cn-form-leads8341.8627.1026.03

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
  • Zombie WordPress options were found after uninstall: 7 options
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_sidemenuwidget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/sw-contact-form/uninstall.php
  • 9× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'CN_DAO' not found in wp-content/plugins/sw-contact-form/admin/leads.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/sw-contact-form/constant-option.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/sw-contact-form/js/frontend.js.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sw-contact-form/inc/ajax_hook_functions.php:58
    • > PHP Fatal error
      Uncaught Error: Class 'CN_DAO' not found in wp-content/plugins/sw-contact-form/admin/leads.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/sw-contact-form/constant-option.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/sw-contact-form/admin/contact.widget.php:2
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/sw-contact-form/constant-option.php on line 3
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/sw-contact-form/constant-option.php on line 3

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=swcf-plugin-menu
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=swcf-plugin-menu 196:31 Uncaught TypeError: jQuery(...).live is not a function
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=show-cn-form-leads
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).live is not a function" "TypeError: jQuery(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/sw-contact-form/js/admin.backend.js?ver=1.0:12:22)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=show-cn-form-leads
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: jQuery(...).live is not a function

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Screenshots: Screenshot #1 (Screenshots) image not found
You can take inspiration from this readme.txt

sw-contact-form/sw-contact-form.php Passed 13 tests

"SW Contact Form" version 1.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
83 characters long description:
Easily integrate contact form anywhere in their website using shortcode and widget.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin2,323 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP1261171,006
SVG100565
CSS534256496
JavaScript297256

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity11.86
▷ Minimum class complexity1.00
▷ Maximum class complexity28.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods57
▷ Static methods00.00%
▷ Public methods5392.98%
▷ Protected methods00.00%
▷ Private methods47.02%
Functions16
▷ Named functions16100.00%
▷ Anonymous functions00.00%
Constants16
▷ Global constants16100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
4 compressed PNG files occupy 0.00MB
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/wrong.png0.64KB0.72KB0.00%
images/correct.png0.52KB0.52KB0.00%
images/x.png1.04KB1.25KB0.00%
images/cn_form_icon.png0.82KB0.62KB▼ 24.07%