84% ip2location-world-clock

Code Review | IP2Location World Clock

WordPress plugin IP2Location World Clock scored84%from 54 tests.

About plugin

  • Plugin page: ip2location-world...
  • Plugin version: 1.1.6
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Aug 2, 2019
  • Latest release: Nov 14, 2023
  • Number of updates: 79
  • Update frequency: every 19.8 days
  • Top authors: ip2location (100%)

Code review

54 tests

User reviews

1 review

Install metrics

300+ active /7,371 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲0.40MB] [CPU: ▼9.11ms] Passed 4 tests

An overview of server-side resources used by IP2Location World Clock
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.88 ▲0.4139.61 ▼2.17
Dashboard /wp-admin3.72 ▲0.3746.83 ▼16.69
Posts /wp-admin/edit.php3.83 ▲0.4751.60 ▲1.28
Add New Post /wp-admin/post-new.php6.30 ▲0.4083.61 ▼18.84
Media Library /wp-admin/upload.php3.64 ▲0.4038.42 ▲5.89

Server storage [IO: ▲2.93MB] [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: 152 new files
Database: no new tables, 7 new options
New WordPress options
widget_iwc
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for IP2Location World Clock
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,802 ▲3014.27 ▼0.121.57 ▼0.4439.33 ▼3.06
Dashboard /wp-admin2,210 ▲365.64 ▼0.0392.64 ▼8.3040.29 ▼2.18
Posts /wp-admin/edit.php2,115 ▲121.97 ▼0.0439.87 ▲0.9935.23 ▼1.12
Add New Post /wp-admin/post-new.php1,536 ▲1023.22 ▼0.30673.07 ▼24.2155.37 ▼5.40
Media Library /wp-admin/upload.php1,409 ▲64.21 ▲0.02102.81 ▲4.4948.16 ▲5.34

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 7 options in the database
    • db_upgraded
    • widget_iwc
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ip2location-world-clock/ip2location-world-clock-menu.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/ip2location-world-clock/ip2location-world-clock.php:13

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 on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
8 plugin tags: local time, world clock, analog clock, clock, digital clock...

ip2location-world-clock/ip2location-world-clock.php Passed 13 tests

The main file in "IP2Location World Clock" v. 1.1.6 serves as a complement to information provided in readme.txt and as the entry point to the plugin
68 characters long description:
Display analog or digital clock on your site based on time selection

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin8,357 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP48098766,209
CSS1194171,609
JavaScript28314539

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 376)
Cyclomatic complexity
Average complexity per logical line of code1.02
Average class complexity283.00
▷ Minimum class complexity185.00
▷ Maximum class complexity381.00
Average method complexity13.22
▷ Minimum method complexity1.00
▷ Maximum method complexity376.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods47
▷ Static methods00.00%
▷ Public methods1531.91%
▷ Protected methods00.00%
▷ Private methods3268.09%
Functions17
▷ Named functions1588.24%
▷ Anonymous functions211.76%
Constants57
▷ Global constants35.26%
▷ Class constants5494.74%
▷ Public constants54100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
133 PNG files occupy 1.84MB with 0.89MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/bg/clock_bg22.png51.86KB21.31KB▼ 58.90%
assets/images/bg/clock_bg20.png43.09KB17.86KB▼ 58.55%
assets/images/example/clock18.png31.60KB16.42KB▼ 48.04%
assets/images/hand/min22.png0.27KB0.20KB▼ 26.62%
assets/images/example/clock10.png6.24KB3.14KB▼ 49.72%