74% preferred-locale

Code Review | Preferred Locale

WordPress plugin Preferred Locale scored74%from 54 tests.

About plugin

  • Plugin page: preferred-locale
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.0
  • WordPress version: 6.3.1
  • First release: Mar 16, 2017
  • Latest release: Jan 9, 2019
  • Number of updates: 4
  • Update frequency: every 165.0 days
  • Top authors: Dreamsorcerer (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /489 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▼1.84MB] [CPU: ▼52.55ms] Passed 4 tests

Server-side resources used by Preferred Locale
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.13 ▼1.335.09 ▼33.75
Dashboard /wp-admin2.17 ▼1.137.39 ▼41.50
Posts /wp-admin/edit.php2.18 ▼1.189.80 ▼42.48
Add New Post /wp-admin/post-new.php2.17 ▼3.717.67 ▼92.48
Media Library /wp-admin/upload.php2.18 ▼1.057.00 ▼26.11

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Preferred Locale
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.25 ▼1.131.71 ▲0.0043.36 ▼0.42
Dashboard /wp-admin2,206 ▲185.90 ▼0.01100.61 ▼2.3437.25 ▼3.71
Posts /wp-admin/edit.php2,086 ▼31.99 ▲0.0236.15 ▼9.5133.45 ▼1.33
Add New Post /wp-admin/post-new.php1,533 ▼322.94 ▼0.32649.13 ▲5.0858.31 ▲3.41
Media Library /wp-admin/upload.php1,391 ▲34.22 ▼0.0595.56 ▼3.4840.40 ▼4.29

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
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/preferred-locale/preferred-locale.php+14
    Undefined index: HTTP_ACCEPT_LANGUAGE
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means 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
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/preferred-locale/preferred-locale.php:60

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 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
Please fix the following attributes:
  • Plugin Name: Please specify the plugin name on the first line ( === preferred-locale === )
You can look at the official readme.txt

preferred-locale/preferred-locale.php Passed 13 tests

The main PHP script in "Preferred Locale" version 1.2 is automatically included on every request by WordPress
71 characters long description:
Select site locale according to user preference (set in their browser).

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin73 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1182173

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.47
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%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG images were found in this plugin