66% wp-mapbox-gl-js

Code Review | WP Mapbox GL JS Maps

WordPress plugin WP Mapbox GL JS Maps scored66%from 54 tests.

About plugin

  • Plugin page: wp-mapbox-gl-js
  • Plugin version: 3.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.4.2
  • WordPress version: 6.3.1
  • First release: Jan 10, 2018
  • Latest release: Nov 7, 2021
  • Number of updates: 42
  • Update frequency: every 33.3 days
  • Top authors: tempranova (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

2,000+ active /24,861 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.11MB] [CPU: ▲3.91ms] Passed 4 tests

A check of server-side resources used by WP Mapbox GL JS Maps
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1045.03 ▲3.45
Dashboard /wp-admin3.41 ▲0.1054.13 ▲4.83
Posts /wp-admin/edit.php3.50 ▲0.1455.95 ▲4.49
Add New Post /wp-admin/post-new.php6.08 ▲0.19100.56 ▲2.85
Media Library /wp-admin/upload.php3.33 ▲0.1042.94 ▲9.04
WP Mapbox Settings /wp-admin/admin.php?page=wp-mapbox-gl-js-settings3.3740.03
GL JS Maps /wp-admin/edit.php?post_type=gl_js_maps3.3542.81
Add New /wp-admin/post-new.php?post_type=gl_js_maps3.3345.43
WP Mapbox Tools /wp-admin/admin.php?page=wp-mapbox-gl-js-tools3.46161.84
Maps Categories /wp-admin/edit-tags.php?taxonomy=gl_js_maps_category&post_type=gl_js_maps3.3242.01

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 2,419 new files
Database: no new tables, 9 new options
New WordPress options
theysaidso_admin_options
post_type_rules_flushed_gl_js_maps
wp_mapbox_gl_js_upgrade
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-comments
mapbox_gl_js_access_token

Browser metrics Passed 4 tests

An overview of browser requirements for WP Mapbox GL JS Maps
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,058 ▲29717.77 ▲3.1925.11 ▲23.4639.35 ▼5.81
Dashboard /wp-admin2,315 ▲1386.42 ▲0.85106.79 ▲19.7387.04 ▲50.03
Posts /wp-admin/edit.php2,221 ▲1213.47 ▲1.3849.23 ▲9.2035.42 ▼0.62
Add New Post /wp-admin/post-new.php1,623 ▲8723.08 ▲0.02710.39 ▼14.4547.47 ▼16.63
Media Library /wp-admin/upload.php1,520 ▲1205.81 ▲1.58110.93 ▲17.0882.34 ▲38.03
WP Mapbox Settings /wp-admin/admin.php?page=wp-mapbox-gl-js-settings1,0283.6268.9530.61
GL JS Maps /wp-admin/edit.php?post_type=gl_js_maps1,2023.4143.8730.95
Add New /wp-admin/post-new.php?post_type=gl_js_maps2,66010.22277.44149.11
WP Mapbox Tools /wp-admin/admin.php?page=wp-mapbox-gl-js-tools1,0393.0534.9028.27
Maps Categories /wp-admin/edit-tags.php?taxonomy=gl_js_maps_category&post_type=gl_js_maps1,3913.2438.5538.56

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • post_type_rules_flushed_gl_js_maps
    • widget_recent-comments
    • mapbox_gl_js_access_token
    • wp_mapbox_gl_js_upgrade
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/post-new.php?post_type=gl_js_maps
    • > Notice in wp-content/plugins/wp-mapbox-gl-js/admin/class-wp-mapbox-gl-js-admin.php+107
    Undefined index: X-WP-Nonce
    • > GET request to /wp-admin/admin.php?page=wp-mapbox-gl-js-tools
    • > Notice in wp-content/plugins/wp-mapbox-gl-js/admin/partials/wp-mapbox-gl-js-tools.php+256
    Trying to get property 'id' of non-object
    • > GET request to /wp-admin/admin.php?page=wp-mapbox-gl-js-tools
    • > Notice in wp-content/plugins/wp-mapbox-gl-js/admin/partials/wp-mapbox-gl-js-tools.php+256
    Trying to get property 'name' of non-object
    • > GET request to /wp-admin/admin.php?page=wp-mapbox-gl-js-tools
    • > Notice in wp-content/plugins/wp-mapbox-gl-js/admin/partials/wp-mapbox-gl-js-tools.php+275
    Undefined index: dataset_import

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/wp-mapbox-gl-js/admin/partials/wp-mapbox-gl-js-print.php
    • > /wp-content/plugins/wp-mapbox-gl-js/public/partials/wp-mapbox-gl-js-public-display.php
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/wp-mapbox-gl-js/admin/partials/wp-mapbox-gl-js-tools.php:233
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/wp-mapbox-gl-js/admin/wp-mapbox-gl-js-settings.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/wp-mapbox-gl-js/admin/partials/wp-mapbox-gl-js-settings.php:180

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=wp-mapbox-gl-js-settings
    • > Console-api (warning) in unknown
    https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js?ver=6.3.1 30:4337 "This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/."
    • > GET request to /wp-admin/post-new.php?post_type=gl_js_maps
    • > Console-api (severe) in wp-content/plugins/wp-mapbox-gl-js/admin/wp-mapmaker/build/static/js/main.31f3ba31.js?ver=558+0:1248181
    You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) to ensure you have the correct code for your production build.
    • > GET request to /wp-admin/post-new.php?post_type=gl_js_maps
    • > Javascript (severe) in unknown
    /wp-content/plugins/wp-mapbox-gl-js/admin/wp-mapmaker/build/static/js/main.31f3ba31.js?ver=558 0:386742 Uncaught Error: Minified React error #200; visit http://facebook.g… for full errors and additional helpful warnings.

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 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
These attributes need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Here is a screenshot of the GL JS Maps map editor!), #2 (The shortcode appears in the top right after you Publish.), #3 (Copy the shortcode to any post or page and use the [shortcode options](https://www.mapster.me/wp-mapbox-gl-js/docs/shortcode/map-options/) as needed.), #4 (Publish your post/page and check out your new map!)
The official readme.txt is a good inspiration

wp-mapbox-gl-js/wp-mapbox-gl-js.php 92% from 13 tests

The entry point to "WP Mapbox GL JS Maps" version 3.0.1 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Domain Path: The domain path folder does not exist ("/wp-mapbox-gl-js")

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
Good job! No executable or dangerous file extensions detected50,080 lines of code in 2,355 files:
LanguageFilesBlank linesComment linesLines of code
SVG2,319131,09139,912
CSS97703114,742
JSON5003,358
PHP152365931,232
JavaScript45633733
Markdown125076
HTML242027

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity9.14
▷ Minimum class complexity1.00
▷ Maximum class complexity35.00
Average method complexity2.51
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods40
▷ Static methods25.00%
▷ Public methods3587.50%
▷ Protected methods00.00%
▷ Private methods512.50%
Functions8
▷ Named functions675.00%
▷ Anonymous functions225.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
27 PNG files occupy 0.86MB with 0.40MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/wp-mapmaker/public/img/black_tall.png6.33KB3.82KB▼ 39.64%
screenshot-1.png142.10KB43.35KB▼ 69.49%
admin/wp-mapmaker/build/img/black_tall.png6.33KB3.82KB▼ 39.64%
admin/wp-mapmaker/public/img/black_default.png3.60KB2.44KB▼ 32.20%
admin/wp-mapmaker/public/maki/sprites/osm-liberty@2x.png47.08KB22.02KB▼ 53.22%