62% accept-payments-wp

Code Review | Braintree Payments For Wordpress - Accept Payments WP

WordPress plugin Braintree Payments For Wordpress - Accept Payments WP scored 62% from 54 tests.

About plugin

  • Plugin page: accept-payments-wp
  • Plugin version: 1.2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.0.3
  • WordPress version: 5.9.2
  • First release: Jan 24, 2019
  • Latest release: Jan 31, 2019
  • Number of updates: 16
  • Update frequency: every 0.5 days
  • Top authors: LukasPaskauskas (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 795 total downloads

Benchmarks

Plugin footprint 83% 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: ▲0.31MB] [CPU: ▼321.36ms] Passed 4 tests

An overview of server-side resources used by Braintree Payments For Wordpress - Accept Payments WP
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.85 ▲0.3453.54 ▲3.37
Dashboard /wp-admin3.72 ▲0.3136.53 ▼9.86
Posts /wp-admin/edit.php3.95 ▲0.3045.11 ▲6.35
Add New Post /wp-admin/post-new.php7.25 ▲0.2896.48 ▼1,277.74
Media Library /wp-admin/upload.php3.67 ▲0.3726.35 ▼1.20
Settings /wp-admin/edit.php?post_type=accept_payments_wp&page=accept_payments_wp_settings3.5827.00
24/7 Support And Feature Request /wp-admin/edit.php?post_type=accept_payments_wp&page=accept_payments_wp_support3.5723.13
Add New Payment Form /wp-admin/post-new.php?post_type=accept_payments_wp3.8835.84
Payment Forms /wp-admin/edit.php?post_type=accept_payments_wp3.7128.47

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 334 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Braintree Payments For Wordpress - Accept Payments WP: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,837 ▲8315.97 ▲0.286.24 ▲0.372.56 ▼0.51
Dashboard /wp-admin2,930 ▲696.00 ▼0.16121.47 ▼11.81157.52 ▼2.81
Posts /wp-admin/edit.php2,744 ▲563.24 ▲0.0266.01 ▲1.34141.58 ▼1.43
Add New Post /wp-admin/post-new.php1,793 ▲10321.31 ▲0.37451.61 ▲9.37162.60 ▲0.88
Media Library /wp-admin/upload.php1,751 ▲565.54 ▼0.01143.38 ▲2.82183.88 ▼6.38
Settings /wp-admin/edit.php?post_type=accept_payments_wp&page=accept_payments_wp_settings1,2722.6154.01109.09
24/7 Support And Feature Request /wp-admin/edit.php?post_type=accept_payments_wp&page=accept_payments_wp_support1,0392.4155.28133.84
Add New Payment Form /wp-admin/post-new.php?post_type=accept_payments_wp2,1073.85104.59132.69
Payment Forms /wp-admin/edit.php?post_type=accept_payments_wp1,4513.1760.86115.91

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Warning in wp-includes/class-wp-hook.php+307
    call_user_func_array() expects parameter 1 to be a valid callback, function 'deactivate_wp_plugin' not found or invalid function name

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=accept_payments_wp
    • > Warning in wp-content/plugins/accept-payments-wp/includes/core/AcceptPaymentsWPMetaBoxes.php+22
    Illegal string offset 'price'
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=accept_payments_wp
    • > Warning in wp-content/plugins/accept-payments-wp/includes/core/AcceptPaymentsWPMetaBoxes.php+101
    Cannot assign an empty string to a string offset
    • > GET request to /wp-admin/post-new.php?post_type=accept_payments_wp
    • > Warning in wp-content/plugins/accept-payments-wp/includes/core/AcceptPaymentsWPMetaBoxes.php+88
    Illegal string offset 'description'
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=accept_payments_wp
    • > Warning in wp-content/plugins/accept-payments-wp/includes/core/AcceptPaymentsWPMetaBoxes.php+51
    Illegal string offset 'success_page_url'
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=accept_payments_wp
    • > Warning in wp-content/plugins/accept-payments-wp/includes/core/AcceptPaymentsWPMetaBoxes.php+60
    Illegal string offset 'failure_page_url'
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=accept_payments_wp
    • > Warning in wp-content/plugins/accept-payments-wp/includes/core/AcceptPaymentsWPMetaBoxes.php+41
    Illegal string offset 'button_text'
    • > GET request to /wp-admin/post-new.php?post_type=accept_payments_wp
    • > Warning in wp-content/plugins/accept-payments-wp/includes/core/AcceptPaymentsWPMetaBoxes.php+31
    Illegal string offset 'item_description'

SRP 0% 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
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/accept-payments-wp/templates/admin/support.php
  • 206× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Http' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/tests/integration/HttpClientApi.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/lib/Braintree/Exception/Configuration.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/lib/Braintree/Dispute/EvidenceDetails.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Http' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/tests/integration/HttpClientApi.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/lib/Braintree/Result/Successful.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Http' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/tests/integration/HttpClientApi.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Http' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/tests/integration/HttpClientApi.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Http' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/tests/integration/HttpClientApi.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Http' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/tests/integration/HttpClientApi.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/lib/Braintree/Transaction/AndroidPayCardDetails.php:33

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)
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Requires php: Version format is invalid
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can take inspiration from this readme.txt

accept-payments-wp/accept-payments-wp.php Passed 13 tests

"Braintree Payments For Wordpress - Accept Payments WP" version 1.2.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
58 characters long description:
Easily accept Braintree Payments on your Wordpress website

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
These items require your attention
  • Do not distribute dangerous files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/accept-payments-wp/vendor/braintree/braintree_php/lib/ssl/api_braintreegateway_com.ca.crt
36,599 lines of code in 322 files:
LanguageFilesBlank linesComment linesLines of code
PHP3035,3185,57435,652
Markdown62160590
CSS31610102
JSON20087
Ruby117064
JavaScript214456
XML12022
Dockerfile1419
Bourne Shell1308
make1208
SVG1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.08
Average class complexity4.51
▷ Minimum class complexity1.00
▷ Maximum class complexity163.00
Average method complexity1.43
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces26
Interfaces0
Traits0
Classes294
▷ Abstract classes20.68%
▷ Concrete classes29299.32%
▷ Final classes10.34%
Methods2,391
▷ Static methods49020.49%
▷ Public methods2,16490.51%
▷ Protected methods1004.18%
▷ Private methods1275.31%
Functions20
▷ Named functions315.00%
▷ Anonymous functions1785.00%
Constants871
▷ Global constants60.69%
▷ Class constants86599.31%
▷ Public constants865100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 compressed PNG files occupy 0.00MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon-coin.png0.64KB0.56KB▼ 13.03%
vendor/braintree/braintree_php/tests/fixtures/bt_logo.png2.39KB2.26KB▼ 5.32%