68% avatar-privacy

Code Review | Avatar Privacy

WordPress plugin Avatar Privacy scored68%from 54 tests.

About plugin

  • Plugin page: avatar-privacy
  • Plugin version: 2.7.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-6.2
  • WordPress version: 6.3.1
  • First release: Feb 13, 2012
  • Latest release: May 1, 2023
  • Number of updates: 161
  • Update frequency: every 25.5 days
  • Top authors: pputzer (84.47%)Ammaletu (16.15%)

Code review

54 tests

User reviews

24 reviews

Install metrics

1,000+ active /35,243 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.82MB] [CPU: ▲4.50ms] Passed 4 tests

A check of server-side resources used by Avatar Privacy
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.24 ▲0.7846.33 ▲7.31
Dashboard /wp-admin4.18 ▲0.8851.55 ▲1.74
Posts /wp-admin/edit.php4.23 ▲0.8755.32 ▲4.95
Add New Post /wp-admin/post-new.php6.72 ▲0.8392.98 ▲3.99
Media Library /wp-admin/upload.php4.04 ▲0.8143.77 ▲10.96

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 603 new files
Database: 2 new tables, 7 new options
New tables
wp_avatar_privacy_hashes
wp_avatar_privacy
New WordPress options
can_compress_scripts
widget_theysaidso_widget
avatar_privacy_settings
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Avatar Privacy
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲7113.68 ▼0.621.85 ▲0.0836.16 ▼4.76
Dashboard /wp-admin2,225 ▲344.87 ▼1.04102.43 ▼6.9338.30 ▼9.13
Posts /wp-admin/edit.php2,105 ▲162.06 ▲0.0340.28 ▼1.2733.11 ▼3.74
Add New Post /wp-admin/post-new.php6,352 ▲4,83227.82 ▲4.78892.08 ▲225.8458.03 ▲9.81
Media Library /wp-admin/upload.php1,401 ▲134.20 ▲0.0093.82 ▼1.8243.16 ▼2.57

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_avatar_privacy_hashes
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

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
Please fix the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/avatar-privacy/admin/partials/sections/avatars-disabled-script.php
  • 123× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Avatar_Privacy\\Avatar_Handlers\\Avatar_Handler' not found in wp-content/plugins/avatar-privacy/includes/avatar-privacy/avatar-handlers/class-legacy-icon-handler.php:45
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_kses() in wp-content/plugins/avatar-privacy/vendor-scoped/mundschenk-at/check-wp-requirements/partials/requirements-error-notice.php:29
    • > PHP Notice
      Undefined variable: align in wp-content/plugins/avatar-privacy/public/partials/block/avatar.php on line 39
    • > PHP Fatal error
      Uncaught Error: Class 'Avatar_Privacy\\Avatar_Handlers\\Default_Icons\\Abstract_Icon_Provider' not found in wp-content/plugins/avatar-privacy/includes/avatar-privacy/avatar-handlers/default-icons/class-static-icon-provider.php:39
    • > PHP Fatal error
      Uncaught Error: Class 'Avatar_Privacy\\Vendor\\Mundschenk\\WP_Requirements' not found in wp-content/plugins/avatar-privacy/includes/avatar-privacy/class-requirements.php:38
    • > PHP Fatal error
      Uncaught Error: Class 'Avatar_Privacy\\Avatar_Handlers\\Default_Icons\\SVG_Icon_Provider' not found in wp-content/plugins/avatar-privacy/includes/avatar-privacy/avatar-handlers/default-icons/static-icons/class-bowling-pin-icon-provider.php:38
    • > PHP Fatal error
      Uncaught Error: Class 'Avatar_Privacy\\CLI\\Abstract_Command' not found in wp-content/plugins/avatar-privacy/includes/avatar-privacy/cli/class-database-command.php:47
    • > PHP Fatal error
      Uncaught Error: Class 'Avatar_Privacy\\Avatar_Handlers\\Default_Icons\\Abstract_Icon_Provider' not found in wp-content/plugins/avatar-privacy/includes/avatar-privacy/avatar-handlers/default-icons/class-custom-icon-provider.php:46
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/avatar-privacy/public/partials/block/avatar.php:44
    • > PHP Fatal error
      Uncaught Error: Call to a member function avatar_uploader() on null in wp-content/plugins/avatar-privacy/public/partials/shortcode/avatar-upload.php:44

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
6 plugin tags: avatar, caching, privacy, gravatar, bbpress...

avatar-privacy/avatar-privacy.php Passed 13 tests

"Avatar Privacy" version 2.7.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
55 characters long description:
Adds options to enhance the privacy when using avatars.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin12,205 lines of code in 268 files:
LanguageFilesBlank linesComment linesLines of code
PHP1922,40017,08111,459
Markdown72010428
JavaScript940140200
SVG540054
JSON20048
CSS42216

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 150)
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity9.34
▷ Minimum class complexity1.00
▷ Maximum class complexity208.00
Average method complexity2.45
▷ Minimum method complexity1.00
▷ Maximum method complexity150.00
Code structure
Namespaces31
Interfaces9
Traits0
Classes146
▷ Abstract classes1510.27%
▷ Concrete classes13189.73%
▷ Final classes00.00%
Methods915
▷ Static methods657.10%
▷ Public methods66572.68%
▷ Protected methods22124.15%
▷ Private methods293.17%
Functions42
▷ Named functions614.29%
▷ Anonymous functions3685.71%
Constants247
▷ Global constants41.62%
▷ Class constants24398.38%
▷ Public constants21186.83%

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
327 PNG files occupy 4.84MB with 1.89MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/images/wavatars/brow_2.png0.39KB0.36KB▼ 9.23%
public/images/cats/eyes_13.png27.50KB11.77KB▼ 57.20%
public/images/wavatars/shine_4.png3.31KB2.50KB▼ 24.42%
public/images/cats/eyes_15.png17.02KB7.82KB▼ 54.05%
public/images/cats/eyes_8.png18.05KB8.96KB▼ 50.39%