71% leaflet-maps-marker

Code Review | Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps)

WordPress plugin Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps) scored71%from 54 tests.

About plugin

  • Plugin page: leaflet-maps-marker
  • Plugin version: 3.12.8
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-6.2.2
  • WordPress version: 6.3.1
  • First release: Jan 1, 2012
  • Latest release: Jun 11, 2023
  • Number of updates: 585
  • Update frequency: every 7.2 days
  • Top authors: harmr (100%)

Code review

54 tests

User reviews

244 reviews

Install metrics

10,000+ active /872,065 total downloads

Benchmarks

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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲3.62MB] [CPU: ▲11.38ms] Passed 4 tests

Analyzing server-side resources used by Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.96 ▲0.5043.61 ▲2.48
Dashboard /wp-admin8.85 ▲5.5468.07 ▲19.05
Posts /wp-admin/edit.php8.85 ▲5.4959.58 ▲13.84
Add New Post /wp-admin/post-new.php8.85 ▲2.96102.47 ▲10.14
Media Library /wp-admin/upload.php8.85 ▲5.6260.51 ▲27.78
Tools /wp-admin/admin.php?page=leafletmapsmarker_tools8.8581.18
Import/Export /wp-admin/admin.php?page=leafletmapsmarker_import_export8.8550.44
Add new marker /wp-admin/admin.php?page=leafletmapsmarker_marker8.8579.35
List all layers /wp-admin/admin.php?page=leafletmapsmarker_layers8.8545.54
Settings /wp-admin/admin.php?page=leafletmapsmarker_settings8.85120.66
Retirement info   & coupon code    /wp-admin/admin.php?page=leafletmapsmarker_retirement8.8547.08
Add new layer /wp-admin/admin.php?page=leafletmapsmarker_layer8.8553.29
Maps Marker APIs /wp-admin/admin.php?page=leafletmapsmarker_apis8.8546.10
Support /wp-admin/admin.php?page=leafletmapsmarker_help8.8546.34
List all markers /wp-admin/admin.php?page=leafletmapsmarker_markers8.8547.80

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 264 new files
Database: 2 new tables, 13 new options
New tables
wp_leafletmapsmarker_markers
wp_leafletmapsmarker_layers
New WordPress options
leafletmapsmarker_version_before_update
can_compress_scripts
leafletmapsmarker_redirect
leafletmapsmarker_editor
widget_recent-comments
theysaidso_admin_options
leafletmapsmarker_update_info
leafletmapsmarker_version
widget_theysaidso_widget
leafletmapsmarker_options
...

Browser metrics Passed 4 tests

Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps): an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,132 ▲39713.24 ▼1.161.64 ▼0.2232.43 ▼18.37
Dashboard /wp-admin2,466 ▲2814.91 ▲0.03112.50 ▲6.88107.68 ▲62.40
Posts /wp-admin/edit.php2,239 ▲1502.06 ▲0.0434.81 ▼0.7036.50 ▼0.41
Add New Post /wp-admin/post-new.php1,652 ▲11823.21 ▲0.01770.29 ▲88.5135.80 ▼23.88
Media Library /wp-admin/upload.php1,542 ▲1544.25 ▲0.06100.72 ▼8.7472.56 ▲25.69
Tools /wp-admin/admin.php?page=leafletmapsmarker_tools4,6716.83149.86146.60
Import/Export /wp-admin/admin.php?page=leafletmapsmarker_import_export1,2831.9432.3184.60
Add new marker /wp-admin/admin.php?page=leafletmapsmarker_marker3,7518.10177.78187.19
List all layers /wp-admin/admin.php?page=leafletmapsmarker_layers1,3501.8227.0073.62
Settings /wp-admin/admin.php?page=leafletmapsmarker_settings16,6633.5581.38150.62
Retirement info   & coupon code    /wp-admin/admin.php?page=leafletmapsmarker_retirement9691.8023.2526.70
Add new layer /wp-admin/admin.php?page=leafletmapsmarker_layer2,1483.4259.3193.54
Maps Marker APIs /wp-admin/admin.php?page=leafletmapsmarker_apis1,2641.9229.9478.00
Support /wp-admin/admin.php?page=leafletmapsmarker_help1,7871.9226.8971.81
List all markers /wp-admin/admin.php?page=leafletmapsmarker_markers1,3991.8128.7178.93

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_theysaidso_widget
    • widget_class_leaflet_recent_marker_widget
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 18× PHP files perform the task of outputting text when accessed with GET requests (only 10 are shown):
    • > /wp-content/plugins/leaflet-maps-marker/leaflet-list-markers.php
    • > /wp-content/plugins/leaflet-maps-marker/leaflet-pro-upgrade.php
    • > /wp-content/plugins/leaflet-maps-marker/leaflet-import-export.php
    • > /wp-content/plugins/leaflet-maps-marker/inc/install-and-updates.php
    • > /wp-content/plugins/leaflet-maps-marker/leaflet-help-credits.php
    • > /wp-content/plugins/leaflet-maps-marker/leaflet-marker.php
    • > /wp-content/plugins/leaflet-maps-marker/inc/compatibility-checks.php
    • > /wp-content/plugins/leaflet-maps-marker/inc/tinymce-plugin.php
    • > /wp-content/plugins/leaflet-maps-marker/inc/admin-footer.php
    • > /wp-content/plugins/leaflet-maps-marker/leaflet-layer.php
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant LEAFLET_WP_ADMIN_URL - assumed 'LEAFLET_WP_ADMIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/leaflet-maps-marker/inc/admin-content-retirement.php on line 10
    • > PHP Notice
      Undefined index: SCRIPT_URI in wp-content/plugins/leaflet-maps-marker/leaflet-api.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr__() in wp-content/plugins/leaflet-maps-marker/inc/admin-content-apis.php:10
    • > PHP Notice
      Undefined index: SCRIPT_URI in wp-content/plugins/leaflet-maps-marker/leaflet-kml.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/leaflet-maps-marker/inc/class-google-places-geocoding.php:184
    • > PHP Warning
      Use of undefined constant LEAFLET_WP_ADMIN_URL - assumed 'LEAFLET_WP_ADMIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/leaflet-maps-marker/inc/admin-content-apis.php on line 10
    • > PHP Notice
      Undefined index: SCRIPT_URI in wp-content/plugins/leaflet-maps-marker/leaflet-geositemap.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr__() in wp-content/plugins/leaflet-maps-marker/inc/admin-content-retirement.php:10
    • > PHP Notice
      Undefined index: SCRIPT_URI in wp-content/plugins/leaflet-maps-marker/leaflet-qr.php on line 6
    • > PHP Notice
      Undefined index: SCRIPT_URI in wp-content/plugins/leaflet-maps-marker/leaflet-georss.php on line 7

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=leafletmapsmarker_settings
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of undefined (reading 'mozilla')" "TypeError: Cannot read properties of undefined (reading 'mozilla')\n at HTMLDocument.\u003Canonymous> (/wp-admin/admin.php?page=leafletmapsmarker_settings:252:18)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=leafletmapsmarker_settings
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of undefined (reading 'mozilla')

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 81% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Screenshots: Screenshot #32 (Pro preview: showing marker in layar (via Augmented-Reality API)) image required
  • Tags: You are using too many tags: 12 tag instead of maximum 10
  • Screenshots: A description for screenshot #6 is missing in leaflet-maps-marker/assets to your readme.txt
The official readme.txt is a good inspiration

leaflet-maps-marker/leaflet-maps-marker.php 92% from 13 tests

The entry point to "Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps)" version 3.12.8 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 359 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin23,703 lines of code in 52 files:
LanguageFilesBlank linesComment linesLines of code
PHP294401,12320,092
CSS815583,004
JavaScript9966492
SVG600115

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
The following items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 482)
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity183.75
▷ Minimum class complexity22.00
▷ Maximum class complexity564.00
Average method complexity12.05
▷ Minimum method complexity1.00
▷ Maximum method complexity482.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods67
▷ Static methods00.00%
▷ Public methods6495.52%
▷ Protected methods34.48%
▷ Private methods00.00%
Functions13
▷ Named functions1292.31%
▷ Anonymous functions17.69%
Constants8
▷ Global constants8100.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
121 PNG files occupy 0.35MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/img/pro-feature-banner.png1.09KB0.18KB▼ 83.44%
inc/img/icon-resellers.png0.50KB0.51KB0.00%
inc/img/icon-menu-help.png0.19KB0.23KB0.00%
inc/img/geocoding/icon-key-enter.png0.74KB0.89KB0.00%
inc/img/icon-menu-add.png0.11KB0.12KB0.00%