78% advanced-custom-fields-leaflet-field

Code Review | Advanced Custom Fields: Leaflet Field

WordPress plugin Advanced Custom Fields: Leaflet Field scored78%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: 6.3.1
  • 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

100+ active /5,766 total downloads


Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼7.14ms] Passed 4 tests

Server-side resources used by Advanced Custom Fields: Leaflet Field
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0236.75 ▼5.12
Dashboard /wp-admin3.32 ▼0.0250.33 ▼14.96
Posts /wp-admin/edit.php3.37 ▲0.0244.08 ▲1.84
Add New Post /wp-admin/post-new.php5.90 ▲0.0279.15 ▼10.32
Media Library /wp-admin/upload.php3.24 ▲0.0136.67 ▲4.03

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 100 new files
Database: no new tables, 6 new options
New WordPress options

Browser metrics Passed 4 tests

Advanced Custom Fields: Leaflet Field: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7913.27 ▼1.031.90 ▲0.0843.94 ▼0.55
Dashboard /wp-admin2,206 ▲184.84 ▼0.9799.19 ▼19.4037.09 ▼9.51
Posts /wp-admin/edit.php2,089 ▼02.03 ▼0.0335.88 ▲1.6633.76 ▼5.24
Add New Post /wp-admin/post-new.php1,533 ▲1223.30 ▲0.00670.13 ▼8.9661.40 ▲1.12
Media Library /wp-admin/upload.php1,388 ▼04.11 ▼0.0894.56 ▼7.9745.90 ▼0.65

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/advanced-custom-fields-leaflet-field/js/input.js.php
  • 6× PHP files trigger server errors when accessed directly:
    • > 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: Class 'acf_Field' not found in wp-content/plugins/advanced-custom-fields-leaflet-field/leaflet_field-v3.php:3
    • > 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 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-v5.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues 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: admin, acf4, map markers, map, acf...

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

The primary PHP file in "Advanced Custom Fields: Leaflet Field" version 1.2.1 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("advanced-custom-fields-leaflet-field.php" instead of "acf-leaflet_field.php")
  • Git Repository: An alternative Git repository was detected

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin25,751 lines of code in 78 files:
LanguageFilesBlank linesComment linesLines of code

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
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

Using a strong compression for your PNG files is a great way to speed-up your plugin
13 PNG files occupy 0.03MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
js/Leaflet.draw/examples/libs/images/marker-icon.png1.71KB1.56KB▼ 8.59%
js/Leaflet.draw/dist/images/spritesheet-2x.png2.03KB1.27KB▼ 37.63%
js/Leaflet.draw/examples/libs/images/marker-icon-2x.png3.94KB2.53KB▼ 35.71%