56% direction-map

Code Review | Direction Map

WordPress plugin Direction Map scored56%from 54 tests.

About plugin

  • Plugin page: direction-map
  • Plugin version: 2.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.8
  • WordPress version: 6.3.1
  • First release: Jun 19, 2012
  • Latest release: Dec 15, 2013
  • Number of updates: 66
  • Update frequency: every 8.3 days
  • Top authors: softy.5454 (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

40+ active /6,294 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▼1.96MB] [CPU: ▼58.13ms] Passed 4 tests

A check of server-side resources used by Direction Map
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.03 ▼1.444.28 ▼41.33
Dashboard /wp-admin2.05 ▼1.265.76 ▼48.50
Posts /wp-admin/edit.php2.05 ▼1.315.76 ▼43.69
Add New Post /wp-admin/post-new.php2.05 ▼3.845.93 ▼99.00
Media Library /wp-admin/upload.php2.05 ▼1.185.11 ▼32.02
Direction Map /wp-admin/options-general.php?page=Map-Direction2.055.50

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 13 new files
Database: 1 new table, 7 new options
New tables
wp_direction_map
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
widget_direction_map-widget

Browser metrics Passed 4 tests

A check of browser resources used by Direction Map
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,850 ▲7914.96 ▲0.217.67 ▲5.6047.13 ▲2.54
Dashboard /wp-admin2,211 ▲235.89 ▲1.00113.85 ▼1.4146.72 ▼0.09
Posts /wp-admin/edit.php2,097 ▲82.54 ▲0.5343.87 ▲0.4239.02 ▲6.08
Add New Post /wp-admin/post-new.php1,523 ▲923.76 ▲6.21650.29 ▼34.3561.44 ▲0.97
Media Library /wp-admin/upload.php1,393 ▲115.03 ▲0.82107.75 ▲5.7542.71 ▼1.51
Direction Map /wp-admin/options-general.php?page=Map-Direction1,0402.4629.6926.29

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Uninstall procedure validation failed for this plugin
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the mapStyle handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • This plugin does not fully uninstall, leaving 7 options in the database
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_direction_map-widget
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the mapStyle handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the mapStyle handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the mapjs handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the mapjs handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the mapScript handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in Direction_Map_Widget is deprecated since version 4.3.0! Use __construct() instead.
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+2
    Undefined index: map_hidden
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+93
    Trying to get property 'sCenterAddr' of non-object
  • 21 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+119
    Trying to get property 'nZoomLevel' of non-object
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+123
    Trying to get property 'sTitle' of non-object
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+127
    Trying to get property 'nWidth' of non-object
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+132
    Trying to get property 'nHeight' of non-object
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+140
    Trying to get property 'nDefaultViews' of non-object
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+145
    Trying to get property 'sWaterBack' of non-object
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+150
    Trying to get property 'sWaterText' of non-object
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+154
    Trying to get property 'sLandBack' of non-object
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Notice in wp-content/plugins/direction-map/map_direction_admin.php+158
    Trying to get property 'sLandText' of non-object

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
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/direction-map/js.php
  • 9× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_widget() in wp-content/plugins/direction-map/widget.php:2
    • > PHP Notice
      Undefined index: map_hidden in wp-content/plugins/direction-map/map_direction_admin.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_row() on null in wp-content/plugins/direction-map/map.php:2
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/direction-map/map_direction_admin.php on line 80
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/direction-map/map_widget.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_row() on null in wp-content/plugins/direction-map/map_widget.php:2
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/direction-map/map.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_register_style() in wp-content/plugins/direction-map/map_direction.php:11
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_row() on null in wp-content/plugins/direction-map/map_direction_admin.php:81

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please take a look at the following user-side issues
    • > GET request to /wp-admin/options-general.php?page=Map-Direction
    • > Console-api (warning) in unknown
    http://maps.googleapis.com/maps/api/js?sensor=false&ver=6.3.1 210:51 "Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading"

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Please fix the following attributes:
  • Tags: You are using too many tags: 13 tag instead of maximum 10
  • Screenshots: These screenshots do not have images: #1 (Direction Map settings page.), #2 (Map front view(main view)), #3 (Widget view(Admin panel)), #4 (Color Map view), #5 (Color Map settings view in admin panel)
You can take inspiration from this readme.txt

direction-map/map_direction.php 92% from 13 tests

The main PHP script in "Direction Map" version 2.2 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("direction-map.php" instead of "map_direction.php")

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
There were no executable files found in this plugin672 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP63255660
CSS10012

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
There are no PNG files in this plugin