78% acf-recent-posts-widget

Code Review | ACF Recent Posts Widget

WordPress plugin ACF Recent Posts Widget scored78%from 54 tests.

About plugin

  • Plugin page: acf-recent-posts-...
  • Plugin version: 5.9.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.2.2
  • WordPress version: 6.3.1
  • First release: Mar 14, 2015
  • Latest release: Jul 30, 2023
  • Number of updates: 56
  • Update frequency: every 54.7 days
  • Top authors: gicolek (92.86%)patopaiar (8.93%)

Code review

54 tests

User reviews

12 reviews

Install metrics

800+ active /21,331 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▲0.14MB] [CPU: ▼2.89ms] Passed 4 tests

An overview of server-side resources used by ACF Recent Posts Widget
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1233.93 ▼5.06
Dashboard /wp-admin3.46 ▲0.1245.95 ▼12.12
Posts /wp-admin/edit.php3.57 ▲0.2150.29 ▲3.61
Add New Post /wp-admin/post-new.php6.06 ▲0.1791.70 ▲2.02
Media Library /wp-admin/upload.php3.39 ▲0.1637.19 ▲4.25

Server storage [IO: ▲0.28MB] [DB: ▲0.07MB] Passed 3 tests

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 38 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
widget_acf-recent-posts-widget
widget_recent-posts
db_upgraded
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for ACF Recent Posts Widget
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,158 ▲1,40113.52 ▼0.851.67 ▼0.4138.93 ▼4.28
Dashboard /wp-admin3,562 ▲1,3775.24 ▼0.58113.44 ▲13.6940.34 ▲0.70
Posts /wp-admin/edit.php3,450 ▲1,3612.47 ▲0.4646.46 ▲10.5633.79 ▲2.59
Add New Post /wp-admin/post-new.php2,833 ▲1,29117.63 ▼0.72661.20 ▲10.7967.04 ▲16.20
Media Library /wp-admin/upload.php2,744 ▲1,3564.57 ▲0.36101.45 ▲7.7545.31 ▲2.95

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • widget_acf-recent-posts-widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/acf-recent-posts-widget/templates/loop-after.php
    • > /wp-content/plugins/acf-recent-posts-widget/templates/loop-before.php
  • 15× GET requests to PHP files have triggered server-side errors or warnings (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/acf-recent-posts-widget/acf-widget.php on line 34
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-recent-posts-widget/acf-widget.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function has_post_thumbnail() in wp-content/plugins/acf-recent-posts-widget/templates/loop-inner.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/acf-recent-posts-widget/classes/widget-base.php:6
    • > PHP Warning
      extract() expects parameter 1 to be array, null given in wp-content/plugins/acf-recent-posts-widget/templates/loop-after.php on line 10
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/acf-recent-posts-widget/acf-widget.php on line 34
    • > PHP Warning
      extract() expects parameter 1 to be array, null given in wp-content/plugins/acf-recent-posts-widget/templates/loop-inner.php on line 21
    • > PHP Warning
      extract() expects parameter 1 to be array, null given in wp-content/plugins/acf-recent-posts-widget/templates/loop-empty.php on line 9
    • > PHP Fatal error
      Uncaught Error: Class 'Widget_Base' not found in wp-content/plugins/acf-recent-posts-widget/classes/acf-widget-widget.php:6
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/acf-recent-posts-widget/acf-widget.php on line 34

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Plugin Name: You should set the name of your plugin on the first line ( === acf-recent-posts-widget === )
The official readme.txt is a good inspiration

acf-recent-posts-widget/acf-widget.php 92% from 13 tests

"ACF Recent Posts Widget" version 5.9.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("acf-recent-posts-widget.php" instead of "acf-widget.php")

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
There were no executable files found in this plugin3,699 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PO File76556671,714
PHP132765921,459
CSS364117510
JavaScript14316

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity24.71
▷ Minimum class complexity5.00
▷ Maximum class complexity75.00
Average method complexity3.08
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods54
▷ Static methods1120.37%
▷ Public methods5296.30%
▷ Protected methods00.00%
▷ Private methods23.70%
Functions5
▷ Named functions360.00%
▷ Anonymous functions240.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG files were detected