10% wp-affiliate-links

Code Review | WP Affiliate Links

WordPress plugin WP Affiliate Links scored 10% from 54 tests.

About plugin

  • Plugin page: wp-affiliate-links
  • Plugin version: 0.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.1
  • WordPress version: 5.9.2
  • First release: May 11, 2016
  • Latest release: Apr 16, 2019
  • Number of updates: 8
  • Update frequency: every 133.8 days
  • Top authors: AjariAkuWordPress (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

1,000+ active / 23,895 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
You still need to fix the following installer errors
  • The plugin cannot be installed
    • > Deprecated in wp-content/plugins/wp-affiliate-links/plugin.php+372
    Function create_function() is deprecated

Server metrics [RAM: ▼1.12MB] [CPU: ▼324.02ms] Passed 4 tests

Analyzing server-side resources used by WP Affiliate Links
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.61 ▲0.1058.72 ▲5.57
Dashboard /wp-admin3.20 ▼0.2020.01 ▼13.38
Posts /wp-admin/edit.php3.21 ▼0.4420.72 ▼17.11
Add New Post /wp-admin/post-new.php3.21 ▼3.7722.71 ▼1,258.72
Media Library /wp-admin/upload.php3.21 ▼0.0917.63 ▼6.85
Manage Links /wp-admin/admin.php?page=wpal-admin-links3.2120.39
Create Link /wp-admin/admin.php?page=wpal-admin-add3.2121.40
Auto Link Keywords /wp-admin/admin.php?page=wpal-admin-keywords3.2120.99
Statistics /wp-admin/admin.php?page=wpal-admin-statistics3.2119.86
Settings /wp-admin/admin.php?page=wpal-admin-settings3.2119.78
Edit Link /wp-admin/admin.php?page=wpal-admin-edit3.2120.23
TinyMCE /wp-admin/admin.php?page=wpal-admin-tinymce3.2118.71

Server storage [IO: ▲3.04MB] [DB: ▲9.62MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 126 new files
Database: 7 new tables, 1 new option
New tables
wp_wpal_keywords
wp_wpal_geoipcountry
wp_wpal_links
wp_wpal_destinations
wp_wpal_stats
wp_wpal_automatches
wp_wpal_rules
New WordPress options
WPAL_Plugin_Options

Browser metrics Passed 4 tests

WP Affiliate Links: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,815 ▲9315.92 ▼0.066.15 ▼0.522.33 ▼0.41
Dashboard /wp-admin2,942 ▲816.13 ▼0.02122.80 ▼10.13157.01 ▼3.25
Posts /wp-admin/edit.php2,738 ▲443.25 ▲0.0262.47 ▼1.32137.88 ▼2.65
Add New Post /wp-admin/post-new.php1,692 ▼6816.03 ▼1.15416.78 ▼5.61155.11 ▼4.85
Media Library /wp-admin/upload.php1,744 ▲465.53 ▼0.02146.39 ▲3.11188.83 ▲1.95
Manage Links /wp-admin/admin.php?page=wpal-admin-links1,3563.7878.19130.15
Create Link /wp-admin/admin.php?page=wpal-admin-add4,4103.8483.79154.43
Auto Link Keywords /wp-admin/admin.php?page=wpal-admin-keywords1,3273.6163.89101.69
Statistics /wp-admin/admin.php?page=wpal-admin-statistics1,2393.5462.56102.11
Settings /wp-admin/admin.php?page=wpal-admin-settings1,7593.5668.07188.97
Edit Link /wp-admin/admin.php?page=wpal-admin-edit4,3903.6666.05127.27
TinyMCE /wp-admin/admin.php?page=wpal-admin-tinymce4933.0451.720.09

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/wp-affiliate-links/actions/admin_init.php+8
    Function create_function() is deprecated
  • Zombie tables detected upon uninstall: 7 tables
    • wp_wpal_stats
    • wp_wpal_rules
    • wp_wpal_links
    • wp_wpal_destinations
    • wp_wpal_keywords
    • wp_wpal_geoipcountry
    • wp_wpal_automatches
  • Zombie WordPress options detected upon uninstall: 1 option
    • WPAL_Plugin_Options

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These errors were triggered by the plugin
  • 31 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Deprecated in wp-content/plugins/wp-affiliate-links/controllers/controller/admin.php+89
    Function create_function() is deprecated
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-edit
    • > User deprecated in wp-includes/functions.php+5691
    contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead.

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
The following issues need your attention
  • 10× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/wp-affiliate-links/views/admin/links/index-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/keywords/edit-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/statistics/index-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/edit/index-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/settings/index-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/statistics/stats-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/keywords/index-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/home/index-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/help/index-help.php
    • > /wp-content/plugins/wp-affiliate-links/views/admin/help/index.php
  • 43× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/wp-affiliate-links/views/admin/edit/destination.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WPAL_Controller' not found in wp-content/plugins/wp-affiliate-links/shortcodes/clink.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WPAL_Controller_Tinymce' not found in wp-content/plugins/wp-affiliate-links/controllers/admin/tinymce.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WPAL_Controller_Admin' not found in wp-content/plugins/wp-affiliate-links/controllers/admin/help.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WPAL_Model_List' not found in wp-content/plugins/wp-affiliate-links/models/geoipcountry/list.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/wp-affiliate-links/plugin.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'WPAL_Controller' not found in wp-content/plugins/wp-affiliate-links/controllers/controller/admin.php:8
    • > PHP Notice
      Undefined variable: errors in wp-content/plugins/wp-affiliate-links/views/controller/error.php on line 1
    • > PHP Fatal error
      Uncaught Error: Class 'WPAL_Controller_Admin' not found in wp-content/plugins/wp-affiliate-links/controllers/admin/edit.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WPAL_Controller_Admin' not found in wp-content/plugins/wp-affiliate-links/controllers/admin/settings.php:7

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following browser errors
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-content/plugins/wp-affiliate-links/static/js/jquery/jqplot/jquery.jqplot.js?ver=5.9.2 202:39 Uncaught TypeError: Cannot read properties of undefined (reading 'msie')
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-content/plugins/wp-affiliate-links/static/js/jquery/jqplot/plugins/jqplot.categoryAxisRenderer.js?ver=5.9.2 50:46 Uncaught TypeError: $.jqplot.LinearAxisRenderer is not a constructor
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-content/plugins/wp-affiliate-links/static/js/jquery/jqplot/plugins/jqplot.dateAxisRenderer.js?ver=5.9.2 98:42 Uncaught TypeError: $.jqplot.LinearAxisRenderer is not a constructor
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-content/plugins/wp-affiliate-links/static/js/jquery/jqplot/plugins/jqplot.highlighter.js?ver=5.9.2 18:32 Uncaught TypeError: Cannot read properties of undefined (reading 'push')
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core&ver=5.9.2 1:31592 "jQuery.Deferred exception: this[binder] is not a function" "TypeError: this[binder] is not a function\n at s.fn.init.$.fn.tipsy (/wp-content/plugins/wp-affiliate-links/static/js/jquery/jquery.tipsy.js?ver=5.9.2:161:25)\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/wp-affiliate-links/static/js/admin.js?ver=5.9.2:8:14)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core&ver=5.9.2:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core&ver=5.9.2:2:30340)" undefined
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core&ver=5.9.2 1:31702 Uncaught TypeError: this[binder] is not a function
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-includes/js/tinymce/tiny_mce_popup.js 32:26 Uncaught TypeError: Cannot read properties of undefined (reading 'EditorManager')
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-includes/js/tinymce/utils/mctabs.js 14:38 Uncaught TypeError: Cannot read properties of undefined (reading 'windowManager')
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-includes/js/tinymce/utils/form_utils.js 10:39 Uncaught TypeError: Cannot read properties of undefined (reading 'baseURI')
    • > GET request to /wp-admin/admin.php?page=wpal-admin-tinymce
    • > Javascript (severe) in unknown
    /wp-includes/js/tinymce/tiny_mce_popup.js 114:27 Uncaught TypeError: Cannot read properties of undefined (reading 'plugin_url')

Optimizations

Plugin configuration 96% 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
10 plugin tags: url, mask, short, redirect, shortener...

wp-affiliate-links/plugin.php 92% from 13 tests

"WP Affiliate Links" version 0.1.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("wp-affiliate-links.php" instead of "plugin.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
Everything looks great! No dangerous files found in this plugin14,663 lines of code in 89 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript139362,5519,092
PHP714738994,691
CSS58288880

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
These items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 109)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity16.85
▷ Minimum class complexity1.00
▷ Maximum class complexity135.00
Average method complexity4.93
▷ Minimum method complexity1.00
▷ Maximum method complexity109.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes33
▷ Abstract classes412.12%
▷ Concrete classes2987.88%
▷ Final classes13.45%
Methods134
▷ Static methods32.24%
▷ Public methods12190.30%
▷ Protected methods139.70%
▷ Private methods00.00%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants15
▷ Global constants1173.33%
▷ Class constants426.67%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
22 PNG files occupy 0.39MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
static/img/wizard-icon-20x20.png3.39KB0.67KB▼ 80.10%
static/js/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
screenshot-2.png98.92KB31.40KB▼ 68.26%
static/js/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
static/js/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%