84% google-language-translator

Code Review | Translate WordPress - Google Language Translator

WordPress plugin Translate WordPress - Google Language Translator scored84%from 54 tests.

About plugin

  • Plugin page: google-language-t...
  • Plugin version: 6.0.19
  • PHP version: 7.4.16
  • WordPress compatibility: 2.9-6.1
  • WordPress version: 6.3.1
  • First release: Dec 8, 2012
  • Latest release: Mar 15, 2023
  • Number of updates: 254
  • Update frequency: every 14.8 days
  • Top authors: rm2773 (69.29%)edo888 (30.71%)

Code review

54 tests

User reviews

531 reviews

Install metrics

100,000+ active /3,077,720 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.46MB] [CPU: ▲4.73ms] Passed 4 tests

This is a short check of server-side resources used by Translate WordPress - Google Language Translator
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4547.13 ▲4.72
Dashboard /wp-admin3.76 ▲0.4658.69 ▲8.64
Posts /wp-admin/edit.php3.88 ▲0.5255.63 ▲6.81
Add New Post /wp-admin/post-new.php6.34 ▲0.46100.52 ▲8.00
Media Library /wp-admin/upload.php3.69 ▲0.4639.69 ▼0.62
Google Language Translator /wp-admin/options-general.php?page=google_language_translator3.6853.29

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 20 new files
Database: no new tables, 39 new options
New WordPress options
googlelanguagetranslator_analytics_id
db_upgraded
googlelanguagetranslator_flags
googlelanguagetranslator_language
googlelanguagetranslator_showbranding
glt_language_switcher_bg_color
glt_language_switcher_text_color
googlelanguagetranslator_url_translation_active
can_compress_scripts
glt_floating_widget_text_color
...

Browser metrics Passed 4 tests

An overview of browser requirements for Translate WordPress - Google Language Translator
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,411 ▲64015.39 ▲1.0160.68 ▲58.5852.90 ▲8.14
Dashboard /wp-admin2,313 ▲1255.88 ▼0.15102.67 ▼13.6344.74 ▲4.28
Posts /wp-admin/edit.php2,195 ▲1032.11 ▲0.0539.76 ▼2.1639.51 ▲1.77
Add New Post /wp-admin/post-new.php1,583 ▲5023.28 ▲0.29689.21 ▲13.0655.59 ▼3.78
Media Library /wp-admin/upload.php1,492 ▲1044.24 ▲0.00100.70 ▼51.1745.31 ▼9.75
Google Language Translator /wp-admin/options-general.php?page=google_language_translator3,7057.72220.2371.74

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 39 options
    • googlelanguagetranslator_analytics
    • googlelanguagetranslator_multilanguage
    • theysaidso_admin_options
    • googlelanguagetranslator_url_structure
    • googlelanguagetranslator_flags_order
    • glt_language_switcher_text_color
    • googlelanguagetranslator_translatebox
    • googlelanguagetranslator_display
    • googlelanguagetranslator_flags
    • googlelanguagetranslator_active
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/google-language-translator/google-language-translator.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/google-language-translator/css/style.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/google-language-translator/widget.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
6 plugin tags: translation, translator, multi language, language, translate...

google-language-translator/google-language-translator.php 85% from 13 tests

The main PHP script in "Translate WordPress - Google Language Translator" version 6.0.19 is automatically included on every request by WordPress
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 310 characters long)
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

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
Everything looks great! No dangerous files found in this plugin6,264 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
CSS39583,457
PHP55272162,401
JavaScript26025370
SVG10036

PHP code Passed 2 tests

An overview 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.49
Average class complexity126.00
▷ Minimum class complexity4.00
▷ Maximum class complexity321.00
Average method complexity6.77
▷ Minimum method complexity1.00
▷ Maximum method complexity72.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods65
▷ Static methods00.00%
▷ Public methods65100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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
5 PNG files occupy 0.23MB with 0.16MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/flags.png53.71KB17.76KB▼ 66.93%
images/flags20.png50.31KB15.97KB▼ 68.26%
images/flags18.png41.07KB12.96KB▼ 68.45%
images/flags16.png36.48KB11.07KB▼ 69.65%
images/flags22.png53.14KB17.07KB▼ 67.89%