10% simple-language-switcher

Code Review | Simple Language Switcher

WordPress plugin Simple Language Switcher scored10%from 54 tests.

About plugin

  • Plugin page: simple-language-s...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.5.1
  • WordPress version: 6.3.1
  • First release: May 31, 2013
  • Latest release: Sep 5, 2013
  • Number of updates: 5
  • Update frequency: every 19.2 days
  • Top authors: matthewbe (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

300+ active /15,879 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
You still need to fix the following installer errors
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/simple-language-switcher/front/language-switcher-generator.php+11
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲0.05MB] [CPU: ▼1.64ms] Passed 4 tests

Server-side resources used by Simple Language Switcher
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0342.91 ▼1.40
Dashboard /wp-admin3.36 ▲0.0649.80 ▼4.92
Posts /wp-admin/edit.php3.47 ▲0.1248.59 ▼0.41
Add New Post /wp-admin/post-new.php5.94 ▲0.0594.03 ▲3.11
Media Library /wp-admin/upload.php3.28 ▲0.0538.65 ▲0.19
Simple Language Switcher /wp-admin/options-general.php?page=sls3.2329.41

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 22 new files
Database: no new tables, 12 new options
New WordPress options
sls_plugin_linking_backup
sls_plugin_linking
sls_plugin_options
can_compress_scripts
widget_recent-posts
db_upgraded
widget_recent-comments
sls_plugin_langs_backup
widget_simple-language-switcher
theysaidso_admin_options
...

Browser metrics Passed 4 tests

Simple 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,796 ▲3514.55 ▲0.191.83 ▼0.0144.37 ▼0.78
Dashboard /wp-admin2,196 ▲215.59 ▼0.0385.57 ▼26.8938.90 ▼2.12
Posts /wp-admin/edit.php2,107 ▲101.99 ▼0.0340.29 ▲4.8636.54 ▲0.85
Add New Post /wp-admin/post-new.php1,541 ▲1518.46 ▼4.63638.66 ▼61.6378.30 ▲27.61
Media Library /wp-admin/upload.php1,410 ▲104.19 ▼0.0098.66 ▼17.4944.31 ▼3.98
Simple Language Switcher /wp-admin/options-general.php?page=sls1,8722.0125.02123.90

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
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 12 options
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • sls_plugin_linking
    • theysaidso_admin_options
    • sls_plugin_langs_backup
    • db_upgraded
    • widget_simple-language-switcher
    • sls_plugin_options
    • sls_plugin_langs
    • ...

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
    • > GET request to /wp-admin/options-general.php?page=sls
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=sls
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 6× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'SimpleLanguageSwitcher_Front_Display_Strategy' not found in wp-content/plugins/simple-language-switcher/front/strategy/display-language-name.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/simple-language-switcher/simple-language-switcher.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/simple-language-switcher/front/language-switcher-widget.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'SimpleLanguageSwitcher_Front_Display_Strategy' not found in wp-content/plugins/simple-language-switcher/front/strategy/display-language-iso.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/simple-language-switcher/admin/options-page.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'SimpleLanguageSwitcher_Front_Display_Strategy' not found in wp-content/plugins/simple-language-switcher/front/strategy/display-language-flag.php: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

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
These attributes need your attention:
  • Contributors: The plugin contributors field is not present
The official readme.txt is a good inspiration

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

The main file in "Simple Language Switcher" v. 1.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
43 characters long description:
A simple and lightweight language switcher.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin2,208 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP13152411,478
JavaScript100730

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.30
Average class complexity8.00
▷ Minimum class complexity1.00
▷ Maximum class complexity40.00
Average method complexity2.28
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes19.09%
▷ Concrete classes1090.91%
▷ Final classes00.00%
Methods60
▷ Static methods11.67%
▷ Public methods5998.33%
▷ Protected methods00.00%
▷ Private methods11.67%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants350.00%
▷ Class constants350.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
4 compressed PNG files occupy 0.00MB
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
flags/ru.png0.41KB0.64KB0.00%
flags/en.png0.58KB0.65KB0.00%
flags/fr.png0.53KB0.63KB0.00%
flags/nl.png0.44KB0.64KB0.00%