47% ip-geo-block

Code Review | IP Geo Block

WordPress plugin IP Geo Block scored 47% from 54 tests.

About plugin

  • Plugin page: ip-geo-block
  • Plugin version: 3.0.17.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-5.0.3
  • WordPress version: 6.3.1
  • First release: Feb 1, 2014
  • Latest release: Jan 22, 2019
  • Number of updates: 226
  • Update frequency: every 8.2 days
  • Top authors: tokkonopapa (100%)

Code review

54 tests

User reviews

95 reviews

Install metrics

20,000+ active / 769,055 total downloads

Benchmarks

Plugin footprint 30% 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.07MB] [CPU: ▲7.96ms] Passed 4 tests

Analyzing server-side resources used by IP Geo Block
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.32 ▲0.8642.89 ▲1.93
Dashboard /wp-admin4.44 ▲1.1455.62 ▲7.32
Posts /wp-admin/edit.php4.55 ▲1.2059.56 ▲12.81
Add New Post /wp-admin/post-new.php7.04 ▲1.15106.69 ▲9.76
Media Library /wp-admin/upload.php4.36 ▲1.1350.62 ▲14.95
IP Geo Block /wp-admin/options-general.php?page=ip-geo-block4.9153.96

Server storage [IO: ▲3.20MB] [DB: ▲0.01MB] 67% from 3 tests

Filesystem and database footprint
It is recommended to fix the following issues
  • Illegal file modification detected: 99 files (11,966.42KB) outside of "wp-content/plugins/ip-geo-block/" and "wp-content/uploads/"
    • (new file) wp-content/ip-geo-api/ip2location/bcmath.php
    • (new file) wp-content/ip-geo-api/ip2location/index.php
    • (new file) wp-content/ip-geo-api/drop-in-admin-sample.php
    • (new file) wp-content/ip-geo-api/drop-in-sample.php
    • (new file) wp-content/ip-geo-api/index.php
    • (new file) wp-content/ip-geo-api/ip2location/class-ip2location.php
    • (new file) wp-content/ip-geo-api/ip2location/IP2Location.php
    • (new file) wp-content/ip-geo-api/ip2location/IP2LOCATION-LITE-DB1.BIN
    • (new file) wp-content/ip-geo-api/ip2location/IP2LOCATION-LITE-DB1.IPV6.BIN
    • (new file) wp-content/ip-geo-api/maxmind/GeoLite2/index.php
    • ...
Filesystem: 217 new files
Database: 3 new tables, 8 new options
New tables
wp_ip_geo_block_stat
wp_ip_geo_block_logs
wp_ip_geo_block_cache
New WordPress options
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
ip_geo_block_settings
ip_geo_block_metadata
db_upgraded
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for IP Geo Block
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,907 ▲15013.72 ▼0.646.41 ▲4.6238.04 ▼2.13
Dashboard /wp-admin2,218 ▲305.93 ▲1.05105.51 ▼11.7744.64 ▲2.70
Posts /wp-admin/edit.php2,101 ▲152.07 ▲0.0140.37 ▲2.8933.70 ▲0.65
Add New Post /wp-admin/post-new.php1,545 ▲2618.25 ▼5.01646.80 ▼42.0963.17 ▲5.93
Media Library /wp-admin/upload.php1,397 ▲94.21 ▲0.05100.75 ▼8.9642.29 ▼4.90
IP Geo Block /wp-admin/options-general.php?page=ip-geo-block3,3712.4249.2161.76

Uninstaller [IO: ▲14.89MB] [DB: ▲0.01MB] 0% from 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/ip-geo-block/uninstall.php+15
    Constant IP_GEO_BLOCK_PATH already defined
  • The plugin did not uninstall successfully, leaving 217 files (3.20MB) in the plugin directory
    • (new file) admin/css/admin-icons.css
    • (new file) admin/css/cidr.min.css
    • (new file) admin/css/admin.min.css
    • (new file) admin/css/admin.css
    • (new file) admin/class-ip-geo-block-admin.php
    • (new file) admin/css/admin-icons.min.css
    • (new file) admin/css/fonts/icomoon.svg
    • (new file) README.txt
    • (new file) admin/css/fonts/icomoon.eot
    • (new file) LICENSE.txt
    • ...
  • Zombie tables detected upon uninstall: 3 tables
    • wp_ip_geo_block_stat
    • wp_ip_geo_block_cache
    • wp_ip_geo_block_logs
  • Zombie WordPress options were found after uninstall: 9 options
    • ip_geo_block_metadata
    • db_upgraded
    • widget_recent-posts
    • recovery_mode_email_last_sent
    • ip_geo_block_settings
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/ip-geo-block/samples.php
  • 51× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Postal.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\Country' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/RepresentedCountry.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\AbstractModel' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Domain.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\HttpException' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Net_DNS2_RR' not found in wp-content/plugins/ip-geo-block/includes/Net/DNS2/RR/SIG.php:108
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Record/Continent.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Exception/AuthenticationException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\City' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Insights.php:45
    • > PHP Fatal error
      require_once(): Failed opening required 'IP_GEO_BLOCK_PATHclasses/class-ip-geo-block-util.php' (include_path='.:/usr/share/php') in wp-content/plugins/ip-geo-block/classes/class-ip-geo-block-actv.php on line 13
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\City' not found in wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/maxmind/vendor/geoip2/geoip2/src/Model/Enterprise.php:45

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Donate link: Please fix this invalid URI: ""
  • Tags: Please reduce the number of tags, currently 18 tag instead of maximum 10
The official readme.txt is a good inspiration

ip-geo-block/ip-geo-block.php 92% from 13 tests

The primary PHP file in "IP Geo Block" version 3.0.17.4 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Description: Please don't use more than 140 characters for the plugin description (currently 143 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin39,898 lines of code in 175 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript194,77815,17618,629
PHP1233,7839,71714,982
CSS13681612,216
PO File26387662,122
Markdown73330750
C17315476
JSON500371
Pascal239302308
SVG10022
m415014
C/C++ Header14128

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity23.06
▷ Minimum class complexity1.00
▷ Maximum class complexity322.00
Average method complexity5.01
▷ Minimum method complexity1.00
▷ Maximum method complexity66.00
Code structure
Namespaces13
Interfaces2
Traits0
Classes110
▷ Abstract classes65.45%
▷ Concrete classes10494.55%
▷ Final classes00.00%
Methods626
▷ Static methods25440.58%
▷ Public methods43569.49%
▷ Protected methods396.23%
▷ Private methods15224.28%
Functions56
▷ Named functions5292.86%
▷ Anonymous functions47.14%
Constants208
▷ Global constants5425.96%
▷ Class constants15474.04%
▷ Public constants154100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
10 compressed PNG files occupy 0.01MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/datatables/images/sort_asc.png0.19KB0.21KB0.00%
admin/images/find.png0.44KB0.46KB0.00%
admin/datatables/images/sort_desc_disabled.png0.10KB0.11KB0.00%
admin/images/unlock.png0.40KB0.41KB0.00%
admin/images/icon-72x72.png8.27KB3.70KB▼ 55.26%