78% geoswitch

Code Review | Geocode Switch

WordPress plugin Geocode Switch scored78%from 54 tests.

About plugin

  • Plugin page: geoswitch
  • Plugin version: 1.1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.9.7
  • WordPress version: 6.3.1
  • First release: Dec 9, 2014
  • Latest release: Jul 21, 2018
  • Number of updates: 29
  • Update frequency: every 45.7 days
  • Top authors: elialgranti (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

80+ active /3,613 total downloads

Benchmarks

Plugin footprint 82% 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.28MB] [CPU: ▲1.16ms] Passed 4 tests

This is a short check of server-side resources used by Geocode Switch
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.75 ▲0.2943.80 ▲1.60
Dashboard /wp-admin3.63 ▲0.3253.85 ▲2.08
Posts /wp-admin/edit.php3.68 ▲0.3254.27 ▲4.26
Add New Post /wp-admin/post-new.php6.15 ▲0.2686.37 ▼3.29
Media Library /wp-admin/upload.php3.49 ▲0.2640.89 ▲4.81
GeoSwitch /wp-admin/options-general.php?page=geoswitch/class.geoswitch_admin.php3.4632.51

Server storage [IO: ▲54.53MB] [DB: ▲0.00MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Please fix the following
  • Total filesystem usage must be limited to 25MB (currently using 54.53MB)
Filesystem: 92 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
geoswitch_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Geocode Switch: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.72 ▲0.521.72 ▲0.0946.09 ▲3.00
Dashboard /wp-admin2,196 ▲195.62 ▲0.0198.27 ▲4.5645.02 ▲2.17
Posts /wp-admin/edit.php2,101 ▼21.97 ▲0.0233.35 ▼5.7234.81 ▼3.88
Add New Post /wp-admin/post-new.php1,531 ▲523.11 ▼0.02638.12 ▼42.7455.71 ▼2.06
Media Library /wp-admin/upload.php1,398 ▼54.18 ▲0.0494.12 ▼8.2640.47 ▼2.30
GeoSwitch /wp-admin/options-general.php?page=geoswitch/class.geoswitch_admin.php8892.1923.9126.79

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/geoswitch/class.geoswitch.php
    • > /wp-content/plugins/geoswitch/geoswitch.php
    • > /wp-content/plugins/geoswitch/class.geoswitch_admin.php
  • 34× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geoswitch/vendor/geoip2/geoip2/src/Record/Postal.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/geoswitch/vendor/geoip2/geoip2/src/Exception/HttpException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geoswitch/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/geoswitch/vendor/geoip2/geoip2/src/Record/Country.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geoswitch/vendor/geoip2/geoip2/src/Record/Location.php:36
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geoswitch/vendor/geoip2/geoip2/src/Record/MaxMind.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'MaxMind\\WebService\\Http\\Request' not found in wp-content/plugins/geoswitch/vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\WebServiceException' not found in wp-content/plugins/geoswitch/vendor/maxmind/web-service-common/src/Exception/HttpException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geoswitch/vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\AbstractModel' not found in wp-content/plugins/geoswitch/vendor/geoip2/geoip2/src/Model/AnonymousIp.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that need to be fixed:
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
You can take inspiration from this readme.txt

geoswitch/geoswitch.php Passed 13 tests

"Geocode Switch" version 1.1.4's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
117 characters long description:
GeoSwitch is a plugin that allows you to change the content of your site based on the location of your client’s IP.

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
There were no executable files found in this plugin4,352 lines of code in 81 files:
LanguageFilesBlank linesComment linesLines of code
PHP645511,5152,656
Markdown73460784
C17315476
JSON600374
Bourne Shell120040
m415014
C/C++ Header14128

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity6.45
▷ Minimum class complexity1.00
▷ Maximum class complexity50.00
Average method complexity2.62
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces14
Interfaces4
Traits0
Classes51
▷ Abstract classes35.88%
▷ Concrete classes4894.12%
▷ Final classes00.00%
Methods179
▷ Static methods4726.26%
▷ Public methods12770.95%
▷ Protected methods10.56%
▷ Private methods5128.49%
Functions6
▷ Named functions233.33%
▷ Anonymous functions466.67%
Constants5
▷ Global constants360.00%
▷ Class constants240.00%
▷ Public constants2100.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
No PNG images were found in this plugin