73% restrict-for-elementor

Code Review | Restrict for Elementor

WordPress plugin Restrict for Elementor scored73%from 54 tests.

About plugin

  • Plugin page: restrict-for-elem...
  • Plugin version: 1.0.6
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-6.2.2
  • WordPress version: 6.3.1
  • First release: Jul 1, 2021
  • Latest release: Jul 5, 2023
  • Number of updates: 8
  • Update frequency: every 92.1 days
  • Top authors: restrict (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

800+ active /3,932 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲5.04MB] [CPU: ▲27.61ms] 75% from 4 tests

Analyzing server-side resources used by Restrict for Elementor
Please take the time to fix the following items
  • Extra RAM: Try to keep extra memory usage under 5MB (currently 5.04MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /8.91 ▲5.4564.94 ▲23.55
Dashboard /wp-admin8.93 ▲5.6284.23 ▲35.30
Posts /wp-admin/edit.php8.93 ▲5.5782.60 ▲29.62
Add New Post /wp-admin/post-new.php9.40 ▲3.51115.90 ▲21.98
Media Library /wp-admin/upload.php8.93 ▲5.7081.51 ▲40.79
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius8.9361.96

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 235 new files
Database: no new tables, 9 new options
New WordPress options
fs_active_plugins
widget_recent-comments
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_recent-posts
fs_accounts
widget_theysaidso_widget
fs_debug_mode

Browser metrics Passed 4 tests

A check of browser resources used by Restrict for Elementor
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,849 ▲10314.42 ▲0.041.87 ▲0.0034.40 ▼17.35
Dashboard /wp-admin2,255 ▲675.78 ▼0.11116.23 ▲4.1246.40 ▲2.42
Posts /wp-admin/edit.php2,138 ▲462.02 ▲0.0440.52 ▼2.0344.55 ▲9.87
Add New Post /wp-admin/post-new.php1,544 ▲3022.96 ▲5.16686.28 ▲13.4658.45 ▼6.17
Media Library /wp-admin/upload.php1,434 ▲464.24 ▼0.06106.19 ▼22.2353.02 ▲2.33
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,0981.6929.3929.85

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/restrict-for-elementor/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • Zombie WordPress options were found after uninstall: 9 options
    • widget_theysaidso_widget
    • fs_active_plugins
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • fs_debug_mode
    • fs_accounts

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 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 8× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Elementor\\add_filter() in wp-content/plugins/restrict-for-elementor/free-addons/user_role.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/restrict-for-elementor/free-addons/logged_in_users.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Elementor\\add_filter() in wp-content/plugins/restrict-for-elementor/free-addons/user_meta.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Elementor\\add_action() in wp-content/plugins/restrict-for-elementor/control.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/restrict-for-elementor/free-addons/post_author.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/restrict-for-elementor/settings/settings.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Elementor\\add_filter() in wp-content/plugins/restrict-for-elementor/free-addons/location.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Elementor\\add_filter() in wp-content/plugins/restrict-for-elementor/free-addons/user_capability.php:8

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
9 plugin tags: restrict access, easy digital downloads, tickera, elementor, restricted content...

restrict-for-elementor/index.php 92% from 13 tests

The entry point to "Restrict for Elementor" version 1.0.6 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("restrict-for-elementor.php" instead of "index.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin38,219 lines of code in 163 files:
LanguageFilesBlank linesComment linesLines of code
PHP1288,20117,32434,909
CSS1633771,592
SVG142551,520
JavaScript53459198

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please tend to the following items
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity82.20
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.56
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes56
▷ Abstract classes23.57%
▷ Concrete classes5496.43%
▷ Final classes00.00%
Methods1,307
▷ Static methods20115.38%
▷ Public methods91770.16%
▷ Protected methods171.30%
▷ Private methods37328.54%
Functions99
▷ Named functions99100.00%
▷ Anonymous functions00.00%
Constants146
▷ Global constants9867.12%
▷ Class constants4832.88%
▷ Public constants48100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
23 PNG files occupy 1.02MB with 0.62MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/geolocation.png109.75KB37.94KB▼ 65.43%
assets/images/specific-meta-value.png58.47KB19.39KB▼ 66.84%
assets/icon-128x128.png3.74KB2.29KB▼ 38.95%
assets/images/box-corner-gray.png1.25KB0.55KB▼ 55.92%
assets/images/restrict-part.png64.05KB15.47KB▼ 75.85%