83% jp-theme-bar

Code Review | JP Theme Switcher Bar

WordPress plugin JP Theme Switcher Bar scored83%from 54 tests.

About plugin

  • Plugin page: jp-theme-bar
  • Plugin version: 0.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.0
  • WordPress version: 6.3.1
  • First release: Jan 18, 2014
  • Latest release: Sep 4, 2014
  • Number of updates: 9
  • Update frequency: every 25.4 days
  • Top authors: Shelob9 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,462 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

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

An overview of server-side resources used by JP Theme Switcher Bar
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0848.68 ▲10.34
Dashboard /wp-admin3.39 ▲0.0950.69 ▲3.32
Posts /wp-admin/edit.php3.44 ▲0.0951.22 ▼0.13
Add New Post /wp-admin/post-new.php5.99 ▲0.1192.25 ▼7.48
Media Library /wp-admin/upload.php3.31 ▲0.0940.11 ▲4.42
JP Theme Bar /wp-admin/themes.php?page=jptb_settings3.2837.38

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 16 new files
Database: no new tables, 11 new options
New WordPress options
widget_recent-comments
db_upgraded
bg_colour
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
label
text_colour
widget_recent-posts
label_bg_colour
...

Browser metrics Passed 4 tests

A check of browser resources used by JP Theme Switcher Bar
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,031 ▲28514.00 ▼0.3712.18 ▲10.2242.97 ▲2.82
Dashboard /wp-admin2,212 ▲244.88 ▼0.02111.36 ▲1.4342.54 ▲1.17
Posts /wp-admin/edit.php2,095 ▲62.04 ▲0.0841.21 ▲1.7335.21 ▼4.51
Add New Post /wp-admin/post-new.php1,533 ▲1923.44 ▲5.91670.57 ▲44.0657.68 ▲0.53
Media Library /wp-admin/upload.php1,397 ▲64.22 ▲0.0394.59 ▼12.2942.64 ▼0.27
JP Theme Bar /wp-admin/themes.php?page=jptb_settings8972.2727.0432.03

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 11 options
    • theysaidso_admin_options
    • widget_recent-comments
    • label_bg_colour
    • widget_recent-posts
    • label_text_colour
    • text_colour
    • can_compress_scripts
    • db_upgraded
    • bg_colour
    • label
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/jp-theme-bar/jptb-admin.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/jp-theme-bar/jptb-frontend.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/jp-theme-bar/jptb-frontend.php:9

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 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Tags: Please delete some tags, you are using 11 tag instead of maximum 10
You can take inspiration from this readme.txt

jp-theme-bar/jptb-theme-bar.php 85% from 13 tests

The principal PHP file in "JP Theme Switcher Bar" v. 0.1.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("jp-theme-bar.php" instead of "jptb-theme-bar.php")

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 detected424 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP564237367
CSS15032
JavaScript22025

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.13
Average class complexity10.00
▷ Minimum class complexity9.00
▷ Maximum class complexity11.00
Average method complexity1.69
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods26
▷ Static methods13.85%
▷ Public methods26100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
4 PNG files occupy 0.51MB with 0.18MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png103.44KB31.54KB▼ 69.51%
assets/banner-772x250.png8.11KB7.93KB▼ 2.17%
assets/banner-1544x500.png16.73KB16.24KB▼ 2.93%
assets/screenshot-2.png394.07KB139.10KB▼ 64.70%