62% wc-affiliate

Code Review | WC Affiliate – A Full-fledged Affiliate Manager for WooCommerce

WordPress plugin WC Affiliate – A Full-fledged Affiliate Manager for WooCommerce scored62%from 54 tests.

About plugin

  • Plugin page: wc-affiliate
  • Plugin version: 2.2.3.3
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.3
  • WordPress version: 6.3.1
  • First release: Jun 22, 2021
  • Latest release: Sep 13, 2023
  • Number of updates: 29
  • Update frequency: every 28.2 days
  • Top authors: codexpert (68.97%)mukto90 (34.48%)

Code review

54 tests

User reviews

9 reviews

Install metrics

200+ active /3,722 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.52MB] [CPU: ▼1.27ms] Passed 4 tests

A check of server-side resources used by WC Affiliate – A Full-fledged Affiliate Manager for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.45 ▲0.9849.92 ▲4.94
Dashboard /wp-admin5.00 ▲1.6665.82 ▼5.41
Posts /wp-admin/edit.php5.12 ▲1.7764.88 ▲0.59
Add New Post /wp-admin/post-new.php7.62 ▲1.74108.87 ▼5.19
Media Library /wp-admin/upload.php4.93 ▲1.7053.84 ▲16.15
Settings /wp-admin/admin.php?page=wc-affiliate-settings5.0658.92
Transactions /wp-admin/admin.php?page=transactions4.9772.37
Payables /wp-admin/admin.php?page=payables4.9751.00
Referrals /wp-admin/admin.php?page=referrals4.9850.06
Affiliates /wp-admin/admin.php?page=affiliates4.9849.72
Banners /wp-admin/admin.php?page=banners4.9149.67
Summary /wp-admin/admin.php?page=wc-affiliate4.9751.00
Visits /wp-admin/admin.php?page=visits4.9754.02

Server storage [IO: ▲3.49MB] [DB: ▲0.08MB] Passed 3 tests

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 330 new files
Database: 3 new tables, 11 new options
New tables
wp_wca_transactions
wp_wca_visits
wp_wca_referrals
New WordPress options
pl-survey_wc-affiliate-activated
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
wc_affiliate_basic
can_compress_scripts
wc-affiliate_setup
db_upgraded
widget_recent-posts
wc-affiliate-docs-json
...

Browser metrics Passed 4 tests

A check of browser resources used by WC Affiliate – A Full-fledged Affiliate Manager for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,346 ▲58516.27 ▲2.0047.79 ▲45.9442.77 ▼1.02
Dashboard /wp-admin2,352 ▲1754.91 ▼0.6993.09 ▲1.1041.43 ▲0.55
Posts /wp-admin/edit.php2,214 ▲1142.32 ▲0.3542.26 ▼1.7336.06 ▼2.96
Add New Post /wp-admin/post-new.php1,635 ▲10923.19 ▲0.01609.09 ▼23.2533.06 ▼27.80
Media Library /wp-admin/upload.php1,516 ▲1164.39 ▲0.2093.68 ▼20.1045.93 ▼2.26
Settings /wp-admin/admin.php?page=wc-affiliate-settings5,36421.10649.16106.81
Transactions /wp-admin/admin.php?page=transactions1,2652.1435.6235.66
Payables /wp-admin/admin.php?page=payables1,2152.1632.3833.37
Referrals /wp-admin/admin.php?page=referrals1,3382.1535.0033.11
Affiliates /wp-admin/admin.php?page=affiliates1,2102.0729.3228.97
Banners /wp-admin/admin.php?page=banners9511.8532.1556.93
Summary /wp-admin/admin.php?page=wc-affiliate1,1612.0329.8932.05
Visits /wp-admin/admin.php?page=visits1,2162.0531.4533.11

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin does not fully uninstall, leaving 3 tables in the database
    • wp_wca_transactions
    • wp_wca_referrals
    • wp_wca_visits
  • This plugin does not fully uninstall, leaving 10 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • wc_affiliate_basic
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • wc-affiliate_setup
    • wc-affiliate-docs-json
    • wc-affiliate_survey
    • widget_recent-posts

Smoke tests 25% 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 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
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/wc-affiliate/trunk/views/loader.php
    • > /wp-content/plugins/wc-affiliate/views/loader.php
  • 112× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wc-affiliate/trunk/views/front/shortcodes/dashboard/tabs/referrals.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/wc-affiliate/trunk/views/placeholders/banners.php:12
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wc-affiliate/inc/functions.php on line 5
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wc-affiliate/trunk/views/front/shortcodes/dashboard/tabs/transactions.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wc-affiliate/trunk/views/front/authenticate/rejected.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/wc-affiliate/views/placeholders/multilevel-commission.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Codexpert\\WC_Affiliate\\Helper' not found in wp-content/plugins/wc-affiliate/trunk/views/front/shortcodes/dashboard/navigation.php:4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wc-affiliate/views/front/shortcodes/dashboard/tabs/transactions.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/wc-affiliate/views/admin/user/transaction-form.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_time() in wp-content/plugins/wc-affiliate/views/admin/menus/transactions.php:3

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
These are user-side errors you should fix
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=referrals
    • > Network (severe)
    wp-content/plugins/wc-affiliate/assets/css/chosen-sprite.png - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: woocommerce, affiliate marketing, affiliate management, woocommerce affiliate, affiliates

wc-affiliate/wc-affiliate.php 85% from 13 tests

"WC Affiliate – A Full-fledged Affiliate Manager for WooCommerce" version 2.2.3.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Domain Path: The domain path folder does not exist ("/languages")
  • Git Repository: Please remove the Git repository from this plugin

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
Success! There were no dangerous files found in this plugin16,323 lines of code in 140 files:
LanguageFilesBlank linesComment linesLines of code
PHP962,3622,18310,678
CSS18652264,123
JavaScript14118461,125
JSON700318
Markdown415056
YAML11023

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity39.61
▷ Minimum class complexity1.00
▷ Maximum class complexity228.00
Average method complexity4.10
▷ Minimum method complexity1.00
▷ Maximum method complexity43.00
Code structure
Namespaces7
Interfaces0
Traits0
Classes72
▷ Abstract classes45.56%
▷ Concrete classes6894.44%
▷ Final classes22.94%
Methods898
▷ Static methods14215.81%
▷ Public methods86896.66%
▷ Protected methods40.45%
▷ Private methods262.90%
Functions52
▷ Named functions3465.38%
▷ Anonymous functions1834.62%
Constants12
▷ Global constants12100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
40 PNG files occupy 1.61MB with 0.86MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
trunk/assets/img/holiday-deals.png203.19KB58.85KB▼ 71.04%
trunk/assets/img/connect.png7.02KB2.46KB▼ 64.95%
vendor/codexpert/plugin/src/assets/img/checked.png18.81KB9.90KB▼ 47.36%
assets/img/unpaid-commissions.png0.80KB0.42KB▼ 47.93%
assets/img/paid-commissions.png0.59KB0.38KB▼ 35.27%