83% woo-currency

Code Review | WBW Currency Switcher for WooCommerce

WordPress plugin WBW Currency Switcher for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: woo-currency
  • Plugin version: 1.9.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.0-6.4
  • WordPress version: 6.3.1
  • First release: Jun 22, 2018
  • Latest release: Nov 17, 2023
  • Number of updates: 112
  • Update frequency: every 17.6 days
  • Top authors: woobewoo (100%)

Code review

54 tests

User reviews

29 reviews

Install metrics

4,000+ active /144,318 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲2.24MB] [CPU: ▲12.82ms] Passed 4 tests

A check of server-side resources used by WBW Currency Switcher for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /5.72 ▲2.2651.88 ▲10.89
Dashboard /wp-admin5.55 ▲2.2456.66 ▲8.25
Posts /wp-admin/edit.php5.66 ▲2.3063.99 ▲18.02
Add New Post /wp-admin/post-new.php8.13 ▲2.24108.89 ▲14.13
Media Library /wp-admin/upload.php5.47 ▲2.2455.13 ▲21.44
Overview /wp-admin/admin.php?page=woo-currency&tab=overview5.8556.99
/wp-admin/admin.php?page=woo-currency5.6054.67
Settings /wp-admin/admin.php?page=woo-currency&tab=settings5.6050.55

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 293 new files
Database: 3 new tables, 13 new options
New tables
wp_wcu_modules_type
wp_wcu_usage_stat
wp_wcu_modules
New WordPress options
wcu_opts_data
widget_wcucurrencyswitcherwidget
wcu_plug_was_used
theysaidso_admin_options
widget_recent-comments
db_upgraded
widget_wcucurrencyconverterwidget
widget_wcucurrencyrateswidget
wp_wcu_db_version
can_compress_scripts
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for WBW Currency Switcher for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,842 ▲8014.39 ▲0.041.69 ▼0.1038.76 ▼9.49
Dashboard /wp-admin2,247 ▲705.76 ▲0.2296.62 ▼6.3243.89 ▲0.38
Posts /wp-admin/edit.php2,157 ▲602.24 ▲0.3043.40 ▲7.2234.98 ▼1.39
Add New Post /wp-admin/post-new.php1,567 ▲3723.06 ▼0.08692.56 ▼1.1038.32 ▼49.69
Media Library /wp-admin/upload.php1,455 ▲554.50 ▲0.23101.13 ▼1.3745.91 ▲2.02
Overview /wp-admin/admin.php?page=woo-currency&tab=overview1,5523.8570.0160.80
/wp-admin/admin.php?page=woo-currency1,3354.0772.8043.18
Settings /wp-admin/admin.php?page=woo-currency&tab=settings1,3384.0771.6439.57

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options were found after uninstall: 12 options
    • theysaidso_admin_options
    • widget_wcucurrencyrateswidget
    • widget_theysaidso_widget
    • widget_wcucurrencyswitcherwidget
    • can_compress_scripts
    • db_upgraded
    • wcu_plug_was_used
    • widget_wcucurrencyconverterwidget
    • wcu_opts_data
    • widget_recent-posts
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 80× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/woo-currency/modules/currency/views/tpl/old/designTab.php:1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/woo-currency/modules/currency/views/tpl/childrenMultipleTab.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'controllerWcu' not found in wp-content/plugins/woo-currency/modules/admin_nav/controller.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'moduleWcu' not found in wp-content/plugins/woo-currency/modules/mail/mod.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'moduleWcu' not found in wp-content/plugins/woo-currency/modules/adminmenu/mod.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'frameWcu' not found in wp-content/plugins/woo-currency/modules/currency_widget/views/tpl/currencySwitcherForm.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'modelWcu' not found in wp-content/plugins/woo-currency/modules/options/models/options.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/woo-currency/config.php:23
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/woo-currency/config.php on line 21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/woo-currency/modules/options/views/tpl/optionsSettingsTabContent.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
7 plugin tags: woocommerce currency switcher, currency, currency switcher, woocommerce, multi currency...

woo-currency/wcu.php 85% from 13 tests

Analyzing the main PHP file in "WBW Currency Switcher for WooCommerce" version 1.9.2
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 168 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("woo-currency.php" instead of "wcu.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin43,758 lines of code in 246 files:
LanguageFilesBlank linesComment linesLines of code
PHP1141,2694,14022,590
JavaScript935021,8839,472
CSS365662336,579
SVG1002,671
PO File29421,5752,446

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Please tend to the following items
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 107)
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity34.22
▷ Minimum class complexity1.00
▷ Maximum class complexity418.00
Average method complexity3.58
▷ Minimum method complexity1.00
▷ Maximum method complexity107.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes83
▷ Abstract classes910.84%
▷ Concrete classes7489.16%
▷ Final classes00.00%
Methods1,072
▷ Static methods26825.00%
▷ Public methods95889.37%
▷ Protected methods888.21%
▷ Private methods262.43%
Functions24
▷ Named functions2187.50%
▷ Anonymous functions312.50%
Constants90
▷ Global constants6976.67%
▷ Class constants2123.33%
▷ Public constants21100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
32 PNG files occupy 0.63MB with 0.15MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/ui-icons_f29a00_256x240.png4.44KB4.17KB▼ 6.02%
css/images/ui-bg_flat_0_aaaaaa_40x100.png0.21KB0.08KB▼ 58.96%
modules/templates/lib/chosen/chosen-sprite@2x.png0.72KB0.83KB0.00%
css/images/ui-icons_c98000_256x240.png4.44KB4.17KB▼ 6.02%
css/images/ui-bg_highlight-soft_60_dddddd_1x100.png0.27KB0.15KB▼ 44.44%