84% donation-button

Code Review | Donation Button

WordPress plugin Donation Button scored 84% from 54 tests.

About plugin

  • Plugin page: donation-button
  • Plugin version: 3.0.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.8.2
  • WordPress version: 5.9.2
  • First release: Aug 22, 2015
  • Latest release: Dec 1, 2021
  • Number of updates: 107
  • Update frequency: every 21.4 days
  • Top authors: mbj-webdevelopment (100%)

Code review

54 tests

User reviews

16 reviews

Install metrics

3,000+ active / 96,648 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.97MB] [CPU: ▼293.48ms] Passed 4 tests

A check of server-side resources used by Donation Button
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.49 ▲0.9760.90 ▲6.59
Dashboard /wp-admin4.41 ▲1.0045.72 ▲9.49
Posts /wp-admin/edit.php4.63 ▲0.9949.70 ▼4.70
Add New Post /wp-admin/post-new.php7.88 ▲0.91105.00 ▼1,179.53
Media Library /wp-admin/upload.php4.29 ▲1.0033.43 ▲3.72
Add New Goal /wp-admin/post-new.php?post_type=donationgoal4.5053.84
Paypal Donation /wp-admin/options-general.php?page=donation-button4.2735.85
All Goals /wp-admin/edit.php?post_type=donationgoal4.3336.93

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 254 new files
Database: no new tables, 1 new option
New WordPress options
widget_donation_button_admin_widget

Browser metrics Passed 4 tests

Donation Button: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,881 ▲13716.41 ▲0.546.54 ▲0.022.31 ▲0.12
Dashboard /wp-admin3,008 ▲1287.43 ▲0.94138.61 ▼2.93179.61 ▲20.20
Posts /wp-admin/edit.php2,782 ▲943.93 ▲0.5072.30 ▲9.36159.14 ▲16.73
Add New Post /wp-admin/post-new.php1,740 ▲4419.19 ▼2.11402.51 ▼53.76191.63 ▲21.89
Media Library /wp-admin/upload.php1,789 ▲916.41 ▲0.69118.16 ▼21.71201.34 ▲10.89
Add New Goal /wp-admin/post-new.php?post_type=donationgoal3,4305.49125.28160.33
Paypal Donation /wp-admin/options-general.php?page=donation-button1,8353.5962.72176.86
All Goals /wp-admin/edit.php?post_type=donationgoal1,4403.6471.47124.88

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
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 1 option
    • widget_donation_button_admin_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 191× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/donation-button/admin/partials/lib/constant_contact/constant_contact_subscribe.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'Ctct\\Services\\BaseService' not found in wp-content/plugins/donation-button/admin/partials/lib/constant_contact/Ctct/Services/CampaignScheduleService.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'Services_Twilio_SIPListResource' not found in wp-content/plugins/donation-button/admin/partials/lib/Twilio/Rest/CredentialLists.php:3
    • > PHP Warning
      include_once(DBP_PLUGIN_DIR_PATH/admin/partials/lib/constant_contact/Ctct/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/donation-button/includes/class-donation-button-constant-contact-helper.php on line 10
    • > PHP Fatal error
      Uncaught Error: Class 'Services_Twilio_TaskRouterInstanceResource' not found in wp-content/plugins/donation-button/admin/partials/lib/Twilio/Rest/TaskRouter/Activity.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Services_Twilio_InstanceResource' not found in wp-content/plugins/donation-button/admin/partials/lib/Twilio/Rest/IncomingPhoneNumber.php:92
    • > PHP Fatal error
      Uncaught Error: Class 'Services_Twilio_InstanceResource' not found in wp-content/plugins/donation-button/admin/partials/lib/Twilio/Rest/IpAccessControlListMapping.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Services_Twilio_TaskRouterInstanceResource' not found in wp-content/plugins/donation-button/admin/partials/lib/Twilio/Rest/TaskRouter/WorkerStatistics.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Services_Twilio_MonitorInstanceResource' not found in wp-content/plugins/donation-button/admin/partials/lib/Twilio/Rest/Monitor/Event.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Services_Twilio_ListResource' not found in wp-content/plugins/donation-button/admin/partials/lib/Twilio/Rest/AvailablePhoneNumbers.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
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 an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: Please reduce the number of tags, currently 36 tag instead of maximum 10
You can take inspiration from this readme.txt

donation-button/donation-button.php Passed 13 tests

The entry point to "Donation Button" version 3.0.7 is a PHP file that has certain tags in its header comment area
56 characters long description:
Easy to used PayPal Donation button with Auto Responder.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin17,974 lines of code in 237 files:
LanguageFilesBlank linesComment linesLines of code
PHP2262,5599,98315,540
CSS5571931,202
JavaScript51742911,151
make1271581

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity6.67
▷ Minimum class complexity1.00
▷ Maximum class complexity160.00
Average method complexity2.43
▷ Minimum method complexity1.00
▷ Maximum method complexity67.00
Code structure
Namespaces11
Interfaces2
Traits0
Classes245
▷ Abstract classes166.53%
▷ Concrete classes22993.47%
▷ Final classes00.00%
Methods990
▷ Static methods12612.73%
▷ Public methods93093.94%
▷ Protected methods404.04%
▷ Private methods202.02%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants46
▷ Global constants4597.83%
▷ Class constants12.17%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/reload.png1.10KB1.07KB▼ 2.74%
admin/images/add.png0.62KB0.44KB▼ 29.34%
admin/images/remove.png0.82KB0.75KB▼ 8.66%
admin/images/donation-button.png1.48KB0.83KB▼ 43.92%