94% advanced-custom-fields-shortcode-field

Code Review | Advanced Custom Field: Shortcode Field

WordPress plugin Advanced Custom Field: Shortcode Field scored 94% from 54 tests.

About plugin

  • Plugin page: advanced-custom-f...
  • Plugin version: 4.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-3.5.2
  • WordPress version: 5.9.2
  • First release: Jun 29, 2013
  • Latest release: Jun 29, 2013
  • Number of updates: 6
  • Update frequency: every 0.2 days
  • Top authors: ounziw (100%)

Code review

54 tests

User reviews

1 review

Install metrics

400+ active / 3,542 total downloads

Benchmarks

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

A check of server-side resources used by Advanced Custom Field: Shortcode Field
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0153.58 ▲0.23
Dashboard /wp-admin3.41 ▲0.0132.85 ▼7.59
Posts /wp-admin/edit.php3.65 ▲0.0137.87 ▲0.50
Add New Post /wp-admin/post-new.php6.89 ▼0.0897.26 ▼1,178.12
Media Library /wp-admin/upload.php3.30 ▼0.0023.23 ▼6.32

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 7 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Advanced Custom Field: Shortcode Field
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲4115.93 ▲0.305.74 ▼0.892.96 ▲0.14
Dashboard /wp-admin2,888 ▲276.13 ▼0.04118.75 ▼14.44156.39 ▼3.51
Posts /wp-admin/edit.php2,691 ▲33.23 ▼0.0163.18 ▼0.34141.83 ▲0.40
Add New Post /wp-admin/post-new.php1,661 ▼9116.45 ▼4.85392.38 ▼46.66153.12 ▼0.28
Media Library /wp-admin/upload.php1,701 ▲35.53 ▲0.01141.31 ▲1.75185.10 ▼6.97

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The plugin uninstalled completely, with no zombie files or tables

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
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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 items
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-custom-fields-shortcode-field/init.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields-shortcode-field/shortcode_field.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 on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Screenshot #1 (field for shortcodes, you can view the shortcodes available on your blog.) image required
The official readme.txt is a good inspiration

advanced-custom-fields-shortcode-field/init.php 92% from 13 tests

The principal PHP file in "Advanced Custom Field: Shortcode Field" v. 4.0 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("advanced-custom-fields-shortcode-field.php" instead of "init.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
No dangerous file extensions were detected71 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP291154
PO File14517

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.04
Average class complexity2.00
▷ Minimum class complexity2.00
▷ Maximum class complexity2.00
Average method complexity1.33
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods00.00%
▷ Public methods3100.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

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png32.97KB14.58KB▼ 55.77%