83% protect-pages-posts

Code Review | Protect Pages & Posts

WordPress plugin Protect Pages & Posts scored83%from 54 tests.

About plugin

  • Plugin page: protect-pages-posts
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.8
  • WordPress version: 6.3.1
  • First release: Jan 24, 2018
  • Latest release: Mar 15, 2022
  • Number of updates: 9
  • Update frequency: every 168.1 days
  • Top authors: gaupoit (88.89%)profaceoff (22.22%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /725 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.07MB] [CPU: ▲3.53ms] Passed 4 tests

This is a short check of server-side resources used by Protect Pages & Posts
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0538.29 ▼2.08
Dashboard /wp-admin3.37 ▲0.0750.67 ▲4.49
Posts /wp-admin/edit.php3.47 ▲0.1155.44 ▲10.25
Add New Post /wp-admin/post-new.php5.97 ▲0.0897.97 ▲1.44
Media Library /wp-admin/upload.php3.29 ▲0.0642.40 ▲11.35

Server storage [IO: ▲0.30MB] [DB: ▲0.00MB] 67% from 3 tests

Filesystem and database footprint
Just a few items left to fix
  • You have illegally modified 1 file (0.61KB) outside of "wp-content/plugins/protect-pages-posts/" and "wp-content/uploads/"
    • (modified) .htaccess
Filesystem: 35 new files
Database: 1 new table, 7 new options
New tables
wp_pur_private_links
New WordPress options
db_upgraded
jal_db_version
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Protect Pages & Posts: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲8113.22 ▼1.561.53 ▼0.8842.82 ▼0.14
Dashboard /wp-admin2,220 ▲324.91 ▼1.02104.01 ▲6.8939.57 ▼5.63
Posts /wp-admin/edit.php2,137 ▲482.05 ▲0.0542.32 ▲6.6435.12 ▼0.50
Add New Post /wp-admin/post-new.php1,532 ▲418.49 ▲0.29596.91 ▼4.9456.39 ▲1.60
Media Library /wp-admin/upload.php1,402 ▲174.36 ▲0.22100.90 ▲1.7044.67 ▲0.74

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • jal_db_version
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/protect-pages-posts/admin/partials/prevent_ur_pages-admin-display.php
    • > /wp-content/plugins/protect-pages-posts/includes/class-prevent_ur_page-function.php
    • > /wp-content/plugins/protect-pages-posts/public/partials/prevent_ur_pages-public-display.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention: You can take inspiration from this readme.txt

protect-pages-posts/prevent_ur_pages.php 85% from 13 tests

The main PHP file in "Protect Pages & Posts" ver. 1.0.0 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Text Domain: The text domain name must use dashes instead of underscores, and it must be lowercase
  • Main file name: The principal plugin file should be the same as the plugin slug ("protect-pages-posts.php" instead of "prevent_ur_pages.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin966 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP18302687783
JavaScript13526110
Markdown129043
CSS221319
Bourne Shell23011

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity4.83
▷ Minimum class complexity1.00
▷ Maximum class complexity12.00
Average method complexity1.81
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes12
▷ Abstract classes00.00%
▷ Concrete classes12100.00%
▷ Final classes00.00%
Methods57
▷ Static methods35.26%
▷ Public methods5291.23%
▷ Protected methods00.00%
▷ Private methods58.77%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants11
▷ Global constants00.00%
▷ Class constants11100.00%
▷ Public constants11100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.22MB with 0.13MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
banner-772x250.png223.57KB89.51KB▼ 59.96%