84% wp-user-rewards

Code Review | WP User Rewards

WordPress plugin WP User Rewards scored84%from 54 tests.

About plugin

  • Plugin page: wp-user-rewards
  • Plugin version: 0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.8
  • WordPress version: 6.3.1
  • First release: Aug 21, 2017
  • Latest release: Aug 21, 2017
  • Number of updates: 3
  • Update frequency: every 0.3 days
  • Top authors: xieweiking (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /1,916 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.10MB] [CPU: ▼1.76ms] Passed 4 tests

An overview of server-side resources used by WP User Rewards
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1143.83 ▲4.51
Dashboard /wp-admin3.40 ▲0.1045.37 ▲1.78
Posts /wp-admin/edit.php3.52 ▲0.1643.84 ▼1.83
Add New Post /wp-admin/post-new.php5.98 ▲0.1081.39 ▼7.21
Media Library /wp-admin/upload.php3.33 ▲0.1036.15 ▲0.21

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

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

Browser metrics Passed 4 tests

Checking browser requirements for WP User Rewards
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.29 ▼1.081.84 ▲0.0236.74 ▼4.48
Dashboard /wp-admin2,209 ▲214.85 ▼0.0497.12 ▼12.7938.31 ▼3.58
Posts /wp-admin/edit.php2,086 ▼31.97 ▼0.0435.48 ▲0.1632.52 ▲1.06
Add New Post /wp-admin/post-new.php1,542 ▲918.32 ▼4.92645.49 ▼33.4962.35 ▲4.76
Media Library /wp-admin/upload.php1,391 ▲34.21 ▼0.0395.87 ▼4.5644.39 ▲0.04

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
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

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 errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/wp-user-rewards/wp-user-rewards.php:17

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

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Please fix the following attributes:
  • Screenshots: Screenshot #1 (Display rewards at the end of article. 在文章的末尾显示打赏内容) image missing
You can take inspiration from this readme.txt

wp-user-rewards/wp-user-rewards.php Passed 13 tests

The main PHP script in "WP User Rewards" version 0.1 is automatically included on every request by WordPress
109 characters long description:
Adds user reward/donate fields to user profiles, including Wechat pay QRCode, Alipay QRCode, and PayPal link.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
No dangerous file extensions were detected591 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP17211396
JavaScript23078
CSS114070
PO File117247

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity72.00
▷ Minimum class complexity72.00
▷ Maximum class complexity72.00
Average method complexity4.23
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods22
▷ Static methods00.00%
▷ Public methods1672.73%
▷ Protected methods00.00%
▷ Private methods627.27%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
3 PNG files occupy 0.14MB with 0.08MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png58.20KB23.17KB▼ 60.19%
img/bg.png4.82KB2.93KB▼ 39.12%
screenshot-2.png85.31KB36.62KB▼ 57.08%