72% addfreestats

Code Review | AFS Analytics

WordPress plugin AFS Analytics scored 72% from 54 tests.

About plugin

  • Plugin page: addfreestats
  • Plugin version: 4.14
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 1.4.1-5.9.1
  • WordPress version: 5.9.2
  • First release: Sep 4, 2008
  • Latest release: Mar 6, 2022
  • Number of updates: 100
  • Update frequency: every 49.3 days
  • Top authors: AddFreeStats (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

1,000+ active / 42,444 total downloads


Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲0.78MB] [CPU: ▼287.04ms] Passed 4 tests

An overview of server-side resources used by AFS Analytics
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.45 ▲1.3363.99 ▲40.96
Dashboard /wp-admin4.23 ▲0.8250.48 ▲16.36
Posts /wp-admin/edit.php4.44 ▲0.8048.26 ▲11.15
Add New Post /wp-admin/post-new.php7.68 ▲0.72105.94 ▼1,180.25
Media Library /wp-admin/upload.php4.10 ▲0.8032.54 ▲4.57
AFS Analytics /wp-admin/options-general.php?page=afsa_settings_page4.0637.50
Dashboard Demo /wp-admin/admin.php?page=afsa_demo_dashboard_page4.0736.75
Contact us /wp-admin/admin.php?page=afsa_support4.0429.58
AFS Analytics /wp-admin/admin.php?page=afsa_dashboard4.0733.57
account_manager /wp-admin/admin.php?page=afsa_account_manager4.0732.01
Plugin settings /wp-admin/admin.php?page=afsa_settings_page4.0636.61

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 82 new files
Database: 1 new table, 3 new options
New tables
New WordPress options

Browser metrics Passed 4 tests

This is an overview of browser requirements for AFS Analytics
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,949 ▲22716.30 ▲0.696.05 ▲0.092.44 ▲0.10
Dashboard /wp-admin3,046 ▲1856.19 ▼0.05118.97 ▼12.20216.71 ▲58.65
Posts /wp-admin/edit.php2,736 ▲423.13 ▼0.1264.45 ▲2.75141.31 ▼2.79
Add New Post /wp-admin/post-new.php1,683 ▲2220.55 ▲4.50402.07 ▼8.34205.72 ▲45.80
Media Library /wp-admin/upload.php1,741 ▲465.54 ▼0.00123.29 ▼21.69206.72 ▲18.15
AFS Analytics /wp-admin/options-general.php?page=afsa_settings_page1,1142.5555.95127.16
Dashboard Demo /wp-admin/admin.php?page=afsa_demo_dashboard_page1,8405.40131.10253.67
Contact us /wp-admin/admin.php?page=afsa_support9962.4150.8890.83
AFS Analytics /wp-admin/admin.php?page=afsa_dashboard1,0622.4357.08130.14
account_manager /wp-admin/admin.php?page=afsa_account_manager1,0322.3955.7589.58
Plugin settings /wp-admin/admin.php?page=afsa_settings_page1,1142.7553.29125.83

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% 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 does not fully uninstall, leaving 2 options in the database
    • afsa_request_state
    • afsa_accounts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
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+1358
    Cannot modify header information - headers already sent by (output started at wp-admin/includes/misc.php:1013)

SRP 50% 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
The following issues need your attention
  • 57× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'AFSA_Setting_Tab' not found in wp-content/plugins/addfreestats/includes/controllers/settings/tabs/class-afsa-setting-tab-privacy.php:3
    • > PHP Fatal error
      require_once(): Failed opening required 'AFSA_INCLUDES_DIR/infos/class-afsa-infos-visitor.php' (include_path='.:/usr/share/php') in wp-content/plugins/addfreestats/includes/infos/woo/class-afsa-infos-customer.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'AFSA_Infos' not found in wp-content/plugins/addfreestats/includes/infos/class-afsa-infos-site.php: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 Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/upgrade.php' (include_path='.:/usr/share/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/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 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
    • > PHP Fatal error
      Uncaught Error: Class 'AFSA_Setting_Tab' not found in wp-content/plugins/addfreestats/includes/controllers/settings/tabs/class-afsa-setting-tab-woo.php:3
    • > PHP Warning
      require_once(AFSA_INCLUDES_DIR/defines.php): failed to open stream: No such file or directory in wp-content/plugins/addfreestats/includes/class-afsa-tracker.php on line 5

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=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)


Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 32 tag instead of maximum 10
The official readme.txt might help

addfreestats/addfreestats.php 85% from 13 tests

The entry point to "AFS Analytics" version 4.14 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("3.5.0" instead of "1.4.1")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected6,313 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
PO File2209243510

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity11.33
▷ Minimum class complexity1.00
▷ Maximum class complexity90.00
Average method complexity2.15
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
▷ Abstract classes11.85%
▷ Concrete classes5398.15%
▷ Final classes00.00%
▷ Static methods18236.99%
▷ Public methods44891.06%
▷ Protected methods20.41%
▷ Private methods428.54%
▷ Named functions00.00%
▷ Anonymous functions11100.00%
▷ Global constants3897.44%
▷ Class constants12.56%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
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.square.png27.41KB9.83KB▼ 64.15%
assets/images/icon.png17.73KB7.30KB▼ 58.80%
assets/images/logo.small.png5.36KB2.67KB▼ 50.15%
assets/images/intro.screen.png96.44KB36.36KB▼ 62.29%