90% language-switcher

Code Review | Language Switcher

WordPress plugin Language Switcher scored90%from 54 tests.

About plugin

  • Plugin page: language-switcher
  • Plugin version: 3.7.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.3
  • WordPress version: 6.3.1
  • First release: Sep 9, 2018
  • Latest release: Aug 21, 2023
  • Number of updates: 130
  • Update frequency: every 45.0 days
  • Top authors: rafasashi (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

1,000+ active /37,338 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.73MB] [CPU: ▲2.76ms] Passed 4 tests

A check of server-side resources used by Language Switcher
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.24 ▲0.7844.31 ▲5.48
Dashboard /wp-admin4.06 ▲0.7652.56 ▲0.37
Posts /wp-admin/edit.php4.11 ▲0.7649.45 ▲2.19
Add New Post /wp-admin/post-new.php6.60 ▲0.7182.80 ▲2.98
Media Library /wp-admin/upload.php3.92 ▲0.6941.65 ▲11.11
Settings /wp-admin/admin.php?page=language-switcher3.9937.81

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

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

Browser metrics Passed 4 tests

Language Switcher: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,902 ▲14113.72 ▼0.568.76 ▲6.7842.64 ▼0.02
Dashboard /wp-admin2,221 ▲445.67 ▲0.1394.82 ▲8.2541.88 ▲2.48
Posts /wp-admin/edit.php2,120 ▲232.02 ▲0.0535.26 ▲0.3632.07 ▼2.94
Add New Post /wp-admin/post-new.php1,546 ▲1823.14 ▼0.01666.18 ▼7.8354.19 ▼6.68
Media Library /wp-admin/upload.php1,426 ▲264.23 ▲0.1094.25 ▼4.6344.29 ▲1.04
Settings /wp-admin/admin.php?page=language-switcher2,6871.6622.36131.86

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
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 7 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • widget_language_switcher_widget
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP Passed 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
Congratulations! This plugin passed the SRP test

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Screenshots: These screenshots do not have images: #1 (The language switcher), #2 (Edit post type language), #3 (Edit tag language), #4 (Select activate languages), #5 (Select activate post types and taxonomies), #6 (Add the language switcher with the widget)
You can take inspiration from this readme.txt

language-switcher/language-switcher.php Passed 13 tests

The entry point to "Language Switcher" version 3.7.5 is a PHP file that has certain tags in its header comment area
52 characters long description:
Add a Language Switcher to Post Types and Taxonomies

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected3,281 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP91,1734953,021
CSS31618233
JavaScript2181025
Markdown1002

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity71.17
▷ Minimum class complexity5.00
▷ Maximum class complexity257.00
Average method complexity4.99
▷ Minimum method complexity1.00
▷ Maximum method complexity90.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods104
▷ Static methods21.92%
▷ Public methods10298.08%
▷ Protected methods00.00%
▷ Private methods21.92%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants1
▷ Global constants1100.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
10 PNG files occupy 0.30MB with 0.16MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png29.76KB12.30KB▼ 58.67%
assets/images/flags.png78.70KB26.55KB▼ 66.27%
screenshot-4.png46.27KB16.01KB▼ 65.40%
screenshot-3.png19.74KB8.28KB▼ 58.06%
assets/images/dnd-icon.png0.63KB0.52KB▼ 18.52%