64% braintree-donations

Code Review | Braintree Donations

WordPress plugin Braintree Donations scored64%from 54 tests.

About plugin

  • Plugin page: braintree-donations
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-3.9.1
  • WordPress version: 6.3.1
  • First release: Jun 23, 2014
  • Latest release: Jun 23, 2014
  • Number of updates: 6
  • Update frequency: every 0.2 days
  • Top authors: fasterthemes (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

10+ active /1,597 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.96MB] [CPU: ▼38.96ms] Passed 4 tests

Analyzing server-side resources used by Braintree Donations
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0039.35 ▼3.97
Dashboard /wp-admin2.99 ▼0.3522.74 ▼43.28
Posts /wp-admin/edit.php2.99 ▼0.3624.89 ▼23.24
Add New Post /wp-admin/post-new.php2.99 ▼2.8927.74 ▼76.81
Media Library /wp-admin/upload.php2.99 ▼0.2325.74 ▼12.52

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 99 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Braintree Donations: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲8913.26 ▼1.121.59 ▼0.9151.64 ▲5.17
Dashboard /wp-admin2,239 ▲394.83 ▼0.01111.29 ▲4.0139.51 ▲0.99
Posts /wp-admin/edit.php2,118 ▲182.05 ▲0.0440.67 ▲2.8934.30 ▼0.12
Add New Post /wp-admin/post-new.php1,555 ▲2422.94 ▼0.40645.82 ▼35.3754.09 ▼8.09
Media Library /wp-admin/upload.php1,421 ▲214.18 ▼0.22100.32 ▲0.5444.40 ▼1.24

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • The plugin did not uninstall gracefully
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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 take a closer look at the following
  • 54× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      Use of undefined constant BRAINTREE_FILE_PATH - assumed 'BRAINTREE_FILE_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/braintree-donations/shortcode.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree_Exception' not found in wp-content/plugins/braintree-donations/lib/Braintree/Exception/SSLCertificate.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree' not found in wp-content/plugins/braintree-donations/lib/Braintree/Subscription.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree_Exception' not found in wp-content/plugins/braintree-donations/lib/Braintree/Exception/Authentication.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree' not found in wp-content/plugins/braintree-donations/lib/Braintree/PartnerMerchant.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree_Customer' not found in wp-content/plugins/braintree-donations/lib/Braintree/TransparentRedirect.php:86
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree_Exception' not found in wp-content/plugins/braintree-donations/lib/Braintree/Exception/Unexpected.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree' not found in wp-content/plugins/braintree-donations/lib/Braintree/Disbursement.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree_Instance' not found in wp-content/plugins/braintree-donations/lib/Braintree/Transaction/AddressDetails.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree_Modification' not found in wp-content/plugins/braintree-donations/lib/Braintree/Discount.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
4 plugin tags: donation, braintree, payment gateway, payments

braintree-donations/braintreedonations.php 92% from 13 tests

The main PHP file in "Braintree Donations" ver. 1.0 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("braintree-donations.php" instead of "braintreedonations.php")

Code Analysis 5% from 3 tests

File types 0% from 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
Please make sure to remedy the following
  • Do not distribute dangerous files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/braintree-donations/lib/ssl/api_braintreegateway_com.ca.crt
10,672 lines of code in 85 files:
LanguageFilesBlank linesComment linesLines of code
CSS21285,863
PHP839142,5084,809

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity4.84
▷ Minimum class complexity1.00
▷ Maximum class complexity32.00
Average method complexity1.67
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes80
▷ Abstract classes22.50%
▷ Concrete classes7897.50%
▷ Final classes1012.82%
Methods459
▷ Static methods32971.68%
▷ Public methods37381.26%
▷ Protected methods204.36%
▷ Private methods6614.38%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants412
▷ Global constants40.97%
▷ Class constants40899.03%
▷ Public constants408100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/logo.png5.31KB1.03KB▼ 80.57%