83% to-top

Code Review | To Top

WordPress plugin To Top scored83%from 54 tests.

About plugin

  • Plugin page: to-top
  • Plugin version: 2.5.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.7-6.4
  • WordPress version: 6.3.1
  • First release: Feb 1, 2016
  • Latest release: Nov 15, 2023
  • Number of updates: 41
  • Update frequency: every 69.4 days
  • Top authors: catchthemes (100%)

Code review

54 tests

User reviews

50 reviews

Install metrics

80,000+ active /1,003,667 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
Install script ran successfully

Server metrics [RAM: ▲0.24MB] [CPU: ▲0.89ms] Passed 4 tests

This is a short check of server-side resources used by To Top
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.72 ▲0.2538.83 ▼0.67
Dashboard /wp-admin3.55 ▲0.2450.82 ▲2.66
Posts /wp-admin/edit.php3.67 ▲0.3050.31 ▲5.01
Add New Post /wp-admin/post-new.php6.13 ▲0.2497.48 ▲2.49
Media Library /wp-admin/upload.php3.47 ▲0.2435.63 ▼0.93

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 54 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for To Top
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,920 ▲15813.73 ▼0.619.25 ▲7.4940.94 ▼2.75
Dashboard /wp-admin2,214 ▲375.58 ▼0.0694.70 ▼5.8742.22 ▲2.35
Posts /wp-admin/edit.php2,113 ▲161.96 ▲0.0040.55 ▼0.4038.16 ▲2.59
Add New Post /wp-admin/post-new.php1,541 ▲1523.24 ▲0.14585.27 ▼79.2853.88 ▲2.40
Media Library /wp-admin/upload.php1,410 ▲104.21 ▲0.0297.20 ▼9.1942.08 ▼2.04

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

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
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Control' not found in wp-content/plugins/to-top/admin/partials/customizer/customizer-custom-controls.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/to-top/admin/partials/to-top-admin-display.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_query_arg() in wp-content/plugins/to-top/admin/partials/to-top-dashboard.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function remove_action() in wp-content/plugins/to-top/admin/inc/CatchThemesThemePlugin.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/to-top/admin/partials/sidebar.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/to-top/admin/partials/footer.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/to-top/admin/inc/ctp-tabs-removal.php:16

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)
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Tags: Too many tags (13 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

to-top/to-top.php 77% from 13 tests

"To Top" version 2.5.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Domain Path: Prefix the domain path with a forward slash character ("/languages")
  • Description: Please don't use more than 140 characters for the plugin description (currently 153 characters long)
  • Domain Path: The domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("languages")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin6,785 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
CSS7183603,271
PHP174287221,645
SVG2031,189
JavaScript57624423
PO File191136257

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity14.67
▷ Minimum class complexity1.00
▷ Maximum class complexity47.00
Average method complexity3.51
▷ Minimum method complexity1.00
▷ Maximum method complexity32.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods49
▷ Static methods24.08%
▷ Public methods4489.80%
▷ Protected methods00.00%
▷ Private methods510.20%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
5 PNG files occupy 0.02MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/premium-plugin-246x116.png9.01KB4.16KB▼ 53.83%
admin/images/arrow-up.png1.35KB0.40KB▼ 70.17%
admin/images/arrow-down.png1.36KB0.40KB▼ 70.40%
admin/images/free-plugin-246x116.png8.01KB3.81KB▼ 52.42%
admin/images/default.png5.58KB2.07KB▼ 62.83%