46% xlocate

Code Review | xLocate

WordPress plugin xLocate scored46%from 54 tests.

About plugin

  • Plugin page: xlocate
  • Plugin version: 1.0.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-4.9
  • WordPress version: 6.3.1
  • First release: Dec 3, 2017
  • Latest release: Dec 4, 2017
  • Number of updates: 7
  • Update frequency: every 1.9 days
  • Top authors: codemanas (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /654 total downloads

Benchmarks

Plugin footprint 48% 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▼1.10MB] [CPU: ▼43.58ms] Passed 4 tests

This is a short check of server-side resources used by xLocate
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.87 ▼0.5915.18 ▼21.16
Dashboard /wp-admin2.92 ▼0.4318.94 ▼42.78
Posts /wp-admin/edit.php2.92 ▼0.4416.09 ▼31.27
Add New Post /wp-admin/post-new.php2.92 ▼2.9716.63 ▼79.10
Media Library /wp-admin/upload.php2.92 ▼0.3116.20 ▼17.55
Category /wp-admin/edit-tags.php?taxonomy=xlocate-category&post_type=house2.9221.60
All Houses /wp-admin/edit.php?post_type=house2.9218.66
Add New /wp-admin/post-new.php?post_type=house2.9217.85

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 59 new files
Database: 1 new table, 8 new options
New tables
wp_xloc_locations
New WordPress options
widget_recent-posts
xlocate_settings_pages
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
db_upgraded
xloc_search_page

Browser metrics Passed 4 tests

xLocate: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,846 ▲10013.25 ▼1.151.76 ▲0.1944.19 ▲4.93
Dashboard /wp-admin2,249 ▲575.84 ▲0.6994.23 ▼13.8838.65 ▼1.95
Posts /wp-admin/edit.php2,132 ▲432.00 ▼0.0935.04 ▼1.6331.65 ▼2.85
Add New Post /wp-admin/post-new.php1,569 ▲3623.26 ▲0.03684.13 ▲0.6350.80 ▼3.31
Media Library /wp-admin/upload.php1,431 ▲434.23 ▲0.04103.07 ▲5.3443.29 ▼3.43
Category /wp-admin/edit-tags.php?taxonomy=xlocate-category&post_type=house1,3082.1429.1129.41
All Houses /wp-admin/edit.php?post_type=house1,1551.9731.3132.60
Add New /wp-admin/post-new.php?post_type=house2,8219.82321.94186.78

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_xloc_locations
  • Zombie WordPress options were found after uninstall: 8 options
    • widget_recent-posts
    • can_compress_scripts
    • xlocate_settings_pages
    • xloc_search_page
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options

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
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=house
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)

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
Almost there! Just fix the following items
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/xlocate/admin/views/help.php
    • > /wp-content/plugins/xlocate/xlocate.php
    • > /wp-content/plugins/xlocate/admin/views/shortcodes.php
  • 19× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_pages() in wp-content/plugins/xlocate/admin/views/pages.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/xlocate/admin/classes/class-xlocate-location.php:129
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/xlocate/admin/classes/class-xlocate-admin-shortcodes-settings.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/xlocate/includes/shortcodes.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_current_screen() in wp-content/plugins/xlocate/admin/views/contextual-help.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/xlocate/admin/classes/class-xlocate-admin.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/xlocate/admin/classes/class-xlocate-admin-help-settings.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/xlocate/admin/classes/class-xlocate-admin-menus.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/xlocate/includes/custom-post-type.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/xlocate/frontend/classes/class-xlocate-search-handler.php:175

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following browser errors
    • > GET request to /wp-admin/post-new.php?post_type=house
    • > Console-api (warning) in unknown
    https://maps.googleapis.com/maps/api/js?key&libraries=places&ver=6.3.1 234: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"
    • > GET request to /wp-admin/post-new.php?post_type=house
    • > Console-api (severe) in unknown
    https://maps.googleapis.com/maps/api/js?key&libraries=places&ver=6.3.1 152:248 "You are using this API without a key. See https://developers.google.com/maps/documentation/javascript/error-messages?utm_source=maps_js&utm_medium=degraded&utm_campaign=billing#api-key-and-billing-errors"

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Add descriptions for screenshots #1, #2, #3, #4, #5, #6, #7, #8, #9 in xlocate/assets to your readme.txt
The official readme.txt is a good inspiration

xlocate/xlocate.php 85% from 13 tests

"xLocate" version 1.0.1'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 215 characters long)
  • Domain Path: The domain path folder was not found ("/language")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin3,654 lines of code in 45 files:
LanguageFilesBlank linesComment linesLines of code
PHP252412281,269
JavaScript93036111,229
CSS55631601
Sass4861515
JSON10028
SVG10012

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity7.00
▷ Minimum class complexity1.00
▷ Maximum class complexity20.00
Average method complexity2.22
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes12
▷ Abstract classes00.00%
▷ Concrete classes12100.00%
▷ Final classes18.33%
Methods59
▷ Static methods1220.34%
▷ Public methods59100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.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
5 PNG files occupy 1.58MB with 0.85MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/admin/images/skin-galaxy.png446.74KB153.96KB▼ 65.54%
assets/admin/images/skin-mirage.png433.40KB147.69KB▼ 65.92%
assets/admin/images/skin-default.png455.79KB156.36KB▼ 65.69%
assets/frontend/images/marker.png2.86KB2.98KB0.00%
assets/admin/images/skin-aliceblue.png283.86KB82.49KB▼ 70.94%