93% acf-db-field

Code Review | Advanced Custom Fields: DB Field

WordPress plugin Advanced Custom Fields: DB Field scored 93% from 54 tests.

About plugin

  • Plugin page: acf-db-field
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-4.9.4
  • WordPress version: 5.9.2
  • First release: Oct 18, 2018
  • Latest release: Nov 28, 2018
  • Number of updates: 10
  • Update frequency: every 4.2 days
  • Top authors: ktyrnet (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 705 total downloads

Benchmarks

Plugin footprint Passed 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.02MB] [CPU: ▼295.24ms] Passed 4 tests

This is a short check of server-side resources used by Advanced Custom Fields: DB Field
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0152.94 ▲4.33
Dashboard /wp-admin3.42 ▲0.0132.24 ▼7.62
Posts /wp-admin/edit.php3.65 ▲0.0137.57 ▼0.56
Add New Post /wp-admin/post-new.php6.90 ▼0.08110.85 ▼1,167.18
Media Library /wp-admin/upload.php3.30 ▼0.0026.32 ▼5.59

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 11 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Advanced Custom Fields: DB Field: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,785 ▲6315.94 ▲0.335.81 ▲0.042.17 ▲0.14
Dashboard /wp-admin2,888 ▲346.09 ▼0.13116.64 ▼22.07152.21 ▼11.09
Posts /wp-admin/edit.php2,694 ▼03.23 ▲0.0164.35 ▲1.17140.08 ▼4.42
Add New Post /wp-admin/post-new.php1,781 ▲2922.69 ▲1.46458.69 ▲8.55198.18 ▲44.57
Media Library /wp-admin/upload.php1,698 ▼05.53 ▼0.00143.02 ▲2.63189.72 ▼8.52

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstall script ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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
Please fix the following items
  • 8× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Notice
      Undefined variable: field in wp-content/plugins/acf-db-field/views/parts-item-list.php on line 1
    • > PHP Notice
      Undefined variable: field in wp-content/plugins/acf-db-field/views/parts-item-list.php on line 2
    • > PHP Notice
      Undefined variable: posts in wp-content/plugins/acf-db-field/views/parts-item-list.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/acf-db-field/fields/acf-db-common.php:2
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/acf-db-field/views/parts-item-list.php on line 1
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/acf-db-field/views/parts-item-list.php on line 3
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/acf-db-field/views/parts-item-list.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'acf_db_common' not found in wp-content/plugins/acf-db-field/fields/acf-db.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 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
These attributes need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (DB Field Settings), #2 (Edit Post With DB Field)
You can take inspiration from this readme.txt

acf-db-field/acf-db.php 85% from 13 tests

The principal PHP file in "Advanced Custom Fields: DB Field" v. 1.0.1 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("acf-db-field.php" instead of "acf-db.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
No dangerous file extensions were detected459 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP4727273
JavaScript100163
Markdown17014
CSS1009

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity10.33
▷ Minimum class complexity1.00
▷ Maximum class complexity27.00
Average method complexity2.75
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes133.33%
▷ Concrete classes266.67%
▷ Final classes00.00%
Methods16
▷ Static methods00.00%
▷ Public methods16100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
2 PNG files occupy 0.07MB with 0.03MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png40.92KB20.55KB▼ 49.76%
screenshot-2.png26.78KB14.00KB▼ 47.74%