78% language-switcher-for-transposh

Code Review | Language Switcher for Transposh

WordPress plugin Language Switcher for Transposh scored78%from 54 tests.

About plugin

  • Plugin page: language-switcher...
  • Plugin version: 1.5.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.1-6.4
  • WordPress version: 6.3.1
  • First release: Feb 6, 2021
  • Latest release: Nov 14, 2023
  • Number of updates: 146
  • Update frequency: every 6.9 days
  • Top authors: codingfix (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

700+ active /27,301 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼6.29ms] Passed 4 tests

This is a short check of server-side resources used by Language Switcher for Transposh
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0040.31 ▼0.16
Dashboard /wp-admin3.31 ▼0.0446.02 ▼15.38
Posts /wp-admin/edit.php3.36 ▲0.0048.21 ▲3.84
Add New Post /wp-admin/post-new.php5.89 ▲0.0083.89 ▼7.79
Media Library /wp-admin/upload.php3.23 ▲0.0030.98 ▼1.81

Server storage [IO: ▲0.46MB] [DB: ▲0.07MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 298 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

Language Switcher for Transposh: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.03 ▼0.221.81 ▲0.1445.22 ▲0.10
Dashboard /wp-admin2,195 ▲175.64 ▼0.0286.21 ▼28.0838.34 ▼6.44
Posts /wp-admin/edit.php2,100 ▼01.95 ▼0.0739.52 ▲2.2137.33 ▲2.70
Add New Post /wp-admin/post-new.php1,526 ▼123.19 ▲0.20680.74 ▲14.2557.72 ▲4.40
Media Library /wp-admin/upload.php1,400 ▼34.31 ▲0.0594.08 ▼2.2741.66 ▼0.68

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts

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 | 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
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/language-switcher-for-transposh/public/partials/cfx-language-switcher-for-transposh-public-display.php
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/language-switcher-for-transposh/widgets/language-switcher-for-transposh-widget.php:12
    • > PHP Notice
      file_get_contents(): read of 8192 bytes failed with errno=21 Is a directory in wp-content/plugins/language-switcher-for-transposh/includes/load-list-style.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/language-switcher-for-transposh/admin/partials/cfx-language-switcher-for-transposh-admin-display.php:26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% 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
Attributes that need to be fixed:
  • Screenshots: Add an image for screenshot #1 (/assets/lsft.png)
The official readme.txt is a good inspiration

language-switcher-for-transposh/cfx-language-switcher-for-transposh.php 85% from 13 tests

The principal PHP file in "Language Switcher for Transposh" v. 1.5.3 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("language-switcher-for-transposh.php" instead of "cfx-language-switcher-for-transposh.php")

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
Success! There were no dangerous files found in this plugin2,214 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
PHP152399491,425
CSS125720644
JavaScript2208144
SVG1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity20.88
▷ Minimum class complexity1.00
▷ Maximum class complexity72.00
Average method complexity3.09
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods76
▷ Static methods22.63%
▷ Public methods6585.53%
▷ Protected methods00.00%
▷ Private methods1114.47%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.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
262 compressed PNG files occupy 0.31MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/flags/ai.png0.74KB0.75KB0.00%
assets/flags/li.png0.25KB0.24KB▼ 5.10%
assets/flags/gq.png0.48KB0.49KB0.00%
assets/flags/es-ga.png0.43KB0.43KB0.00%
assets/flags/gs.png0.84KB0.83KB▼ 1.40%