84% prevent-users-from-deleting-pages-posts-custom-post-types

Code Review | Prevent Users From Deleting Post and Pages

WordPress plugin Prevent Users From Deleting Post and Pages scored84%from 54 tests.

About plugin

  • Plugin page: prevent-users-fro...
  • Plugin version: 0.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.2.4
  • WordPress version: 6.3.1
  • First release: Nov 27, 2014
  • Latest release: Aug 17, 2015
  • Number of updates: 23
  • Update frequency: every 11.8 days
  • Top authors: ravisakya (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

60+ active /1,428 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼6.93ms] Passed 4 tests

This is a short check of server-side resources used by Prevent Users From Deleting Post and Pages
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0436.34 ▼4.07
Dashboard /wp-admin3.34 ▲0.0445.11 ▼4.58
Posts /wp-admin/edit.php3.39 ▲0.0446.43 ▼3.34
Add New Post /wp-admin/post-new.php5.92 ▲0.0484.51 ▼15.71
Media Library /wp-admin/upload.php3.26 ▲0.0434.00 ▼2.32
Disable Delete /wp-admin/options-general.php?page=disable_delete3.2844.16

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Prevent Users From Deleting Post and Pages
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6913.22 ▼1.064.54 ▲2.8741.03 ▼0.03
Dashboard /wp-admin2,210 ▲255.85 ▲0.94107.30 ▲3.6939.27 ▼2.75
Posts /wp-admin/edit.php2,093 ▲11.97 ▼0.0941.16 ▼0.9535.88 ▼0.28
Add New Post /wp-admin/post-new.php1,517 ▼1617.76 ▼5.50662.48 ▲33.9451.20 ▲1.30
Media Library /wp-admin/upload.php1,386 ▼24.19 ▲0.0298.73 ▲3.9441.87 ▼0.63
Disable Delete /wp-admin/options-general.php?page=disable_delete1,0882.0626.2035.57

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting 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
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/prevent-users-from-deleting-pages-posts-custom-post-types/index.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Screenshot #1 (Settings Page) image required
Please take inspiration from this readme.txt

prevent-users-from-deleting-pages-posts-custom-post-types/index.php 92% from 13 tests

The main file in "Prevent Users From Deleting Post and Pages" v. 0.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("prevent-users-from-deleting-pages-posts-custom-post-types.php" instead of "index.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
Good job! No executable or dangerous file extensions detected277 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP16761277

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.11MB with 0.06MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png114.83KB52.39KB▼ 54.38%