84% iq-block-country

Code Review | iQ Block Country

WordPress plugin iQ Block Country scored84%from 54 tests.

About plugin

  • Plugin page: iq-block-country
  • Plugin version: 1.2.21
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5.2-6.2.2
  • WordPress version: 6.3.1
  • First release: Mar 16, 2010
  • Latest release: Jul 7, 2023
  • Number of updates: 237
  • Update frequency: every 20.5 days
  • Top authors: iqpascal (100%)

Code review

54 tests

User reviews

149 reviews

Install metrics

30,000+ active /1,044,947 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.89MB] [CPU: ▲0.04ms] Passed 4 tests

Server-side resources used by iQ Block Country
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.38 ▲0.9255.05 ▲9.71
Dashboard /wp-admin4.22 ▲0.9256.82 ▲6.05
Posts /wp-admin/edit.php4.28 ▲0.9248.80 ▼3.48
Add New Post /wp-admin/post-new.php6.74 ▲0.8684.79 ▼12.13
Media Library /wp-admin/upload.php4.08 ▲0.8648.59 ▲14.10
iQ Block Country /wp-admin/options-general.php?page=iq-block-country/libs/blockcountry-settings.php4.0741.19

Server storage [IO: ▲0.99MB] [DB: ▲0.07MB] Passed 3 tests

Filesystem and database footprint
This plugin installed successfully
Filesystem: 365 new files
Database: 1 new table, 20 new options
New tables
wp_iqblock_logging
New WordPress options
blockcountry_blockfeed
blockcountry_ipoverride
db_upgraded
blockcountry_backendwhitelist
blockcountry_backendnrblocks
blockcountry_frontendnrblocks
blockcountry_nrstatistics
blockcountry_dbversion
blockcountry_frontendwhitelist
blockcountry_banlist_inverse
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for iQ Block Country
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,812 ▲2614.35 ▼0.182.16 ▲0.2244.06 ▼1.02
Dashboard /wp-admin2,218 ▲385.54 ▼0.0699.55 ▲13.8349.05 ▲10.13
Posts /wp-admin/edit.php2,124 ▲242.15 ▲0.1533.30 ▼1.5436.99 ▲0.20
Add New Post /wp-admin/post-new.php1,548 ▲1123.67 ▲5.47647.80 ▲48.5053.91 ▼10.95
Media Library /wp-admin/upload.php1,426 ▲324.32 ▲0.1395.37 ▲1.3144.76 ▲1.89
iQ Block Country /wp-admin/options-general.php?page=iq-block-country/libs/blockcountry-settings.php1,3581.8729.1246.87

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • blockcountry_nrstatistics
    • theysaidso_admin_options
    • widget_theysaidso_widget

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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 37× 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/iq-block-country/vendor/geoip2/geoip2/src/Record/Postal.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/iq-block-country/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/iq-block-country/vendor/geoip2/geoip2/src/Record/MaxMind.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/iq-block-country/vendor/geoip2/geoip2/src/Exception/OutOfQueriesException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\City' not found in wp-content/plugins/iq-block-country/vendor/geoip2/geoip2/src/Model/Enterprise.php:45
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\WebServiceException' not found in wp-content/plugins/iq-block-country/vendor/maxmind/web-service-common/src/Exception/HttpException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/iq-block-country/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\Country' not found in wp-content/plugins/iq-block-country/vendor/geoip2/geoip2/src/Record/RepresentedCountry.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/iq-block-country/iq-block-country.php:141
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/iq-block-country/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php:8

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: Too many tags (15 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can take inspiration from this readme.txt

iq-block-country/iq-block-country.php 92% from 13 tests

"iQ Block Country" version 1.2.21's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 207 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin11,270 lines of code in 92 files:
LanguageFilesBlank linesComment linesLines of code
PHP699831,7806,285
PO File46848141,714
JavaScript297141,165
Markdown73460784
C17315476
CSS11025415
JSON500369
Bourne Shell120040
m415014
C/C++ Header14128

PHP code Passed 2 tests

Analyzing 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.40
Average class complexity5.71
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.63
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces13
Interfaces2
Traits0
Classes49
▷ Abstract classes36.12%
▷ Concrete classes4693.88%
▷ Final classes00.00%
Methods140
▷ Static methods96.43%
▷ Public methods9265.71%
▷ Protected methods10.71%
▷ Private methods4733.57%
Functions77
▷ Named functions7394.81%
▷ Anonymous functions45.19%
Constants23
▷ Global constants2191.30%
▷ Class constants28.70%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
260 compressed PNG files occupy 0.13MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
icons/ph.png0.53KB0.71KB0.00%
icons/us.png0.59KB0.65KB0.00%
icons/tc.png0.61KB0.73KB0.00%
icons/ar.png0.49KB0.69KB0.00%
icons/hn.png0.52KB0.70KB0.00%