78% acf-recent-posts-widget

Code Review | ACF Recent Posts Widget

WordPress plugin ACF Recent Posts Widget scored 78% from 54 tests.

About plugin

  • Plugin page: acf-recent-posts-...
  • Plugin version: 5.9
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.9
  • WordPress version: 5.9.2
  • First release: Mar 14, 2015
  • Latest release: Feb 17, 2022
  • Number of updates: 51
  • Update frequency: every 49.7 days
  • Top authors: gicolek (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

1,000+ active / 18,389 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 successfully, without throwing any errors or notices

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

Server-side resources used by ACF Recent Posts Widget
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.69 ▲0.1861.02 ▲12.17
Dashboard /wp-admin3.58 ▲0.1738.24 ▼57.38
Posts /wp-admin/edit.php3.80 ▲0.1645.41 ▲3.90
Add New Post /wp-admin/post-new.php7.03 ▲0.0799.49 ▼1,165.21
Media Library /wp-admin/upload.php3.47 ▲0.1726.42 ▲0.50

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 36 new files
Database: no new tables, 1 new option
New WordPress options
widget_acf-recent-posts-widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for ACF Recent Posts Widget
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /5,692 ▲1,94816.67 ▲0.626.88 ▲0.232.93 ▲1.01
Dashboard /wp-admin4,787 ▲1,9296.79 ▲0.58127.31 ▼7.15226.58 ▲58.30
Posts /wp-admin/edit.php4,586 ▲1,9023.33 ▲0.0974.77 ▲0.40141.52 ▼42.88
Add New Post /wp-admin/post-new.php2,893 ▲1,19716.22 ▼4.97415.66 ▼64.93201.62 ▲41.74
Media Library /wp-admin/upload.php3,589 ▲1,8986.03 ▲0.47149.46 ▼3.47248.71 ▲36.94

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 1 option in the database
    • widget_acf-recent-posts-widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however 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 take a closer look at the following
  • 2× PHP files output text when accessed directly:
    • > /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 trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-recent-posts-widget/acf-widget.php:36
    • > 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 Warning
      extract() expects parameter 1 to be array, null given in wp-content/plugins/acf-recent-posts-widget/templates/loop-before.php on line 10
    • > 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
      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 33
    • > 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 33
    • > 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 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 33
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/acf-recent-posts-widget/templates/loop-before.php on line 16
    • > PHP Fatal error
      Uncaught Error: Class 'Widget_Base' not found in wp-content/plugins/acf-recent-posts-widget/classes/acf-widget-widget.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

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: Please specify the plugin name on the first line ( === acf-recent-posts-widget === )
You can take inspiration from this readme.txt

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

The main PHP script in "ACF Recent Posts Widget" version 5.9 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: Name the main plugin file 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 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin3,402 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP132765911,459
PO File65475591,417
CSS364117510
JavaScript14316

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
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 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
(invalid) img/logo.png3.26KB0.00KB▼ 100.00%