10% contact-ajax-form

Code Review | Contact AJAX forms

WordPress plugin Contact AJAX forms scored10%from 54 tests.

About plugin

  • Plugin page: contact-ajax-form
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-4.9.6
  • WordPress version: 6.3.1
  • First release: Aug 4, 2018
  • Latest release: Aug 4, 2018
  • Number of updates: 4
  • Update frequency: every 0.8 days
  • Top authors: testiflair (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /818 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Deprecated in wp-content/plugins/contact-ajax-form/form-widget.php+3
    Methods with the same name as their class will not be constructors in a future version of PHP; IWAJAX_Contact_Widget has a deprecated constructor

Server metrics [RAM: ▼1.55MB] [CPU: ▼52.96ms] Passed 4 tests

An overview of server-side resources used by Contact AJAX forms
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.45 ▼1.018.49 ▼30.02
Dashboard /wp-admin2.47 ▼0.879.86 ▼58.10
Posts /wp-admin/edit.php2.47 ▼0.889.56 ▼33.49
Add New Post /wp-admin/post-new.php2.47 ▼3.4110.62 ▼90.22
Media Library /wp-admin/upload.php2.47 ▼0.7612.23 ▼26.01
All Forms /wp-admin/edit.php?post_type=iwacontactform2.479.76
Contact AJAX Form /wp-admin/options-general.php?page=ajaxcontact2.479.48
Add New Form /wp-admin/post-new.php?post_type=iwacontactform2.479.89
Submissions /wp-admin/edit.php?post_type=iwacontactsubmission2.4710.26

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 50 new files
Database: no new tables, 9 new options
New WordPress options
ajaxcontactvalues
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts
recovery_mode_email_last_sent
db_upgraded
widget_recent-comments
widget_iwajax_contact_widget

Browser metrics Passed 4 tests

A check of browser resources used by Contact AJAX forms
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,923 ▲13713.59 ▼0.808.35 ▲6.5643.34 ▼0.38
Dashboard /wp-admin2,221 ▲435.72 ▲0.0186.50 ▼17.5971.84 ▲28.20
Posts /wp-admin/edit.php2,155 ▲552.26 ▲0.2838.64 ▲1.0634.06 ▼1.64
Add New Post /wp-admin/post-new.php1,715 ▲18922.15 ▼1.00673.34 ▲84.4051.01 ▼3.83
Media Library /wp-admin/upload.php1,442 ▲424.35 ▲0.14104.22 ▲8.3474.16 ▲33.37
All Forms /wp-admin/edit.php?post_type=iwacontactform1,1402.2432.4729.07
Contact AJAX Form /wp-admin/options-general.php?page=ajaxcontact7331.6511.0920.97
Add New Form /wp-admin/post-new.php?post_type=iwacontactform2,1512.8859.7975.36
Submissions /wp-admin/edit.php?post_type=iwacontactsubmission1,1162.2431.9730.81

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Uninstall procedure had uncaught errors
    • > Deprecated in wp-content/plugins/contact-ajax-form/form-widget.php+3
    Methods with the same name as their class will not be constructors in a future version of PHP; IWAJAX_Contact_Widget has a deprecated constructor
  • Zombie WordPress options were found after uninstall: 9 options
    • widget_iwajax_contact_widget
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • ajaxcontactvalues

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=iwacontactsubmission
    • > POST request to /wp-admin/admin-ajax.php
    • > Deprecated in wp-content/plugins/contact-ajax-form/form-widget.php+3
    Methods with the same name as their class will not be constructors in a future version of PHP; IWAJAX_Contact_Widget has a deprecated constructor
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=iwacontactsubmission
    • > POST request to /wp-admin/admin-ajax.php
    • > Deprecated in wp-content/plugins/contact-ajax-form/form-widget.php+94
    Function create_function() is deprecated
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=iwacontactsubmission
    • > POST request to /wp-admin/admin-ajax.php
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in IWAJAX_Contact_Widget is deprecated since version 4.3.0! Use __construct() instead.
    • > GET request to /wp-admin/options-general.php?page=ajaxcontact
    • > Error in wp-content/plugins/contact-ajax-form/wpset/wpset.inc.php+409
    Uncaught Error: Call to undefined function split() in wp-content/plugins/contact-ajax-form/wpset/wpset.inc.php:409
    Stack trace:
    #0 wp-content/plugins/contact-ajax-form/wpset/wpset.inc.php(797): IWAJAX_WPSet->_getSettingsHtml()
    #1 wp-includes/class-wp-hook.php(310): IWAJAX_WPSet->printPageHtml()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 wp-admin/options-general.php(10): require_once('/var/www/wordpr...')
    #6 {main}
    thrown
  • 28 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=iwacontactform
    • > Notice in wp-content/plugins/contact-ajax-form/form-admin.php+654
    Undefined variable: field_type

SRP 50% 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
Almost there! Just fix the following items
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/contact-ajax-form/ajax-contact.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/contact-ajax-form/form-widget.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/contact-ajax-form/form-display.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/contact-ajax-form/form-admin.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/contact-ajax-form/functions.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'IWAJAX_WPSet' not found in wp-content/plugins/contact-ajax-form/ajax-settings.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 14 tag instead of maximum 10
You can take inspiration from this readme.txt

contact-ajax-form/ajax-contact.php 92% from 13 tests

"Contact AJAX forms" version 1.0.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("contact-ajax-form.php" instead of "ajax-contact.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
Good job! No executable or dangerous file extensions detected2,595 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP85557751,870
JavaScript33418325
PO File1127146277
CSS3340123

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity40.33
▷ Minimum class complexity1.00
▷ Maximum class complexity113.00
Average method complexity5.07
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods29
▷ Static methods00.00%
▷ Public methods1965.52%
▷ Protected methods00.00%
▷ Private methods1034.48%
Functions52
▷ Named functions52100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
30 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
wpset/images/tab-bar-bg.png0.91KB0.08KB▼ 91.05%
images/field-icons/ui-password.png0.27KB0.23KB▼ 14.91%
images/field-icons/ui-menu.png0.35KB0.38KB0.00%
images/tiny-success.png0.87KB0.64KB▼ 26.29%
images/post-type-icon.png0.44KB0.46KB0.00%