62% calculated-fields-form

Code Review | Calculated Fields Form

WordPress plugin Calculated Fields Form scored62%from 54 tests.

About plugin

  • Plugin page: calculated-fields...
  • Plugin version: 1.2.40
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.5-6.4
  • WordPress version: 6.3.1
  • First release: Mar 12, 2013
  • Latest release: Nov 28, 2023
  • Number of updates: 1,084
  • Update frequency: every 3.6 days
  • Top authors: codepeople (100%)

Code review

54 tests

User reviews

885 reviews

Install metrics

60,000+ active /6,341,207 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.53MB] [CPU: ▼3.08ms] Passed 4 tests

Analyzing server-side resources used by Calculated Fields Form
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.03 ▲0.5743.15 ▲3.07
Dashboard /wp-admin3.87 ▲0.5349.57 ▼12.05
Posts /wp-admin/edit.php3.92 ▲0.5750.00 ▼2.63
Add New Post /wp-admin/post-new.php6.41 ▲0.5395.86 ▼0.69
Media Library /wp-admin/upload.php3.73 ▲0.5045.65 ▲11.61
Add New /wp-admin/admin.php?page=cp_calculated_fields_form_sub_new3.9843.87
All Forms /wp-admin/admin.php?page=cp_calculated_fields_form3.9841.75
Upgrade /wp-admin/admin.php?page=cp_calculated_fields_form_sub_upgrade3.6834.69
Calculated Fields Form /wp-admin/options-general.php?page=cp_calculated_fields_form3.9842.37
Documentation /wp-admin/admin.php?page=cp_calculated_fields_form_sub_documentation3.6833.82
Online Help /wp-admin/admin.php?page=cp_calculated_fields_form_sub_forum3.6845.76
Troubleshoot Area & General Settings /wp-admin/admin.php?page=cp_calculated_fields_form_sub_troubleshoots_settings3.9854.22
Marketplace /wp-admin/admin.php?page=cp_calculated_fields_form_sub_marketplace3.6835.07

Server storage [IO: ▲3.01MB] [DB: ▲0.09MB] Passed 3 tests

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 282 new files
Database: 4 new tables, 9 new options
New tables
wp_cp_calculated_fields_form_posts
wp_cp_calculated_fields_form_revision
wp_cp_calculated_fields_form_settings
wp_cp_calculated_fields_form_discount_codes
New WordPress options
theysaidso_admin_options
wp_cp_calculated_fields_form_settings_ROW_FORMAT
installed_calculated-fields-form
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
db_upgraded
widget_recent-comments
CP_CALCULATEDFIELDSF_VERSION

Browser metrics Passed 4 tests

A check of browser resources used by Calculated Fields Form
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,843 ▲9214.22 ▼0.051.62 ▼0.0738.63 ▼9.40
Dashboard /wp-admin2,248 ▲715.57 ▼0.2591.19 ▼5.3440.06 ▼1.27
Posts /wp-admin/edit.php2,153 ▲502.03 ▲0.0640.95 ▼0.6836.00 ▼0.42
Add New Post /wp-admin/post-new.php6,240 ▲4,71419.15 ▼4.13881.26 ▲198.3166.43 ▲8.89
Media Library /wp-admin/upload.php1,456 ▲564.23 ▼0.0395.49 ▲1.3442.14 ▼0.66
Add New /wp-admin/admin.php?page=cp_calculated_fields_form_sub_new1,7992.3150.8457.44
All Forms /wp-admin/admin.php?page=cp_calculated_fields_form1,8022.3247.8839.59
Upgrade /wp-admin/admin.php?page=cp_calculated_fields_form_sub_upgrade2,7673.8083.65128.62
Calculated Fields Form /wp-admin/options-general.php?page=cp_calculated_fields_form1,8052.2642.4046.12
Documentation /wp-admin/admin.php?page=cp_calculated_fields_form_sub_documentation15,32825.40804.8229.59
Online Help /wp-admin/admin.php?page=cp_calculated_fields_form_sub_forum2,9644.80122.39143.92
Troubleshoot Area & General Settings /wp-admin/admin.php?page=cp_calculated_fields_form_sub_troubleshoots_settings1,8082.3034.4042.66
Marketplace /wp-admin/admin.php?page=cp_calculated_fields_form_sub_marketplace1,4124.0980.4741.08

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • Zombie tables detected upon uninstall: 4 tables
    • wp_cp_calculated_fields_form_discount_codes
    • wp_cp_calculated_fields_form_posts
    • wp_cp_calculated_fields_form_revision
    • wp_cp_calculated_fields_form_settings
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_recent-posts
    • installed_calculated-fields-form
    • widget_recent-comments
    • CP_CALCULATEDFIELDSF_VERSION
    • wp_cp_calculated_fields_form_settings_ROW_FORMAT
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These errors were triggered by the plugin
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=cp_calculated_fields_form_sub_marketplace
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

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 items
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/calculated-fields-form/inc/cpcff_openai.inc.php
    • > /wp-content/plugins/calculated-fields-form/inc/cpcff_public_int.inc.php
    • > /wp-content/plugins/calculated-fields-form/captcha/captcha.php
  • 25× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'FLBuilderModule' not found in wp-content/plugins/calculated-fields-form/pagebuilders/beaverbuilder/cff/cff/cff.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sanitize_text_field() in wp-content/plugins/calculated-fields-form/pagebuilders/siteorigin/siteorigin-cpcff-variable/tpl/siteorigin-cff-variable-shortcode.php:2
    • > PHP Warning
      Use of undefined constant CP_CALCULATEDFIELDSF_BASE_PATH - assumed 'CP_CALCULATEDFIELDSF_BASE_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/calculated-fields-form/pagebuilders/beaverbuilder/cffvar/cffvar.inc.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/calculated-fields-form/cp_calculatedfieldsf_free.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'ET_Builder_Module' not found in wp-content/plugins/calculated-fields-form/pagebuilders/divi/cff.pb.php:2
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/calculated-fields-form/pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php on line 2
    • > PHP Notice
      Undefined variable: instance in wp-content/plugins/calculated-fields-form/pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'FLBuilderModule' not found in wp-content/plugins/calculated-fields-form/pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_ssl() in wp-content/plugins/calculated-fields-form/config/cpcff_config.cfg.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/calculated-fields-form/inc/cpcff_admin_int.inc.php:3

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Tags: There are too many tags (44 tag instead of maximum 10)
You can take inspiration from this readme.txt

calculated-fields-form/cp_calculatedfieldsf_free.php 92% from 13 tests

The main PHP script in "Calculated Fields Form" version 1.2.40 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("calculated-fields-form.php" instead of "cp_calculatedfieldsf_free.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin22,608 lines of code in 205 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1161,04229912,484
PHP387661,1685,405
CSS293231693,770
PO File1267291653
HTML110167
INI140073
SVG50037
JSON10019

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity22.16
▷ Minimum class complexity1.00
▷ Maximum class complexity155.00
Average method complexity3.81
▷ Minimum method complexity1.00
▷ Maximum method complexity62.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes25
▷ Abstract classes00.00%
▷ Concrete classes25100.00%
▷ Final classes00.00%
Methods189
▷ Static methods4825.40%
▷ Public methods13873.02%
▷ Protected methods1910.05%
▷ Private methods3216.93%
Functions16
▷ Named functions1168.75%
▷ Anonymous functions531.25%
Constants93
▷ Global constants8894.62%
▷ Class constants55.38%
▷ Public constants5100.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
31 PNG files occupy 0.10MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendors/jquery-ui/images/ui-icons_777777_256x240.png6.85KB4.18KB▼ 38.94%
vendors/jquery-ui/images/ui-bg_glass_80_d7ebf9_1x400.png0.39KB0.16KB▼ 60.40%
pagebuilders/visualcomposer/CFFForm/CFFForm/public/cff-thumbnail.png7.98KB4.25KB▼ 46.73%
vendors/chosen/chosen-sprite@2x.png0.72KB0.83KB0.00%
templates/02/thumbnail.png2.27KB1.96KB▼ 13.80%