78% ip2location-tags

Code Review | IP2Location Tags

WordPress plugin IP2Location Tags scored78%from 54 tests.

About plugin

  • Plugin page: ip2location-tags
  • Plugin version: 2.13.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0-6.4
  • WordPress version: 6.3.1
  • First release: Nov 16, 2009
  • Latest release: Nov 28, 2023
  • Number of updates: 142
  • Update frequency: every 36.1 days
  • Top authors: ip2location (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

300+ active /21,302 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.71MB] [CPU: ▼1.56ms] Passed 4 tests

An overview of server-side resources used by IP2Location Tags
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.20 ▲0.7345.44 ▲2.08
Dashboard /wp-admin4.02 ▲0.6751.55 ▼7.95
Posts /wp-admin/edit.php4.14 ▲0.7751.53 ▲3.44
Add New Post /wp-admin/post-new.php6.62 ▲0.7392.43 ▼3.79
Media Library /wp-admin/upload.php3.94 ▲0.7141.56 ▲7.55
IP2Location Tags /wp-admin/options-general.php?page=ip2location-tags3.9338.09

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 792 new files
Database: no new tables, 10 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
db_upgraded
widget_recent-posts
ip2location_tags_lookup_mode
ip2location_tags_database
ip2location_tags_io_api_key
ip2location_tags_api_key
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for IP2Location Tags
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,799 ▲3714.31 ▲0.071.61 ▲0.0135.82 ▼7.73
Dashboard /wp-admin2,204 ▲275.60 ▼0.0491.07 ▼8.5039.78 ▼2.34
Posts /wp-admin/edit.php2,109 ▲92.01 ▲0.0735.02 ▼5.2932.02 ▼5.23
Add New Post /wp-admin/post-new.php1,534 ▲823.32 ▼0.15676.49 ▼3.2859.45 ▲4.32
Media Library /wp-admin/upload.php1,412 ▲94.20 ▼0.0494.83 ▼4.4341.59 ▼0.41
IP2Location Tags /wp-admin/options-general.php?page=ip2location-tags2,7032.2326.9745.15

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 7 options
    • ip2location_tags_io_api_key
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 0% 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
Please fix the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/ip2location-tags/vendor/ip2location/ip2location-php/tests/bootstrap.php
  • 7× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/ip2location-tags/vendor/ip2location/ip2location-php/tests/WebServiceTest.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/ip2location-tags/ip2location-tags.php:11
    • > PHP Fatal error
      require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/ip2location-tags/vendor/ip2location/ip2location-php/examples/example.php on line 3
    • > PHP Warning
      require(vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/ip2location-tags/vendor/ip2location/ip2location-php/examples/example.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/ip2location-tags/vendor/ip2location/ip2location-php/tests/IpToolsTest.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/ip2location-tags/vendor/ip2location/ip2location-php/tests/CountryTest.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/ip2location-tags/vendor/ip2location/ip2location-php/tests/DatabaseTest.php:10

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, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention:
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

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

The principal PHP file in "IP2Location Tags" v. 2.13.0 is loaded by WordPress automatically on each request
77 characters long description:
Enable you to use IP2Location tags to customize your post content by country.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected3,842 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
PHP229491,2983,498
JavaScript3320131
JSON200101
Markdown134087
CSS12018
XML1007

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity37.69
▷ Minimum class complexity1.00
▷ Maximum class complexity187.00
Average method complexity4.19
▷ Minimum method complexity1.00
▷ Maximum method complexity73.00
Code structure
Namespaces7
Interfaces0
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes00.00%
Methods151
▷ Static methods2617.22%
▷ Public methods10670.20%
▷ Protected methods00.00%
▷ Private methods4529.80%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants63
▷ Global constants34.76%
▷ Class constants6095.24%
▷ Public constants60100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
755 PNG files occupy 2.55MB with 1.96MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/step-1-selected.png3.01KB1.35KB▼ 55.06%
assets/img/flags/16/bw_16.png2.80KB0.19KB▼ 93.23%
assets/img/flags/64/cm_64.png3.32KB0.57KB▼ 82.74%
assets/img/flags/16/cc_16.png3.02KB0.47KB▼ 84.40%
assets/img/flags/64/na_64.png5.73KB1.81KB▼ 68.38%