73% pay-what-you-want

Code Review | Pay What You Want

WordPress plugin Pay What You Want scored73%from 54 tests.

About plugin

  • Plugin page: pay-what-you-want
  • Plugin version: 1.0.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.3
  • WordPress version: 6.3.1
  • First release: May 11, 2022
  • Latest release: Oct 15, 2023
  • Number of updates: 5
  • Update frequency: every 104.6 days
  • Top authors: niaj (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,422 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲5.35MB] [CPU: ▲29.33ms] 75% from 4 tests

Server-side resources used by Pay What You Want
The following require your attention
  • Extra RAM: Extra memory usage should kept under 5MB (currently 5.35MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.21 ▲5.7564.50 ▲24.74
Dashboard /wp-admin9.23 ▲5.9370.04 ▲22.17
Posts /wp-admin/edit.php9.23 ▲5.8883.20 ▲35.32
Add New Post /wp-admin/post-new.php9.72 ▲3.84123.16 ▲35.57
Media Library /wp-admin/upload.php9.23 ▲6.0067.03 ▲35.10
Freemius Debug [v.2.5.12] /wp-admin/admin.php?page=freemius9.2356.25

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 191 new files
Database: no new tables, 9 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
db_upgraded
fs_debug_mode
theysaidso_admin_options
fs_accounts
can_compress_scripts
fs_active_plugins
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Pay What You Want
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,914 ▲15313.46 ▼1.087.72 ▲5.7429.17 ▼9.91
Dashboard /wp-admin2,240 ▲655.66 ▼0.0090.88 ▼4.9944.99 ▲0.27
Posts /wp-admin/edit.php2,146 ▲462.15 ▲0.1340.97 ▼0.1841.22 ▲2.66
Add New Post /wp-admin/post-new.php1,559 ▲2218.11 ▼0.40617.25 ▲8.9272.16 ▲8.91
Media Library /wp-admin/upload.php1,445 ▲514.22 ▼0.0099.32 ▼1.8644.10 ▲1.00
Freemius Debug [v.2.5.12] /wp-admin/admin.php?page=freemius1,0762.0725.1126.78

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/pay-what-you-want/freemius/includes/class-freemius.php+8515
    Undefined property: stdClass::$plugins
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_recent-posts
    • fs_debug_mode
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • fs_accounts
    • fs_active_plugins
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pay-what-you-want/inc/settings-page.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/pay-what-you-want/inc/single-product-settings.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/pay-what-you-want/inc/form.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pay-what-you-want/inc/pay-what-you-want.php:52

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 on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Example 1), #2 (Settings), #3 (Example 2)
The official readme.txt is a good inspiration

pay-what-you-want/pay-what-you-want.php 85% from 13 tests

The main file in "Pay What You Want" v. 1.0.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Domain Path: The domain path points to a folder that does not exist ("/languages")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis 97% from 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
Everything looks great! No dangerous files found in this plugin33,985 lines of code in 145 files:
LanguageFilesBlank linesComment linesLines of code
PHP1238,12917,26133,436
JavaScript55666233
Markdown1680214
CSS152086
XML13016

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
The following items need your attention
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 3,088)
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity91.61
▷ Minimum class complexity1.00
▷ Maximum class complexity3,088.00
Average method complexity4.59
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes49
▷ Abstract classes24.08%
▷ Concrete classes4795.92%
▷ Final classes00.00%
Methods1,264
▷ Static methods19815.66%
▷ Public methods87469.15%
▷ Protected methods171.34%
▷ Private methods37329.51%
Functions119
▷ Named functions11798.32%
▷ Anonymous functions21.68%
Constants156
▷ Global constants10969.87%
▷ Class constants4730.13%
▷ Public constants47100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/pay-what-you-want.png12.71KB6.98KB▼ 45.12%