83% table-of-contents-plus

Code Review | Table of Contents Plus

WordPress plugin Table of Contents Plus scored83%from 54 tests.

About plugin

  • Plugin page: table-of-contents...
  • Plugin version: 2311...
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-6.4
  • WordPress version: 6.3.1
  • First release: Jul 1, 2011
  • Latest release: Nov 7, 2023
  • Number of updates: 108
  • Update frequency: every 41.8 days
  • Top authors: conjur3r (100%)

Code review

54 tests

User reviews

142 reviews

Install metrics

300,000+ active /2,447,684 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.30MB] [CPU: ▼4.86ms] Passed 4 tests

Server-side resources used by Table of Contents Plus
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.78 ▲0.3243.73 ▲7.21
Dashboard /wp-admin3.61 ▲0.2649.70 ▼12.61
Posts /wp-admin/edit.php3.73 ▲0.3751.17 ▲3.95
Add New Post /wp-admin/post-new.php6.19 ▲0.3089.97 ▼10.14
Media Library /wp-admin/upload.php3.53 ▲0.3036.82 ▼0.63
TOC+ /wp-admin/options-general.php?page=toc3.5535.19

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 32 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_toc-widget
widget_recent-posts
db_upgraded
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Table of Contents Plus
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,880 ▲13313.44 ▼1.2910.33 ▲8.7542.80 ▲1.93
Dashboard /wp-admin2,199 ▲225.63 ▲0.0085.50 ▼5.4038.81 ▼1.76
Posts /wp-admin/edit.php2,104 ▲11.94 ▼0.0636.64 ▼0.9030.65 ▼1.99
Add New Post /wp-admin/post-new.php1,529 ▲323.35 ▼0.03658.98 ▼27.8653.40 ▼1.20
Media Library /wp-admin/upload.php1,398 ▼24.17 ▲0.0199.95 ▼12.3241.26 ▼10.02
TOC+ /wp-admin/options-general.php?page=toc1,9052.3734.9544.20

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The uninstall procedure has failed, leaving 7 options in the database
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_toc-widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

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
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/table-of-contents-plus/includes/globals.php:26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/table-of-contents-plus/includes/globals.php:26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/table-of-contents-plus/includes/globals.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/table-of-contents-plus/includes/class-toc-widget.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 86% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (An example of the table of contents, positioned at the top, right aligned, and a width of 275px), #2 (An example of the sitemap_pages shortcode), #3 (An example of the sitemap_posts shortcode), #4 (The options panel found in Settings > TOC+), #5 (Some advanced options), #6 (The sitemap tab)
The official readme.txt might help

table-of-contents-plus/toc.php 77% from 13 tests

"Table of Contents Plus" version 2311...'s main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Version: Use only periods and digits for the version number (ex. "1.0.3" instead of "2311...")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("table-of-contents-plus.php" instead of "toc.php")
  • Description: Keep the plugin description shorter than 140 characters (currently 143 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected2,234 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP62592001,508
Markdown2680292
CSS3170206
JavaScript32343192
XML19920
JSON10016

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity140.00
▷ Minimum class complexity13.00
▷ Maximum class complexity267.00
Average method complexity8.49
▷ Minimum method complexity1.00
▷ Maximum method complexity63.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods38
▷ Static methods00.00%
▷ Public methods3284.21%
▷ Protected methods00.00%
▷ Private methods615.79%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants24
▷ Global constants24100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
13 PNG files occupy 0.59MB with 0.32MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-3.png74.56KB31.51KB▼ 57.74%
screenshot-5.png134.04KB58.02KB▼ 56.71%
screenshot-1.png127.56KB54.65KB▼ 57.16%
images/blue.png9.87KB4.49KB▼ 54.46%
images/transparent.png21.52KB10.78KB▼ 49.93%