72% restricted-content

Code Review | Restrict - membership, site, content and user access restrictions for WordPress

WordPress plugin Restrict - membership, site, content and user access restrictions for WordPress scored 72% from 54 tests.

About plugin

  • Plugin page: restricted-content
  • Plugin version: 2.2.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-6.3.1
  • WordPress version: 6.3.1
  • First release: Oct 10, 2016
  • Latest release: Sep 15, 2023
  • Number of updates: 48
  • Update frequency: every 52.8 days
  • Top authors: tickera (100%)

Code review

54 tests

User reviews

22 reviews

Install metrics

2,000+ active / 43,373 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.60MB] [CPU: ▼2.99ms] Passed 4 tests

This is a short check of server-side resources used by Restrict - membership, site, content and user access restrictions for WordPress
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.07 ▲0.6239.30 ▼4.78
Dashboard /wp-admin3.91 ▲0.6150.16 ▼0.34
Posts /wp-admin/edit.php3.96 ▲0.6152.02 ▲5.24
Add New Post /wp-admin/post-new.php6.46 ▲0.5790.75 ▼8.16
Media Library /wp-admin/upload.php3.82 ▲0.5937.88 ▲1.34
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius4.0037.63

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 248 new files
Database: no new tables, 9 new options
New WordPress options
fs_debug_mode
widget_theysaidso_widget
db_upgraded
widget_recent-comments
fs_active_plugins
widget_recent-posts
fs_accounts
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Restrict - membership, site, content and user access restrictions for WordPress
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,874 ▲13913.36 ▼1.011.71 ▼0.2932.67 ▼10.85
Dashboard /wp-admin2,252 ▲614.93 ▲0.03114.40 ▲7.8160.73 ▲20.38
Posts /wp-admin/edit.php2,141 ▲522.15 ▲0.1641.52 ▲4.2053.21 ▲16.31
Add New Post /wp-admin/post-new.php6,585 ▲5,06120.37 ▼2.92931.30 ▲322.2474.88 ▲24.27
Media Library /wp-admin/upload.php1,434 ▲464.37 ▲0.17102.35 ▲3.7755.99 ▲13.46
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,1151.8428.2442.42

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/restricted-content/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • fs_debug_mode
    • widget_recent-comments
    • theysaidso_admin_options
    • fs_accounts
    • fs_active_plugins

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
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
Please take a closer look at the following
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/restricted-content/includes/freeaddons/simple-urls.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/restricted-content/includes/freeaddons/siteorigin-integration.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_reset_vars() in wp-content/plugins/restricted-content/includes/settings/settings.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/restricted-content/includes/freeaddons/comments.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function restrict_fs() in wp-content/plugins/restricted-content/includes/settings/welcome-page.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function rsc_iw_is_wl() in wp-content/plugins/restricted-content/includes/settings/settings-general.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/restricted-content/includes/freeaddons/woocommerce-shop-page.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 79% 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
5 plugin tags: protect content, restricted content, restrict content, restrict access, restrict site

restricted-content/index.php 54% from 13 tests

The main file in "Restrict - membership, site, content and user access restrictions for WordPress" v. 2.2.5 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Domain Path: The domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("languages")
  • Description: Please don't use more than 140 characters for the plugin description (currently 247 characters long)
  • Domain Path: Please prefix the domain path with a forward slash character ("/languages")
  • Main file name: Name the main plugin file the same as the plugin slug ("restricted-content.php" instead of "index.php")
  • Plugin Name: A shorter plugin name is better (currently 79 characters long instead of max. 70)

Code Analysis 97% from 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 detected55,437 lines of code in 166 files:
LanguageFilesBlank linesComment linesLines of code
PHP1308,48817,61937,142
PO File126,9608,45515,240
CSS16316321,846
JavaScript613883751
SVG21341458

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
It is recommended to fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity96.90
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.81
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes51
▷ Abstract classes23.92%
▷ Concrete classes4996.08%
▷ Final classes00.00%
Methods1,311
▷ Static methods22817.39%
▷ Public methods92270.33%
▷ Protected methods171.30%
▷ Private methods37228.38%
Functions131
▷ Named functions131100.00%
▷ Anonymous functions00.00%
Constants146
▷ Global constants9967.81%
▷ Class constants4732.19%
▷ Public constants47100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
35 PNG files occupy 1.53MB with 1.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/restrict-categories.png27.95KB8.66KB▼ 69.01%
assets/images/restrict-login.png30.98KB11.14KB▼ 64.04%
assets/images/restrict-part@2x.png125.84KB28.51KB▼ 77.35%
assets/images/general-header@2x.png231.07KB70.05KB▼ 69.69%
assets/images/restrict-widget.png32.24KB11.21KB▼ 65.23%