84% restricted-blocks

Code Review | Restricted Blocks

WordPress plugin Restricted Blocks scored84%from 54 tests.

About plugin

  • Plugin page: restricted-blocks
  • Plugin version: 1.11
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.1
  • WordPress version: 6.3.1
  • First release: Sep 1, 2021
  • Latest release: Nov 15, 2022
  • Number of updates: 3
  • Update frequency: every 146.7 days
  • Top authors: daext (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /867 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.29MB] [CPU: ▼1.71ms] Passed 4 tests

This is a short check of server-side resources used by Restricted Blocks
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.1342.56 ▲1.35
Dashboard /wp-admin3.70 ▲0.3956.82 ▲1.57
Posts /wp-admin/edit.php3.75 ▲0.3951.61 ▲0.57
Add New Post /wp-admin/post-new.php6.22 ▲0.33103.20 ▼9.21
Media Library /wp-admin/upload.php3.56 ▲0.3338.60 ▲0.46
Help /wp-admin/admin.php?page=daextrebl-help3.5238.22
Restrictions /wp-admin/admin.php?page=daextrebl-restrictions3.9445.26
Pro Version /wp-admin/admin.php?page=daextrebl-pro-version3.5334.17
Options /wp-admin/admin.php?page=daextrebl-options3.5336.92

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 125 new files
Database: 1 new table, 25 new options
New tables
wp_daextrebl_restriction
New WordPress options
daextrebl_controls_background_color
daextrebl_google_font_url
daextrebl_font_family
widget_recent-posts
daextrebl_title_font_color
daextrebl_controls_label_color
daextrebl_buttons_font_color
theysaidso_admin_options
widget_recent-comments
daextrebl_restrictions_menu_capability
...

Browser metrics Passed 4 tests

Checking browser requirements for Restricted Blocks
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,941 ▲18013.52 ▼0.869.12 ▲7.4739.92 ▼6.51
Dashboard /wp-admin2,230 ▲535.63 ▼0.0591.36 ▲2.3239.47 ▼6.32
Posts /wp-admin/edit.php2,135 ▲351.97 ▲0.0139.16 ▲3.0436.74 ▲0.26
Add New Post /wp-admin/post-new.php1,561 ▲3523.69 ▲0.13635.02 ▼60.9864.03 ▲8.89
Media Library /wp-admin/upload.php1,429 ▲294.16 ▼0.0599.49 ▼4.2945.94 ▲0.91
Help /wp-admin/admin.php?page=daextrebl-help8442.0023.1328.48
Restrictions /wp-admin/admin.php?page=daextrebl-restrictions3,3885.53106.9568.87
Pro Version /wp-admin/admin.php?page=daextrebl-pro-version8512.0025.3128.42
Options /wp-admin/admin.php?page=daextrebl-options2,2943.4091.3333.20

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded

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
Even though no errors were found, this is by no means an exhaustive test

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
Please fix the following items
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/restricted-blocks/admin/view/options.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/restricted-blocks/admin/view/restrictions.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/restricted-blocks/admin/view/pro_version.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/restricted-blocks/admin/view/help.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Tags: There are too many tags (12 tag instead of maximum 10)
Please take inspiration from this readme.txt

restricted-blocks/init.php 92% from 13 tests

The primary PHP file in "Restricted Blocks" version 1.11 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("restricted-blocks.php" instead of "init.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin17,972 lines of code in 108 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript742,82788011,388
CSS14621873,230
PHP151,0201,3863,054
Markdown21160249
JSON10031
SVG20020

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity37.14
▷ Minimum class complexity4.00
▷ Maximum class complexity136.00
Average method complexity2.95
▷ Minimum method complexity1.00
▷ Maximum method complexity78.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods130
▷ Static methods1612.31%
▷ Public methods11991.54%
▷ Protected methods21.54%
▷ Private methods96.92%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants00.00%
▷ Class constants9100.00%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
15 PNG files occupy 0.12MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/assets/img/edit-hover.png1.30KB0.33KB▼ 74.47%
admin/assets/img/help-f7f7f7.png15.86KB0.59KB▼ 96.25%
admin/assets/img/clone.png18.71KB0.12KB▼ 99.34%
admin/assets/img/search-hover.png0.21KB0.21KB0.00%
admin/assets/img/search.png0.21KB0.21KB0.00%