84% 2c2p-redirect-api-for-woocommerce

Code Review | 2C2P Redirect API for WooCommerce

WordPress plugin 2C2P Redirect API for WooCommerce scored 84% from 54 tests.

About plugin

  • Plugin page: 2c2p-redirect-api...
  • Plugin version: 7.0.3
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6.0-4.8
  • WordPress version: 6.3.1
  • First release: Jun 20, 2017
  • Latest release: Jun 4, 2018
  • Number of updates: 15
  • Update frequency: every 23.7 days
  • Top authors: 2c2p (100%)

Code review

54 tests

User reviews

1 review

Install metrics

1,000+ active / 5,579 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼3.90ms] Passed 4 tests

A check of server-side resources used by 2C2P Redirect API for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0237.64 ▼5.06
Dashboard /wp-admin3.32 ▲0.0145.17 ▼3.24
Posts /wp-admin/edit.php3.37 ▲0.0144.80 ▼1.08
Add New Post /wp-admin/post-new.php5.90 ▲0.0193.12 ▼6.22
Media Library /wp-admin/upload.php3.24 ▲0.0135.13 ▼0.09

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for 2C2P Redirect API for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,802 ▲6713.23 ▼1.361.54 ▼0.2437.83 ▼5.70
Dashboard /wp-admin2,211 ▲204.87 ▼1.0298.70 ▼3.5137.99 ▼3.51
Posts /wp-admin/edit.php2,094 ▲52.05 ▲0.0039.15 ▲0.6133.61 ▲2.02
Add New Post /wp-admin/post-new.php1,516 ▼1217.67 ▼5.42655.59 ▲25.2168.70 ▲12.70
Media Library /wp-admin/upload.php1,384 ▼44.23 ▼0.0295.04 ▼2.9242.55 ▼1.50

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
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 75% 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 50% 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
Please fix the following
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/2c2p-redirect-api-for-woocommerce/Includes/wc-2c2p-request-helper.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/2c2p-redirect-api-for-woocommerce/2c2p.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/2c2p-redirect-api-for-woocommerce/Includes/wc-2c2p-setting.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (Open the plugin's setting page and enter configuration setting field for 2c2p payment.), #2 (During checkout, customer can select 2C2P Payment and also select previously stored cards (if enabled stored card payment)), #3 (Customer shall be redirected to 2C2P's payment page, where they will be able to save their card (if enabled stored card payment)), #4 (Customer can see the payment result page.)
You can look at the official readme.txt

2c2p-redirect-api-for-woocommerce/2c2p.php 92% from 13 tests

Analyzing the main PHP file in "2C2P Redirect API for WooCommerce" version 7.0.3
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("2c2p-redirect-api-for-woocommerce.php" instead of "2c2p.php")

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
No dangerous file extensions were detected1,357 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP7252501,252
Markdown113057
JavaScript17248

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.66
Average class complexity38.71
▷ Minimum class complexity1.00
▷ Maximum class complexity100.00
Average method complexity9.25
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods32
▷ Static methods00.00%
▷ Public methods32100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants00.00%
▷ Class constants2100.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
4 PNG files occupy 0.25MB with 0.17MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png55.03KB16.63KB▼ 69.78%
screenshot-4.png78.79KB23.58KB▼ 70.07%
screenshot-1.png61.71KB19.86KB▼ 67.82%
screenshot-3.png63.83KB20.87KB▼ 67.30%