84% switch-theme-on-admin-bar

Code Review | Switch theme on admin bar

WordPress plugin Switch theme on admin bar scored84%from 54 tests.

About plugin

  • Plugin page: switch-theme-on-a...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8.0-4.1
  • WordPress version: 6.3.1
  • First release: Sep 13, 2014
  • Latest release: Feb 21, 2015
  • Number of updates: 11
  • Update frequency: every 14.9 days
  • Top authors: xxxx7 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /778 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼4.89ms] Passed 4 tests

A check of server-side resources used by Switch theme on admin bar
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.42 ▼0.0436.01 ▼3.44
Dashboard /wp-admin3.31 ▲0.0049.26 ▲0.17
Posts /wp-admin/edit.php3.36 ▲0.0048.12 ▼1.87
Add New Post /wp-admin/post-new.php5.89 ▲0.0084.06 ▼14.42
Media Library /wp-admin/upload.php3.23 ▲0.0042.13 ▲6.26

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Switch theme on admin bar
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,552 ▼20913.75 ▼0.617.79 ▲6.1615.22 ▼28.60
Dashboard /wp-admin2,198 ▲185.63 ▼0.0483.23 ▼3.5840.22 ▲2.89
Posts /wp-admin/edit.php2,103 ▲32.02 ▼0.0136.90 ▲0.3137.66 ▲0.90
Add New Post /wp-admin/post-new.php1,531 ▼122.94 ▼0.14667.85 ▲3.3868.90 ▲8.97
Media Library /wp-admin/upload.php1,397 ▼64.19 ▼0.02103.53 ▼0.9954.11 ▲2.82

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded

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 everything seems fine, this is not 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
The following issues need your attention
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/switch-theme-on-admin-bar/switch-theme-on-admin-bar.php:13

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 issues were found

Optimizations

Plugin configuration 97% 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
These attributes need to be fixed:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === switch-theme-on-admin-bar === )
The official readme.txt is a good inspiration

switch-theme-on-admin-bar/switch-theme-on-admin-bar.php Passed 13 tests

The main PHP file in "Switch theme on admin bar" ver. 1.1 adds more information about the plugin and also serves as the entry point for this plugin
46 characters long description:
This plugin adds Theme menus in the admin bar.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin46 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1171746

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
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%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There were not PNG files found in your plugin