72% wp-scroll-to-top

Code Review | Scroll To Top

WordPress plugin Scroll To Top scored 72% from 54 tests.

About plugin

  • Plugin page: wp-scroll-to-top
  • Plugin version: 2.0
  • PHP version: 7.4.16
  • WordPress version: 5.8.1
  • First release: Nov 17, 2013
  • Latest release: Jun 14, 2016
  • Number of updates: 77
  • Update frequency: every 12.2 days
  • Top authors: umarbajwa (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

300+ active / 17,352 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼140.13ms] Passed 4 tests

Server-side resources used by Scroll To Top
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.87 ▲0.0340.43 ▲4.06
Dashboard /wp-admin3.09 ▲0.0445.10 ▲10.68
Posts /wp-admin/edit.php3.15 ▲0.0443.21 ▼1.01
Add New Post /wp-admin/post-new.php5.45 ▲0.0285.97 ▼561.67
Media Library /wp-admin/upload.php3.04 ▲0.0331.82 ▼1.89
Recommendations /wp-admin/admin.php?page=wstt_recommendations3.0229.52
Scroll To Top /wp-admin/admin.php?page=scr_options_premium3.0229.59

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 25 new files
Database: no new tables, 11 new options
New WordPress options
scr_font_size
scr_border_radius
scr_pre_icons
scr_text
activate_text_icon
scr_background_color
scr_color
scr_width
scr_position
scr_height
...

Browser metrics Passed 4 tests

Scroll To Top: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,859 ▲26316.34 ▲0.7312.70 ▲3.3849.50 ▼1.97
Dashboard /wp-admin3,005 ▲745.98 ▼0.24143.84 ▼9.25109.62 ▼2.40
Posts /wp-admin/edit.php2,777 ▲382.75 ▲0.0370.75 ▲5.5282.83 ▼7.60
Add New Post /wp-admin/post-new.php1,731 ▲4815.60 ▼3.11471.59 ▲61.77108.93 ▲5.54
Media Library /wp-admin/upload.php1,845 ▲355.05 ▲0.03157.84 ▲11.42112.99 ▼6.14
Recommendations /wp-admin/admin.php?page=wstt_recommendations1,3452.1052.9071.50
Scroll To Top /wp-admin/admin.php?page=scr_options_premium1,8603.2384.80118.63

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
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 11 options in the database
    • scr_font_size
    • scr_width
    • activate_pre_icon
    • activate_text_icon
    • scr_pre_icons
    • scr_height
    • scr_background_color
    • scr_color
    • scr_position
    • scr_text
    • ...

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
The following issues need your attention
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/wp-scroll-to-top/scr_style.php
  • 14× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: activate_pre_icon in wp-content/plugins/wp-scroll-to-top/scr_style.php on line 16
    • > PHP Notice
      Undefined variable: scr_border_radius in wp-content/plugins/wp-scroll-to-top/scr_style.php on line 20
    • > PHP Notice
      Undefined variable: scr_height in wp-content/plugins/wp-scroll-to-top/scr_style.php on line 15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/wp-scroll-to-top/admin/wstt_ui.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/wp-scroll-to-top/wp-scroller.php:14
    • > PHP Notice
      Undefined variable: scr_width in wp-content/plugins/wp-scroll-to-top/scr_style.php on line 21
    • > PHP Notice
      Undefined variable: scr_color in wp-content/plugins/wp-scroll-to-top/scr_style.php on line 43
    • > PHP Notice
      Undefined variable: scr_position in wp-content/plugins/wp-scroll-to-top/scr_style.php on line 8
    • > PHP Notice
      Undefined variable: scr_background_color in wp-content/plugins/wp-scroll-to-top/scr_style.php on line 24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/wp-scroll-to-top/wstt_recommendations.php:4

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
These are user-side errors you should fix
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=scr_options_premium
    • > Network (severe)
    wp-content/plugins/wp-scroll-to-top-premium/scr_style2.css?ver=5.8.1 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=scr_options_premium
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=scr_options_premium 203 The specified value "150px" cannot be parsed, or is out of range.
    • > GET request to /wp-admin/admin.php?page=scr_options_premium
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=scr_options_premium 207 The specified value "34px" cannot be parsed, or is out of range.
    • > GET request to /wp-admin/admin.php?page=scr_options_premium
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1 1:31592 "jQuery.Deferred exception: asd is not defined" "ReferenceError: asd is not defined\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/wp-scroll-to-top/js/color-picker.js?ver=5.8.1:3:9)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1:2:30340)" undefined
    • > GET request to /wp-admin/admin.php?page=scr_options_premium
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1 1:31702 Uncaught ReferenceError: asd is not defined

Optimizations

Plugin configuration 93% 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
These attributes need your attention:
  • Tags: Please delete some tags, you are using 13 tag instead of maximum 10
Please take inspiration from this readme.txt

wp-scroll-to-top/wp-scroller.php 92% from 13 tests

The primary PHP file in "Scroll To Top" version 2.0 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("wp-scroll-to-top.php" instead of "wp-scroller.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin494 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP410219473
JavaScript29021

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.01
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%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
17 PNG files occupy 0.24MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
imgs/slider.png27.00KB4.15KB▼ 84.63%
imgs/social-feed.png86.63KB25.78KB▼ 70.24%
scr_icons/icon-6/icon-6-red.png3.73KB0.93KB▼ 74.95%
scr_icons/icon-6/icon-6-black.png3.54KB0.93KB▼ 73.64%
scr_icons/icon-6/icon-6-blue.png3.73KB0.94KB▼ 74.88%