68% pageview-content-restriction

Code Review | Pageview content restriction

WordPress plugin Pageview content restriction scored 68% from 54 tests.

About plugin

  • Plugin page: pageview-content-...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.2.4
  • WordPress version: 6.3.1
  • First release: Apr 18, 2014
  • Latest release: Aug 8, 2015
  • Number of updates: 5
  • Update frequency: every 95.4 days
  • Top authors: veganist (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,247 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.13MB] [CPU: ▼4.04ms] Passed 4 tests

This is a short check of server-side resources used by Pageview content restriction
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0843.67 ▲1.92
Dashboard /wp-admin3.43 ▲0.1354.07 ▼0.21
Posts /wp-admin/edit.php3.53 ▲0.1755.05 ▲4.08
Add New Post /wp-admin/post-new.php6.11 ▲0.2280.73 ▼16.73
Media Library /wp-admin/upload.php3.37 ▲0.1436.12 ▼1.15
Pageview Content Restriction /wp-admin/options-general.php?page=pageview-content-restriction-admin3.2634.15

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Pageview content restriction
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲414.48 ▲1.231.90 ▼3.3139.35 ▼3.98
Dashboard /wp-admin2,210 ▲14.81 ▼1.0998.93 ▲0.6339.55 ▼2.68
Posts /wp-admin/edit.php2,096 ▲72.04 ▲0.0641.03 ▲5.2536.17 ▲4.07
Add New Post /wp-admin/post-new.php1,539 ▲123.39 ▲0.10697.91 ▲60.8153.44 ▼7.63
Media Library /wp-admin/upload.php1,395 ▲44.21 ▲0.0194.68 ▼5.9444.26 ▼4.46
Pageview Content Restriction /wp-admin/options-general.php?page=pageview-content-restriction-admin8042.0328.4628.43

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Warning in wp-content/plugins/pageview-content-restriction/uninstall.php+10
    rmdir(wp-content/uploads/unauthenticatedsessions): Directory not empty
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=pageview-content-restriction-admin
    • > Notice in wp-content/plugins/pageview-content-restriction/pageview_content_restriction.php+365
    Trying to access array offset on value of type bool

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
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/pageview-content-restriction/pageview_content_restriction.php:35

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
8 plugin tags: pageviews, content restriction, member only, registration, restricted access...

pageview-content-restriction/pageview_content_restriction.php 92% from 13 tests

The main file in "Pageview content restriction" v. 1.0 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 ("pageview-content-restriction.php" instead of "pageview_content_restriction.php")

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
Success! There were no dangerous files found in this plugin226 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP244123226

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity1.40
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods10100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG images were found in this plugin