74% affiliates

Code Review | Affiliates

WordPress plugin Affiliates scored74%from 54 tests.

About plugin

  • Plugin page: affiliates
  • Plugin version: 4.19.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.2
  • WordPress version: 6.3.1
  • First release: Jun 7, 2011
  • Latest release: Jun 28, 2023
  • Number of updates: 395
  • Update frequency: every 11.3 days
  • Top authors: itthinx (100%)

Code review

54 tests

User reviews

130 reviews

Install metrics

4,000+ active /401,419 total downloads


Plugin footprint 65% 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.18MB] [CPU: ▲6.30ms] Passed 4 tests

An overview of server-side resources used by Affiliates
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.92 ▲1.4654.98 ▲10.75
Dashboard /wp-admin5.74 ▲2.3970.74 ▼1.81
Posts /wp-admin/edit.php5.79 ▲2.4374.99 ▲22.05
Add New Post /wp-admin/post-new.php8.35 ▲2.46102.64 ▼5.79
Media Library /wp-admin/upload.php5.65 ▲2.4369.03 ▲30.90
Visits & Referrals /wp-admin/admin.php?page=affiliates-admin-hits5.5760.54
Add-Ons /wp-admin/admin.php?page=affiliates-admin-add-ons5.5756.89
Traffic /wp-admin/admin.php?page=affiliates-admin-hits-uri5.5751.46
Manage Affiliates /wp-admin/admin.php?page=affiliates-admin-affiliates5.5760.69
Referrals /wp-admin/admin.php?page=affiliates-admin-referrals5.5757.13
User Registration /wp-admin/admin.php?page=affiliates-admin-user-registration5.5751.11
Affiliates & Referrals /wp-admin/admin.php?page=affiliates-admin-hits-affiliate5.5756.49
Affiliates /wp-admin/admin.php?page=affiliates-admin5.5761.11
Notifications /wp-admin/admin.php?page=affiliates-admin-notifications5.5554.57
Settings /wp-admin/admin.php?page=affiliates-admin-settings5.6757.44

Server storage [IO: ▲4.34MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 186 new files
Database: 8 new tables, 9 new options
New tables
New WordPress options

Browser metrics Passed 4 tests

Affiliates: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,964 ▲20314.28 ▼0.191.90 ▲0.2133.82 ▼9.49
Dashboard /wp-admin2,358 ▲1785.59 ▲0.0494.03 ▲2.1275.74 ▲33.05
Posts /wp-admin/edit.php2,190 ▲902.10 ▲0.1639.14 ▲1.0935.89 ▼1.55
Add New Post /wp-admin/post-new.php6,308 ▲4,78226.27 ▲2.69963.59 ▲272.8252.90 ▲2.09
Media Library /wp-admin/upload.php1,487 ▲874.10 ▼0.10103.90 ▼3.9578.38 ▲28.44
Visits & Referrals /wp-admin/admin.php?page=affiliates-admin-hits1,1082.5552.2342.13
Add-Ons /wp-admin/admin.php?page=affiliates-admin-add-ons1,1241.9736.9737.52
Traffic /wp-admin/admin.php?page=affiliates-admin-hits-uri1,1592.4845.5334.35
Manage Affiliates /wp-admin/admin.php?page=affiliates-admin-affiliates1,1852.0529.7646.87
Referrals /wp-admin/admin.php?page=affiliates-admin-referrals1,1712.5139.7035.00
User Registration /wp-admin/admin.php?page=affiliates-admin-user-registration1,6852.0428.6030.23
Affiliates & Referrals /wp-admin/admin.php?page=affiliates-admin-hits-affiliate1,1492.4842.7537.02
Affiliates /wp-admin/admin.php?page=affiliates-admin1,1822.6857.5744.70
Notifications /wp-admin/admin.php?page=affiliates-admin-notifications9811.9227.8336.72
Settings /wp-admin/admin.php?page=affiliates-admin-settings1,1301.9529.2138.80

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie tables were found after uninstall: 8 tables
    • wp_aff_hits
    • wp_aff_robots
    • wp_aff_user_agents
    • wp_aff_referrals
    • wp_aff_affiliates_users
    • wp_aff_uris
    • wp_aff_affiliates
    • wp_aff_referral_items
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • db_upgraded
    • affiliates_plugin_version
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_affiliates_contact
    • widget_recent-comments
    • widget_affiliates_registration_widget
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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 fix the following items
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Interface 'I_Affiliates_Dashboard_Section' not found in wp-content/plugins/affiliates/lib/core/dashboard/class-affiliates-dashboard-section.php:25
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/affiliates/lib/core/class-affiliates-exclusion.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Affiliates_Dashboard_Section' not found in wp-content/plugins/affiliates/lib/core/dashboard/class-affiliates-dashboard-section-table.php:25

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side


Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Tags: You are using too many tags: 33 tag instead of maximum 10
The official readme.txt is a good inspiration

affiliates/affiliates.php Passed 13 tests

The principal PHP file in "Affiliates" v. 4.19.0 is loaded by WordPress automatically on each request
86 characters long description:
The Affiliates plugin provides the right tools to maintain a partner referral program.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin53,636 lines of code in 129 files:
LanguageFilesBlank linesComment linesLines of code
PO File1611,24420,89430,546

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity20.92
▷ Minimum class complexity1.00
▷ Maximum class complexity197.00
Average method complexity4.96
▷ Minimum method complexity1.00
▷ Maximum method complexity89.00
Code structure
▷ Abstract classes23.57%
▷ Concrete classes5496.43%
▷ Final classes00.00%
▷ Static methods24576.56%
▷ Public methods30996.56%
▷ Protected methods20.62%
▷ Private methods92.81%
▷ Named functions86100.00%
▷ Anonymous functions00.00%
▷ Global constants7061.95%
▷ Class constants4338.05%
▷ Public constants43100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
35 PNG files occupy 0.38MB with 0.16MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/pending.png0.20KB0.13KB▼ 33.97%
images/required.png0.16KB0.13KB▼ 18.29%
images/add-ons/affiliates-enterprise.png31.46KB12.30KB▼ 60.89%
images/affiliates-bw.png0.20KB0.13KB▼ 36.59%
images/add-ons/affiliates-permanent.png27.76KB11.05KB▼ 60.21%