78% adv-geoip-redirect

Code Review | Advanced GeoIP Redirect

WordPress plugin Advanced GeoIP Redirect scored78%from 54 tests.

About plugin

  • Plugin page: adv-geoip-redirect
  • Plugin version: 1.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-6.3
  • WordPress version: 6.3.1
  • First release: Apr 29, 2020
  • Latest release: Aug 27, 2023
  • Number of updates: 15
  • Update frequency: every 81.0 days
  • Top authors: sajjad67 (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

400+ active /3,728 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.15MB] [CPU: ▼2.44ms] Passed 4 tests

A check of server-side resources used by Advanced GeoIP Redirect
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1642.15 ▲4.05
Dashboard /wp-admin3.46 ▲0.1543.49 ▼1.57
Posts /wp-admin/edit.php3.57 ▲0.2148.05 ▲0.07
Add New Post /wp-admin/post-new.php6.04 ▲0.1581.49 ▼12.02
Media Library /wp-admin/upload.php3.38 ▲0.1537.87 ▲3.77

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 104 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
geoipr_redirect_options
db_upgraded
widget_recent-posts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Advanced GeoIP Redirect
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5814.47 ▲0.102.00 ▲0.2145.43 ▲0.64
Dashboard /wp-admin2,210 ▲194.85 ▼0.06109.84 ▲4.8449.63 ▲9.70
Posts /wp-admin/edit.php2,093 ▲42.04 ▲0.0439.52 ▼1.2434.11 ▼2.42
Add New Post /wp-admin/post-new.php1,536 ▲1723.50 ▲0.23668.86 ▼10.4955.73 ▼3.80
Media Library /wp-admin/upload.php1,392 ▲44.19 ▲0.0494.86 ▼13.0040.03 ▼6.54
GeoIP Redirect /wp-admin/geoip-redirect.php260.440.0814.05

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • geoipr_redirect_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 37× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php:10
    • > PHP Warning
      require(wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/examples/benchmark.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\AbstractModel' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Model/ConnectionType.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\AbstractModel' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Model/Domain.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'GeoIp2\\ProviderInterface' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/WebService/Client.php:49
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Record/Postal.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\HttpException' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Record/Country.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php:10

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please take a look at the following user-side issues
    • > GET request to /wp-admin/geoip-redirect.php
    • > Network (severe)
    wp-admin/geoip-redirect.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
4 plugin tags: wpml redirect, redirect visitor, redirect, redirect by country

adv-geoip-redirect/adv-geoip-redirect.php 92% from 13 tests

The main PHP script in "Advanced GeoIP Redirect" version 1.0.5 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 146 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin13,431 lines of code in 90 files:
LanguageFilesBlank linesComment linesLines of code
CSS31,03777,685
PHP679562,2363,427
Markdown74110990
C111825668
JSON600431
JavaScript2301993
XML14059
Bourne Shell118038
m418032
C/C++ Header14128

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity8.57
▷ Minimum class complexity1.00
▷ Maximum class complexity60.00
Average method complexity3.09
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces14
Interfaces2
Traits0
Classes54
▷ Abstract classes35.56%
▷ Concrete classes5194.44%
▷ Final classes00.00%
Methods190
▷ Static methods4624.21%
▷ Public methods13772.11%
▷ Protected methods10.53%
▷ Private methods5227.37%
Functions10
▷ Named functions220.00%
▷ Anonymous functions880.00%
Constants20
▷ Global constants210.00%
▷ Class constants1890.00%
▷ Public constants211.11%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There are no PNG files in this plugin