78% razorpay-payment-button-for-visual-composer

Code Review | Razorpay Payment Button for Visual Composer

WordPress plugin Razorpay Payment Button for Visual Composer scored78%from 54 tests.

About plugin

  • Plugin page: razorpay-payment-...
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Mar 8, 2022
  • Latest release: Jun 28, 2022
  • Number of updates: 8
  • Update frequency: every 14.6 days
  • Top authors: razorpay (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /370 total downloads

Benchmarks

Plugin footprint 83% 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.02MB] [CPU: ▼2.83ms] Passed 4 tests

Analyzing server-side resources used by Razorpay Payment Button for Visual Composer
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0338.06 ▼3.82
Dashboard /wp-admin3.34 ▼0.0044.61 ▼18.10
Posts /wp-admin/edit.php3.45 ▲0.1053.27 ▲8.31
Add New Post /wp-admin/post-new.php5.92 ▲0.04105.86 ▲11.32
Media Library /wp-admin/upload.php3.26 ▲0.0434.57 ▲2.29
Subscription Buttons /wp-admin/admin.php?page=rzp_button_view_visual_composer3.2029.73
Settings /wp-admin/admin.php?page=razorpay_visual_composer_settings3.2330.51
Payment Buttons /wp-admin/admin.php?page=razorpay_payment_button_visual_composer3.2031.98
Subscription Buttons /wp-admin/admin.php?page=razorpay_subscription_button_visual_composer3.2129.83

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 203 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Razorpay Payment Button for Visual Composer
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,852 ▲10613.18 ▼1.212.01 ▲0.3043.95 ▲1.67
Dashboard /wp-admin2,233 ▲485.00 ▲0.07109.93 ▼8.0639.13 ▼10.34
Posts /wp-admin/edit.php2,119 ▲302.01 ▲0.0245.74 ▲9.3236.37 ▲3.11
Add New Post /wp-admin/post-new.php1,545 ▲323.25 ▲5.06679.51 ▲43.4161.33 ▲4.85
Media Library /wp-admin/upload.php1,418 ▲364.18 ▼0.0696.91 ▼7.6643.13 ▼0.72
Subscription Buttons /wp-admin/admin.php?page=rzp_button_view_visual_composer6921.146.7926.52
Settings /wp-admin/admin.php?page=razorpay_visual_composer_settings8142.0423.2827.30
Payment Buttons /wp-admin/admin.php?page=razorpay_payment_button_visual_composer6951.536.4616.92
Subscription Buttons /wp-admin/admin.php?page=razorpay_subscription_button_visual_composer6951.537.1217.80

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
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
The following issues need your attention
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/razorpay-payment-button-for-visual-composer/index.php
  • 116× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WpOrg\\Requests\\Exception\\Http' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/libs/Requests-2.0.0/src/Exception/Http/Status408.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Requests_Exception_HTTP' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/libs/Requests-1.8.0/library/Requests/Exception/HTTP/431.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WpOrg\\Requests\\Exception\\Http' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/libs/Requests-2.0.0/src/Exception/Http/Status400.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Razorpay\\Api\\Entity' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/src/Payment.php:7
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/razorpay-payment-button-for-visual-composer/includes/rzp-payment-buttons.php on line 5
    • > PHP Fatal error
      Uncaught Error: Class 'Razorpay\\Api\\Entity' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/src/PaymentLink.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'WpOrg\\Requests\\Utility\\CaseInsensitiveDictionary' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/libs/Requests-2.0.0/src/Response/Headers.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Requests_Exception' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/libs/Requests-1.8.0/library/Requests/Exception/HTTP.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'WpOrg\\Requests\\Exception\\Http' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/libs/Requests-2.0.0/src/Exception/Http/Status428.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Razorpay\\Api\\Entity' not found in wp-content/plugins/razorpay-payment-button-for-visual-composer/razorpay-sdk/src/Item.php:5

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

readme.txt Passed 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
9 plugin tags: upicreditdebit card, payment gateway, e-commerce, payment plugin, donate button...

razorpay-payment-button-for-visual-composer/index.php 92% from 13 tests

The main PHP file in "Razorpay Payment Button for Visual Composer" ver. 1.0.2 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("razorpay-payment-button-for-visual-composer.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin24,344 lines of code in 192 files:
LanguageFilesBlank linesComment linesLines of code
JSON90013,831
PHP1682,2087,1948,821
Markdown552201,358
CSS248159
JavaScript63238116
XML12041
YAML12118

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity9.80
▷ Minimum class complexity1.00
▷ Maximum class complexity197.00
Average method complexity3.55
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces15
Interfaces10
Traits0
Classes156
▷ Abstract classes00.00%
▷ Concrete classes156100.00%
▷ Final classes4528.85%
Methods588
▷ Static methods12521.26%
▷ Public methods48582.48%
▷ Protected methods9415.99%
▷ Private methods91.53%
Functions4
▷ Named functions250.00%
▷ Anonymous functions250.00%
Constants73
▷ Global constants912.33%
▷ Class constants6487.67%
▷ Public constants64100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 0.16MB with 0.09MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
elements/rzpSubscriptionButton/rzpSubscriptionButton/public/subscription-button-element-preview.png67.60KB25.25KB▼ 62.65%
elements/rzpSubscriptionButton/rzpSubscriptionButton/public/subscription-button-element-thumbnail.png8.06KB4.49KB▼ 44.33%
elements/rzpPaymentButton/rzpPaymentButton/public/payment-button-element-preview.png75.96KB24.95KB▼ 67.15%
elements/rzpPaymentButton/rzpPaymentButton/public/payment-button-element-thumbnail.png8.06KB4.49KB▼ 44.33%