88% acf-restrict-color-picker

Code Review | Advanced Custom Fields: Restrict Color Picker Options

WordPress plugin Advanced Custom Fields: Restrict Color Picker Options scored 88% from 54 tests.

About plugin

  • Plugin page: acf-restrict-colo...
  • Plugin version: 1.3.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.9
  • WordPress version: 5.9.2
  • First release: Mar 8, 2016
  • Latest release: Jan 25, 2022
  • Number of updates: 37
  • Update frequency: every 58.1 days
  • Top authors: adamwalter (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

1,000+ active / 9,491 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.03MB] [CPU: ▼312.44ms] Passed 4 tests

Server-side resources used by Advanced Custom Fields: Restrict Color Picker Options
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.0954.64 ▲4.43
Dashboard /wp-admin3.47 ▲0.0634.81 ▲1.82
Posts /wp-admin/edit.php3.69 ▲0.0538.09 ▲2.76
Add New Post /wp-admin/post-new.php6.93 ▼0.0494.62 ▼1,257.78
Media Library /wp-admin/upload.php3.34 ▲0.0526.19 ▲3.45
Restrict Color Picker Options /wp-admin/edit.php?post_type=acf-field-group&page=acf-restrict-color-picker3.1418.30

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 6 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Advanced Custom Fields: Restrict Color Picker Options: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲4116.25 ▲0.565.77 ▼0.122.77 ▲0.31
Dashboard /wp-admin2,895 ▲346.13 ▼0.07117.91 ▼16.36155.57 ▼7.56
Posts /wp-admin/edit.php2,691 ▼33.24 ▲0.0171.02 ▲7.41152.96 ▲9.97
Add New Post /wp-admin/post-new.php1,781 ▲12022.48 ▲6.33418.84 ▲22.96157.25 ▲0.14
Media Library /wp-admin/upload.php1,698 ▼05.53 ▼0.01141.94 ▲1.05184.30 ▼0.85
Restrict Color Picker Options /wp-admin/edit.php?post_type=acf-field-group&page=acf-restrict-color-picker280.940.0417.74

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 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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 take a closer look at the following
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/acf-restrict-color-picker/admin.php:153

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please fix the following user-side errors
    • > GET request to /wp-admin/edit.php?post_type=acf-field-group&page=acf-restrict-color-picker
    • > Network (severe)
    wp-admin/edit.php?post_type=acf-field-group&page=acf-restrict-color-picker - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
3 plugin tags: color, custom fields, acf

acf-restrict-color-picker/acf-restrict-color-picker.php 92% from 13 tests

Analyzing the main PHP file in "Advanced Custom Fields: Restrict Color Picker Options" version 1.3.1
Please make the necessary changes and 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

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin268 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP36397214
CSS18044
JavaScript13010

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity11.50
▷ Minimum class complexity5.00
▷ Maximum class complexity18.00
Average method complexity2.24
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods17
▷ Static methods00.00%
▷ Public methods1482.35%
▷ Protected methods00.00%
▷ Private methods317.65%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG images were found in this plugin