62% translatepress-multilingual

Code Review | Translate Multilingual sites - TranslatePress

WordPress plugin Translate Multilingual sites - TranslatePress scored62%from 54 tests.

About plugin

  • Plugin page: translatepress-mu...
  • Plugin version: 2.6.7
  • PHP compatiblity: 5.6.20+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.5.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Aug 31, 2017
  • Latest release: Nov 27, 2023
  • Number of updates: 191
  • Update frequency: every 11.9 days
  • Top authors: madalin.ungureanu (62.83%)razvan.mo (37.7%)

Code review

54 tests

User reviews

1212 reviews

Install metrics

300,000+ active /8,619,095 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲4.49MB] [CPU: ▲37.55ms] Passed 4 tests

Server-side resources used by Translate Multilingual sites - TranslatePress
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /8.05 ▲4.59164.95 ▲126.72
Dashboard /wp-admin7.83 ▲4.5286.96 ▲40.84
Posts /wp-admin/edit.php7.87 ▲4.5282.46 ▲37.73
Add New Post /wp-admin/post-new.php10.36 ▲4.47133.43 ▲37.61
Media Library /wp-admin/upload.php7.68 ▲4.4567.59 ▲34.02
TRPHidden /wp-admin/admin.php?page=trp_advanced_page7.5057.64
TRPHidden /wp-admin/admin.php?page=trp_test_machine_api7.6662.90
TRPHidden /wp-admin/admin.php?page=trp_optin_page7.6663.35
TRPHidden /wp-admin/admin.php?page=trp_license_key7.5052.26
TRPHidden /wp-admin/admin.php?page=trp_update_database7.6556.73
TRPHidden /wp-admin/admin.php?page=trp_remove_duplicate_rows7.6758.24
TRPHidden /wp-admin/admin.php?page=trp_error_manager7.6559.94
TRPHidden /wp-admin/admin.php?page=trp_addons_page7.5048.01
TRPHidden /wp-admin/admin.php?page=trp_machine_translation7.5051.41
TranslatePress1 /wp-admin/options-general.php?page=translate-press7.5055.93

Server storage [IO: ▲5.73MB] [DB: ▲0.06MB] Passed 3 tests

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 328 new files
Database: 3 new tables, 10 new options
New tables
wp_trp_gettext_original_meta
wp_trp_gettext_original_strings
wp_trp_gettext_en_us
New WordPress options
widget_recent-comments
trp_settings
can_compress_scripts
db_upgraded
trp_plugin_version
widget_theysaidso_widget
widget_recent-posts
trp_db_stored_data
theysaidso_admin_options
trp_show_error_db_message

Browser metrics Passed 4 tests

This is an overview of browser requirements for Translate Multilingual sites - TranslatePress
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,865 ▲11814.67 ▲0.321.88 ▲0.1537.33 ▼2.36
Dashboard /wp-admin2,228 ▲475.62 ▼0.0993.96 ▼20.0547.58 ▲4.38
Posts /wp-admin/edit.php2,130 ▲302.01 ▲0.0739.64 ▲0.4036.60 ▲3.02
Add New Post /wp-admin/post-new.php1,579 ▲5323.24 ▲0.04657.64 ▲24.3970.16 ▲12.69
Media Library /wp-admin/upload.php1,427 ▲304.12 ▼0.07108.78 ▲7.6752.00 ▲11.19
TRPHidden /wp-admin/admin.php?page=trp_advanced_page9041.9925.5831.11
TRPHidden /wp-admin/admin.php?page=trp_test_machine_api8882.0927.7541.94
TRPHidden /wp-admin/admin.php?page=trp_optin_page9071.9924.0129.24
TRPHidden /wp-admin/admin.php?page=trp_license_key9041.9725.9433.20
TRPHidden /wp-admin/admin.php?page=trp_update_database8521.7132.5029.31
TRPHidden /wp-admin/admin.php?page=trp_remove_duplicate_rows9351.9924.0126.97
TRPHidden /wp-admin/admin.php?page=trp_error_manager8491.9622.2328.98
TRPHidden /wp-admin/admin.php?page=trp_addons_page9071.9926.5631.43
TRPHidden /wp-admin/admin.php?page=trp_machine_translation9072.1725.4031.15
TranslatePress1 /wp-admin/options-general.php?page=translate-press9041.9923.6828.50

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • The plugin did not uninstall successfully, leaving 3 tables in the database
    • wp_trp_gettext_original_strings
    • wp_trp_gettext_original_meta
    • wp_trp_gettext_en_us
  • This plugin does not fully uninstall, leaving 10 options in the database
    • trp_show_error_db_message
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • trp_db_stored_data
    • trp_settings
    • widget_recent-posts
    • trp_plugin_version
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These errors were triggered by the plugin
    • > GET request to /wp-admin/admin.php?page=trp_test_machine_api
    • > Notice in wp-content/plugins/translatepress-multilingual/includes/google-translate/class-google-translate-v2-machine-translator.php+18
    Undefined index: google-translate-key

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/translatepress-multilingual/partials/settings-navigation-tabs.php
  • 53× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/translatepress-multilingual/includes/google-translate/functions.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'TRP_Query' not found in wp-content/plugins/translatepress-multilingual/includes/queries/class-gettext-normalization.php:14
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/translatepress-multilingual/partials/settings-navigation-tabs.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/translatepress-multilingual/includes/advanced-settings/do-not-translate-certain-paths.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/translatepress-multilingual/includes/shortcodes.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/translatepress-multilingual/languages/translatepress-multilingual.catalog.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/translatepress-multilingual/includes/advanced-settings/exclude-selectors.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/translatepress-multilingual/includes/advanced-settings/custom-date-format.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function language_attributes() in wp-content/plugins/translatepress-multilingual/partials/translation-manager.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/translatepress-multilingual/includes/advanced-settings/disable-languages-sitemap.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
8 plugin tags: translate, automatic translation, bilingual, language, google translate...

translatepress-multilingual/index.php 77% from 13 tests

The principal PHP file in "Translate Multilingual sites - TranslatePress" v. 2.6.7 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Requires at least: The required version number did not match the one declared in readme.txt ("3.1.0" instead of "2.5.0")
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("translatepress-multilingual.php" instead of "index.php")
  • Description: Keep the plugin description shorter than 140 characters (currently 156 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin32,461 lines of code in 176 files:
LanguageFilesBlank linesComment linesLines of code
PHP994,1805,52619,470
JavaScript632,72181110,522
CSS10429622,312
Markdown2240118
JSON10032
SVG1107

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 154)
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity56.10
▷ Minimum class complexity1.00
▷ Maximum class complexity392.00
Average method complexity4.94
▷ Minimum method complexity1.00
▷ Maximum method complexity154.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes52
▷ Abstract classes00.00%
▷ Concrete classes52100.00%
▷ Final classes00.00%
Methods728
▷ Static methods172.34%
▷ Public methods65990.52%
▷ Protected methods395.36%
▷ Private methods304.12%
Functions297
▷ Named functions29097.64%
▷ Anonymous functions72.36%
Constants52
▷ Global constants4382.69%
▷ Class constants917.31%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
141 PNG files occupy 0.44MB with 0.14MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/flags/haz.png0.36KB0.33KB▼ 9.68%
assets/images/flags/en_AU.png0.56KB0.47KB▼ 15.96%
assets/images/flags/es_UY.png0.42KB0.37KB▼ 11.86%
assets/images/flags/da_DK.png0.30KB0.22KB▼ 24.34%
assets/images/flags/cy.png15.20KB0.89KB▼ 94.17%