52% wp-geometa

Code Review | WP-GeoMeta

WordPress plugin WP-GeoMeta scored52%from 54 tests.

About plugin

  • Plugin page: wp-geometa
  • Plugin version: 0.3.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4.0-4.9
  • WordPress version: 6.3.1
  • First release: Sep 2, 2016
  • Latest release: Nov 22, 2017
  • Number of updates: 13
  • Update frequency: every 34.3 days
  • Top authors: stuporglue (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

50+ active /1,984 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.33MB] [CPU: ▼53.72ms] Passed 4 tests

An overview of server-side resources used by WP-GeoMeta
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.47 ▼1.006.75 ▼37.64
Dashboard /wp-admin2.74 ▼0.579.31 ▼41.27
Posts /wp-admin/edit.php2.74 ▼0.629.01 ▼42.70
Add New Post /wp-admin/post-new.php2.74 ▼3.1511.40 ▼93.28
Media Library /wp-admin/upload.php2.74 ▼0.4913.64 ▼24.54
WP-GeoMeta /wp-admin/tools.php?page=wp-geometa2.7410.29

Server storage [IO: ▲5.55MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 175 new files
Database: 4 new tables, 8 new options
New tables
wp_termmeta_geo
wp_postmeta_geo
wp_usermeta_geo
wp_commentmeta_geo
New WordPress options
wp_geometa_version
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
db_upgraded
widget_recent-comments
wp_geometa_db_version
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for WP-GeoMeta
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.35 ▼0.271.87 ▲0.2543.78 ▼1.47
Dashboard /wp-admin2,202 ▲255.63 ▼0.0590.22 ▼2.2739.37 ▼4.02
Posts /wp-admin/edit.php2,104 ▲12.01 ▲0.0141.31 ▲1.0837.24 ▼2.66
Add New Post /wp-admin/post-new.php1,529 ▲223.17 ▼0.05669.58 ▲26.6752.38 ▲1.20
Media Library /wp-admin/upload.php1,404 ▲74.08 ▼0.16102.12 ▼4.7145.55 ▼0.96
WP-GeoMeta /wp-admin/tools.php?page=wp-geometa1,4892.5156.7352.76

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/wp-geometa/lib/wp-geometa-lib/wp-geometa-lib.php+34
    Undefined variable: wp_geometa_version
  • The plugin did not uninstall successfully, leaving 4 tables in the database
    • wp_postmeta_geo
    • wp_usermeta_geo
    • wp_commentmeta_geo
    • wp_termmeta_geo
  • Zombie WordPress options were found after uninstall: 8 options
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • wp_geometa_db_version
    • wp_geometa_version
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Please fix the following server-side errors
    • > GET request to /wp-admin/tools.php?page=wp-geometa
    • > Notice in wp-content/plugins/wp-geometa/lib/wp-geometa-lib/wp-geometa-lib.php+34
    Undefined variable: wp_geometa_version
    • > GET request to /wp-admin/tools.php?page=wp-geometa
    • > Notice in wp-content/plugins/wp-geometa/lib/wp-geometa-lib/wp-geometa-lib.php+34
    Undefined variable: wp_geometa_max_version

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
  • 24× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/testsuite.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/QueryOrderByDistance.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/LoadLatLng.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/wp-geometa.php
    • > /wp-content/plugins/wp-geometa/wp-geometa.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/UnloadDataTest.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/PopulateTable.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/QueryOneGeomInValTest.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/QueryOrderByTest.php
    • > /wp-content/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/TablesCreatedTest.php
  • 172× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > WordPress database error FUNCTION potrivit.Dimension does not exist for query SELECT Dimension(meta_value) FROM wp_postmeta_geo WHERE meta_key='wpgeometa_test' AND post_id='19'
    • > WordPress database error FUNCTION potrivit.GeomFromText does not exist for query INSERT INTO wp_postmeta_geo \t\t\t\t\t(\t\t\tpost_id,\t\t\tfk_meta_id,\t\t\tmeta_key,\t\t\tmeta_value\t\t) VALUES (\t\t\t28,\t\t\t42,\t\t\t'wpgeometa_test',\t\t\tGeomFromText('MULTIPOINT (-93.22086811153 45.090051566527)',4326)\t\t) ON DUPLICATE KEY UPDATE meta_value=GeomFromText('MULTIPOINT (-93.22086811153 45.090051566527)',4326) made by WP_GeoMeta->populate_geo_tables, WP_GeoMeta->upsert_meta
    • > WordPress database error FUNCTION potrivit.Dimension does not exist for query SELECT Dimension(meta_value) FROM wp_postmeta_geo WHERE meta_key='wpgeometa_test' AND post_id='24'
    • > WordPress database error FUNCTION potrivit.GeomFromText does not exist for query INSERT INTO wp_postmeta_geo \t\t\t\t\t(\t\t\tpost_id,\t\t\tfk_meta_id,\t\t\tmeta_key,\t\t\tmeta_value\t\t) VALUES (\t\t\t23,\t\t\t32,\t\t\t'wpgeometa_test',\t\t\tGeomFromText('MULTIPOINT (-93.26704502193 45.096110844925)',4326)\t\t) ON DUPLICATE KEY UPDATE meta_value=GeomFromText('MULTIPOINT (-93.26704502193 45.096110844925)',4326) made by WP_GeoMeta->populate_geo_tables, WP_GeoMeta->upsert_meta
    • > WordPress database error FUNCTION potrivit.GeomFromText does not exist for query INSERT INTO wp_postmeta_geo \t\t\t\t\t(\t\t\tpost_id,\t\t\tfk_meta_id,\t\t\tmeta_key,\t\t\tmeta_value\t\t) VALUES (\t\t\t45,\t\t\t86,\t\t\t'wpgeometa_test',\t\t\tGeomFromText('MULTIPOINT (-93.231167794147 45.090778713879)',4326)\t\t) ON DUPLICATE KEY UPDATE meta_value=GeomFromText('MULTIPOINT (-93.231167794147 45.090778713879)',4326) made by require('/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/LoadDataTest.php'), update_post_meta, update_metadata, add_metadata, do_action('added_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->upsert_meta
    • > WordPress database error FUNCTION potrivit.GeomFromText does not exist for query INSERT INTO wp_postmeta_geo \t\t\t\t\t(\t\t\tpost_id,\t\t\tfk_meta_id,\t\t\tmeta_key,\t\t\tmeta_value\t\t) VALUES (\t\t\t11,\t\t\t45,\t\t\t'geo_',\t\t\tGeomFromText('MULTIPOINT (-93.265 44.9778)',4326)\t\t) ON DUPLICATE KEY UPDATE meta_value=GeomFromText('MULTIPOINT (-93.265 44.9778)',4326) made by update_post_meta, update_metadata, add_metadata, do_action('added_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->upsert_meta
    • > WordPress database error FUNCTION potrivit.Dimension does not exist for query SELECT Dimension(meta_value) FROM wp_postmeta_geo WHERE meta_key='wpgeometa_test' AND post_id='12'
    • > WordPress database error FUNCTION potrivit.Dimension does not exist for query SELECT Dimension(meta_value) FROM wp_postmeta_geo WHERE meta_key='wpgeometa_test' AND post_id='43' made by require('/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/QueryOrderByTest.php')
    • > WordPress database error FUNCTION potrivit.Dimension does not exist for query SELECT Dimension(meta_value) FROM wp_postmeta_geo WHERE meta_key='wpgeometa_test' AND post_id='24'
    • > WordPress database error FUNCTION potrivit.Dimension does not exist for query SELECT Dimension(meta_value) FROM wp_postmeta_geo WHERE meta_key='wpgeometa_test' AND post_id='33' made by require('/plugins/wp-geometa/lib/wp-geometa-lib/test/tests/QueryOrderByTest.php')

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration Passed 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
9 plugin tags: spatial, mapping, meta, metadata, geography...

wp-geometa/wp-geometa.php Passed 13 tests

The main PHP file in "WP-GeoMeta" ver. 0.3.5 adds more information about the plugin and also serves as the entry point for this plugin
92 characters long description:
Store and search spatial metadata while taking advantage of MySQL spatial types and indexes.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin41,018 lines of code in 113 files:
LanguageFilesBlank linesComment linesLines of code
XML122018,393
JavaScript73,5294,19411,385
PHP541,4362,0067,216
CSS9208701,229
Markdown1539701,192
HTML1150720
PO File1150270382
SVG100193
SQL47620130
Pascal14316295
JSON40040
Bourne Shell313525
YAML16518

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity35.32
▷ Minimum class complexity1.00
▷ Maximum class complexity166.00
Average method complexity4.18
▷ Minimum method complexity1.00
▷ Maximum method complexity83.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes34
▷ Abstract classes38.82%
▷ Concrete classes3191.18%
▷ Final classes00.00%
Methods395
▷ Static methods5112.91%
▷ Public methods31078.48%
▷ Protected methods4310.89%
▷ Private methods4210.63%
Functions15
▷ Named functions1386.67%
▷ Anonymous functions213.33%
Constants24
▷ Global constants937.50%
▷ Class constants1562.50%
▷ Public constants15100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
23 PNG files occupy 1.75MB with 0.51MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/leaflet-php/assets/Leaflet.draw/dist/images/layers-2x.png1.23KB1.67KB0.00%
lib/leaflet-php/assets/leaflet/images/marker-icon-2x.png2.53KB2.52KB0.39%
assets/screenshot-1.png346.99KB104.14KB▼ 69.99%
lib/leaflet-php/assets/leaflet/images/marker-shadow.png0.60KB1.16KB0.00%
assets/screenshot-4.png169.86KB42.64KB▼ 74.90%