68% content-protector

Code Review | Passster - Password Protection

WordPress plugin Passster - Password Protection scored 68% from 54 tests.

About plugin

  • Plugin page: content-protector
  • Plugin version: 3.5.4
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.8
  • WordPress version: 5.8.1
  • First release: Dec 8, 2013
  • Latest release: Aug 18, 2021
  • Number of updates: 209
  • Update frequency: every 13.4 days
  • Top authors: patrickposner (62.2%)kjvtough (38.28%)

Code review

54 tests

User reviews

47 reviews

Install metrics

10,000+ active / 201,091 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

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

An overview of server-side resources used by Passster - Password Protection
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /8.28 ▲5.4563.45 ▲29.71
Dashboard /wp-admin8.30 ▲5.2581.13 ▲33.02
Posts /wp-admin/edit.php8.30 ▲5.1978.80 ▲26.84
Add New Post /wp-admin/post-new.php9.14 ▲3.71120.93 ▼563.02
Media Library /wp-admin/upload.php8.30 ▲5.3062.83 ▲26.64
Options /wp-admin/admin.php?page=passster_settings8.3062.39
Freemius Debug [v.2.4.2] /wp-admin/admin.php?page=freemius8.3061.15
Protected Areas /wp-admin/edit.php?post_type=protected_areas8.3065.11

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 257 new files
Database: no new tables, 6 new options
New WordPress options
fs_accounts
passster_general_settings
fs_gdpr
fs_debug_mode
fs_active_plugins
passster_advanced_settings

Browser metrics Passed 4 tests

A check of browser resources used by Passster - Password Protection
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,107 ▲51118.65 ▲2.7522.52 ▲8.7945.29 ▼14.39
Dashboard /wp-admin3,251 ▲3208.23 ▲2.27184.31 ▲31.66120.83 ▲7.71
Posts /wp-admin/edit.php3,038 ▲2994.41 ▲1.6995.33 ▲30.9694.53 ▲9.57
Add New Post /wp-admin/post-new.php1,866 ▲25121.34 ▼0.09266.78 ▼38.85136.73 ▲27.04
Media Library /wp-admin/upload.php1,834 ▲274.92 ▼0.09124.03 ▼32.61137.08 ▲18.48
Options /wp-admin/admin.php?page=passster_settings1,7183.9888.23119.68
Freemius Debug [v.2.4.2] /wp-admin/admin.php?page=freemius1,7913.7988.8075.31
Protected Areas /wp-admin/edit.php?post_type=protected_areas1,7164.3395.1581.09

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/content-protector/inc/freemius/includes/class-freemius.php+8552
    Undefined property: stdClass::$plugins
  • This plugin does not fully uninstall, leaving 6 options in the database
    • passster_advanced_settings
    • fs_active_plugins
    • fs_gdpr
    • fs_debug_mode
    • passster_general_settings
    • fs_accounts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 4× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/content-protector/src/templates/recaptcha-v2-form.php
    • > /wp-content/plugins/content-protector/src/templates/password-form.php
    • > /wp-content/plugins/content-protector/inc/freemius/templates/ajax-loader.php
    • > /wp-content/plugins/content-protector/src/templates/captcha-form.php
  • 9× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/content-protector/inc/freemius/templates/account/partials/addon.php on line 8
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/content-protector/inc/freemius/templates/account/partials/addon.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_slug() on null in wp-content/plugins/content-protector/inc/freemius/templates/account/partials/addon.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/content-protector/content-protector.php:16
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/content-protector/inc/freemius/templates/account/partials/addon.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function freemius() in wp-content/plugins/content-protector/inc/freemius/templates/partials/network-activation.php:6
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/content-protector/inc/freemius/templates/account/partials/addon.php on line 6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/content-protector/inc/freemius/templates/account/partials/addon.php on line 6
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/content-protector/inc/freemius/templates/account/partials/addon.php on line 8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes: You can take inspiration from this readme.txt

content-protector/content-protector.php Passed 13 tests

"Passster - Password Protection" version 3.5.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
106 characters long description:
A simple plugin to password-protect your complete website, some pages/posts or just parts of your content.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected52,469 lines of code in 206 files:
LanguageFilesBlank linesComment linesLines of code
PHP1307,70517,00033,223
PO File137,2238,98415,623
Sass28399772,515
JavaScript107485455
CSS17471351
Markdown2680214
JSON30058
XML10028
SVG2002

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,907)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity76.82
▷ Minimum class complexity1.00
▷ Maximum class complexity2,907.00
Average method complexity4.52
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes57
▷ Abstract classes23.51%
▷ Concrete classes5596.49%
▷ Final classes00.00%
Methods1,255
▷ Static methods20616.41%
▷ Public methods91372.75%
▷ Protected methods151.20%
▷ Private methods32726.06%
Functions108
▷ Named functions10092.59%
▷ Anonymous functions87.41%
Constants126
▷ Global constants10180.16%
▷ Class constants2519.84%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
inc/freemius/assets/img/content-protector.png9.16KB5.26KB▼ 42.58%
inc/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%