72% cm-table-of-content

Code Review | CM Table Of Contents

WordPress plugin CM Table Of Contents scored72%from 54 tests.

About plugin

  • Plugin page: cm-table-of-content
  • Plugin version: 1.1.8
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.0-6.3.0
  • WordPress version: 6.3.1
  • First release: Jun 3, 2015
  • Latest release: Jul 23, 2023
  • Number of updates: 201
  • Update frequency: every 14.8 days
  • Top authors: CreativeMindsSolutions (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

600+ active /30,316 total downloads

Benchmarks

Plugin footprint 82% 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.81MB] [CPU: ▲0.99ms] 75% from 4 tests

This is a short check of server-side resources used by CM Table Of Contents
Please fix the following
  • CPU: Total CPU usage must kept under 500.00ms (currently 909.87ms on /wp-admin/admin.php?page=cmtoc_settings)
PageMemory (MB)CPU Time (ms)
Home /4.30 ▲0.8447.48 ▲3.10
Dashboard /wp-admin4.14 ▲0.8360.63 ▲4.31
Posts /wp-admin/edit.php4.19 ▲0.8353.19 ▲0.82
Add New Post /wp-admin/post-new.php6.68 ▲0.7997.25 ▼1.97
Media Library /wp-admin/upload.php3.99 ▲0.7742.53 ▲2.01
Settings /wp-admin/admin.php?page=cmtoc_settings4.23909.87
User Guide /wp-admin/admin.php?page=cmtoc_about4.17451.09
Upgrade ➤ /wp-admin/admin.php?page=cmtoc_pro4.0145.02

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 90 new files
Database: no new tables, 25 new options
New WordPress options
cmtoc_table_of_contentsLevel0Tag
db_upgraded
cmtoc_table_of_contentsLevel2Tag
cmtoc_table_of_contentsOnlySingle
widget_theysaidso_widget
cmtoc_table_of_contentsLevel3Tag
cmtoc_table_of_contentsLevel1Size
cmtoc_table_of_contentsLevel4Size
cmtoc_table_of_contentsLevel3Size
cmtoc_table_of_contentsOnPosttypes
...

Browser metrics Passed 4 tests

Checking browser requirements for CM Table Of Contents
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲8913.21 ▼1.092.12 ▲0.1645.35 ▼0.92
Dashboard /wp-admin2,221 ▲335.86 ▲0.99111.53 ▼7.2189.26 ▲43.82
Posts /wp-admin/edit.php2,128 ▲422.04 ▼0.0138.01 ▲1.9240.15 ▲3.38
Add New Post /wp-admin/post-new.php6,414 ▲4,90027.27 ▲9.67963.57 ▲271.9156.37 ▲0.51
Media Library /wp-admin/upload.php1,412 ▲244.24 ▼0.01103.01 ▼8.4877.29 ▲31.12
Settings /wp-admin/admin.php?page=cmtoc_settings2,8428.6487.06101.59
User Guide /wp-admin/admin.php?page=cmtoc_about3,88114.85374.34208.10
Upgrade ➤ /wp-admin/admin.php?page=cmtoc_pro1,8772.0539.1660.93

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 25 options
    • cmtoc_table_of_contentsOnMainQuery
    • cmtoc_table_of_contentsLevel0Size
    • cmtoc_table_of_contentsLevel0Tag
    • cmtoc_table_of_contentsLevel2Tag
    • cmtoc_table_of_contentsLevel1Tag
    • cmtoc_table_of_contentsLevel5Tag
    • cmtoc_table_of_contentsLevel3Tag
    • widget_recent-posts
    • db_upgraded
    • cmtoc_table_of_contentsLevel3Size
    • ...

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/cm-table-of-content/views/backend/admin_nav.php
    • > /wp-content/plugins/cm-table-of-content/views/backend/admin_pro.php
    • > /wp-content/plugins/cm-table-of-content/views/backend/admin_about.php
  • 27× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Walker' not found in wp-content/plugins/cm-table-of-content/functions.php:469
    • > PHP Warning
      Use of undefined constant CMTOC_NAME - assumed 'CMTOC_NAME' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-table-of-content/views/backend/admin_pro.php on line 44
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cm-table-of-content/package/cminds-plugin-config.php:4
    • > PHP Warning
      Use of undefined constant CMTOC_NAME - assumed 'CMTOC_NAME' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-table-of-content/views/backend/admin_about.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_shortcode() in wp-content/plugins/cm-table-of-content/views/backend/admin_settings.php:8
    • > PHP Warning
      Use of undefined constant CMTOC_RELEASE_NOTES - assumed 'CMTOC_RELEASE_NOTES' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-table-of-content/views/backend/admin_about.php on line 6
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/cm-table-of-content/package/views/userguide_free.php:8
    • > PHP Warning
      Use of undefined constant CMTOC_RELEASE_NOTES - assumed 'CMTOC_RELEASE_NOTES' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-table-of-content/views/backend/admin_pro.php on line 11
    • > PHP Warning
      Use of undefined constant CMTOC_NAME - assumed 'CMTOC_NAME' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-table-of-content/views/backend/admin_pro.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'CMTOC_Pro' not found in wp-content/plugins/cm-table-of-content/views/backend/admin_template.php:6

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=cmtoc_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/admin.php?page=cmtoc_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.
    • > GET request to /wp-admin/admin.php?page=cmtoc_about
    • > Deprecation (warning) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yq/r/EkaQjAsGGEY.js?_nc_x=Ij3Wp8lg5Kz 271 Listener added for a synchronous 'DOMSubtreeModified' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.
    • > GET request to /wp-admin/admin.php?page=cmtoc_about
    • > Console-api (severe) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yq/r/EkaQjAsGGEY.js?_nc_x=Ij3Wp8lg5Kz 60:573 "ErrorUtils caught an error:\n\nCannot listen to an undefined element. [Caught in: Tried to listen to element of type click]\n\nSubsequent non-fatal errors won't be logged; see https://fburl.com/debugjs."

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
5 plugin tags: toc, contents, navigation, indexes, table of contents

cm-table-of-content/cm-table-of-content.php Passed 13 tests

The principal PHP file in "CM Table Of Contents" v. 1.1.8 is loaded by WordPress automatically on each request
76 characters long description:
Adds the "table of contents" to the pages based on the h1-h6 or custom tags.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin7,738 lines of code in 28 files:
LanguageFilesBlank linesComment linesLines of code
PHP179897086,110
CSS6141471,468
JavaScript52413160

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity81.00
▷ Minimum class complexity1.00
▷ Maximum class complexity254.00
Average method complexity4.01
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods134
▷ Static methods5944.03%
▷ Public methods12492.54%
▷ Protected methods107.46%
▷ Private methods00.00%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants24
▷ Global constants1666.67%
▷ Class constants833.33%
▷ Public constants8100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
55 PNG files occupy 0.57MB with 0.11MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
package/css/images/ui-bg_flat_75_ffffff_40x100.png0.20KB0.08KB▼ 58.17%
package/views/Hound2.png13.25KB13.59KB0.00%
package/views/no.png0.38KB0.44KB0.00%
assets/css/images/ui-bg_glass_75_dadada_1x400.png0.26KB0.16KB▼ 38.93%
package/views/img/v1.png0.24KB0.23KB▼ 2.49%