77% page-restrict-for-woocommerce

Code Review | Page Restrict for WooCommerce

WordPress plugin Page Restrict for WooCommerce scored77%from 54 tests.

About plugin

  • Plugin page: page-restrict-for...
  • Plugin version: 1.6.5
  • PHP compatiblity: 7.0.25+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.2
  • WordPress version: 6.3.1
  • First release: Apr 2, 2020
  • Latest release: Jul 29, 2023
  • Number of updates: 65
  • Update frequency: every 19.6 days
  • Top authors: vladogrcic (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

500+ active /7,384 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼2.01ms] Passed 4 tests

Server-side resources used by Page Restrict for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0041.61 ▲2.86
Dashboard /wp-admin3.31 ▲0.0050.66 ▼1.29
Posts /wp-admin/edit.php3.36 ▲0.0059.47 ▲5.69
Add New Post /wp-admin/post-new.php5.89 ▲0.0093.39 ▼7.49
Media Library /wp-admin/upload.php3.23 ▲0.0034.22 ▼2.11

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 176 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
db_upgraded
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Page Restrict for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲5414.48 ▲0.111.82 ▲0.0944.76 ▲3.85
Dashboard /wp-admin2,218 ▲125.83 ▼0.2099.30 ▼3.3239.07 ▼1.28
Posts /wp-admin/edit.php2,103 ▲31.99 ▲0.0241.57 ▲1.2135.58 ▲0.04
Add New Post /wp-admin/post-new.php1,559 ▲518.30 ▲0.14605.78 ▼26.4450.56 ▼11.52
Media Library /wp-admin/upload.php1,403 ▲34.17 ▼0.07101.31 ▼10.3747.69 ▼0.18

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/quick_start/tabs/tab-add-restrict-doc-loop.php
    • > /wp-content/plugins/page-restrict-for-woocommerce/front/partials/display.php
  • 47× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Undefined variable: logo in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-page-pages.php on line 16
    • > PHP Notice
      Undefined variable: prwc_limit_downloadable_products in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/pages/pages-vars.php on line 31
    • > PHP Warning
      count(): Parameter must be an array or an object that implements Countable in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/quick_start/tabs/tab-add-restrict-doc-loop.php on line 2
    • > PHP Warning
      Use of undefined constant PAGE_RESTRICT_WC_LOCATION_URL - assumed 'PAGE_RESTRICT_WC_LOCATION_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/quick_start/tabs/tab-add-restrict-frontend.php on line 22
    • > PHP Notice
      Undefined variable: value in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/pages/pages-page.php on line 24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/pages/pages-page.php:32
    • > PHP Warning
      Use of undefined constant PAGE_RESTRICT_WC_LOCATION_URL - assumed 'PAGE_RESTRICT_WC_LOCATION_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/quick_start/tabs/tab-add-restrict-general-overview.php on line 22
    • > PHP Notice
      Undefined variable: redirect_prod_not_bought_id in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/pages/pages-page.php on line 26
    • > PHP Warning
      Use of undefined constant PAGE_RESTRICT_WC_LOCATION_URL - assumed 'PAGE_RESTRICT_WC_LOCATION_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/quick_start/tabs/tab-add-page-restrict-classic.php on line 22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/page-restrict-for-woocommerce/admin/partials/menu-pages/user_overview/tabs/tab-timeout.php:42

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed: Please take inspiration from this readme.txt

page-restrict-for-woocommerce/page-restrict-wc.php 77% from 13 tests

The main file in "Page Restrict for WooCommerce" v. 1.6.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: The text domain name should consist of only dashes and lowercase characters
  • Requires at least: The required version number must match the one declared in readme.txt ("4.8.12" instead of "3.0.0")
  • Main file name: Name the main plugin file the same as the plugin slug ("page-restrict-for-woocommerce.php" instead of "page-restrict-wc.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin12,821 lines of code in 112 files:
LanguageFilesBlank linesComment linesLines of code
PHP542831,9375,068
CSS11631972,497
JavaScript26452392,193
SVG5001,328
Sass61393705
PO File1267462548
JSON900482

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity20.05
▷ Minimum class complexity1.00
▷ Maximum class complexity83.00
Average method complexity4.06
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces10
Interfaces0
Traits0
Classes20
▷ Abstract classes00.00%
▷ Concrete classes20100.00%
▷ Final classes00.00%
Methods99
▷ Static methods44.04%
▷ Public methods9292.93%
▷ Protected methods00.00%
▷ Private methods77.07%
Functions28
▷ Named functions517.86%
▷ Anonymous functions2382.14%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 0% from 2 tests

Image compression 0% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
32 PNG files occupy 1.47MB with 1.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
(invalid) admin/assets/build/images/ui-icons_ffffff_256x240.69a45a43.png8.49KB0.00KB▼ 100.00%
admin/assets/img/screenshots/en/section/products-sections-settings.png29.68KB8.39KB▼ 71.73%
admin/assets/img/screenshots/en/frontend/restrict-pages-list-shortcode-block-edit.png94.98KB33.26KB▼ 64.99%
(invalid) admin/assets/build/images/ui-icons_777620_256x240.69d91555.png6.13KB0.00KB▼ 100.00%
admin/assets/img/screenshots/en/general-overview/user-page-restricted-time-data.png184.87KB64.59KB▼ 65.06%