78% elex-discount-per-payment-method

Code Review | ELEX WooCommerce Discount Per Payment Method

WordPress plugin ELEX WooCommerce Discount Per Payment Method scored78%from 54 tests.

About plugin

  • Plugin page: elex-discount-per...
  • Plugin version: 1.2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6.0-6.4
  • WordPress version: 6.3.1
  • First release: May 26, 2021
  • Latest release: Nov 9, 2023
  • Number of updates: 19
  • Update frequency: every 47.2 days
  • Top authors: elextensions (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,849 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.02MB] [CPU: ▼8.66ms] Passed 4 tests

An overview of server-side resources used by ELEX WooCommerce Discount Per Payment Method
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0334.12 ▼7.28
Dashboard /wp-admin3.34 ▼0.0145.58 ▼15.14
Posts /wp-admin/edit.php3.39 ▲0.0346.80 ▼0.56
Add New Post /wp-admin/post-new.php5.92 ▲0.0391.49 ▼11.04
Media Library /wp-admin/upload.php3.26 ▲0.0334.11 ▼1.18

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for ELEX WooCommerce Discount Per Payment Method
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,810 ▲6314.68 ▲0.331.56 ▼0.1035.34 ▼7.66
Dashboard /wp-admin2,218 ▲415.68 ▲0.0691.42 ▼9.5040.56 ▼5.56
Posts /wp-admin/edit.php2,121 ▲182.02 ▲0.0135.56 ▼2.9434.88 ▲1.85
Add New Post /wp-admin/post-new.php1,541 ▲1023.34 ▲0.43586.70 ▼69.4647.64 ▼18.73
Media Library /wp-admin/upload.php1,423 ▲234.28 ▲0.11100.67 ▲3.9941.32 ▼2.27

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

Smoke tests 50% 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)
Good news, no errors were detected

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
The following issues need your attention
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/elex-discount-per-payment-method/review_and_troubleshoot_notify/resources/logo.php
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/elex-discount-per-payment-method/includes/scripts.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-discount-per-payment-method/review_and_troubleshoot_notify/resources/review.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/elex-discount-per-payment-method/includes/market.php:108
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/elex-discount-per-payment-method/review_and_troubleshoot_notify/resources/troubleshoot.php:59

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Donate link: Please fix this invalid url: ""
The official readme.txt might help

elex-discount-per-payment-method/elex-discount-per-payment-method.php 92% from 13 tests

The primary PHP file in "ELEX WooCommerce Discount Per Payment Method" version 1.2.0 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Requires at least: The required version number did not match the one declared in readme.txt ("3.0.1" instead of "2.6.0")

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
No dangerous file extensions were detected8,315 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
CSS24186,914
PHP1017653932
PO File393102395
JavaScript152274

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity18.50
▷ Minimum class complexity14.00
▷ Maximum class complexity23.00
Average method complexity3.06
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods17
▷ Static methods00.00%
▷ Public methods17100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions250.00%
▷ Anonymous functions250.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
7 PNG files occupy 0.57MB with 0.44MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/logo/Catalog Mode.png85.64KB21.17KB▼ 75.28%
assets/logo/Name Your Price.png75.69KB17.13KB▼ 77.37%
assets/logo/bulk_edit.png69.40KB15.94KB▼ 77.03%
assets/logo/Hide WooCommerce.png79.45KB18.13KB▼ 77.19%
assets/logo/dynamic_pricing.png90.78KB22.92KB▼ 74.75%