74% ip2location-variables

Code Review | IP2Location Variables

WordPress plugin IP2Location Variables scored74%from 54 tests.

About plugin

  • Plugin page: ip2location-varia...
  • Plugin version: 2.9.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0-6.4
  • WordPress version: 6.3.1
  • First release: Sep 13, 2013
  • Latest release: Nov 28, 2023
  • Number of updates: 89
  • Update frequency: every 41.9 days
  • Top authors: ip2location (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active /8,057 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.01MB] [CPU: ▼10.02ms] Passed 4 tests

A check of server-side resources used by IP2Location Variables
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0341.21 ▲1.22
Dashboard /wp-admin3.32 ▼0.0250.58 ▼14.11
Posts /wp-admin/edit.php3.38 ▲0.0247.80 ▼2.58
Add New Post /wp-admin/post-new.php5.93 ▲0.0492.89 ▼22.96
Media Library /wp-admin/upload.php3.25 ▲0.0233.42 ▼0.43
IP2Location Variables /wp-admin/options-general.php?page=ip2location-variables3.9142.38

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 24 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-comments
db_upgraded
theysaidso_admin_options
widget_recent-posts
ip2location_variables_database
widget_theysaidso_widget

Browser metrics Passed 4 tests

IP2Location Variables: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,799 ▲5214.34 ▼0.371.51 ▼0.2542.82 ▼4.49
Dashboard /wp-admin2,201 ▲245.55 ▼0.1197.73 ▼5.6942.88 ▼6.47
Posts /wp-admin/edit.php2,109 ▲92.04 ▲0.0939.59 ▲0.2235.06 ▼0.43
Add New Post /wp-admin/post-new.php1,534 ▲823.18 ▼0.54652.10 ▲16.7953.74 ▲0.33
Media Library /wp-admin/upload.php1,406 ▲64.26 ▲0.10103.03 ▼11.0545.17 ▲1.54
IP2Location Variables /wp-admin/options-general.php?page=ip2location-variables1,6312.0730.9636.07

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_theysaidso_widget
    • db_upgraded
    • ip2location_variables_database
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% 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)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Exception: IP2Location\\WebService: OK in wp-content/plugins/ip2location-variables/vendor/ip2location/ip2location-php/IP2Location.php:2203
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ip2location-variables/ip2location-variables.php:27

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
9 plugin tags: php library, geolocation, ip2location library, ip2location, geo-targeting...

ip2location-variables/ip2location-variables.php Passed 13 tests

The entry point to "IP2Location Variables" version 2.9.0 is a PHP file that has certain tags in its header comment area
134 characters long description:
A library that enables you to use IP2Location variables to display and customize the contents by country in pages, plugins, or themes.

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
These items require your attention
  • For security reasons, never distribute binary or executable files with your plugin
    • .bin - Binary Executable in Windows, macOS, Linux
      • wp-content/plugins/ip2location-variables/vendor/ip2location/ip2location-php/databases/IP2LOCATION-LITE-DB1.BIN
      • wp-content/plugins/ip2location-variables/IP2LOCATION-LITE-DB1.BIN
2,757 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP126651,1522,538
Markdown132077
JSON20071
JavaScript215071

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity44.75
▷ Minimum class complexity1.00
▷ Maximum class complexity166.00
Average method complexity4.38
▷ Minimum method complexity1.00
▷ Maximum method complexity69.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods105
▷ Static methods2523.81%
▷ Public methods7167.62%
▷ Protected methods00.00%
▷ Private methods3432.38%
Functions4
▷ Named functions250.00%
▷ Anonymous functions250.00%
Constants53
▷ Global constants23.77%
▷ Class constants5196.23%
▷ Public constants51100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There are no PNG files in this plugin