72% dr-affiliate

Code Review | Dr Affiliate

WordPress plugin Dr Affiliate scored72%from 54 tests.

About plugin

  • Plugin page: dr-affiliate
  • Plugin version: 1.2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2.2
  • WordPress version: 6.3.1
  • First release: Aug 6, 2021
  • Latest release: Jul 10, 2023
  • Number of updates: 16
  • Update frequency: every 44.2 days
  • Top authors: rohiturane50 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /903 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.20MB] [CPU: ▼0.89ms] Passed 4 tests

Analyzing server-side resources used by Dr Affiliate
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1742.64 ▼2.06
Dashboard /wp-admin3.59 ▲0.2461.25 ▼4.51
Posts /wp-admin/edit.php3.65 ▲0.3057.96 ▲6.31
Add New Post /wp-admin/post-new.php6.08 ▲0.2094.58 ▲0.42
Media Library /wp-admin/upload.php3.44 ▲0.2138.37 ▲2.59
Import & Export CSV /wp-admin/admin.php?page=import-export-dr-affiliate-slug3.4340.69
Smart Reports /wp-admin/admin.php?page=report-dr-affiliate-slug3.4341.55
Setting /wp-admin/admin.php?page=setting-dr-affiliate-slug3.4441.71
New Affiliate Link /wp-admin/admin.php?page=add-dr-affiliate-slug3.4743.10
Third Party API /wp-admin/admin.php?page=third-party-dr-affiliate-slug3.4340.43
All Affiliate /wp-admin/admin.php?page=dr-affiliate-slug3.4339.64

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 45 new files
Database: 4 new tables, 6 new options
New tables
wp_dr_affiliate_clicks
wp_dr_affiliate
wp_dr_affiliate_image
wp_dr_affiliate_geolocation
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

Dr Affiliate: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,195 ▲43419.36 ▲4.9910.79 ▲8.8842.70 ▼1.47
Dashboard /wp-admin2,482 ▲2798.71 ▲2.90251.56 ▲133.0346.08 ▲1.87
Posts /wp-admin/edit.php2,416 ▲3198.33 ▲6.3188.16 ▲48.6135.66 ▲0.45
Add New Post /wp-admin/post-new.php6,252 ▲4,72619.25 ▲1.61770.41 ▲90.3539.08 ▼12.79
Media Library /wp-admin/upload.php1,548 ▲1489.60 ▲5.35126.28 ▲3.8651.52 ▲1.36
Import & Export CSV /wp-admin/admin.php?page=import-export-dr-affiliate-slug1,1688.0685.7748.35
Smart Reports /wp-admin/admin.php?page=report-dr-affiliate-slug1,1748.0278.8238.63
Setting /wp-admin/admin.php?page=setting-dr-affiliate-slug1,2138.0176.7335.18
New Affiliate Link /wp-admin/admin.php?page=add-dr-affiliate-slug1,3507.9579.7530.99
Third Party API /wp-admin/admin.php?page=third-party-dr-affiliate-slug1,1738.0486.6436.55
All Affiliate /wp-admin/admin.php?page=dr-affiliate-slug1,1518.0879.5432.29

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/dr-affiliate/admin/partials/dr-report.php
    • > /wp-content/plugins/dr-affiliate/public/partials/dr-affilate-public-display.php
    • > /wp-content/plugins/dr-affiliate/admin/partials/dr-import-export-affiliate.php
    • > /wp-content/plugins/dr-affiliate/admin/partials/dr-third-party-affiliate.php
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/dr-affiliate/admin/partials/dr-affilate-admin-display.php:59
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/dr-affiliate/admin/partials/dr-affilate-admin-display.php on line 58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/dr-affiliate/admin/partials/dr-new-affiliate.php:35
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/dr-affiliate/admin/partials/dr-affilate-setting.php:23

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following user-side errors
    • > GET request to /wp-admin/admin.php?page=dr-affiliate-slug
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of null (reading 'getContext')" "TypeError: Cannot read properties of null (reading 'getContext')\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/dr-affiliate/admin/js/dr-affilate-admin.js?ver=1.0.0:210:48)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=dr-affiliate-slug
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of null (reading 'getContext')

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === dr-affiliate === )
The official readme.txt is a good inspiration

dr-affiliate/dr-affilate.php 85% from 13 tests

The entry point to "Dr Affiliate" version 1.2.3 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("dr-affiliate.php" instead of "dr-affilate.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin16,987 lines of code in 37 files:
LanguageFilesBlank linesComment linesLines of code
JSON20015,145
PHP20175710980
JavaScript1170131588
CSS33518258
Sass11016

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity5.57
▷ Minimum class complexity1.00
▷ Maximum class complexity21.00
Average method complexity1.63
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods51
▷ Static methods23.92%
▷ Public methods4690.20%
▷ Protected methods00.00%
▷ Private methods59.80%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
PNG images were not found in this plugin