73% ip2location-redirection

Code Review | IP2Location Redirection

WordPress plugin IP2Location Redirection scored73%from 54 tests.

About plugin

  • Plugin page: ip2location-redir...
  • Plugin version: 1.28.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.2
  • WordPress version: 6.3.1
  • First release: Oct 20, 2014
  • Latest release: Nov 4, 2023
  • Number of updates: 327
  • Update frequency: every 10.1 days
  • Top authors: ip2location (100%)

Code review

54 tests

User reviews

40 reviews

Install metrics

10,000+ active /327,118 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.97MB] [CPU: ▼1.64ms] Passed 4 tests

This is a short check of server-side resources used by IP2Location Redirection
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.42 ▲0.9639.59 ▲2.28
Dashboard /wp-admin4.33 ▲0.9847.45 ▼11.53
Posts /wp-admin/edit.php4.38 ▲1.0254.96 ▲7.71
Add New Post /wp-admin/post-new.php6.85 ▲0.9698.12 ▼4.39
Media Library /wp-admin/upload.php4.19 ▲0.9640.02 ▲7.09
Rules /wp-admin/admin.php?page=ip2location-redirection4.1734.70
IP Lookup /wp-admin/admin.php?page=ip2location-redirection-ip-lookup4.1533.71
Settings /wp-admin/admin.php?page=ip2location-redirection-settings4.1634.01

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 39 new files
Database: no new tables, 20 new options
New WordPress options
ip2location_redirection_database
can_compress_scripts
ip2location_redirection_ip_whitelist
theysaidso_admin_options
widget_recent-posts
ip2location_redirection_first_redirect
widget_theysaidso_widget
db_upgraded
ip2location_redirection_api_key
ip2location_redirection_noredirect_enabled
...

Browser metrics Passed 4 tests

IP2Location Redirection: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,859 ▲11214.33 ▲0.061.60 ▼0.4437.04 ▼6.23
Dashboard /wp-admin2,265 ▲875.62 ▼0.1291.28 ▼18.0539.04 ▼3.24
Posts /wp-admin/edit.php2,167 ▲642.03 ▲0.1039.73 ▼0.0838.56 ▼0.18
Add New Post /wp-admin/post-new.php1,562 ▲3623.38 ▲0.09636.44 ▲37.9567.57 ▲10.90
Media Library /wp-admin/upload.php1,470 ▲674.22 ▲0.0696.96 ▼3.2341.43 ▲1.22
Rules /wp-admin/admin.php?page=ip2location-redirection3,8633.7188.9738.66
IP Lookup /wp-admin/admin.php?page=ip2location-redirection-ip-lookup8671.6926.5828.12
Settings /wp-admin/admin.php?page=ip2location-redirection-settings1,0832.2127.1633.75

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • ip2location_redirection_download_ipv4_only
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments
    • 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
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
The following issues need your attention
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Exception: IP2Location\\WebService: OK in wp-content/plugins/ip2location-redirection/vendor/ip2location/ip2location-php/IP2Location.php:2203
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/ip2location-redirection/ip2location-redirection.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Tags: There are too many tags (13 tag instead of maximum 10)
You can look at the official readme.txt

ip2location-redirection/ip2location-redirection.php 92% from 13 tests

The entry point to "IP2Location Redirection" version 1.28.2 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Text Domain: Please use dashes and lowercase characters for text domains

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Please fix the following items
  • Do not include executable or dangerous files in your plugin
    • .bin - Binary Executable in Windows, macOS, Linux
      • wp-content/plugins/ip2location-redirection/vendor/ip2location/ip2location-php/databases/IP2LOCATION-LITE-DB1.BIN
8,116 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript510544,369
PHP117381,1763,513
CSS2190107
Markdown129065
JSON20062

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
It is recommended to fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 105)
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity100.50
▷ Minimum class complexity1.00
▷ Maximum class complexity372.00
Average method complexity6.36
▷ Minimum method complexity1.00
▷ Maximum method complexity105.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods113
▷ Static methods1311.50%
▷ Public methods5548.67%
▷ Protected methods00.00%
▷ Private methods5851.33%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants54
▷ Global constants35.56%
▷ Class constants5194.44%
▷ Public constants51100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
8 PNG files occupy 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/logo.png3.47KB1.73KB▼ 50.07%
assets/img/step-2.png4.17KB1.69KB▼ 59.53%
assets/img/step-3-selected.png3.89KB1.82KB▼ 53.23%
assets/img/step-1-selected.png3.01KB1.35KB▼ 55.06%
assets/img/step-end.png31.47KB10.52KB▼ 66.57%