84% wp-useragent

Code Review | WP-UserAgent

WordPress plugin WP-UserAgent scored84%from 54 tests.

About plugin

  • Plugin page: wp-useragent
  • Plugin version: 1.1.8
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0-5.5.1
  • WordPress version: 6.3.1
  • First release: Jun 17, 2009
  • Latest release: Oct 17, 2020
  • Number of updates: 80
  • Update frequency: every 51.7 days
  • Top authors: kyleabaker (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

300+ active /37,845 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 gracefully, with no errors

Server metrics [RAM: ▲0.35MB] [CPU: ▼0.92ms] Passed 4 tests

A check of server-side resources used by WP-UserAgent
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.83 ▲0.3744.49 ▲4.43
Dashboard /wp-admin3.66 ▲0.3553.23 ▼0.94
Posts /wp-admin/edit.php3.71 ▲0.3554.90 ▲2.82
Add New Post /wp-admin/post-new.php6.24 ▲0.3591.94 ▼9.99
Media Library /wp-admin/upload.php3.58 ▲0.3545.91 ▲9.94
WP-UserAgent /wp-admin/options-general.php?page=wp-useragent/wp-useragent-options.php3.8039.89

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 753 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

WP-UserAgent: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲3313.56 ▼1.071.63 ▼0.5341.24 ▼6.19
Dashboard /wp-admin2,213 ▲365.86 ▲0.99105.28 ▼13.3739.88 ▼5.92
Posts /wp-admin/edit.php2,096 ▲72.04 ▼0.0139.65 ▲2.2635.61 ▼1.38
Add New Post /wp-admin/post-new.php1,545 ▲1118.50 ▼4.59627.86 ▼90.6052.66 ▼12.84
Media Library /wp-admin/upload.php1,392 ▲44.18 ▲0.0794.72 ▼21.3942.88 ▼5.98
WP-UserAgent /wp-admin/options-general.php?page=wp-useragent/wp-useragent-options.php1,5261.7527.9244.44

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 8× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/wp-useragent/wp-useragent-detect-device.php
    • > /wp-content/plugins/wp-useragent/wp-useragent-detect-os.php
    • > /wp-content/plugins/wp-useragent/wp-useragent-detect-trackback.php
    • > /wp-content/plugins/wp-useragent/wp-useragent.php
    • > /wp-content/plugins/wp-useragent/wp-useragent-detect-webbrowser.php
    • > /wp-content/plugins/wp-useragent/wp-useragent-detect-platform.php
    • > /wp-content/plugins/wp-useragent/wp-useragent-detect-webbrowser-version.php
    • > /wp-content/plugins/wp-useragent/wp-useragent-options.php

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

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that need to be fixed:
  • Tags: Please reduce the number of tags, currently 15 tag instead of maximum 10
The official readme.txt is a good inspiration

wp-useragent/wp-useragent.php 92% from 13 tests

This is the main PHP file of "WP-UserAgent" version 1.1.8, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Description: The description should be shorter than 140 characters (currently 145 characters long)

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 detected4,962 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP92603034,113
PO File1412414849

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.41
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%
Functions19
▷ Named functions19100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.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
741 compressed PNG files occupy 0.75MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/24/os/edubuntu-2.png1.29KB1.41KB0.00%
img/16/net/palemoon.png0.78KB0.88KB0.00%
img/16/net/atomicwebbrowser.png0.28KB0.28KB0.00%
img/16/os/debian.png0.43KB0.60KB0.00%
img/16/net/samsung.png0.90KB1.08KB0.00%