10% pay-to-read

Code Review | Pay to Read - Create paid content on your website. Monetize your website

WordPress plugin Pay to Read - Create paid content on your website. Monetize your website scored 10% from 54 tests.

About plugin

  • Plugin page: pay-to-read
  • Plugin version: 2.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-5.8
  • WordPress version: 5.9.2
  • First release: Aug 14, 2021
  • Latest release: Nov 20, 2021
  • Number of updates: 14
  • Update frequency: every 7.0 days
  • Top authors: loopwi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 256 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
These installer errors require your attention
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/pay-to-read/pay-to-read.php+89
    Trying to get property 'pid' of non-object

Server metrics [RAM: ▲0.05MB] [CPU: ▼309.51ms] Passed 4 tests

Analyzing server-side resources used by Pay to Read - Create paid content on your website. Monetize your website
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1157.20 ▼2.75
Dashboard /wp-admin3.49 ▲0.0835.28 ▲0.94
Posts /wp-admin/edit.php3.71 ▲0.0739.59 ▲3.46
Add New Post /wp-admin/post-new.php6.96 ▼0.0199.92 ▼1,239.06
Media Library /wp-admin/upload.php3.36 ▲0.0727.02 ▲2.82
All Premium Posts /wp-admin/edit.php?post_type=p2r_premium_posts3.4129.05
Settings /wp-admin/admin.php?page=loopwi_p2r_settings3.6042.76
Pay to Read Plugin /wp-admin/admin.php?page=loopwi_p2r3.6036.61
Premium Posts Category /wp-admin/edit-tags.php?taxonomy=premium_posts_category&post_type=p2r_premium_posts3.3634.46
Add New Premium Post /wp-admin/post-new.php?post_type=p2r_premium_posts3.7151.04

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 41 new files
Database: 2 new tables, 1 new option
New tables
wp_p2rplugins_settings
wp_p2rplugins_posts
New WordPress options
my_db_version

Browser metrics Passed 4 tests

This is an overview of browser requirements for Pay to Read - Create paid content on your website. Monetize your website
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,958 ▲23516.55 ▲0.948.37 ▲2.762.26 ▼0.31
Dashboard /wp-admin2,963 ▲1026.01 ▼0.17125.24 ▼5.28227.35 ▼16.58
Posts /wp-admin/edit.php2,742 ▲543.26 ▲0.0363.79 ▼1.99140.58 ▲0.67
Add New Post /wp-admin/post-new.php1,803 ▲13522.06 ▲2.55447.25 ▲24.22205.83 ▲47.23
Media Library /wp-admin/upload.php1,768 ▲745.52 ▲0.05185.65 ▲23.64187.28 ▼4.80
All Premium Posts /wp-admin/edit.php?post_type=p2r_premium_posts1,4432.9258.58118.23
Settings /wp-admin/admin.php?page=loopwi_p2r_settings1,2872.5759.4963.65
Pay to Read Plugin /wp-admin/admin.php?page=loopwi_p2r1,4012.5253.93128.91
Premium Posts Category /wp-admin/edit-tags.php?taxonomy=premium_posts_category&post_type=p2r_premium_posts1,6932.7756.60111.83
Add New Premium Post /wp-admin/post-new.php?post_type=p2r_premium_posts3,08910.00189.18225.05

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
Please fix the following items
  • Zombie tables detected upon uninstall: 2 tables
    • wp_p2rplugins_settings
    • wp_p2rplugins_posts
  • Zombie WordPress options detected upon uninstall: 1 option
    • my_db_version

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=loopwi_p2r
    • > Notice in wp-content/plugins/pay-to-read/includes/dashboard.php+39
    Undefined variable: site_code

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 fix the following
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pay-to-read/includes/metaboxes.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_head() in wp-content/plugins/pay-to-read/includes/dashboard.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_head() in wp-content/plugins/pay-to-read/includes/settings.php:1

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There are user-side issues you should fix
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=loopwi_p2r
    • > Network (severe)
    wp-content/plugins/pay-to-read/css/plugins.css?ver=5.9.2 - Failed to load resource: the server responded with a status of 404 (Not Found)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=loopwi_p2r
    • > Network (severe)
    wp-content/themes/twentytwentytwo/js/jquery.min.js?ver=3.6.0 - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% 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
Please fix the following attributes:
  • Screenshots: Add descriptions for screenshots #6, #7 in pay-to-read/assets to your readme.txt
You can look at the official readme.txt

pay-to-read/pay-to-read.php 92% from 13 tests

The principal PHP file in "Pay to Read - Create paid content on your website. Monetize your website" v. 2.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin11,705 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
CSS10232688,641
SVG2132,630
PHP410464418
JavaScript411116

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.18
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%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
5 PNG files occupy 0.07MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/p2r.png10.87KB4.84KB▼ 55.49%
images/bitnami.css.png8.35KB4.78KB▼ 42.77%
images/payment-methods.png42.08KB3.65KB▼ 91.32%
images/logo.png10.49KB4.83KB▼ 53.94%
images/logo-light.png4.44KB3.26KB▼ 26.56%