44% ip-location-block

Code Review | IP Location Block

WordPress plugin IP Location Block scored44%from 54 tests.

About plugin

  • Plugin page: ip-location-block
  • Plugin version: 1.2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-6.4
  • WordPress version: 6.3.1
  • First release: May 17, 2021
  • Latest release: Nov 12, 2023
  • Number of updates: 45
  • Update frequency: every 20.2 days
  • Top authors: DarkoG (100%)

Code review

54 tests

User reviews

16 reviews

Install metrics

8,000+ active /52,858 total downloads

Benchmarks

Plugin footprint 30% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

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

This is a short check of server-side resources used by IP Location Block
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.42 ▲0.9652.75 ▲8.18
Dashboard /wp-admin4.64 ▲1.3472.74 ▲24.79
Posts /wp-admin/edit.php4.69 ▲1.3465.31 ▲18.75
Add New Post /wp-admin/post-new.php7.16 ▲1.28102.69 ▲3.31
Media Library /wp-admin/upload.php4.51 ▲1.2868.13 ▲34.02
IP Location Block /wp-admin/options-general.php?page=ip-location-block4.9955.28

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 640 new files
Database: 3 new tables, 7 new options
New tables
wp_ip_location_block_cache
wp_ip_location_block_logs
wp_ip_location_block_stat
New WordPress options
widget_recent-posts
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
ip_location_block_settings
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for IP Location Block
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,040 ▲27813.52 ▼1.197.62 ▲5.7841.48 ▼2.16
Dashboard /wp-admin2,333 ▲1535.79 ▲0.15100.09 ▲1.0459.52 ▲16.10
Posts /wp-admin/edit.php2,244 ▲1442.28 ▲0.2740.61 ▲1.4247.39 ▲14.86
Add New Post /wp-admin/post-new.php1,656 ▲12123.40 ▲4.97735.84 ▲127.3557.12 ▼12.05
Media Library /wp-admin/upload.php1,535 ▲1324.40 ▲0.25121.30 ▲23.6359.88 ▲16.27
IP Location Block /wp-admin/options-general.php?page=ip-location-block3,6912.4155.3780.15

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/ip-location-block/uninstall.php+15
    Constant IP_LOCATION_BLOCK_PATH already defined
  • This plugin has failed uninstalling correctly, leaving 640 files (9.70MB) in the plugin directory
    • (new file) admin/class-ip-location-block-admin.php
    • (new file) admin/css/fonts/icomoon.svg
    • (new file) admin/css/admin-icons.min.css
    • (new file) admin/css/cidr.min.css
    • (new file) admin/css/fonts/icomoon.woff
    • (new file) admin/css/fonts/icomoon.ttf
    • (new file) admin/css/admin.css
    • (new file) admin/css/admin.min.css
    • (new file) admin/css/fonts/icomoon.eot
    • (new file) admin/css/admin-icons.css
    • ...
  • Zombie tables were found after uninstall: 3 tables
    • wp_ip_location_block_logs
    • wp_ip_location_block_cache
    • wp_ip_location_block_stat
  • This plugin does not fully uninstall, leaving 8 options in the database
    • theysaidso_admin_options
    • ip_location_block_settings
    • db_upgraded
    • recovery_mode_email_last_sent
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 275× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' not found in wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r2.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/ip-location-block/classes/db-providers/maxmind/vendor/geoip2/geoip2/src/Record/Country.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\AbstractModel' not found in wp-content/plugins/ip-location-block/classes/db-providers/maxmind/vendor/geoip2/geoip2/src/Model/Asn.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Math\\BigInteger\\Engines\\PHP' not found in wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Binary' not found in wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r2.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\Formats\\Keys\\OpenSSH' not found in wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/OpenSSH.php:32
    • > PHP Fatal error
      Uncaught Error: Class 'Net_DNS2_RR' not found in wp-content/plugins/ip-location-block/includes/Net/DNS2/RR/TSIG.php:44
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\AsymmetricKey' not found in wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/phpseclib/phpseclib/phpseclib/Crypt/DH.php:44
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS1' not found in wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS1.php:49
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Binary' not found in wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r1.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
6 plugin tags: block, ip address, ip geo block, geolocation, ip...

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

"IP Location Block" version 1.2.3's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 177 characters long)

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
It is important to fix the following items
  • Do not include executable or dangerous files in your plugin
    • .bin - Binary Executable in Windows, macOS, Linux
      • wp-content/plugins/ip-location-block/classes/db-providers/ip2location/vendor/ip2location/ip2location-php/databases/IP2LOCATION-LITE-DB1.BIN
90,767 lines of code in 584 files:
LanguageFilesBlank linesComment linesLines of code
PHP53511,61639,53351,830
JavaScript209,94722,03434,526
CSS141271882,924
JSON200576
C17315476
Markdown51260335
XML20028
YAML12025
SVG10022
m415014
C/C++ Header14128
Bourne Shell1203

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
The following items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 106)
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity15.55
▷ Minimum class complexity1.00
▷ Maximum class complexity660.00
Average method complexity4.28
▷ Minimum method complexity1.00
▷ Maximum method complexity106.00
Code structure
Namespaces55
Interfaces5
Traits4
Classes514
▷ Abstract classes21141.05%
▷ Concrete classes30358.95%
▷ Final classes144.62%
Methods2,281
▷ Static methods71931.52%
▷ Public methods1,44663.39%
▷ Protected methods45219.82%
▷ Private methods38316.79%
Functions57
▷ Named functions3357.89%
▷ Anonymous functions2442.11%
Constants576
▷ Global constants488.33%
▷ Class constants52891.67%
▷ Public constants528100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
15 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/vendor/leaflet/images/layers.png0.68KB1.05KB0.00%
admin/vendor/leaflet/images/marker-icon-2x.png2.41KB2.52KB0.00%
admin/images/alert.png0.46KB0.47KB0.00%
admin/datatables/images/sort_asc_disabled.png0.10KB0.11KB0.00%
admin/images/unlock.png0.40KB0.41KB0.00%