61% smart-forms

Code Review | Smart Forms - when you need more than just a contact form

WordPress plugin Smart Forms - when you need more than just a contact form scored61%from 54 tests.

About plugin

  • Plugin page: smart-forms
  • Plugin version: 2.6.84
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-6.3
  • WordPress version: 6.3.1
  • First release: Dec 4, 2013
  • Latest release: Aug 23, 2023
  • Number of updates: 739
  • Update frequency: every 4.8 days
  • Top authors: EDGARROJAS (100%)

Code review

54 tests

User reviews

216 reviews

Install metrics

10,000+ active /634,813 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.27MB] [CPU: ▲0.16ms] Passed 4 tests

An overview of server-side resources used by Smart Forms - when you need more than just a contact form
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.74 ▲0.2740.05 ▲1.24
Dashboard /wp-admin3.58 ▲0.2746.72 ▼4.12
Posts /wp-admin/edit.php3.69 ▲0.3350.70 ▲2.27
Add New Post /wp-admin/post-new.php6.16 ▲0.2793.72 ▲4.90
Media Library /wp-admin/upload.php3.50 ▲0.2735.36 ▲1.26
Settings /wp-admin/admin.php?page=smart-forms/smartforms.phpsettings3.4733.37
Smart Forms /wp-admin/admin.php?page=smart_forms_menu3.5234.93
SmartFormsPreview /wp-admin/edit.php?post_type=smartforms_preview3.5436.99
Entries /wp-admin/admin.php?page=smart-forms/smartforms.phpentries3.5534.04
Add New /wp-admin/post-new.php?post_type=smartforms_preview3.6245.56
Support/Wish List /wp-admin/admin.php?page=smart-forms/smartforms.phpwish_list3.4735.00

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 947 new files
Database: 4 new tables, 7 new options
New tables
wp_rednao_smart_forms_entry
wp_rednao_smart_forms_entry_detail
wp_rednao_smart_forms_table_name
wp_rednao_smart_forms_uploaded_files
New WordPress options
db_upgraded
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_rednao_smart_forms_widget
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Smart Forms - when you need more than just a contact form
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,840 ▲9413.32 ▼1.064.56 ▲2.7345.55 ▼0.78
Dashboard /wp-admin2,243 ▲555.78 ▲0.9496.93 ▼16.9872.68 ▲27.95
Posts /wp-admin/edit.php2,129 ▲402.01 ▼0.0037.34 ▲0.1732.84 ▲0.99
Add New Post /wp-admin/post-new.php6,223 ▲4,69519.95 ▼3.081,134.41 ▲443.9343.91 ▼13.54
Media Library /wp-admin/upload.php1,422 ▲344.15 ▼0.06130.76 ▲35.0051.11 ▲5.86
Settings /wp-admin/admin.php?page=smart-forms/smartforms.phpsettings9803.1247.3236.59
Smart Forms /wp-admin/admin.php?page=smart_forms_menu1,0193.1245.2131.56
SmartFormsPreview /wp-admin/edit.php?post_type=smartforms_preview1,0921.9831.5929.41
Entries /wp-admin/admin.php?page=smart-forms/smartforms.phpentries1,4099.31167.0537.39
Add New /wp-admin/post-new.php?post_type=smartforms_preview2,3428.36178.33142.35
Support/Wish List /wp-admin/admin.php?page=smart-forms/smartforms.phpwish_list8052.0223.9429.35

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The plugin did not uninstall successfully, leaving 4 tables in the database
    • wp_rednao_smart_forms_entry_detail
    • wp_rednao_smart_forms_entry
    • wp_rednao_smart_forms_table_name
    • wp_rednao_smart_forms_uploaded_files
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_rednao_smart_forms_widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, 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
Please fix the following
  • 8× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/smart-forms/pr/smart-forms-pr-config.php
    • > /wp-content/plugins/smart-forms/smartforms.php
    • > /wp-content/plugins/smart-forms/pr/smart-forms-pr.php
    • > /wp-content/plugins/smart-forms/utilities/smart-forms-detail-generator.php
    • > /wp-content/plugins/smart-forms/main_screens/smart-forms-add-new.php
    • > /wp-content/plugins/smart-forms/main_screens/smart-forms-entries2.php
    • > /wp-content/plugins/smart-forms/main_screens/smart-forms-settings.php
    • > /wp-content/plugins/smart-forms/smart-forms-config.php
  • 130× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/smart-forms/main_screens/smart-forms-wishlist.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'rednao_base_elements_renderer' not found in wp-content/plugins/smart-forms/string_renderer/rednao_checkbox_renderer.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Smarty_Internal_CompileBase' not found in wp-content/plugins/smart-forms/php_classes/smarty/sysplugins/smarty_internal_compile_private_modifier.php:18
    • > PHP Warning
      Use of undefined constant SMART_FORMS_DIR - assumed 'SMART_FORMS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/smart-forms/php_classes/api/query/comparators/DateComparator.php on line 3
    • > PHP Warning
      Use of undefined constant SMART_FORMS_DIR - assumed 'SMART_FORMS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/smart-forms/main_screens/smart-forms-list.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'Smarty_Internal_CompileBase' not found in wp-content/plugins/smart-forms/php_classes/smarty/sysplugins/smarty_internal_compile_ldelim.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/smart-forms/additional_fields/smart-forms-additional-fields-list.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'rednao_base_elements_renderer' not found in wp-content/plugins/smart-forms/string_renderer/rednao_number_renderer.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Smarty_Resource' not found in wp-content/plugins/smart-forms/php_classes/smarty/sysplugins/smarty_resource_recompiled.php:17
    • > PHP Warning
      Use of undefined constant SMART_FORMS_DIR - assumed 'SMART_FORMS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/smart-forms/php_classes/api/query/WhereClause.php on line 8

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=smart-forms/smartforms.phpentries
    • > Console-api (severe) in wp-content/plugins/smart-forms/js/utilities/react/react.js?ver=6.3.1+275:33
    Warning: Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component." "forceUpdate" "Table

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Add descriptions for screenshots #10, #11, #12 in smart-forms/assets to your readme.txt
The official readme.txt is a good inspiration

smart-forms/smartforms.php 77% from 13 tests

The main PHP file in "Smart Forms - when you need more than just a contact form" ver. 2.6.84 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Domain Path: The domain path points to an invalid folder, "/languages/" does not exist
  • Text Domain: The text domain should only use lowercase characters and dashes
  • Main file name: The principal plugin file should be the same as the plugin slug ("smart-forms.php" instead of "smartforms.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
Good job! No executable or dangerous file extensions detected234,488 lines of code in 693 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript25632,49435,289182,504
PHP1913,3269,87322,325
CSS9099054616,396
TypeScript1202,4346,22011,090
SVG5001,062
Markdown41450423
JSON2010289
HTML4310224
Smarty1210116
Bourne Shell124055
LESS1004

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity17.31
▷ Minimum class complexity1.00
▷ Maximum class complexity171.00
Average method complexity3.88
▷ Minimum method complexity1.00
▷ Maximum method complexity97.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes163
▷ Abstract classes169.82%
▷ Concrete classes14790.18%
▷ Final classes00.00%
Methods947
▷ Static methods424.44%
▷ Public methods87091.87%
▷ Protected methods384.01%
▷ Private methods394.12%
Functions159
▷ Named functions159100.00%
▷ Anonymous functions00.00%
Constants201
▷ Global constants2612.94%
▷ Class constants17587.06%
▷ Public constants175100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
120 PNG files occupy 0.50MB with 0.14MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/smartFormsSlider/images/ui-icons_ffffff_256x240.png6.15KB4.17KB▼ 32.13%
js/utilities/iCheck/skins/square/purple.png2.14KB1.83KB▼ 14.31%
js/utilities/jsColor/hv.png2.80KB7.32KB0.00%
css/smartFormsSlider/images/ui-icons_ffd27a_256x240.png4.44KB4.17KB▼ 6.02%
images/arrow_down.png3.40KB0.48KB▼ 85.77%