73% wp-braintree

Code Review | WP Braintree

WordPress plugin WP Braintree scored73%from 54 tests.

About plugin

  • Plugin page: wp-braintree
  • Plugin version: 2.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Jan 2, 2014
  • Latest release: Jul 25, 2023
  • Number of updates: 50
  • Update frequency: every 69.8 days
  • Top authors: mra13 (98%)wptipsntricks (4%)

Code review

54 tests

User reviews

4 reviews

Install metrics

100+ active /11,079 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.04MB] [CPU: ▼5.74ms] Passed 4 tests

An overview of server-side resources used by WP Braintree
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0440.91 ▼0.59
Dashboard /wp-admin3.35 ▲0.0447.02 ▲3.04
Posts /wp-admin/edit.php3.40 ▲0.0442.36 ▼4.08
Add New Post /wp-admin/post-new.php5.93 ▲0.0479.85 ▼17.95
Media Library /wp-admin/upload.php3.27 ▲0.0433.22 ▼0.32
Settings /wp-admin/edit.php?post_type=braintree_payment&page=wp_braintree_settings3.2429.69
Payments /wp-admin/edit.php?post_type=braintree_payment3.3136.15

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 616 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
wp_braintree_api_keys
widget_theysaidso_widget
wp_braintree_opts
widget_recent-posts
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for WP Braintree
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,823 ▲7713.20 ▼1.181.81 ▲0.1143.96 ▼3.91
Dashboard /wp-admin2,232 ▲474.85 ▼1.0195.28 ▼4.9593.81 ▲49.69
Posts /wp-admin/edit.php2,112 ▲232.02 ▼0.0034.62 ▼5.6031.44 ▼1.69
Add New Post /wp-admin/post-new.php1,534 ▲2023.18 ▲5.66750.94 ▲83.6271.76 ▲18.02
Media Library /wp-admin/upload.php1,411 ▲294.23 ▲0.0396.28 ▼0.1979.87 ▲36.00
Settings /wp-admin/edit.php?post_type=braintree_payment&page=wp_braintree_settings9172.1129.7225.57
Payments /wp-admin/edit.php?post_type=braintree_payment1,0702.0031.5429.13

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • wp_braintree_api_keys
    • widget_recent-comments
    • widget_recent-posts
    • wp_braintree_opts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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 items
  • 109× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/Address.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Result\\CreditCardVerification' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/CreditCardVerification.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/AndroidPayCard.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/Exception/DownForMaintenance.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/Exception/ValidationsFailed.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/SamsungPayCard.php:41
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/Exception/UpgradeRequired.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\EqualityNode' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/PartialMatchNode.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Modification' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/AddOn.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\PartialMatchNode' not found in wp-content/plugins/wp-braintree/braintree/lib/Braintree/TextNode.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need to be fixed:
  • Tags: There are too many tags (12 tag instead of maximum 10)
The official readme.txt might help

wp-braintree/main.php 92% from 13 tests

The main file in "WP Braintree" v. 2.0.4 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("wp-braintree.php" instead of "main.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Please fix the following items
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/wp-braintree/braintree/lib/ssl/api_braintreegateway_com.ca.crt
48,329 lines of code in 270 files:
LanguageFilesBlank linesComment linesLines of code
CSS771,1171,99936,591
PHP1871,8485,18211,246
JavaScript33721339
PO File15959145
XML2008

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity5.09
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity1.71
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces10
Interfaces0
Traits0
Classes183
▷ Abstract classes21.09%
▷ Concrete classes18198.91%
▷ Final classes00.00%
Methods1,044
▷ Static methods44542.62%
▷ Public methods87283.52%
▷ Protected methods555.27%
▷ Private methods11711.21%
Functions5
▷ Named functions00.00%
▷ Anonymous functions5100.00%
Constants810
▷ Global constants20.25%
▷ Class constants80899.75%
▷ Public constants808100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
342 PNG files occupy 0.90MB with 0.24MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/themes/humanity/images/ui-icons_f08000_256x240.png4.44KB4.17KB▼ 6.02%
css/themes/swanky-purse/images/ui-bg_flat_75_ddd4b0_40x100.png0.20KB0.08KB▼ 57.77%
css/themes/dot-luv/images/ui-icons_98d2fb_256x240.png4.44KB4.17KB▼ 6.02%
css/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png0.20KB0.09KB▼ 57.49%
css/themes/hot-sneaks/images/ui-icons_88a206_256x240.png4.44KB4.17KB▼ 6.02%