84% useragent-content-switcher

Code Review | UserAgent Content Switcher

WordPress plugin UserAgent Content Switcher scored84%from 54 tests.

About plugin

  • Plugin page: useragent-content...
  • Plugin version: 3.05
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Feb 23, 2014
  • Latest release: Nov 2, 2023
  • Number of updates: 65
  • Update frequency: every 54.4 days
  • Top authors: Katsushi Kawamori (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /3,420 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.08MB] [CPU: ▼5.85ms] Passed 4 tests

An overview of server-side resources used by UserAgent Content Switcher
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0837.07 ▼5.42
Dashboard /wp-admin3.39 ▲0.0846.34 ▲2.31
Posts /wp-admin/edit.php3.44 ▲0.0849.88 ▼2.22
Add New Post /wp-admin/post-new.php5.97 ▲0.0885.02 ▼18.07
Media Library /wp-admin/upload.php3.31 ▲0.0839.00 ▲5.44
UserAgentContentSwitcher /wp-admin/options-general.php?page=UserAgentContentSwitcher3.2831.98

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 5 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
uac_switcher
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for UserAgent Content Switcher
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,821 ▲7514.28 ▼0.101.82 ▲0.0736.66 ▼5.65
Dashboard /wp-admin2,205 ▲255.59 ▼0.0287.89 ▼9.6939.88 ▼1.95
Posts /wp-admin/edit.php2,104 ▲42.00 ▼0.0241.15 ▲3.6838.47 ▲4.41
Add New Post /wp-admin/post-new.php1,532 ▲622.90 ▼0.20682.54 ▼3.7953.37 ▲1.84
Media Library /wp-admin/upload.php1,407 ▲74.23 ▼0.0094.57 ▼3.3544.45 ▲2.97
UserAgentContentSwitcher /wp-admin/options-general.php?page=UserAgentContentSwitcher1,1101.9923.3528.98

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
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

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
The following issues need your attention
  • 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-content-switcher/lib/class-useragentcontentswitcheradmin.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/useragent-content-switcher/lib/class-useragentcontentswitcher.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/useragent-content-switcher/lib/class-useragentcontentswitcheradmin.php:39

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
7 plugin tags: browser, user agent, useragent, web browser, phone...

useragent-content-switcher/useragentcontentswitcher.php 92% from 13 tests

The principal PHP file in "UserAgent Content Switcher" v. 3.05 is loaded by WordPress automatically on each request
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("useragent-content-switcher.php" instead of "useragentcontentswitcher.php")

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
Everything looks great! No dangerous files found in this plugin390 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP456143390

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity30.00
▷ Minimum class complexity14.00
▷ Maximum class complexity46.00
Average method complexity4.10
▷ 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 methods872.73%
▷ Protected methods00.00%
▷ Private methods327.27%
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

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
PNG images were not found in this plugin