84% leaflet-map

Code Review | Leaflet Map

WordPress plugin Leaflet Map scored84%from 54 tests.

About plugin

  • Plugin page: leaflet-map
  • Plugin version: 3.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.3.1
  • WordPress version: 6.3.1
  • First release: May 7, 2014
  • Latest release: Sep 20, 2023
  • Number of updates: 147
  • Update frequency: every 23.3 days
  • Top authors: bozdoz (100%)

Code review

54 tests

User reviews

53 reviews

Install metrics

30,000+ active /355,679 total downloads

Benchmarks

Plugin footprint 82% from 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.35MB] [CPU: ▼6.10ms] 75% from 4 tests

An overview of server-side resources used by Leaflet Map
Please fix the following
  • CPU: Total CPU usage should be kept under 500.00ms (currently 4,975.13ms on /wp-admin/admin.php?page=leaflet-shortcode-helper)
PageMemory (MB)CPU Time (ms)
Home /3.82 ▲0.3643.37 ▲5.85
Dashboard /wp-admin3.70 ▲0.3650.94 ▼8.65
Posts /wp-admin/edit.php3.75 ▲0.4047.86 ▼1.94
Add New Post /wp-admin/post-new.php6.24 ▲0.3685.09 ▼19.65
Media Library /wp-admin/upload.php3.56 ▲0.3443.09 ▲7.04
Shortcode helper /wp-admin/admin.php?page=leaflet-shortcode-helper3.594,975.13
Settings /wp-admin/admin.php?page=leaflet-map3.5640.05

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 37 new files
Database: no new tables, 17 new options
New WordPress options
widget_theysaidso_widget
leaflet_osm_Halifax%2C+Nova+Scotia
leaflet_osm_San+Juan
leaflet_osm_Tanzania
leaflet_osm_Puerto+Vallarta
leaflet_osm_twilight+lane%2C+nova+scotia
theysaidso_admin_options
leaflet_osm_Ha+Ling%2C+canmore
leaflet_osm_Miami
leaflet_osm_Sayulita
...

Browser metrics Passed 4 tests

Checking browser requirements for Leaflet Map
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲6814.14 ▼0.511.69 ▲0.1644.59 ▲5.99
Dashboard /wp-admin2,236 ▲595.59 ▼0.0183.63 ▼19.4841.72 ▼3.69
Posts /wp-admin/edit.php2,140 ▲402.01 ▲0.0237.31 ▲0.2032.35 ▼0.31
Add New Post /wp-admin/post-new.php1,548 ▲2223.28 ▼0.27684.28 ▲23.6859.81 ▼10.31
Media Library /wp-admin/upload.php1,435 ▲354.19 ▼0.0297.46 ▼14.7242.81 ▼5.97
Shortcode helper /wp-admin/admin.php?page=leaflet-shortcode-helper6,0675.34175.5883.60
Settings /wp-admin/admin.php?page=leaflet-map1,6692.0125.2346.89

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/leaflet-map/templates/settings.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/leaflet-map/templates/shortcode-helper.php:32
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/leaflet-map/templates/settings.php on line 11
    • > PHP Notice
      Undefined variable: plugin_data in wp-content/plugins/leaflet-map/templates/settings.php on line 11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
7 plugin tags: javascript, leaflet, mapquest, openstreetmap, mobile...

leaflet-map/leaflet-map.php Passed 13 tests

"Leaflet Map" version 3.3.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
116 characters long description:
A plugin for creating a Leaflet JS map with a shortcode. Boasts two free map tile services and three free geocoders.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin2,883 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
PHP223638211,970
JavaScript895117469
Markdown31260349
CSS115495

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity13.78
▷ Minimum class complexity1.00
▷ Maximum class complexity57.00
Average method complexity5.07
▷ Minimum method complexity1.00
▷ Maximum method complexity47.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes15.56%
▷ Concrete classes1794.44%
▷ Final classes00.00%
Methods59
▷ Static methods1016.95%
▷ Public methods3661.02%
▷ Protected methods1423.73%
▷ Private methods915.25%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG images were found in this plugin