10% affiliateimporteram

Code Review | AffiliateImporterAm

WordPress plugin AffiliateImporterAm scored10%from 54 tests.

About plugin

  • Plugin page: affiliateimporteram
  • Plugin version: 1.0.6
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-4.7
  • WordPress version: 6.3.1
  • First release: Dec 15, 2016
  • Latest release: Mar 19, 2017
  • Number of updates: 43
  • Update frequency: every 2.1 days
  • Top authors: cr1000 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /3,154 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Warning in wp-content/plugins/affiliateimporteram/src/AIDN/Utils/Ajax.php+41
    file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known

Server metrics [RAM: ▼1.19MB] [CPU: ▲46.76ms] Passed 4 tests

This is a short check of server-side resources used by AffiliateImporterAm
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.49 ▲1.0252.45 ▲12.81
Dashboard /wp-admin2.77 ▼0.58137.80 ▲76.46
Posts /wp-admin/edit.php2.77 ▼0.59127.75 ▲78.49
Add New Post /wp-admin/post-new.php2.77 ▼3.12147.65 ▲42.55
Media Library /wp-admin/upload.php2.77 ▼0.4691.09 ▲55.22
Amazon /wp-admin/admin.php?page=aidn-add2.77136.43
Shedule /wp-admin/admin.php?page=aidn-schedule2.77138.11
Support /wp-admin/admin.php?page=aidn-support2.77148.86
Backup / Restore /wp-admin/admin.php?page=aidn-backup2.77143.02
Affiliate Am /wp-admin/admin.php?page=aidn2.77126.70
Settings /wp-admin/admin.php?page=aidn-settings2.77130.88
Status /wp-admin/admin.php?page=aidn-status2.77143.73
Statistics /wp-admin/admin.php?page=aidn-stats2.77132.30

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 108 new files
Database: 7 new tables, 8 new options
New tables
wp_aidn_price_formula
wp_aidn_account
wp_aidn_goods_archive
wp_aidn_stats
wp_aidn_blacklist
wp_aidn_goods
wp_aidn_log
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
aidn_db_version
widget_recent-posts
widget_theysaidso_widget
db_upgraded
recovery_mode_email_last_sent

Browser metrics Passed 4 tests

This is an overview of browser requirements for AffiliateImporterAm
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,915 ▲16913.78 ▼0.601.88 ▲0.1942.83 ▲1.50
Dashboard /wp-admin2,306 ▲1155.68 ▲0.80105.64 ▲3.3288.06 ▲44.93
Posts /wp-admin/edit.php2,189 ▲1002.68 ▲0.6638.49 ▲1.5858.03 ▲24.13
Add New Post /wp-admin/post-new.php1,611 ▲7823.47 ▲0.06633.02 ▼61.4534.22 ▼18.68
Media Library /wp-admin/upload.php1,494 ▲1064.89 ▲0.65101.14 ▼9.0274.55 ▲27.42
Amazon /wp-admin/admin.php?page=aidn-add8862.5429.3024.98
Shedule /wp-admin/admin.php?page=aidn-schedule1,1682.3837.9451.47
Support /wp-admin/admin.php?page=aidn-support9502.5933.4425.64
Backup / Restore /wp-admin/admin.php?page=aidn-backup1,1512.2535.4054.02
Affiliate Am /wp-admin/admin.php?page=aidn1,1552.3133.6959.59
Settings /wp-admin/admin.php?page=aidn-settings2,0982.3335.1965.46
Status /wp-admin/admin.php?page=aidn-status1,0021.7419.2231.94
Statistics /wp-admin/admin.php?page=aidn-stats1,1352.3535.7034.86

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Warning in wp-content/plugins/affiliateimporteram/src/AIDN/Utils/Ajax.php+41
    file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known
  • The uninstall procedure has failed, leaving 8 options in the database
    • theysaidso_admin_options
    • recovery_mode_email_last_sent
    • widget_recent-comments
    • aidn_db_version
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=aidn-stats
    • > Warning in wp-content/plugins/affiliateimporteram/src/AIDN/Utils/Ajax.php+41
    file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=aidn-stats
    • > Warning in wp-content/plugins/affiliateimporteram/src/AIDN/Utils/Ajax.php+41
    file_get_contents(http://...@potrivit.com): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known
  • 49 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=aidn-stats
    • > Notice in wp-content/plugins/affiliateimporteram/layout/toolbar.php+55
    Undefined index: class
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=aidn-settings
    • > Notice in wp-content/plugins/affiliateimporteram/src/AIDN/Utils/Utils.php+57
    Undefined index: parent
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=aidn-status
    • > Notice in wp-content/plugins/affiliateimporteram/layout/status.php+28
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/admin.php?page=aidn-status
    • > Error in wp-content/plugins/affiliateimporteram/layout/status.php+78
    Uncaught Error: Call to undefined function woocommerce_let_to_num() in wp-content/plugins/affiliateimporteram/layout/status.php:78
    Stack trace:
    #0 wp-content/plugins/affiliateimporteram/src/Dnolbon/Aidn/Pages/Status.php(11): include()
    #1 wp-includes/class-wp-hook.php(310): Dnolbon\Aidn\Pages\Status->render()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/affiliateimporteram/layout/backup_restore.php
  • 28× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/affiliateimporteram/src/AIDN/Utils/Ajax.php:11
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/affiliateimporteram/layout/stats.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'AIDN_AbstractConfigurator' not found in wp-content/plugins/affiliateimporteram/src/AIDN/Modules/amazon/AEIDN_AmazonConfigurator.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/affiliateimporteram/screenoptions.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/affiliateimporteram/src/AIDN/Modules/amazon/view/settings.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/affiliateimporteram/layout/toolbar.php:2
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/affiliateimporteram/src/AIDN/Pages/DashboardPage.php on line 6
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/affiliateimporteram/src/AIDN/Pages/DashboardPage.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/affiliateimporteram/AffiliateImporterAm.php:21
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/affiliateimporteram/src/AIDN/Pages/DashboardPage.php on line 6

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=aidn-support
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of undefined (reading 'replace')" "TypeError: Cannot read properties of undefined (reading 'replace')\n at setActivePage (/wp-admin/admin.php?page=aidn-support:233:87)\n at HTMLDocument.\u003Canonymous> (/wp-admin/admin.php?page=aidn-support:223:9)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&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&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=aidn-support
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of undefined (reading 'replace')

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that need to be fixed:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
  • Screenshots: These screenshots do not have images: #1 (This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from), #2 (This is the second screen shot)
Please take inspiration from this readme.txt

affiliateimporteram/AffiliateImporterAm.php 92% from 13 tests

The primary PHP file in "AffiliateImporterAm" version 1.0.6 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("affiliateimporteram.php" instead of "AffiliateImporterAm.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin15,876 lines of code in 67 files:
LanguageFilesBlank linesComment linesLines of code
PHP511,3601,3366,774
CSS7860214,846
JavaScript6409682,805
SVG2001,301
JSON100150

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity21.32
▷ Minimum class complexity1.00
▷ Maximum class complexity125.00
Average method complexity3.58
▷ Minimum method complexity1.00
▷ Maximum method complexity54.00
Code structure
Namespaces5
Interfaces0
Traits0
Classes37
▷ Abstract classes410.81%
▷ Concrete classes3389.19%
▷ Final classes00.00%
Methods304
▷ Static methods3210.53%
▷ Public methods25583.88%
▷ Protected methods4013.16%
▷ Private methods92.96%
Functions36
▷ Named functions3494.44%
▷ Anonymous functions25.56%
Constants17
▷ Global constants17100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
27 PNG files occupy 0.84MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/toolbar/dashboard.png1.69KB1.17KB▼ 30.92%
assets/img/toolbar/settings.png2.51KB2.00KB▼ 20.14%
assets/img/toolbar/dashboard_active.png1.71KB1.17KB▼ 31.95%
assets/img/toolbar/csv.png1.31KB1.25KB▼ 4.48%
assets/img/toolbar/backup.png2.75KB2.19KB▼ 20.50%