83% if-block-visibility-control-for-blocks

Code Review | If Block — Visibility control for Blocks

WordPress plugin If Block — Visibility control for Blocks scored83%from 54 tests.

About plugin

  • Plugin page: if-block-visibili...
  • Plugin version: 1.2.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.4
  • WordPress version: 6.3.1
  • First release: Apr 5, 2020
  • Latest release: Jun 15, 2020
  • Number of updates: 7
  • Update frequency: every 10.7 days
  • Top authors: mahdiyazdani (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /614 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.09MB] [CPU: ▼4.86ms] Passed 4 tests

A check of server-side resources used by If Block — Visibility control for Blocks
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0943.25 ▼1.59
Dashboard /wp-admin3.39 ▲0.0950.83 ▲0.55
Posts /wp-admin/edit.php3.50 ▲0.1548.87 ▼8.70
Add New Post /wp-admin/post-new.php5.98 ▲0.1090.69 ▼7.30
Media Library /wp-admin/upload.php3.31 ▲0.0834.47 ▼1.84

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-posts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for If Block — Visibility control for Blocks
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.21 ▼0.341.80 ▲0.1944.48 ▲2.82
Dashboard /wp-admin2,192 ▲125.62 ▼0.0492.51 ▼0.3243.83 ▼1.94
Posts /wp-admin/edit.php2,097 ▼32.02 ▲0.0238.57 ▼1.2337.86 ▼2.97
Add New Post /wp-admin/post-new.php6,192 ▲4,66419.25 ▼3.89883.24 ▲266.3154.45 ▼1.78
Media Library /wp-admin/upload.php1,400 ▲64.22 ▲0.1096.11 ▼6.6739.63 ▼12.18

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • 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
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
Almost there! Just fix the following items
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function IfBlock\\Includes\\wp_die() in wp-content/plugins/if-block-visibility-control-for-blocks/includes/class-block.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function IfBlock\\wp_die() in wp-content/plugins/if-block-visibility-control-for-blocks/class-ifblock.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function IfBlock\\Includes\\wp_die() in wp-content/plugins/if-block-visibility-control-for-blocks/includes/class-api.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 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
7 plugin tags: if block, block logic, user role, conditional logic, conditional display...

if-block-visibility-control-for-blocks/class-ifblock.php 77% from 13 tests

"If Block — Visibility control for Blocks" version 1.2.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Description: Please keep the plugin description shorter than 140 characters (currently 152 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("if-block-visibility-control-for-blocks.php" instead of "class-ifblock.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 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected338 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP671259334
CSS2002
JavaScript1042

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity11.33
▷ Minimum class complexity2.00
▷ Maximum class complexity24.00
Average method complexity2.32
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes3100.00%
Methods23
▷ Static methods730.43%
▷ Public methods1982.61%
▷ Protected methods14.35%
▷ Private methods313.04%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants6
▷ Global constants6100.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
There are no PNG files in this plugin