62% code-sample-contact-form

Code Review | Code Sample Contact Form

WordPress plugin Code Sample Contact Form scored62%from 54 tests.

About plugin

  • Plugin page: code-sample-conta...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Jan 5, 2023
  • Latest release: Sep 29, 2023
  • Number of updates: 13
  • Update frequency: every 20.5 days
  • Top authors: codesampleinfo (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /180 total downloads

Benchmarks

Plugin footprint 65% 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.74MB] [CPU: ▼33.42ms] Passed 4 tests

Server-side resources used by Code Sample Contact Form
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1742.82 ▼7.16
Dashboard /wp-admin3.21 ▼0.1032.76 ▼23.80
Posts /wp-admin/edit.php3.21 ▼0.1528.40 ▼26.61
Add New Post /wp-admin/post-new.php3.21 ▼2.6825.84 ▼71.06
Media Library /wp-admin/upload.php3.21 ▼0.0227.58 ▼12.21
Setting /wp-admin/admin.php?page=setting_cs_contact3.2128.92
Add New /wp-admin/admin.php?page=add_cs_contact3.2128.16
Support /wp-admin/admin.php?page=support_cs_contact3.2127.49
CS Contact /wp-admin/admin.php?page=cs_contact3.2128.74

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 52 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Code Sample Contact Form: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,918 ▲17213.93 ▼0.459.08 ▲7.0143.31 ▲0.25
Dashboard /wp-admin2,241 ▲534.89 ▼0.01116.06 ▲11.8942.41 ▲1.38
Posts /wp-admin/edit.php2,128 ▲362.23 ▲0.1935.03 ▼6.7032.45 ▼4.20
Add New Post /wp-admin/post-new.php1,543 ▲14517.86 ▼0.01688.31 ▲46.6357.72 ▲12.91
Media Library /wp-admin/upload.php1,423 ▲384.24 ▲0.02104.01 ▲0.0541.92 ▼1.52
Setting /wp-admin/admin.php?page=setting_cs_contact1,1841.9527.8333.72
Add New /wp-admin/admin.php?page=add_cs_contact1,5292.0130.9041.04
Support /wp-admin/admin.php?page=support_cs_contact9491.8227.3835.28
CS Contact /wp-admin/admin.php?page=cs_contact9461.9328.8029.21

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall without warnings or errors
    • > User notice in wp-includes/functions.php+5905
    Function add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be numeric representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.)
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 12 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=cs_contact
    • > User notice in wp-includes/functions.php+5905
    Function add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be numeric representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.)
    • > GET request to /wp-admin/admin.php?page=setting_cs_contact
    • > Notice in wp-content/plugins/code-sample-contact-form/admin/controllers/wp_codesample_contact_controller.php+135
    unserialize(): Error at offset 0 of 1 bytes
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=cs_contact
    • > Notice in wp-content/plugins/code-sample-contact-form/admin/views/wp_codesample_contact-admin-list.php+56
    Only variables should be passed by reference
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=setting_cs_contact
    • > Notice in wp-content/plugins/code-sample-contact-form/admin/views/wp_codesample_contact-admin-setting.php+40
    Undefined variable: capcha
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=setting_cs_contact
    • > Notice in wp-content/plugins/code-sample-contact-form/admin/views/wp_codesample_contact-admin-setting.php+40
    Trying to access array offset on value of type null
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=add_cs_contact
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD
    • > GET request to /wp-admin/admin.php?page=support_cs_contact
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method Wp_codesample_contact_controller::view_support_contact() should not be called statically
    • > GET request to /wp-admin/admin.php?page=cs_contact
    • > Notice in wp-content/plugins/code-sample-contact-form/admin/controllers/wp_codesample_contact_controller.php+87
    Undefined index: action

SRP 50% 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
Please fix the following
  • 46× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/code-sample-contact-form/fields/email.php on line 14
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/code-sample-contact-form/fields/url.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/code-sample-contact-form/fields/number.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/code-sample-contact-form/admin/views/wp_codesample_contact-admin-setting.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/code-sample-contact-form/fields/text.php:20
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/code-sample-contact-form/fields/text.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/code-sample-contact-form/fields/url.php:20
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/code-sample-contact-form/fields/text.php on line 16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/code-sample-contact-form/fields/textarea.php:18
    • > PHP Notice
      Undefined variable: list_attr in wp-content/plugins/code-sample-contact-form/fields/email.php on line 13

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=support_cs_contact
    • > Network (severe)
    wp-content/plugins/wp_codesample_contact/admin/assets/images/contact.png - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=support_cs_contact
    • > Network (severe)
    wp-content/plugins/wp_codesample_contact/admin/assets/images/fanpage.png - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=support_cs_contact
    • > Network (severe)
    wp-content/plugins/wp_codesample_contact/admin/assets/images/bug.png - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=support_cs_contact
    • > Network (severe)
    wp-content/plugins/wp_codesample_contact/admin/assets/images/guide.png - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=support_cs_contact
    • > Network (severe)
    wp-content/plugins/wp_codesample_contact/admin/assets/images/pro.svg - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 86% 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
Please fix the following attributes: The official readme.txt is a good inspiration

code-sample-contact-form/wp_codesample_contact.php 77% from 13 tests

The entry point to "Code Sample Contact Form" version 1.0.0 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 240 characters long)
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes
  • Main file name: Name the main plugin file the same as the plugin slug ("code-sample-contact-form.php" instead of "wp_codesample_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,267 lines of code in 39 files:
LanguageFilesBlank linesComment linesLines of code
PHP342407491,658
CSS28810418
JavaScript2307190
SVG1001

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.34
Average class complexity8.55
▷ Minimum class complexity1.00
▷ Maximum class complexity30.00
Average method complexity2.69
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods49
▷ Static methods510.20%
▷ Public methods4387.76%
▷ Protected methods00.00%
▷ Private methods612.24%
Functions9
▷ Named functions888.89%
▷ Anonymous functions111.11%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
7 PNG files occupy 0.07MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/assets/images/contact.png5.79KB5.65KB▼ 2.31%
admin/assets/images/guide.png26.21KB10.24KB▼ 60.94%
admin/assets/images/bug.png21.63KB8.43KB▼ 61.01%
admin/assets/images/contact_support.png8.06KB8.04KB0.25%
admin/assets/images/fanpage_old.png12.27KB7.19KB▼ 41.35%