84% content-restrict

Code Review | Content Restrict

WordPress plugin Content Restrict scored84%from 54 tests.

About plugin

  • Plugin page: content-restrict
  • Plugin version: 0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.8.1
  • WordPress version: 6.3.1
  • First release: Feb 12, 2014
  • Latest release: Feb 12, 2014
  • Number of updates: 5
  • Update frequency: every 0.4 days
  • Top authors: hasmimeraj@gmail.com (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

60+ active /4,255 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼2.44ms] Passed 4 tests

Analyzing server-side resources used by Content Restrict
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0245.95 ▲0.24
Dashboard /wp-admin3.33 ▲0.0347.25 ▼2.13
Posts /wp-admin/edit.php3.39 ▲0.0351.30 ▲0.75
Add New Post /wp-admin/post-new.php5.92 ▲0.0391.02 ▼5.23
Media Library /wp-admin/upload.php3.26 ▲0.0233.01 ▼2.62

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 7 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
can_compress_scripts
cr_version
theysaidso_admin_options
widget_recent-comments
db_upgraded
cr_contentstype
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Content Restrict
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲4414.70 ▲0.471.77 ▲0.0644.12 ▼0.86
Dashboard /wp-admin2,214 ▲345.56 ▲0.0281.89 ▼8.3139.40 ▼7.14
Posts /wp-admin/edit.php2,116 ▲132.02 ▲0.0538.04 ▲0.4335.66 ▼1.19
Add New Post /wp-admin/post-new.php6,257 ▲4,73126.10 ▲2.52881.51 ▲251.3360.54 ▲7.43
Media Library /wp-admin/upload.php1,413 ▲134.23 ▲0.02102.45 ▼3.8145.62 ▼0.94

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Zombie WordPress options were found after uninstall: 8 options
    • widget_recent-comments
    • widget_recent-posts
    • cr_contentstype
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • cr_version
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

SRP 50% 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
Please fix the following
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/content-restrict/admin/cr_admin_panel.php:26

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 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
7 plugin tags: for logged in user, restriction, custom post type restrict, post, pages...

content-restrict/contentrestrict.php 92% from 13 tests

The primary PHP file in "Content Restrict" version 0.1 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("content-restrict.php" instead of "contentrestrict.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected143 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP23926143

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.42
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%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
4 PNG files occupy 0.50MB with 0.34MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin.png155.49KB45.92KB▼ 70.47%
front.png157.65KB44.83KB▼ 71.56%
screenshot-1.png100.00KB33.33KB▼ 66.67%
screenshot-2.png93.87KB35.54KB▼ 62.14%