84% advanced-custom-fields-widget

Code Review | Advanced Custom Fields: Widget

WordPress plugin Advanced Custom Fields: Widget scored84%from 54 tests.

About plugin

  • Plugin page: advanced-custom-f...
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.3.1
  • WordPress version: 6.3.1
  • First release: Aug 2, 2014
  • Latest release: May 10, 2016
  • Number of updates: 14
  • Update frequency: every 46.3 days
  • Top authors: alexvandervegt (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /7,145 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.00MB] [CPU: ▼5.92ms] Passed 4 tests

This is a short check of server-side resources used by Advanced Custom Fields: Widget
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0237.87 ▼0.30
Dashboard /wp-admin3.32 ▼0.0344.62 ▼17.53
Posts /wp-admin/edit.php3.37 ▲0.0148.92 ▲1.23
Add New Post /wp-admin/post-new.php5.90 ▲0.0190.17 ▼5.73
Media Library /wp-admin/upload.php3.24 ▲0.0133.91 ▼0.11

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 12 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_recent-posts
widget_acf_widget

Browser metrics Passed 4 tests

Advanced Custom Fields: Widget: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.29 ▼1.091.81 ▲0.0837.53 ▼7.23
Dashboard /wp-admin2,206 ▲184.85 ▼0.06108.85 ▲0.7339.86 ▲0.44
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.0139.11 ▲0.8236.75 ▲2.35
Add New Post /wp-admin/post-new.php1,537 ▲423.39 ▲0.49674.05 ▲29.7352.51 ▲1.51
Media Library /wp-admin/upload.php1,391 ▲34.21 ▲0.0396.60 ▼4.2042.21 ▼2.65

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
Please fix the following items
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • widget_recent-comments
    • widget_acf_widget
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/advanced-custom-fields-widget/includes/class-acf-widget.php:3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/advanced-custom-fields-widget/partials/acf-widget-html.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/advanced-custom-fields-widget/includes/class-acf-widget.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
4 plugin tags: advanced custom fields, widget, acf, widgets

advanced-custom-fields-widget/acf-widget.php 85% from 13 tests

The main PHP script in "Advanced Custom Fields: Widget" version 1.0.2 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("advanced-custom-fields-widget.php" instead of "acf-widget.php")
  • Text Domain: Please use dashes and lowercase characters for text domains

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
Good job! No executable or dangerous file extensions detected269 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP516944264
JavaScript1405

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity7.67
▷ Minimum class complexity1.00
▷ Maximum class complexity19.00
Average method complexity2.25
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods16
▷ Static methods00.00%
▷ Public methods16100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
4 PNG files occupy 0.16MB with 0.11MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-4.png48.26KB14.56KB▼ 69.83%
screenshot-1.png48.42KB15.27KB▼ 68.47%
screenshot-3.png38.01KB12.16KB▼ 68.00%
screenshot-2.png32.78KB10.25KB▼ 68.72%