10% show-useragent

Code Review | Show UserAgent

WordPress plugin Show UserAgent scored10%from 54 tests.

About plugin

  • Plugin page: show-useragent
  • Plugin version: 1.0.9
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-3.5
  • WordPress version: 6.3.1
  • First release: Oct 8, 2010
  • Latest release: Dec 23, 2012
  • Number of updates: 49
  • Update frequency: every 16.9 days
  • Top authors: hzlzh (100%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active /11,445 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
It is recommended to fix the following installer errors
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/show-useragent/browser.php+3
    Trying to access array offset on value of type bool

Server metrics [RAM: ▼0.95MB] [CPU: ▼33.91ms] Passed 4 tests

A check of server-side resources used by Show UserAgent
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0140.54 ▲3.57
Dashboard /wp-admin3.00 ▼0.3123.74 ▼24.85
Posts /wp-admin/edit.php3.00 ▼0.3623.01 ▼24.31
Add New Post /wp-admin/post-new.php3.00 ▼2.8923.11 ▼78.43
Media Library /wp-admin/upload.php3.00 ▼0.2322.98 ▼8.05
Show-UserAgent /wp-admin/options-general.php?page=show-useragent/options.php3.0021.45

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Show UserAgent
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,808 ▲6213.60 ▼0.924.80 ▲3.1341.20 ▲0.34
Dashboard /wp-admin2,210 ▲224.86 ▼0.06104.89 ▲2.5539.50 ▲0.51
Posts /wp-admin/edit.php2,093 ▲12.06 ▲0.0138.53 ▼3.1636.46 ▼0.24
Add New Post /wp-admin/post-new.php1,537 ▲2323.20 ▲5.73648.20 ▲22.9759.47 ▲6.65
Media Library /wp-admin/upload.php1,389 ▼24.22 ▼0.03102.37 ▲0.7344.40 ▼1.18
Show-UserAgent /wp-admin/options-general.php?page=show-useragent/options.php1,0832.0523.3335.68

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall without warnings or errors
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • CID_options
    • db_upgraded
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=show-useragent/options.php
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
    • > GET request to /wp-admin/options-general.php?page=show-useragent/options.php
    • > Notice in wp-content/plugins/show-useragent/options.php+3
    Undefined index: mode

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
Please fix the following items
  • 6× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/show-useragent/options.php:76
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/show-useragent/show-useragent.php on line 12
    • > PHP Notice
      Undefined variable: CID_options in wp-content/plugins/show-useragent/browser.php on line 3
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/show-useragent/browser.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/show-useragent/show-useragent.php:15
    • > PHP Notice
      Undefined index: mode in wp-content/plugins/show-useragent/options.php on line 3

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Screenshots: These screenshots do not have images: #1 (Display on comment list.), #2 (Configure on /wp-admin/)
You can look at the official readme.txt

show-useragent/show-useragent.php Passed 13 tests

The entry point to "Show UserAgent" version 1.0.9 is a PHP file that has certain tags in its header comment area
98 characters long description:
Show visitors' IP to Country Flag, Web Browser, Operating System icons on WordPreess comment list.

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
It is important to fix the following items
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .bin - Binary Executable in Windows, macOS, Linux
      • wp-content/plugins/show-useragent/ip2c/ip-to-country.bin
1,633 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP5131331,558
PO File1243871
CSS1004
HTML1100

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity46.00
▷ Minimum class complexity46.00
▷ Maximum class complexity46.00
Average method complexity4.46
▷ Minimum method complexity2.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods13
▷ Static methods00.00%
▷ Public methods13100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions22
▷ Named functions22100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.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
447 compressed PNG files occupy 0.41MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
flags/lk.png0.61KB0.72KB0.00%
flags/tj.png0.48KB0.58KB0.00%
flags/ki.png0.64KB0.74KB0.00%
browsers/msie-mobile.png0.71KB1.00KB0.00%
browsers/sony-psp.png0.67KB0.83KB0.00%