68% translator-with-baidu-service

Code Review | Translator with Baidu Service

WordPress plugin Translator with Baidu Service scored68%from 54 tests.

About plugin

  • Plugin page: translator-with-b...
  • Plugin version: 1.10
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.7
  • WordPress version: 6.3.1
  • First release: Jan 20, 2017
  • Latest release: Feb 23, 2017
  • Number of updates: 7
  • Update frequency: every 4.6 days
  • Top authors: gongwan33 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,138 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▼1.85MB] [CPU: ▼44.72ms] Passed 4 tests

A check of server-side resources used by Translator with Baidu Service
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.08 ▼1.394.98 ▼36.96
Dashboard /wp-admin2.17 ▼1.139.40 ▼35.98
Posts /wp-admin/edit.php2.18 ▼1.188.02 ▼35.15
Add New Post /wp-admin/post-new.php2.17 ▼3.719.22 ▼70.80
Media Library /wp-admin/upload.php2.18 ▼1.057.73 ▼26.58
BD Translator /wp-admin/options-general.php?page=baidu-translator2.188.48

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 137 new files
Database: no new tables, 8 new options
New WordPress options
baidu_translator
widget_recent-posts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
widget_baidu-translator
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Translator with Baidu Service
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.73 ▼0.591.76 ▼0.0139.15 ▼6.16
Dashboard /wp-admin2,207 ▲195.81 ▲0.91103.39 ▲0.1438.33 ▼0.66
Posts /wp-admin/edit.php2,093 ▲42.03 ▲0.0239.19 ▲4.0835.64 ▲3.25
Add New Post /wp-admin/post-new.php1,538 ▼423.16 ▲5.06663.19 ▼1.2551.04 ▼4.47
Media Library /wp-admin/upload.php1,395 ▲134.19 ▼0.0093.59 ▼4.4940.64 ▼1.58
BD Translator /wp-admin/options-general.php?page=baidu-translator1,0382.0723.6160.78

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/translator-with-baidu-service/includes/baidu-translate-proxy.php+39
    Undefined index: option
  • Zombie WordPress options were found after uninstall: 7 options
    • db_upgraded
    • widget_baidu-translator
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=baidu-translator
    • > Notice in wp-content/plugins/translator-with-baidu-service/includes/baidu-translate-proxy.php+41
    Undefined index: option

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
  • 5× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/translator-with-baidu-service/admin/views/screen-settings.php:3
    • > PHP Notice
      Undefined index: option in wp-content/plugins/translator-with-baidu-service/includes/baidu-translate-proxy.php on line 41
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/translator-with-baidu-service/baidu-translator.php:37
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/translator-with-baidu-service/includes/class-baidu-translator-widget.php:3
    • > PHP Notice
      Undefined index: option in wp-content/plugins/translator-with-baidu-service/includes/baidu-translate-proxy.php on line 39

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 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: translation, cantonese, i18n, translator, localization...

translator-with-baidu-service/baidu-translator.php 85% from 13 tests

"Translator with Baidu Service" version 1.10's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("translator-with-baidu-service.php" instead of "baidu-translator.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected1,530 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP1112251669
JavaScript611428652
CSS2200109
PO File13239100

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity9.33
▷ Minimum class complexity1.00
▷ Maximum class complexity20.00
Average method complexity2.14
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods44
▷ Static methods12.27%
▷ Public methods4397.73%
▷ Protected methods12.27%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
113 PNG files occupy 0.13MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/img/pt-br.png1.22KB0.89KB▼ 27.44%
includes/img/rom.png0.72KB0.57KB▼ 21.86%
includes/img/en-us.png1.10KB1.08KB▼ 2.48%
includes/img/si.png1.16KB1.08KB▼ 7.32%
includes/img/kk.png1.00KB0.76KB▼ 24.14%