88% advanced-custom-fields-leaflet-field

Code Review | Advanced Custom Fields: Leaflet Field

WordPress plugin Advanced Custom Fields: Leaflet Field scored 88% from 54 tests.

About plugin

  • Plugin page: advanced-custom-f...
  • Plugin version: 1.2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-4.0
  • WordPress version: 5.9.2
  • First release: Apr 10, 2013
  • Latest release: Nov 4, 2014
  • Number of updates: 25
  • Update frequency: every 22.9 days
  • Top authors: jensnilsson (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

200+ active / 5,105 total downloads


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.01MB] [CPU: ▼300.05ms] Passed 4 tests

A check of server-side resources used by Advanced Custom Fields: Leaflet Field
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0257.28 ▼14.29
Dashboard /wp-admin3.42 ▲0.0236.98 ▼4.24
Posts /wp-admin/edit.php3.66 ▲0.0240.96 ▼1.06
Add New Post /wp-admin/post-new.php6.89 ▼0.07101.38 ▼1,180.60
Media Library /wp-admin/upload.php3.31 ▲0.0128.06 ▲1.52

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Advanced Custom Fields: Leaflet Field
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲4115.88 ▲0.595.75 ▼0.292.31 ▼0.46
Dashboard /wp-admin2,892 ▲346.02 ▼0.12123.68 ▼17.33223.68 ▲30.17
Posts /wp-admin/edit.php2,691 ▼03.24 ▲0.0061.49 ▼1.92139.67 ▼8.09
Add New Post /wp-admin/post-new.php1,717 ▲5621.20 ▲5.61449.46 ▲23.21169.14 ▼39.29
Media Library /wp-admin/upload.php1,692 ▼35.46 ▼0.03149.97 ▼7.16221.65 ▲10.41

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
Uninstaller ran successfully

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/advanced-custom-fields-leaflet-field/js/input.js.php
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Notice
      Undefined variable: field in wp-content/plugins/advanced-custom-fields-leaflet-field/js/input.js.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields-leaflet-field/leaflet_field-v4.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'acf_Field' not found in wp-content/plugins/advanced-custom-fields-leaflet-field/leaflet_field-v3.php:3
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/advanced-custom-fields-leaflet-field/js/input.js.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function trailingslashit() in wp-content/plugins/advanced-custom-fields-leaflet-field/acf-leaflet_field.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields-leaflet-field/leaflet_field-v5.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found


Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
9 plugin tags: wp-admin, admin, advanced custom fields, acf, map...

advanced-custom-fields-leaflet-field/acf-leaflet_field.php 85% from 13 tests

The entry point to "Advanced Custom Fields: Leaflet Field" version 1.2.1 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("advanced-custom-fields-leaflet-field.php" instead of "acf-leaflet_field.php")
  • Git Repository: There should be no Git repositories present in your plugin

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected25,751 lines of code in 78 files:
LanguageFilesBlank linesComment linesLines of code

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.05
Average class complexity3.25
▷ Minimum class complexity2.00
▷ Maximum class complexity4.00
Average method complexity1.26
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
▷ Static methods00.00%
▷ Public methods35100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
▷ Named functions1100.00%
▷ Anonymous functions00.00%
▷ 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
13 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
js/leaflet/images/marker-icon-2x.png3.94KB2.53KB▼ 35.71%
js/Leaflet.draw/examples/libs/images/marker-icon-2x.png3.94KB2.53KB▼ 35.71%
js/Leaflet.draw/examples/libs/images/marker-icon.png1.71KB1.56KB▼ 8.59%
js/Leaflet.draw/examples/libs/images/marker-icon@2x.png3.94KB2.53KB▼ 35.71%