67% locations-and-areas

Code Review | Locations and Areas - Leaflet Map with Region Tabs

WordPress plugin Locations and Areas - Leaflet Map with Region Tabs scored 67% from 54 tests.

About plugin

  • Plugin page: locations-and-areas
  • Plugin version: 1.7.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.2
  • WordPress version: 6.3.1
  • First release: Aug 28, 2020
  • Latest release: Jul 5, 2023
  • Number of updates: 77
  • Update frequency: every 13.5 days
  • Top authors: 100plugins (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active / 2,847 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.66MB] [CPU: ▲2.95ms] 75% from 4 tests

This is a short check of server-side resources used by Locations and Areas - Leaflet Map with Region Tabs
The following require your attention
  • CPU: Total CPU usage should be kept under 500.00ms (currently 2,194.87ms on /wp-admin/options-general.php?page=locations_and_areas)
PageMemory (MB)CPU Time (ms)
Home /4.12 ▲0.6639.94 ▼3.56
Dashboard /wp-admin3.99 ▲0.6955.20 ▲5.40
Posts /wp-admin/edit.php4.06 ▲0.7092.65 ▲43.70
Add New Post /wp-admin/post-new.php6.51 ▲0.6294.30 ▲2.84
Media Library /wp-admin/upload.php3.89 ▲0.6640.30 ▲7.12
Areas /wp-admin/edit-tags.php?taxonomy=laa-area&post_type=laa-location3.9445.59
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius4.2543.51
All locations /wp-admin/edit.php?post_type=laa-location3.9645.14
Locations and Areas /wp-admin/options-general.php?page=locations_and_areas4.152,194.87
Add location /wp-admin/post-new.php?post_type=laa-location4.0157.47

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 265 new files
Database: no new tables, 9 new options
New WordPress options
fs_active_plugins
fs_accounts
fs_debug_mode
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

Locations and Areas - Leaflet Map with Region Tabs: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,015 ▲28015.98 ▲1.611.57 ▼0.0132.55 ▼9.44
Dashboard /wp-admin2,415 ▲2247.22 ▲2.35145.52 ▲42.0346.88 ▲2.37
Posts /wp-admin/edit.php2,324 ▲2353.94 ▲1.9052.55 ▲12.0736.88 ▲0.61
Add New Post /wp-admin/post-new.php6,470 ▲4,94721.36 ▼1.831,041.35 ▲400.6539.05 ▼19.96
Media Library /wp-admin/upload.php1,460 ▲695.32 ▲1.1682.24 ▼10.4247.39 ▲1.77
Areas /wp-admin/edit-tags.php?taxonomy=laa-area&post_type=laa-location1,5314.1958.9655.26
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,3063.7244.4628.30
All locations /wp-admin/edit.php?post_type=laa-location1,3184.0147.8830.29
Locations and Areas /wp-admin/options-general.php?page=locations_and_areas1,1973.7647.5588.20
Add location /wp-admin/post-new.php?post_type=laa-location2,2917.76171.3670.28

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/locations-and-areas/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • Zombie WordPress options detected upon uninstall: 9 options
    • widget_recent-posts
    • fs_accounts
    • can_compress_scripts
    • fs_debug_mode
    • widget_theysaidso_widget
    • widget_recent-comments
    • fs_active_plugins
    • db_upgraded
    • theysaidso_admin_options

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)
The smoke test was a success, however most plugin functionality was not tested

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 output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/locations-and-areas/locations-and-areas.php
  • 9× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'LocationsAndAreasPlugin\\Base\\BaseController' not found in wp-content/plugins/locations-and-areas/inc/Pages/Settings.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'LocationsAndAreasPlugin\\Base\\BaseController' not found in wp-content/plugins/locations-and-areas/inc/Base/BlockController.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'LocationsAndAreasPlugin\\Base\\BaseController' not found in wp-content/plugins/locations-and-areas/inc/Base/Enqueue.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'LocationsAndAreasPlugin\\Base\\BaseController' not found in wp-content/plugins/locations-and-areas/inc/Pages/Frontend.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'LocationsAndAreasPlugin\\Base\\BaseController' not found in wp-content/plugins/locations-and-areas/inc/Base/SettingsLinks.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'LocationsAndAreasPlugin\\Base\\BaseController' not found in wp-content/plugins/locations-and-areas/inc/Base/LocationController.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'LocationsAndAreasPlugin\\Base\\BaseController' not found in wp-content/plugins/locations-and-areas/inc/Base/AreaController.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/locations-and-areas/templates/page-backend-settings.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/locations-and-areas/templates/block-map.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
8 plugin tags: leaflet, area, gutenberg, pins, region...

locations-and-areas/locations-and-areas.php 92% from 13 tests

"Locations and Areas - Leaflet Map with Region Tabs" version 1.7.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 158 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
Good job! No executable or dangerous file extensions detected71,982 lines of code in 187 files:
LanguageFilesBlank linesComment linesLines of code
PHP1408,24417,51134,609
JavaScript195,3257,04917,574
JSON60016,689
CSS20305742,017
Sass2236341,093

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity74.05
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.50
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes62
▷ Abstract classes23.23%
▷ Concrete classes6096.77%
▷ Final classes11.67%
Methods1,322
▷ Static methods21516.26%
▷ Public methods93170.42%
▷ Protected methods171.29%
▷ Private methods37428.29%
Functions108
▷ Named functions10395.37%
▷ Anonymous functions54.63%
Constants145
▷ Global constants9867.59%
▷ Class constants4732.41%
▷ Public constants47100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
26 PNG files occupy 0.86MB with 0.34MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
src/leaflet/images/marker-icon_custom4-2x.png3.20KB1.61KB▼ 49.62%
src/leaflet/images/marker-icon_custom2-2x.png4.73KB2.47KB▼ 47.79%
src/leaflet/images/marker-shadow.png0.60KB1.16KB0.00%
src/leaflet/images/marker-icon_custom3.png2.41KB1.23KB▼ 49.15%
src/leaflet/images/marker-icon_custom3-2x.png4.37KB1.98KB▼ 54.57%