78% if-so-geolocation

Code Review | If-So Geolocation

WordPress plugin If-So Geolocation scored78%from 54 tests.

About plugin

  • Plugin page: if-so-geolocation
  • Plugin version: 1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.1-6.3
  • WordPress version: 6.3.1
  • First release: Mar 12, 2023
  • Latest release: Aug 30, 2023
  • Number of updates: 24
  • Update frequency: every 7.2 days
  • Top authors: ifso (100%)

Code review

54 tests

User reviews

1 review

Install metrics

300+ active /2,200 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▼0.00MB] [CPU: ▼7.23ms] Passed 4 tests

An overview of server-side resources used by If-So Geolocation
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0137.03 ▼2.63
Dashboard /wp-admin3.31 ▼0.0346.02 ▼15.56
Posts /wp-admin/edit.php3.36 ▲0.0142.17 ▼4.44
Add New Post /wp-admin/post-new.php5.89 ▲0.0186.95 ▼6.28
Media Library /wp-admin/upload.php3.23 ▲0.0135.21 ▼0.38

Server storage [IO: ▲0.57MB] [DB: ▲0.07MB] Passed 3 tests

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 264 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for If-So Geolocation
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,797 ▲5114.25 ▼0.001.69 ▼0.1639.49 ▲0.30
Dashboard /wp-admin2,200 ▲235.54 ▼0.1387.62 ▼2.9436.22 ▼4.37
Posts /wp-admin/edit.php2,112 ▲121.99 ▼0.0438.13 ▲0.3033.46 ▼4.99
Add New Post /wp-admin/post-new.php1,545 ▲1718.25 ▼4.82601.67 ▼24.6566.33 ▼5.79
Media Library /wp-admin/upload.php1,402 ▼14.20 ▲0.0196.41 ▼0.7545.28 ▼0.12

Uninstaller [IO: ▲0.00MB] [DB: ▲0.07MB] 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 does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/if-so-geolocation/admin/markup/location-override/generator-results.php
    • > /wp-content/plugins/if-so-geolocation/admin/markup/location-override/radio-icon.php
    • > /wp-content/plugins/if-so-geolocation/admin/markup/location-override/select-icon.php
  • 9× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/if-so-geolocation/admin/markup/location-override/generator-form.php:1
    • > PHP Warning
      include_once(): Failed opening 'IFSO_PLUGIN_BASE_DIRextensions/extension-base/ifso-extension-include.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/if-so-geolocation/ifso-geolocation.class.php on line 4
    • > PHP Warning
      Use of undefined constant IFSO_PLUGIN_BASE_DIR - assumed 'IFSO_PLUGIN_BASE_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/if-so-geolocation/ifso-geolocation.class.php on line 4
    • > PHP Warning
      Use of undefined constant IFSO_PLUGIN_BASE_DIR - assumed 'IFSO_PLUGIN_BASE_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/if-so-geolocation/ifso-geolocation.class.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/if-so-geolocation/admin/markup/geo_analysis_tool_page_display.php:2
    • > PHP Warning
      include_once(IFSO_PLUGIN_BASE_DIRextensions/extension-base/ifso-extension-include.php): failed to open stream: No such file or directory in wp-content/plugins/if-so-geolocation/ifso-geolocation.class.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/if-so-geolocation/admin/markup/location-override/location_override_generator_page_display.php:2
    • > PHP Warning
      require_once(IFSO_PLUGIN_BASE_DIRservices/geolocation-service/geolocation-service.class.php): failed to open stream: No such file or directory in wp-content/plugins/if-so-geolocation/ifso-geolocation.class.php on line 7
    • > PHP Fatal error
      require_once(): Failed opening required 'IFSO_PLUGIN_BASE_DIRservices/geolocation-service/geolocation-service.class.php' (include_path='.:/usr/share/php') in wp-content/plugins/if-so-geolocation/ifso-geolocation.class.php on line 7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
5 plugin tags: geoip, location-based content, geolocation, geotargeting, geolocation redirect

if-so-geolocation/ifso-geolocation.php 92% from 13 tests

The principal PHP file in "If-So Geolocation" v. 1.3 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("if-so-geolocation.php" instead of "ifso-geolocation.php")

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
Everything looks great! No dangerous files found in this plugin1,616 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP118913821
CSS18416467
JavaScript4474328

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity26.00
▷ Minimum class complexity7.00
▷ Maximum class complexity51.00
Average method complexity3.92
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods29
▷ Static methods13.45%
▷ Public methods2275.86%
▷ Protected methods26.90%
▷ Private methods517.24%
Functions8
▷ Named functions00.00%
▷ Anonymous functions8100.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
242 compressed PNG files occupy 0.41MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/flags/TG-flag.png0.44KB0.44KB▼ 1.11%
assets/img/flags/MU-flag.png0.13KB0.13KB0.00%
assets/img/flags/TK-flag.png4.26KB2.17KB▼ 49.04%
assets/img/flags/NR-flag.png0.44KB0.47KB0.00%
assets/img/flags/NI-flag.png0.88KB0.84KB▼ 4.89%