72% google-distance-calculator

Code Review | MK Google Directions

WordPress plugin MK Google Directions scored 72% from 54 tests.

About plugin

  • Plugin page: google-distance-c...
  • Plugin version: 3.0
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.2
  • WordPress version: 6.3.1
  • First release: Jan 17, 2011
  • Latest release: May 19, 2023
  • Number of updates: 122
  • Update frequency: every 37.0 days
  • Top authors: manoj_rana91986 (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

200+ active / 11,457 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.73MB] [CPU: ▲1.59ms] Passed 4 tests

Analyzing server-side resources used by MK Google Directions
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4642.67 ▼4.55
Dashboard /wp-admin4.14 ▲0.8451.38 ▲4.42
Posts /wp-admin/edit.php4.16 ▲0.8155.38 ▲4.90
Add New Post /wp-admin/post-new.php6.74 ▲0.85102.77 ▲1.57
Media Library /wp-admin/upload.php4.06 ▲0.8340.81 ▲7.79
Settings /wp-admin/edit.php?post_type=mkgd&page=mkgd_settings4.3238.87
All MK-GD /wp-admin/edit.php?post_type=mkgd4.1140.40
Add New /wp-admin/post-new.php?post_type=mkgd4.5254.19

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 371 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for MK Google Directions
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,958 ▲22314.88 ▲0.2325.26 ▲23.4739.89 ▲0.09
Dashboard /wp-admin2,248 ▲664.98 ▼0.88111.82 ▲9.3742.52 ▼3.01
Posts /wp-admin/edit.php2,134 ▲452.11 ▲0.0643.33 ▲8.0837.38 ▲3.63
Add New Post /wp-admin/post-new.php1,391 ▼14218.27 ▼4.95546.91 ▼119.6948.94 ▼3.90
Media Library /wp-admin/upload.php1,424 ▲394.28 ▲0.0496.34 ▼2.5240.67 ▼4.82
Settings /wp-admin/edit.php?post_type=mkgd&page=mkgd_settings1,2722.2930.1930.90
All MK-GD /wp-admin/edit.php?post_type=mkgd1,1041.9932.9226.63
Add New /wp-admin/post-new.php?post_type=mkgd1,7614.8395.9191.26

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/google-distance-calculator/mk-google-directions.php
  • 43× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/types/CMB2_Type_Oembed.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_REST_Controller_Boxes' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/rest-api/CMB2_REST_Controller_Fields.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/google-distance-calculator/lib/mkgd-post-type.php:57
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Base' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/CMB2_Field.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Picker_Base' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/types/CMB2_Type_Text_Date.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Textarea' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/types/CMB2_Type_Textarea_Code.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Radio' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/types/CMB2_Type_Multicheck.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Radio' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/types/CMB2_Type_Taxonomy_Radio_Hierarchical.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup_Base' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/CMB2_Hookup.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Select' not found in wp-content/plugins/google-distance-calculator/lib/cmb2/includes/types/CMB2_Type_Select_Timezone.php:13

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following user-side errors
    • > GET request to /wp-admin/post-new.php?post_type=mkgd
    • > Console-api (warning) in unknown
    https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places&key&ver=1.0 232: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 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
Attributes that require attention: The official readme.txt is a good inspiration

google-distance-calculator/mk-google-directions.php 85% from 13 tests

"MK Google Directions" version 3.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Description: Keep the plugin description shorter than 140 characters (currently 268 characters long)
  • Main file name: Name the main plugin file the same as the plugin slug ("google-distance-calculator.php" instead of "mk-google-directions.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected52,364 lines of code in 225 files:
LanguageFilesBlank linesComment linesLines of code
PO File12014,31518,50232,323
PHP612,2126,4517,542
CSS132661,1914,563
JSON2004,264
JavaScript93686001,530
Sass17305291,407
Markdown32390735

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity18.99
▷ Minimum class complexity1.00
▷ Maximum class complexity186.00
Average method complexity3.29
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes68
▷ Abstract classes913.24%
▷ Concrete classes5986.76%
▷ Final classes00.00%
Methods536
▷ Static methods8816.42%
▷ Public methods44482.84%
▷ Protected methods8916.60%
▷ Private methods30.56%
Functions43
▷ Named functions43100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants333.33%
▷ Class constants666.67%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
14 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
lib/cmb2/images/ico-delete.png0.70KB0.72KB0.00%
lib/cmb2/images/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%
lib/cmb2/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
lib/cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%