51% dtc-documents

Code Review | DTC Documents

WordPress plugin DTC Documents scored 51% from 54 tests.

About plugin

  • Plugin page: dtc-documents
  • Plugin version: 1.1.05
  • PHP compatiblity: 4.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0.1-6.0.1
  • WordPress version: 6.3.1
  • First release: Aug 12, 2022
  • Latest release: Aug 12, 2022
  • Number of updates: 28
  • Update frequency: every 0.0 days
  • Top authors: diversifiedtechnology (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active / 555 total downloads

Benchmarks

Plugin footprint 48% 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: ▼1.31MB] [CPU: ▼38.93ms] Passed 4 tests

Server-side resources used by DTC Documents
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.66 ▼0.8014.54 ▼23.81
Dashboard /wp-admin2.70 ▼0.6019.82 ▼27.61
Posts /wp-admin/edit.php2.70 ▼0.6518.46 ▼27.28
Add New Post /wp-admin/post-new.php2.70 ▼3.1818.41 ▼77.00
Media Library /wp-admin/upload.php2.70 ▼0.5216.79 ▼17.37
Mass Document Status /wp-admin/admin.php?page=dtc_mass_change_item_status2.7017.21
All Documents /wp-admin/admin.php?page=dtc_display_all_documents2.7018.51
Add New Document /wp-admin/admin.php?page=dtc_add_new_document2.7016.40
Add New Category /wp-admin/admin.php?page=dtc_add_new_category2.7018.34
DTC Documents /wp-admin/admin.php?page=dtc_document2.7017.24
Document Status /wp-admin/admin.php?page=dtc_change_item_status2.7017.46
All Categories /wp-admin/admin.php?page=dtc_all_categories2.7016.92
Delete Topic /wp-admin/admin.php?page=dtc_delete_item2.7018.05

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 39 new files
Database: 2 new tables, 6 new options
New tables
wp_dtc_doc_categories
wp_dtc_doc_documents
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

DTC Documents: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,011 ▲27614.81 ▲0.441.98 ▲0.1638.79 ▼5.83
Dashboard /wp-admin2,391 ▲2036.55 ▲1.67135.81 ▲20.3240.41 ▼6.47
Posts /wp-admin/edit.php2,305 ▲2133.50 ▲1.4855.28 ▲18.5940.17 ▲3.96
Add New Post /wp-admin/post-new.php1,705 ▲19122.20 ▲4.72562.38 ▼125.6532.52 ▼18.66
Media Library /wp-admin/upload.php1,441 ▲564.19 ▲0.0682.82 ▼18.0547.97 ▲3.34
Mass Document Status /wp-admin/admin.php?page=dtc_mass_change_item_status1,8194.3855.4734.52
All Documents /wp-admin/admin.php?page=dtc_display_all_documents1,1483.1844.0027.83
Add New Document /wp-admin/admin.php?page=dtc_add_new_document1,1223.2942.9230.25
Add New Category /wp-admin/admin.php?page=dtc_add_new_category1,0643.1644.0330.46
DTC Documents /wp-admin/admin.php?page=dtc_document1,0123.1941.3961.50
Document Status /wp-admin/admin.php?page=dtc_change_item_status1,8184.4352.5536.18
All Categories /wp-admin/admin.php?page=dtc_all_categories1,1423.2740.1728.82
Delete Topic /wp-admin/admin.php?page=dtc_delete_item1,8304.4153.0337.71

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/dtc-documents/index.php+150
    Constant DTC_DOC_PLUGIN_DIR already defined
  • This plugin does not fully uninstall, leaving 2 tables in the database
    • wp_dtc_doc_documents
    • wp_dtc_doc_categories
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 11 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dtc_delete_item
    • > Notice in wp-content/plugins/dtc-documents/index.php+150
    Constant DTC_DOC_PLUGIN_DIR already defined
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dtc_delete_item
    • > Notice in wp-content/plugins/dtc-documents/index.php+549
    Undefined index: table
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dtc_delete_item
    • > Notice in wp-content/plugins/dtc-documents/index.php+552
    Undefined index: id
    • > GET request to /wp-admin/admin.php?page=dtc_mass_change_item_status
    • > Warning in wp-content/plugins/dtc-documents/index.php+521
    array_map(): Expected parameter 2 to be an array, null given
    • > GET request to /wp-admin/admin.php?page=dtc_mass_change_item_status
    • > Notice in wp-content/plugins/dtc-documents/index.php+522
    Undefined index: action
    • > GET request to /wp-admin/admin.php?page=dtc_mass_change_item_status
    • > Warning in wp-content/plugins/dtc-documents/index.php+524
    Invalid argument supplied for foreach()
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dtc_delete_item
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.)
    • > GET request to /wp-admin/admin.php?page=dtc_display_all_documents
    • > Warning in wp-content/plugins/dtc-documents/views/document-list.php+201
    Division by zero
    • > GET request to /wp-admin/admin.php?page=dtc_add_new_document
    • > Notice in wp-content/plugins/dtc-documents/views/add_document.php+28
    Undefined variable: documentRow
    • > GET request to /wp-admin/admin.php?page=dtc_add_new_document
    • > Notice in wp-content/plugins/dtc-documents/views/add_document.php+28
    Trying to get property 'category_id' of non-object
    • > GET request to /wp-admin/admin.php?page=dtc_change_item_status
    • > Notice in wp-content/plugins/dtc-documents/index.php+486
    Undefined index: value

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
Please fix the following
  • 9× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Notice
      Undefined variable: document in wp-content/plugins/dtc-documents/views/shortcode-recent-document-btn.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_admin_url() in wp-content/plugins/dtc-documents/views/add_category.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_admin_url() in wp-content/plugins/dtc-documents/views/add_document.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/dtc-documents/views/category-list.php:102
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/dtc-documents/views/shortcode-document-list.php:23
    • > PHP Notice
      Undefined variable: optionCSSStyles in wp-content/plugins/dtc-documents/views/shortcode-recent-document-btn.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/dtc-documents/views/index.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/dtc-documents/views/shortcode-recent-document-btn.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/dtc-documents/views/document-list.php:65

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following browser errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dtc_delete_item
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=dtc_all_categories 242:30 Uncaught TypeError: Cannot set properties of null (setting 'checked')
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=dtc_delete_item
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=dtc_all_categories 176:25 Uncaught TypeError: Cannot read properties of null (reading 'checked')
    • > GET request to /wp-admin/admin.php?page=dtc_display_all_documents
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=dtc_display_all_documents 206:30 Uncaught TypeError: Cannot set properties of null (setting 'checked')
    • > GET request to /wp-admin/admin.php?page=dtc_display_all_documents
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=dtc_display_all_documents 163:25 Uncaught TypeError: Cannot read properties of null (reading 'checked')

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Tags: There are too many tags (12 tag instead of maximum 10)
You can take inspiration from this readme.txt

dtc-documents/index.php 69% from 13 tests

The principal PHP file in "DTC Documents" v. 1.1.05 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("dtc-documents.php" instead of "index.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist
  • Description: Please keep the plugin description shorter than 140 characters (currently 513 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin5,208 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
SVG2102,681
PHP113795671,284
CSS42251741,170
JavaScript4242873

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions24
▷ Named functions24100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
5 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/dtc-doc-icon.png11.76KB11.68KB▼ 0.69%
style/css/icons/broken-image.png0.26KB0.17KB▼ 33.33%
style/css/icons/icon-arrow-left.png1.45KB0.40KB▼ 72.16%
style/css/icons/icon-close.png1.18KB0.43KB▼ 63.71%
style/css/icons/icon-arrow-right.png1.46KB0.41KB▼ 72.00%