77% currency-switcher

Code Review | WPCS - WordPress Currency Switcher Professional

WordPress plugin WPCS - WordPress Currency Switcher Professional scored77%from 54 tests.

About plugin

  • Plugin page: currency-switcher
  • Plugin version: 1.2.0.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: WP 3.5.0-6.3
  • WordPress version: 6.3.1
  • First release: May 26, 2016
  • Latest release: Oct 5, 2023
  • Number of updates: 158
  • Update frequency: every 17.0 days
  • Top authors: RealMag777 (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

1,000+ active /33,614 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲1.67MB] [CPU: ▲5.21ms] Passed 4 tests

This is a short check of server-side resources used by WPCS - WordPress Currency Switcher Professional
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /6.04 ▲2.5855.54 ▲17.31
Dashboard /wp-admin5.25 ▲1.9459.11 ▲12.98
Posts /wp-admin/edit.php5.25 ▲1.8957.36 ▲11.99
Add New Post /wp-admin/post-new.php6.73 ▲0.8489.94 ▼18.63
Media Library /wp-admin/upload.php5.25 ▲2.0248.41 ▲14.51
Currency Switcher /wp-admin/options-general.php?page=currency-switcher-settings8.3261.55

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 106 new files
Database: no new tables, 11 new options
New WordPress options
widget_wpcs_rates
wpcs_first_activation
can_compress_scripts
widget_wpcs_converter
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
widget_wpcs_selector
...

Browser metrics Passed 4 tests

An overview of browser requirements for WPCS - WordPress Currency Switcher Professional
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,948 ▲18713.95 ▼0.4012.09 ▲10.4842.86 ▲4.15
Dashboard /wp-admin2,228 ▲575.81 ▲0.1697.71 ▲7.0542.88 ▲2.85
Posts /wp-admin/edit.php2,132 ▲322.27 ▲0.3336.14 ▲1.8234.44 ▼1.17
Add New Post /wp-admin/post-new.php1,544 ▲1823.33 ▲0.19668.76 ▲75.9336.34 ▼17.84
Media Library /wp-admin/upload.php1,433 ▲304.39 ▲0.1598.01 ▲4.1546.68 ▲4.27
Currency Switcher /wp-admin/options-general.php?page=currency-switcher-settings6,60413.28335.94169.55

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • Zombie WordPress options detected upon uninstall: 11 options
    • theysaidso_admin_options
    • widget_recent-posts
    • wpcs_later_rate_alert
    • widget_wpcs_converter
    • widget_theysaidso_widget
    • widget_wpcs_selector
    • wpcs_first_activation
    • db_upgraded
    • widget_recent-comments
    • widget_wpcs_rates
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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 fix the following
  • 23× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/currency-switcher/views/shortcodes/styles/style-1/index.php
    • > /wp-content/plugins/currency-switcher/classes/auto_switcher.php
    • > /wp-content/plugins/currency-switcher/views/shortcodes/wpcs_check_country.php
    • > /wp-content/plugins/currency-switcher/views/widgets/selector_form.php
    • > /wp-content/plugins/currency-switcher/classes/widgets/widget-currency-converter.php
    • > /wp-content/plugins/currency-switcher/views/widgets/rates.php
    • > /wp-content/plugins/currency-switcher/views/shortcodes/styles/style-3/index.php
    • > /wp-content/plugins/currency-switcher/views/shortcodes/styles/style-2/index.php
    • > /wp-content/plugins/currency-switcher/views/shortcodes/wpcs_rates.php
    • > /wp-content/plugins/currency-switcher/views/auto_switcher/round_select.php
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/currency-switcher/views/options-data.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: No descriptions were found for these screenshots #10, #11, #12, #13, #14, #8, #9 in currency-switcher/assets to your readme.txt
The official readme.txt might help

currency-switcher/index.php 85% from 13 tests

This is the main PHP file of "WPCS - WordPress Currency Switcher Professional" version 1.2.0.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Requires at least: Periods and digits should be used for the required version number (ex. "7.0" instead of "WP 3.5.0")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("currency-switcher.php" instead of "index.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin29,857 lines of code in 83 files:
LanguageFilesBlank linesComment linesLines of code
PHP3082123712,613
CSS214821506,149
JavaScript249211935,320
HTML36403,167
SVG1001,839
Pascal2451,757385
PO File1171353346
JSON10038

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
It is recommended to fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 171)
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity47.30
▷ Minimum class complexity1.00
▷ Maximum class complexity370.00
Average method complexity5.65
▷ Minimum method complexity1.00
▷ Maximum method complexity171.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes220.00%
Methods98
▷ Static methods00.00%
▷ Public methods9394.90%
▷ Protected methods00.00%
▷ Private methods55.10%
Functions10
▷ Named functions220.00%
▷ Anonymous functions880.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
14 compressed PNG files occupy 0.29MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/woobe_banner.png46.74KB46.76KB0.00%
img/wpcs_banner.png39.04KB39.12KB0.00%
img/no_flag.png1.70KB1.09KB▼ 36.07%
js/chosen/chosen-sprite-dark.png0.64KB0.43KB▼ 32.47%
js/wselect/img/arrow-down.png0.42KB0.45KB0.00%