83% restrict-country-access

Code Review | Restrict Country Access

WordPress plugin Restrict Country Access scored83%from 54 tests.

About plugin

  • Plugin page: restrict-country-...
  • Plugin version: 1.1.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Apr 15, 2022
  • Latest release: Jan 10, 2023
  • Number of updates: 12
  • Update frequency: every 22.8 days
  • Top authors: biliplugins (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /1,870 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.22MB] [CPU: ▲2,178.07ms] 75% from 4 tests

A check of server-side resources used by Restrict Country Access
It is recommended to improve the following
  • Extra CPU: Try to keep extra CPU usage under 200.00ms (currently 2,178.07ms on /wp-admin/upload.php)
PageMemory (MB)CPU Time (ms)
Home /50.23 ▲46.729,690,535.98 ▲9,690,491.65
Dashboard /wp-admin50.48 ▲0.269,691,113.71 ▲8,719.59
Posts /wp-admin/edit.php3.65 ▲0.2452.91 ▲0.49
Add New Post /wp-admin/post-new.php6.14 ▲0.2189.23 ▼12.15
Media Library /wp-admin/upload.php3.46 ▲0.1840.31 ▲4.34

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 23 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
db_upgraded
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Restrict Country Access
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,799 ▲2814.39 ▼0.341.61 ▼0.6439.98 ▼6.67
Dashboard /wp-admin2,215 ▲385.86 ▲0.1991.10 ▲0.5240.74 ▼5.42
Posts /wp-admin/edit.php2,117 ▲142.29 ▲0.3233.99 ▼1.6729.36 ▼3.09
Add New Post /wp-admin/post-new.php7,291 ▲5,76526.44 ▲3.42979.10 ▲282.8161.89 ▲7.28
Media Library /wp-admin/upload.php1,423 ▲264.34 ▲0.14109.16 ▲1.9947.00 ▼0.16

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/restrict-country-access/restrict-country.php:30

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, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Option to set Country which you want to restrict screenshot-1.png.), #2 (Selected Country will be Restricted screenshot-2.png.)
The official readme.txt is a good inspiration

restrict-country-access/restrict-country.php 85% from 13 tests

Analyzing the main PHP file in "Restrict Country Access" version 1.1.0
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("restrict-country-access.php" instead of "restrict-country.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin31,260 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
JSON30029,820
PHP5741261,318
JavaScript6154987
Markdown19033
CSS2002

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions12
▷ Named functions12100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png24.78KB9.63KB▼ 61.14%
screenshot-2.png13.58KB4.87KB▼ 64.16%