10% geotargeting

Code Review | GeoTargeting Lite - WordPress Geolocation

WordPress plugin GeoTargeting Lite - WordPress Geolocation scored 10% from 54 tests.

About plugin

  • Plugin page: geotargeting
  • Plugin version: 1.3.6.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-6.1
  • WordPress version: 6.3.1
  • First release: Dec 9, 2014
  • Latest release: Aug 15, 2022
  • Number of updates: 34
  • Update frequency: every 82.6 days
  • Top authors: timersys (100%)

Code review

54 tests

User reviews

32 reviews

Install metrics

2,000+ active / 59,161 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Warning in wp-content/plugins/geotargeting/includes/class-geot-maxmind.php+89
    unlink(wp-content/uploads/geot_plugin/GeoLite2-Country.mmdb): No such file or directory

Server metrics [RAM: ▲0.44MB] [CPU: ▼0.43ms] Passed 4 tests

This is a short check of server-side resources used by GeoTargeting Lite - WordPress Geolocation
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.94 ▲0.4848.24 ▼0.09
Dashboard /wp-admin3.77 ▲0.4752.44 ▲0.58
Posts /wp-admin/edit.php3.82 ▲0.4650.09 ▲1.13
Add New Post /wp-admin/post-new.php6.31 ▲0.4291.14 ▼3.33
Media Library /wp-admin/upload.php3.63 ▲0.4038.14 ▲5.19
Settings /wp-admin/admin.php?page=geot-settings3.6035.65
Ip test /wp-admin/admin.php?page=geot-ip-test3.6037.44

Server storage [IO: ▲3.29MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 198 new files
Database: 1 new table, 7 new options
New tables
wp_geot_countries
New WordPress options
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
geot_version

Browser metrics Passed 4 tests

A check of browser resources used by GeoTargeting Lite - WordPress Geolocation
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,945 ▲21013.63 ▼0.757.08 ▲5.0044.41 ▲0.24
Dashboard /wp-admin2,241 ▲534.87 ▼0.03116.05 ▼1.0343.20 ▼2.90
Posts /wp-admin/edit.php2,127 ▲412.06 ▲0.0237.27 ▲1.0133.09 ▲0.89
Add New Post /wp-admin/post-new.php1,544 ▲1123.40 ▲0.30582.92 ▼93.2350.16 ▼10.19
Media Library /wp-admin/upload.php1,426 ▲384.27 ▲0.0898.76 ▲0.7144.13 ▼0.74
Settings /wp-admin/admin.php?page=geot-settings8351.7324.8828.86
Ip test /wp-admin/admin.php?page=geot-ip-test8241.7125.2625.16

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments

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 0% 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
  • 4× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/geotargeting/vendor/geoip2/geoip2/tests/bootstrap.php
    • > /wp-content/plugins/geotargeting/public/partials/plugin-name-public-display.php
    • > /wp-content/plugins/geotargeting/vendor/maxmind/web-service-common/tests/bootstrap.php
    • > /wp-content/plugins/geotargeting/vendor/maxmind-db/reader/tests/bootstrap.php
  • 60× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/geotargeting/vendor/geoip2/geoip2/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/geotargeting/vendor/geoip2/geoip2/examples/benchmark.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geotargeting/vendor/geoip2/geoip2/src/Record/Traits.php:105
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geotargeting/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/geotargeting/vendor/geoip2/geoip2/src/Record/City.php:23
    • > PHP Warning
      require_once(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/geotargeting/vendor/maxmind-db/reader/examples/benchmark.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\AbstractModel' not found in wp-content/plugins/geotargeting/vendor/geoip2/geoip2/src/Model/Asn.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/geotargeting/vendor/geoip2/geoip2/tests/GeoIp2/Test/WebService/ClientTest.php:8
    • > PHP Warning
      require(wp-content/plugins/geotargeting/vendor/geoip2/geoip2/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/geotargeting/vendor/geoip2/geoip2/examples/benchmark.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geotargeting/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php:8
    • > PHP Warning
      require_once(geoip2.phar): failed to open stream: No such file or directory in wp-content/plugins/geotargeting/vendor/geoip2/geoip2/dev-bin/phar-test.php on line 3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Tags: Too many tags (17 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

geotargeting/geotargeting.php 92% from 13 tests

Analyzing the main PHP file in "GeoTargeting Lite - WordPress Geolocation" version 1.3.6.1
Please make the necessary changes and fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

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
Success! There were no dangerous files found in this plugin9,972 lines of code in 160 files:
LanguageFilesBlank linesComment linesLines of code
PHP1121,2802,9146,843
Markdown93930933
C19718589
JSON1100517
CSS344343
JavaScript79762341
Bourne Shell6706193
YAML422093
XML514080
m418032
C/C++ Header14128

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity5.60
▷ Minimum class complexity1.00
▷ Maximum class complexity46.00
Average method complexity2.14
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces21
Interfaces4
Traits0
Classes83
▷ Abstract classes44.82%
▷ Concrete classes7995.18%
▷ Final classes00.00%
Methods337
▷ Static methods257.42%
▷ Public methods26177.45%
▷ Protected methods51.48%
▷ Private methods7121.07%
Functions13
▷ Named functions969.23%
▷ Anonymous functions430.77%
Constants24
▷ Global constants625.00%
▷ Class constants1875.00%
▷ Public constants18100.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
6 compressed PNG files occupy 0.11MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/img/valid-key.png1.43KB0.67KB▼ 53.21%
admin/img/invalid-key.png0.78KB0.74KB▼ 4.41%
admin/js/world.png1.00KB0.94KB▼ 6.51%
admin/img/chosen-sprite.png0.53KB0.88KB0.00%
admin/img/chosen-sprite@2x.png0.72KB0.83KB0.00%