84% wpg-restrict-it

Code Review | Restrict It

WordPress plugin Restrict It scored84%from 54 tests.

About plugin

  • Plugin page: wpg-restrict-it
  • Plugin version: 2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.0
  • WordPress version: 6.3.1
  • First release: Jan 9, 2014
  • Latest release: Nov 28, 2016
  • Number of updates: 19
  • Update frequency: every 55.5 days
  • Top authors: rakeshraja (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /735 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼7.57ms] Passed 4 tests

A check of server-side resources used by Restrict It
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0144.84 ▼0.99
Dashboard /wp-admin3.32 ▲0.0148.20 ▼5.78
Posts /wp-admin/edit.php3.37 ▲0.0147.27 ▼4.55
Add New Post /wp-admin/post-new.php5.90 ▲0.0185.91 ▼18.94
Media Library /wp-admin/upload.php3.24 ▲0.0137.05 ▲2.21

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

Restrict It: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.67 ▲0.321.88 ▼0.2642.30 ▲0.50
Dashboard /wp-admin2,198 ▲245.62 ▲0.0488.31 ▼7.2345.56 ▲0.84
Posts /wp-admin/edit.php2,100 ▼01.97 ▼0.0535.39 ▼6.6333.20 ▼3.33
Add New Post /wp-admin/post-new.php1,526 ▼023.40 ▲0.33680.49 ▲3.5150.48 ▲0.68
Media Library /wp-admin/upload.php1,400 ▲34.13 ▼0.1196.77 ▼5.0944.74 ▲2.67

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means 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
The following issues need your attention
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wpg-restrict-it/index.php:23

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 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
2 plugin tags: comments, restrict

wpg-restrict-it/index.php 92% from 13 tests

Analyzing the main PHP file in "Restrict It" version 2.0
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("wpg-restrict-it.php" instead of "index.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
Good job! No executable or dangerous file extensions detected66 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP1151036
JavaScript162530

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.21
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%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
restrict.png1.06KB0.22KB▼ 78.97%