79% device-detector

Code Review | Device Detector

WordPress plugin Device Detector scored79%from 54 tests.

About plugin

  • Plugin page: device-detector
  • Plugin version: 3.6.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.4
  • WordPress version: 6.3.1
  • First release: Jan 22, 2020
  • Latest release: Oct 25, 2023
  • Number of updates: 31
  • Update frequency: every 44.3 days
  • Top authors: PierreLannoy (100%)

Code review

54 tests

User reviews

1 review

Install metrics

700+ active /11,311 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲1.36MB] [CPU: ▲6.96ms] Passed 4 tests

An overview of server-side resources used by Device Detector
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.70 ▲1.2347.07 ▲6.97
Dashboard /wp-admin4.74 ▲1.4455.83 ▲9.96
Posts /wp-admin/edit.php4.80 ▲1.4360.89 ▲0.02
Add New Post /wp-admin/post-new.php7.29 ▲1.4093.96 ▲10.87
Media Library /wp-admin/upload.php4.61 ▲1.3750.27 ▲17.47
Analytics /wp-admin/admin.php?page=perfopsone-analytics4.6545.95
Devices /wp-admin/admin.php?page=podd-viewer5.4150.07
Control Center /wp-admin/admin.php?page=perfopsone-dashboard4.7143.43
Devices /wp-admin/admin.php?page=podd-tools4.5740.11
Tools /wp-admin/admin.php?page=perfopsone-tools4.6542.85
Device Detector /wp-admin/admin.php?page=podd-settings4.8746.41

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 1,144 new files
Database: 1 new table, 6 new options
New tables
wp_device_detector_statistics
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Device Detector
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,858 ▲10814.36 ▼0.231.85 ▲0.2339.30 ▼3.51
Dashboard /wp-admin2,239 ▲595.64 ▼0.1785.05 ▼9.1337.38 ▼9.98
Posts /wp-admin/edit.php2,145 ▲452.04 ▲0.0136.38 ▼0.2934.16 ▲0.21
Add New Post /wp-admin/post-new.php1,550 ▲2423.40 ▲0.29700.43 ▲40.6155.74 ▼2.50
Media Library /wp-admin/upload.php1,442 ▲484.20 ▲0.0695.17 ▼14.2440.55 ▼7.95
Analytics /wp-admin/admin.php?page=perfopsone-analytics9231.9923.2425.22
Devices /wp-admin/admin.php?page=podd-viewer1,7903.63115.9568.48
Control Center /wp-admin/admin.php?page=perfopsone-dashboard1,0982.0123.1933.54
Devices /wp-admin/admin.php?page=podd-tools8812.0525.1624.66
Tools /wp-admin/admin.php?page=perfopsone-tools9232.1623.2124.76
Device Detector /wp-admin/admin.php?page=podd-settings1,0172.0425.4732.17

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/device-detector/public/partials/device-detector-public-display.php
  • 70× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'UDD\\Parser\\Device\\AbstractDeviceParser' not found in wp-content/plugins/device-detector/includes/libraries/udd/Parser/Device/Console.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_style() in wp-content/plugins/device-detector/admin/partials/device-detector-admin-settings-about.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'UDD\\Parser\\Device\\AbstractDeviceParser' not found in wp-content/plugins/device-detector/includes/libraries/udd/Parser/Device/HbbTv.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'UDD\\Parser\\AbstractParser' not found in wp-content/plugins/device-detector/includes/libraries/udd/Parser/AbstractBotParser.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function PODeviceDetector\\Library\\esc_html__() in wp-content/plugins/device-detector/includes/libraries/class-libraries.php:67
    • > PHP Fatal error
      Uncaught Error: Class 'UDD\\Parser\\Client\\AbstractClientParser' not found in wp-content/plugins/device-detector/includes/libraries/udd/Parser/Client/PIM.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\RequestInterface' not found in wp-content/plugins/device-detector/includes/libraries/psr/http-message/ServerRequestInterface.php:43
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/device-detector/admin/partials/device-detector-admin-settings-devices.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'UDD\\Parser\\AbstractParser' not found in wp-content/plugins/device-detector/includes/libraries/udd/Parser/Client/AbstractClientParser.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/device-detector/admin/partials/device-detector-admin-settings-css.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: device, detector, detection, mobile, bot

device-detector/device-detector.php Passed 13 tests

This is the main PHP file of "Device Detector" version 3.6.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
109 characters long description:
Full featured analytics reporting and management tool that detects all devices accessing your WordPress site.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin85,663 lines of code in 500 files:
LanguageFilesBlank linesComment linesLines of code
YAML203,5372,85542,630
JavaScript121,9252,30520,459
PHP1612,2249,78415,908
SVG285014,251
CSS1329021,937
Markdown71700425
JSON20053

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity16.68
▷ Minimum class complexity1.00
▷ Maximum class complexity303.00
Average method complexity3.72
▷ Minimum method complexity1.00
▷ Maximum method complexity56.00
Code structure
Namespaces26
Interfaces17
Traits15
Classes112
▷ Abstract classes76.25%
▷ Concrete classes10593.75%
▷ Final classes00.00%
Methods924
▷ Static methods27429.65%
▷ Public methods67072.51%
▷ Protected methods13814.94%
▷ Private methods11612.55%
Functions25
▷ Named functions936.00%
▷ Anonymous functions1664.00%
Constants83
▷ Global constants4554.22%
▷ Class constants3845.78%
▷ Public constants38100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
610 compressed PNG files occupy 0.69MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/libraries/morpheus/resources/brand/Fujitsu.png0.93KB0.91KB▼ 2.09%
includes/libraries/morpheus/resources/browser/GB.png1.79KB1.78KB▼ 0.55%
includes/libraries/morpheus/resources/browser/QW.png0.68KB0.66KB▼ 2.86%
includes/libraries/morpheus/resources/browser/LX.png0.56KB0.56KB0.00%
includes/libraries/morpheus/resources/browser/BH.png2.37KB2.36KB0.29%