84% user-language-switch

Code Review | User Language Switch

WordPress plugin User Language Switch scored 84% from 54 tests.

About plugin

  • Plugin page: user-language-switch
  • Plugin version: 1.6.10
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.4
  • WordPress version: 5.8.1
  • First release: Jul 23, 2013
  • Latest release: Oct 3, 2016
  • Number of updates: 50
  • Update frequency: every 26.0 days
  • Top authors: webilop (100%)

Code review

54 tests

User reviews

21 reviews

Install metrics

300+ active / 57,333 total downloads

Benchmarks

Plugin footprint 82% 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.98MB] [CPU: ▲9.69ms] Passed 4 tests

A check of server-side resources used by User Language Switch
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /6.61 ▲3.8945.50 ▲21.78
Dashboard /wp-admin3.67 ▲0.6158.17 ▲21.60
Posts /wp-admin/edit.php3.74 ▲0.6454.21 ▲3.53
Add New Post /wp-admin/post-new.php7.55 ▲2.121,151.24 ▲496.84
Media Library /wp-admin/upload.php3.56 ▲0.5543.76 ▼8.14
User Language Switch /wp-admin/options-general.php?page=uls-settings-page3.6237.71

Server storage [IO: ▲0.52MB] [DB: ▲0.35MB] 67% from 3 tests

Input-output and database impact of this plugin
These are issues you should consider
  • Illegal file modification found: 1 file (0.63KB) outside of "wp-content/plugins/user-language-switch/" and "wp-content/uploads/"
    • (modified) .htaccess
Filesystem: 36 new files
Database: no new tables, 1 new option
New WordPress options
uls_settings

Browser metrics Passed 4 tests

User Language Switch: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,858 ▲26216.46 ▲0.9819.06 ▲4.7056.92 ▲11.80
Dashboard /wp-admin3,006 ▲1125.96 ▲0.08150.39 ▼0.19110.78 ▼6.30
Posts /wp-admin/edit.php2,825 ▲862.86 ▲0.1471.75 ▲3.7190.42 ▼1.36
Add New Post /wp-admin/post-new.php2,026 ▲43523.59 ▲4.79439.28 ▲23.59164.35 ▲54.23
Media Library /wp-admin/upload.php1,849 ▲424.97 ▼0.05168.55 ▼3.29117.59 ▲0.20
User Language Switch /wp-admin/options-general.php?page=uls-settings-page1,3962.2461.2485.56

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 1 option
    • uls_settings

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)
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
  • 6× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/user-language-switch/user-language-switch.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/user-language-switch/uls-functions.php:107
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/user-language-switch/init.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/user-language-switch/uls-options.php:883
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/user-language-switch/uls-tab-template.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/user-language-switch/uls-rewrite-rules.php:86

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
9 plugin tags: translate, multiple language, bilingual, multilingual, i18n...

user-language-switch/user-language-switch.php 92% from 13 tests

This is the main PHP file of "User Language Switch" version 1.6.10, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Description: The description should be shorter than 140 characters (currently 144 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected4,816 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP84137693,193
CSS5825882
PO File4200261540
JavaScript52968201

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity63.00
▷ Minimum class complexity2.00
▷ Maximum class complexity154.00
Average method complexity8.09
▷ Minimum method complexity1.00
▷ Maximum method complexity93.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods35
▷ Static methods2777.14%
▷ Public methods35100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions62
▷ Named functions6198.39%
▷ Anonymous functions11.61%
Constants6
▷ Global constants6100.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
7 PNG files occupy 0.23MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/star.png0.80KB1.16KB0.00%
images/flags_16x11.png76.71KB25.71KB▼ 66.48%
images/twitter.png2.94KB1.80KB▼ 38.81%
images/facebook.png2.76KB1.86KB▼ 32.53%
images/linkedin.png3.04KB1.89KB▼ 37.97%