72% addfreestats

Code Review | AFS Analytics

WordPress plugin AFS Analytics scored72%from 54 tests.

About plugin

  • Plugin page: addfreestats
  • Plugin version: 4.20
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 1.4.1-6.3
  • WordPress version: 6.3.1
  • First release: Sep 4, 2008
  • Latest release: Aug 24, 2023
  • Number of updates: 109
  • Update frequency: every 50.2 days
  • Top authors: AddFreeStats (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

1,000+ active /49,224 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.81MB] [CPU: ▲5.82ms] Passed 4 tests

A check of server-side resources used by AFS Analytics
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.39 ▲0.9251.19 ▲14.24
Dashboard /wp-admin4.12 ▲0.8258.48 ▲9.88
Posts /wp-admin/edit.php4.16 ▲0.8053.53 ▼3.80
Add New Post /wp-admin/post-new.php6.69 ▲0.80100.99 ▲8.45
Media Library /wp-admin/upload.php4.03 ▲0.8044.57 ▲8.73
Plugin settings /wp-admin/admin.php?page=afsa_settings_page3.9943.43
Contact us /wp-admin/admin.php?page=afsa_support3.9838.87
AFS Analytics /wp-admin/admin.php?page=afsa_dashboard4.0045.27
Dashboard Demo /wp-admin/admin.php?page=afsa_demo_dashboard_page4.0042.20
account_manager /wp-admin/admin.php?page=afsa_account_manager4.0049.81
AFS Analytics /wp-admin/options-general.php?page=afsa_settings_page4.0043.36

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 82 new files
Database: 1 new table, 9 new options
New tables
wp_afsa_processed_order
New WordPress options
theysaidso_admin_options
db_upgraded
afsa_accounts
widget_theysaidso_widget
afsa_db_schema_version
widget_recent-posts
can_compress_scripts
afsa_request_state
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for AFS Analytics
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,923 ▲15213.35 ▼1.051.47 ▼0.3625.27 ▼16.57
Dashboard /wp-admin2,314 ▲1234.87 ▲0.0496.46 ▼6.0184.08 ▲43.77
Posts /wp-admin/edit.php2,126 ▲342.02 ▲0.0234.17 ▼8.1334.37 ▼2.07
Add New Post /wp-admin/post-new.php1,705 ▲17224.49 ▲1.47621.12 ▲26.2951.13 ▲5.10
Media Library /wp-admin/upload.php1,419 ▲374.25 ▲0.0997.36 ▲0.4977.83 ▲35.84
Plugin settings /wp-admin/admin.php?page=afsa_settings_page8902.2226.2829.40
Contact us /wp-admin/admin.php?page=afsa_support7962.0222.8523.41
AFS Analytics /wp-admin/admin.php?page=afsa_dashboard8502.0426.2242.86
Dashboard Demo /wp-admin/admin.php?page=afsa_demo_dashboard_page1,6414.3563.60133.15
account_manager /wp-admin/admin.php?page=afsa_account_manager8202.0122.3530.12
AFS Analytics /wp-admin/options-general.php?page=afsa_settings_page8902.2024.8925.80

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • Zombie WordPress options were found after uninstall: 8 options
    • theysaidso_admin_options
    • widget_recent-posts
    • afsa_request_state
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • afsa_accounts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=afsa_support
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

SRP 50% 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 items
  • 57× PHP files trigger server-side errors or warnings when accessed directly (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/addfreestats/includes/class-afsa-db.php on line 3
    • > PHP Warning
      Use of undefined constant AFSA_INCLUDES_DIR - assumed 'AFSA_INCLUDES_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/addfreestats/includes/controllers/class-afsa-dashboard-page.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'AFSA_INCLUDES_DIR/api/oauth/class-afsa-oauth-client.php' (include_path='.:/usr/share/php') in wp-content/plugins/addfreestats/includes/api/class-afsa-api.php on line 3
    • > PHP Warning
      require_once(AFSA_INCLUDES_DIR/api/request/class-afsa-api-request.php): failed to open stream: No such file or directory in wp-content/plugins/addfreestats/includes/ajax/class-afsa-ajax.php on line 3
    • > PHP Warning
      require_once(AFSA_INCLUDES_DIR/infos/class-afsa-infos-site.php): failed to open stream: No such file or directory in wp-content/plugins/addfreestats/includes/infos/woo/class-afsa-infos-store.php on line 3
    • > PHP Warning
      Use of undefined constant AFSA_INCLUDES_DIR - assumed 'AFSA_INCLUDES_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/addfreestats/includes/api/request/class-afsa-api-request.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'AFSA_INCLUDES_DIR/api/request/class-afsa-api-request.php' (include_path='.:/usr/share/php') in wp-content/plugins/addfreestats/includes/ajax/class-afsa-ajax.php on line 3
    • > PHP Warning
      require_once(AFSA_INCLUDES_DIR/api/class-afsa-api.php): failed to open stream: No such file or directory in wp-content/plugins/addfreestats/includes/api/request/class-afsa-api-request.php on line 3
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/upgrade.php): failed to open stream: No such file or directory in wp-content/plugins/addfreestats/includes/class-afsa-db.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'AFSA_Dashboard_Renderer' not found in wp-content/plugins/addfreestats/includes/controllers/renderer/class-afsa-admin-widget-dashboard-renderer.php:5

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=afsa_dashboard
    • > Network (severe)
    wp-content/plugins/addfreestats/assets/images/welcome.png - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Tags: You are using too many tags: 32 tag instead of maximum 10
The official readme.txt is a good inspiration

addfreestats/addfreestats.php 85% from 13 tests

"AFS Analytics" version 4.20's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.5.0" instead of "1.4.1")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin6,341 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
PHP561,6344484,873
CSS717912522
PO File2209243510
JavaScript5804200
SVG111157
Markdown262079

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity11.38
▷ Minimum class complexity1.00
▷ Maximum class complexity90.00
Average method complexity2.16
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes54
▷ Abstract classes11.85%
▷ Concrete classes5398.15%
▷ Final classes00.00%
Methods492
▷ Static methods18236.99%
▷ Public methods44790.85%
▷ Protected methods20.41%
▷ Private methods438.74%
Functions11
▷ Named functions00.00%
▷ Anonymous functions11100.00%
Constants39
▷ Global constants3897.44%
▷ Class constants12.56%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
5 PNG files occupy 0.14MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/logo.small.png5.36KB2.67KB▼ 50.15%
assets/images/intro.screen.png96.44KB36.36KB▼ 62.29%
assets/images/icon.small.png0.83KB1.20KB0.00%
assets/images/icon.png17.73KB7.30KB▼ 58.80%
assets/images/logo.square.png27.41KB9.83KB▼ 64.15%