84% anonymous-restricted-content

Code Review | Anonymous Restricted Content

WordPress plugin Anonymous Restricted Content scored84%from 54 tests.

About plugin

  • Plugin page: anonymous-restric...
  • Plugin version: 1.6.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.2.2
  • WordPress version: 6.3.1
  • First release: Jun 25, 2018
  • Latest release: Aug 3, 2023
  • Number of updates: 34
  • Update frequency: every 54.9 days
  • Top authors: cayenne (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

1,000+ active /16,943 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.23MB] [CPU: ▲5.54ms] Passed 4 tests

This is a short check of server-side resources used by Anonymous Restricted Content
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2136.83 ▲2.29
Dashboard /wp-admin3.53 ▲0.2346.81 ▲5.46
Posts /wp-admin/edit.php3.66 ▲0.3153.67 ▲9.32
Add New Post /wp-admin/post-new.php6.12 ▲0.2495.28 ▲10.45
Media Library /wp-admin/upload.php3.46 ▲0.2341.10 ▲5.09
Restricted Content /wp-admin/options-general.php?page=anonymous-restricted-content3.4438.60

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 27 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
db_upgraded
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Anonymous Restricted Content
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,065 ▲31923.96 ▲9.626.02 ▲4.4639.25 ▲1.06
Dashboard /wp-admin2,358 ▲16914.00 ▲9.05318.07 ▲191.8053.96 ▲7.31
Posts /wp-admin/edit.php2,313 ▲22411.69 ▲9.68108.51 ▲69.6734.32 ▲0.45
Add New Post /wp-admin/post-new.php1,684 ▲16522.55 ▼0.93509.19 ▼106.2338.44 ▼28.38
Media Library /wp-admin/upload.php1,529 ▲14414.03 ▲9.79156.75 ▲58.6146.37 ▲6.64
Restricted Content /wp-admin/options-general.php?page=anonymous-restricted-content1,11211.35109.9336.55

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
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments

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
Even though everything seems fine, this is not an exhaustive test

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
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/anonymous-restricted-content/public/partials/arc-public-display.php
    • > /wp-content/plugins/anonymous-restricted-content/admin/partials/arc-admin-display.php

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
9 plugin tags: restrict anonymous, private, access control, hide content, restricted access...

anonymous-restricted-content/anonymous-restricted-content.php Passed 13 tests

The principal PHP file in "Anonymous Restricted Content" v. 1.6.1 is loaded by WordPress automatically on each request
85 characters long description:
Restrict access to selected content (posts/pages/categories) for NOT LOGGED IN users.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin1,100 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
PHP12237664785
PO File24046136
JavaScript2300102
Markdown133059
CSS23418

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity12.71
▷ Minimum class complexity1.00
▷ Maximum class complexity49.00
Average method complexity2.14
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods64
▷ Static methods23.12%
▷ Public methods5179.69%
▷ Protected methods00.00%
▷ Private methods1320.31%
Functions4
▷ Named functions250.00%
▷ Anonymous functions250.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There were not PNG files found in your plugin