84% geoip-detect

Code Review | Geolocation IP Detection

WordPress plugin Geolocation IP Detection scored84%from 54 tests.

About plugin

  • Plugin page: geoip-detect
  • Plugin version: 5.3.1
  • PHP compatiblity: 7.2.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Jul 4, 2013
  • Latest release: Aug 17, 2023
  • Number of updates: 185
  • Update frequency: every 20.0 days
  • Top authors: benjamin4 (72.43%)benjaminpick (28.11%)

Code review

54 tests

User reviews

53 reviews

Install metrics

10,000+ active /434,201 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.21MB] [CPU: ▲7.49ms] Passed 4 tests

An overview of server-side resources used by Geolocation IP Detection
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.70 ▲1.2456.00 ▲13.90
Dashboard /wp-admin4.52 ▲1.2258.08 ▲9.59
Posts /wp-admin/edit.php4.57 ▲1.2160.97 ▲10.95
Add New Post /wp-admin/post-new.php7.10 ▲1.2198.69 ▼2.62
Media Library /wp-admin/upload.php4.44 ▲1.2150.69 ▲12.04
Geolocation Lookup /wp-admin/tools.php?page=geoip-detect/geoip-detect.php4.52169.55
Geolocation IP Detection /wp-admin/options-general.php?page=geoip-detect/geoip-detect.php4.4747.38

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 346 new files
Database: no new tables, 9 new options
New WordPress options
db_upgraded
theysaidso_admin_options
geoip-detect-plugin_version
geoip-detect-source
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
geoip-detect-disable_pagecache

Browser metrics Passed 4 tests

An overview of browser requirements for Geolocation IP Detection
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,867 ▲10614.36 ▼0.412.10 ▲0.4044.87 ▲3.34
Dashboard /wp-admin2,245 ▲655.56 ▼0.1092.10 ▲1.2541.96 ▼0.24
Posts /wp-admin/edit.php2,154 ▲512.13 ▼0.0237.30 ▼1.7334.09 ▼5.64
Add New Post /wp-admin/post-new.php1,581 ▲5318.14 ▼5.12607.25 ▼71.2176.40 ▲26.40
Media Library /wp-admin/upload.php1,456 ▲594.20 ▲0.0598.77 ▼29.8547.90 ▼4.76
Geolocation Lookup /wp-admin/tools.php?page=geoip-detect/geoip-detect.php1,0141.8024.7035.78
Geolocation IP Detection /wp-admin/options-general.php?page=geoip-detect/geoip-detect.php1,1371.9427.1536.21

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
  • 120× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      require_once(GEOIP_PLUGIN_DIR/shortcodes/_helpers.php): failed to open stream: No such file or directory in wp-content/plugins/geoip-detect/api_shortcodes.php on line 23
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geoip-detect/vendor/geoip2/geoip2/src/Record/Postal.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geoip-detect/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/geoip-detect/vendor/geoip2/geoip2/src/Record/Country.php:28
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\PropertyAccess\\Exception\\ExceptionInterface' not found in wp-content/plugins/geoip-detect/vendor/symfony/property-access/Exception/InvalidArgumentException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\PropertyAccess\\Exception\\AccessException' not found in wp-content/plugins/geoip-detect/vendor/symfony/property-access/Exception/NoSuchPropertyException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\PropertyAccess\\Exception\\RuntimeException' not found in wp-content/plugins/geoip-detect/vendor/symfony/property-access/Exception/InvalidPropertyPathException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\HttpException' not found in wp-content/plugins/geoip-detect/vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/geoip-detect/init.php:28
    • > PHP Warning
      Use of undefined constant GEOIP_PLUGIN_DIR - assumed 'GEOIP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/geoip-detect/lib/geonames/geonames-country-info.php on line 22

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Add images for these screenshots: #1 (Lookup page (under Tools > Geolocation Lookup)), #2 (Options page (under Preferences > Geolocation IP Detection))
The official readme.txt might help

geoip-detect/geoip-detect.php 92% from 13 tests

The main file in "Geolocation IP Detection" v. 5.3.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Requires PHP: Required version does not match the one declared in readme.txt ("7.2" instead of "7.2.5")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected46,808 lines of code in 305 files:
LanguageFilesBlank linesComment linesLines of code
PHP2214,0776,30642,048
JSON20001,639
Markdown2348701,175
JavaScript333041571,166
C19718589
XML370108
Bourne Shell222043
m418032
C/C++ Header14128

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity13.99
▷ Minimum class complexity1.00
▷ Maximum class complexity171.00
Average method complexity3.65
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces48
Interfaces24
Traits0
Classes144
▷ Abstract classes74.86%
▷ Concrete classes13795.14%
▷ Final classes1913.87%
Methods849
▷ Static methods14717.31%
▷ Public methods69181.39%
▷ Protected methods242.83%
▷ Private methods13415.78%
Functions297
▷ Named functions26388.55%
▷ Anonymous functions3411.45%
Constants177
▷ Global constants4223.73%
▷ Class constants13576.27%
▷ Public constants10678.52%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.12MB with 0.08MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png49.38KB19.15KB▼ 61.22%
screenshot-1.png78.36KB28.72KB▼ 63.34%