74% ip2location-hello-greeting

Code Review | IP2Location Hello Greeting

WordPress plugin IP2Location Hello Greeting scored74%from 54 tests.

About plugin

  • Plugin page: ip2location-hello...
  • Plugin version: 1.2.7
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0-6.2
  • WordPress version: 6.3.1
  • First release: Sep 27, 2016
  • Latest release: Mar 31, 2023
  • Number of updates: 44
  • Update frequency: every 54.0 days
  • Top authors: ip2location (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,620 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.20MB] [CPU: ▼7.52ms] Passed 4 tests

A check of server-side resources used by IP2Location Hello Greeting
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.10 ▲0.6445.79 ▲2.30
Dashboard /wp-admin3.44 ▲0.1050.63 ▼16.11
Posts /wp-admin/edit.php3.55 ▲0.2046.93 ▼3.56
Add New Post /wp-admin/post-new.php6.25 ▲0.3690.11 ▼12.71
Media Library /wp-admin/upload.php3.36 ▲0.1439.36 ▲2.99
IP2Location Hello Greeting /wp-admin/options-general.php?page=ip2location-hello-greeting3.8436.19

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 48 new files
Database: no new tables, 10 new options
New WordPress options
can_compress_scripts
ip2location_hello_greeting_debug_log_enabled
widget_ip2locationhellogreeting
widget_recent-comments
widget_recent-posts
ip2location_hello_greeting_database
theysaidso_admin_options
widget_theysaidso_widget
ip2location_hello_greeting_lookup_mode
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for IP2Location Hello Greeting
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.25 ▼0.171.88 ▲0.2244.59 ▲0.92
Dashboard /wp-admin2,199 ▲255.57 ▲0.0088.39 ▼1.7643.39 ▼3.35
Posts /wp-admin/edit.php2,104 ▲72.02 ▼0.0434.40 ▼2.3943.18 ▲8.21
Add New Post /wp-admin/post-new.php1,529 ▲323.14 ▼0.06671.00 ▼6.6068.79 ▲12.45
Media Library /wp-admin/upload.php1,398 ▼24.21 ▲0.01109.01 ▲9.7647.17 ▲0.56
IP2Location Hello Greeting /wp-admin/options-general.php?page=ip2location-hello-greeting9181.9926.9137.62

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
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • widget_ip2locationhellogreeting
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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 take a closer look at the following
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/ip2location-hello-greeting/ip2location-hello-greeting.php:16
    • > PHP Fatal error
      Uncaught Exception: IP2Location\\WebService: OK in wp-content/plugins/ip2location-hello-greeting/vendor/ip2location/ip2location-php/IP2Location.php:2203

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
5 plugin tags: ip geolocation, targeted content, geolocation, customize message, greeting message

ip2location-hello-greeting/ip2location-hello-greeting.php Passed 13 tests

"IP2Location Hello Greeting" version 1.2.7's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
99 characters long description:
Displays the Hello greeting message in visitor's native language based on visitor's origin country.

Code Analysis 3% 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
  • Do not include executable or dangerous files in your plugin
    • .bin - Binary Executable in Windows, macOS, Linux
      • wp-content/plugins/ip2location-hello-greeting/vendor/ip2location/ip2location-php/databases/IP2LOCATION-LITE-DB1.BIN
      • wp-content/plugins/ip2location-hello-greeting/IP2LOCATION-LITE-DB1.BIN
2,048 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP114211,1381,879
Markdown129065
JavaScript19060
JSON10044

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 103)
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity60.17
▷ Minimum class complexity1.00
▷ Maximum class complexity166.00
Average method complexity5.20
▷ Minimum method complexity1.00
▷ Maximum method complexity103.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods86
▷ Static methods1315.12%
▷ Public methods5361.63%
▷ Protected methods00.00%
▷ Private methods3338.37%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants53
▷ Global constants23.77%
▷ Class constants5196.23%
▷ Public constants51100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
25 PNG files occupy 0.17MB with 0.10MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
hello_top25/jv.png6.41KB2.49KB▼ 61.20%
hello_top25/pt.png6.58KB2.54KB▼ 61.48%
hello_top25/de.png6.39KB2.45KB▼ 61.67%
hello_top25/pl.png7.04KB2.60KB▼ 63.12%
hello_top25/it.png6.70KB2.54KB▼ 62.01%