84% wp-password-protect-publication

Code Review | WP Password Protect Publication

WordPress plugin WP Password Protect Publication scored84%from 54 tests.

About plugin

  • Plugin page: wp-password-prote...
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.3.0
  • WordPress version: 6.3.1
  • First release: Apr 16, 2016
  • Latest release: Jul 24, 2023
  • Number of updates: 9
  • Update frequency: every 295.0 days
  • Top authors: pbearne (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /870 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.03MB] [CPU: ▼1.16ms] Passed 4 tests

Server-side resources used by WP Password Protect Publication
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0339.00 ▲3.90
Dashboard /wp-admin3.34 ▲0.0348.73 ▲0.67
Posts /wp-admin/edit.php3.39 ▲0.0343.82 ▼2.05
Add New Post /wp-admin/post-new.php5.92 ▲0.0381.14 ▼7.14
Media Library /wp-admin/upload.php3.26 ▲0.0334.86 ▲4.62

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 13 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

WP Password Protect Publication: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.74 ▲0.371.80 ▲0.1953.12 ▲9.14
Dashboard /wp-admin2,198 ▲215.61 ▼0.0094.57 ▲7.5341.20 ▼2.73
Posts /wp-admin/edit.php2,100 ▼01.96 ▼0.0634.79 ▼1.2934.27 ▼4.49
Add New Post /wp-admin/post-new.php1,526 ▼023.25 ▲0.12672.16 ▼14.4953.91 ▼7.05
Media Library /wp-admin/upload.php1,400 ▲64.17 ▲0.0694.83 ▼6.3941.72 ▼4.25

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% 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)
Good news, no errors were detected

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
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-password-protect-publication/tests/bootstrap.php on line 14
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/wp-password-protect-publication/tests/bootstrap.php on line 14
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/wp-password-protect-publication/tests/test-sample.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_password_protect_publication\\is_admin() in wp-content/plugins/wp-password-protect-publication/wp-password-protect-publication.php:28

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
2 plugin tags: password, protect publication

wp-password-protect-publication/wp-password-protect-publication.php 85% from 13 tests

The entry point to "WP Password Protect Publication" version 1.0.2 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Text Domain: The text domain name must use dashes instead of underscores, and it must be lowercase
  • Domain Path: The domain path folder was not found ("/languages")

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
There were no executable files found in this plugin288 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP33367104
Bourne Shell119693
JavaScript18144
YAML17022
XML10014
JSON11011

PHP code Passed 2 tests

This is a very shot review of 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.39
Average class complexity9.00
▷ Minimum class complexity1.00
▷ Maximum class complexity17.00
Average method complexity4.20
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods5
▷ Static methods360.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.PNG13.91KB6.53KB▼ 53.07%
screenshot-2.PNG12.95KB6.44KB▼ 50.30%