44% restrict-content

Code Review | Membership Plugin - Restrict Content

WordPress plugin Membership Plugin - Restrict Content scored44%from 54 tests.

About plugin

  • Plugin page: restrict-content
  • Plugin version: 3.2.8
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.3
  • WordPress version: 6.3.1
  • First release: Jul 24, 2010
  • Latest release: Nov 6, 2023
  • Number of updates: 148
  • Update frequency: every 32.8 days
  • Top authors: reedyseth (29.73%)mordauk (27.7%)ajmorris (11.49%)jthillithemes (8.78%)mindctrl (8.78%)

Code review

54 tests

User reviews

88 reviews

Install metrics

10,000+ active /476,253 total downloads

Benchmarks

Plugin footprint 64% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲7.11MB] [CPU: ▲67.31ms] 50% from 4 tests

An overview of server-side resources used by Membership Plugin - Restrict Content
The following require your attention
  • RAM: You should keep total memory usage under 10MB (currently 10.95MB on /wp-admin/admin.php?page=restrict-content-welcome)
  • Extra RAM: The extra memory usage should kept under 5MB (currently 7.11MB on /wp-admin/admin.php?page=restrict-content-welcome)
PageMemory (MB)CPU Time (ms)
Home /9.10 ▲5.6491.31 ▲52.21
Dashboard /wp-admin10.97 ▲7.63202.99 ▲142.32
Posts /wp-admin/edit.php10.95 ▲7.59121.17 ▲73.81
Add New Post /wp-admin/post-new.php13.45 ▲7.56158.60 ▲67.06
Media Library /wp-admin/upload.php10.95 ▲7.72112.03 ▲76.17
Memberships /wp-admin/admin.php?page=rcp-members10.95103.77
Payments /wp-admin/admin.php?page=rcp-payments10.95124.04
Customers /wp-admin/admin.php?page=rcp-customers10.9595.62
Membership Levels /wp-admin/admin.php?page=rcp-member-levels10.95102.47
Restrict Access /wp-admin/edit.php?post_type=page&page=rcp-restrict-post-type-page10.9592.60
Settings /wp-admin/admin.php?page=rcp-settings10.9598.63
Subscription Reminder /wp-admin/admin.php?page=rcp-reminder10.95106.15
Restrict Access /wp-admin/edit.php?page=rcp-restrict-post-type10.9597.28
Help /wp-admin/admin.php?page=rcp-need-help10.9593.14
RCP Welcome /wp-admin/admin.php?page=restrict-content-welcome10.95103.96

Server storage [IO: ▲12.06MB] [DB: ▲0.02MB] Passed 3 tests

Filesystem and database footprint
No storage issues were detected
Filesystem: 902 new files
Database: 11 new tables, 26 new options
New tables
wp_rcp_discounts
wp_rcp_subscription_level_meta
wp_rcp_membershipmeta
wp_rcp_queue
wp_rcp_payment_meta
wp_restrict_content_pro
wp_rcp_logs
wp_rcp_memberships
wp_rcp_membership_counts
wp_rcp_customers
...
New WordPress options
wpdb_restrict_content_pro_version
restrict_content_chosen_version
rcp_db_version
rcp_is_installed
wpdb_rcp_memberships_version
rcp_payments_db_version
stellarwp_telemetry_restrict-content_show_optin
can_compress_scripts
rcp_version
wpdb_rcp_logs_version
...

Browser metrics Passed 4 tests

Membership Plugin - Restrict Content: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,892 ▲14514.33 ▲0.201.84 ▲0.3138.74 ▲1.02
Dashboard /wp-admin2,291 ▲1105.66 ▼0.0499.62 ▼4.3645.38 ▲5.97
Posts /wp-admin/edit.php2,200 ▲1032.04 ▲0.0541.60 ▲4.9940.49 ▲4.27
Add New Post /wp-admin/post-new.php2,018 ▲49220.40 ▼2.72637.21 ▼75.4737.31 ▼21.32
Media Library /wp-admin/upload.php1,499 ▲1024.19 ▲0.02100.45 ▲1.7643.22 ▲0.12
Memberships /wp-admin/admin.php?page=rcp-members1,4012.0337.0554.92
Payments /wp-admin/admin.php?page=rcp-payments1,3982.2037.2938.26
Customers /wp-admin/admin.php?page=rcp-customers1,3288.6893.2839.70
Membership Levels /wp-admin/admin.php?page=rcp-member-levels1,7622.4039.2342.95
Restrict Access /wp-admin/edit.php?post_type=page&page=rcp-restrict-post-type-page1,1432.3334.6128.78
Settings /wp-admin/admin.php?page=rcp-settings4,1327.83179.37150.35
Subscription Reminder /wp-admin/admin.php?page=rcp-reminder1,9346.66138.4556.82
Restrict Access /wp-admin/edit.php?page=rcp-restrict-post-type1,1432.2133.1530.39
Help /wp-admin/admin.php?page=rcp-need-help1,2782.1331.6451.07
RCP Welcome /wp-admin/admin.php?page=restrict-content-welcome1,1152.2728.5447.88

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie tables detected upon uninstall: 11 tables
    • wp_rcp_queue
    • wp_rcp_logs
    • wp_rcp_payments
    • wp_rcp_membershipmeta
    • wp_rcp_payment_meta
    • wp_restrict_content_pro
    • wp_rcp_membership_counts
    • wp_rcp_customers
    • wp_rcp_discounts
    • wp_rcp_memberships
    • ...
  • This plugin did not uninstall successfully, leaving 26 options in the database
    • rcp_reminder_notices
    • wpdb_rcp_membershipmeta_version
    • rcp_install_pages_created
    • stellarwp_telemetry
    • can_compress_scripts
    • rcp_db_version
    • db_upgraded
    • widget_recent-posts
    • wpdb_rcp_queue_version
    • rcp_version
    • ...

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=page&page=rcp-restrict-post-type-page
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

SRP 0% 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
Almost there! Just fix the following items
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/restrict-content/core/includes/libraries/stripe/build.php
    • > /wp-content/plugins/restrict-content/core/includes/libraries/stripe/update_certs.php
  • 360× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/restrict-content/core/includes/libraries/stripe/lib/Topup.php:32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/restrict-content/core/includes/redirects.php:74
    • > PHP Fatal error
      Uncaught Error: Class 'RCP\\StellarWP\\Telemetry\\Contracts\\Abstract_Subscriber' not found in wp-content/plugins/restrict-content/vendor/strauss/stellarwp/telemetry/src/Telemetry/Admin/Admin_Subscriber.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractServiceFactory' not found in wp-content/plugins/restrict-content/core/includes/libraries/stripe/lib/Service/Issuing/IssuingServiceFactory.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/restrict-content/core/includes/libraries/stripe/lib/Service/Apps/SecretService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/restrict-content/core/includes/libraries/stripe/lib/Treasury/ReceivedCredit.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/restrict-content/core/includes/libraries/stripe/lib/Service/ProductService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractServiceFactory' not found in wp-content/plugins/restrict-content/core/includes/libraries/stripe/lib/Service/Radar/RadarServiceFactory.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/restrict-content/legacy/includes/scripts.php:44
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Container\\ContainerExceptionInterface' not found in wp-content/plugins/restrict-content/vendor/strauss/lucatume/di52/src/ContainerException.php:24

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=restrict-content-welcome
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of undefined (reading 'hasAttribute')" "TypeError: Cannot read properties of undefined (reading 'hasAttribute')\n at determineDelay (/wp-content/plugins/restrict-content/legacy/includes/assets/js/rc-admin.js?ver=3.5.39:230:36)\n at /wp-content/plugins/restrict-content/legacy/includes/assets/js/rc-admin.js?ver=3.5.39:12:21\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/restrict-content/legacy/includes/assets/js/rc-admin.js?ver=3.5.39:262:6)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=restrict-content-welcome
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of undefined (reading 'hasAttribute')

Optimizations

Plugin configuration 80% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need your attention: You can look at the official readme.txt

restrict-content/restrictcontent.php 62% from 13 tests

The primary PHP file in "Membership Plugin - Restrict Content" version 3.2.8 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Domain Path: You should use only dashes and lowercase characters for the domain path ("languages")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 212 characters long)
  • Domain Path: Prefix the domain path with a forward slash character ("/languages")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("restrict-content.php" instead of "restrictcontent.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
These items require your attention
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/restrict-content/core/includes/libraries/stripe/data/ca-certificates.crt
142,012 lines of code in 661 files:
LanguageFilesBlank linesComment linesLines of code
PO File1728,43146,77482,884
PHP53814,93438,22347,778
JavaScript381,0841,2985,300
CSS196441353,858
Markdown479301,530
SVG3700305
JSON400243
Sass215054
XML10031
make110029

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity8.90
▷ Minimum class complexity1.00
▷ Maximum class complexity347.00
Average method complexity2.57
▷ Minimum method complexity1.00
▷ Maximum method complexity72.00
Code structure
Namespaces58
Interfaces20
Traits9
Classes372
▷ Abstract classes184.84%
▷ Concrete classes35495.16%
▷ Final classes133.67%
Methods2,028
▷ Static methods24412.03%
▷ Public methods1,66982.30%
▷ Protected methods1547.59%
▷ Private methods20510.11%
Functions736
▷ Named functions70595.79%
▷ Anonymous functions314.21%
Constants1,037
▷ Global constants151.45%
▷ Class constants1,02298.55%
▷ Public constants1,01899.61%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
43 PNG files occupy 0.94MB with 0.23MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
core/includes/images/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%
core/includes/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
core/includes/images/Group-Account-addon.png10.79KB3.86KB▼ 64.20%
core/includes/css/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
core/includes/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%