84% useragent-themes-switcher

Code Review | UserAgent Themes Switcher

WordPress plugin UserAgent Themes Switcher scored84%from 54 tests.

About plugin

  • Plugin page: useragent-themes-...
  • Plugin version: 2.04
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Aug 9, 2014
  • Latest release: Nov 2, 2023
  • Number of updates: 69
  • Update frequency: every 48.9 days
  • Top authors: Katsushi Kawamori (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

90+ active /4,923 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
Install script ran successfully

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

A check of server-side resources used by UserAgent Themes Switcher
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.1244.79 ▲3.15
Dashboard /wp-admin3.40 ▲0.0649.24 ▼15.75
Posts /wp-admin/edit.php3.46 ▲0.1054.52 ▲5.34
Add New Post /wp-admin/post-new.php5.99 ▲0.1090.57 ▼3.44
Media Library /wp-admin/upload.php3.33 ▲0.0943.57 ▲7.24
UserAgentThemesSwitcher /wp-admin/options-general.php?page=UserAgentThemesSwitcher3.3036.00

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 5 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
can_compress_scripts
uat_switcher
db_upgraded

Browser metrics Passed 4 tests

UserAgent Themes Switcher: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲4714.72 ▲0.371.78 ▼0.0438.49 ▼5.78
Dashboard /wp-admin2,199 ▲325.60 ▲0.0287.79 ▼25.7241.16 ▼1.17
Posts /wp-admin/edit.php2,107 ▲71.99 ▲0.0341.37 ▲3.4737.89 ▲3.56
Add New Post /wp-admin/post-new.php1,529 ▲123.65 ▲0.53683.95 ▼7.1760.28 ▼0.25
Media Library /wp-admin/upload.php1,404 ▲104.21 ▲0.0997.80 ▼3.1340.94 ▼3.90
UserAgentThemesSwitcher /wp-admin/options-general.php?page=UserAgentThemesSwitcher1,4551.9921.8827.92

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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 items
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/useragent-themes-switcher/lib/class-useragentthemesswitcheradmin.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/useragent-themes-switcher/lib/class-useragentthemesswitcheradmin.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/useragent-themes-switcher/lib/class-useragentthemesswitcher.php:37

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 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
3 plugin tags: themes, useragent, browser

useragent-themes-switcher/useragentthemesswitcher.php 92% from 13 tests

This is the main PHP file of "UserAgent Themes Switcher" version 2.04, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
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 ("useragent-themes-switcher.php" instead of "useragentthemesswitcher.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected453 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP459140453

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity34.50
▷ Minimum class complexity15.00
▷ Maximum class complexity54.00
Average method complexity4.50
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods11
▷ Static methods00.00%
▷ Public methods981.82%
▷ Protected methods00.00%
▷ Private methods218.18%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin