89% zarinpal-woocommerce-payment-gateway

Code Review | Zarinpal Gateway

WordPress plugin Zarinpal Gateway scored89%from 54 tests.

About plugin

  • Plugin page: zarinpal-woocomme...
  • Plugin version: 4.8.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.8
  • WordPress version: 6.3.1
  • First release: Apr 17, 2016
  • Latest release: Nov 22, 2021
  • Number of updates: 35
  • Update frequency: every 78.5 days
  • Top authors: Amini7 (77.14%)aliafi (25.71%)

Code review

54 tests

User reviews

9 reviews

Install metrics

50,000+ active /329,760 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼6.67ms] Passed 4 tests

A check of server-side resources used by Zarinpal Gateway
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0846.79 ▼1.03
Dashboard /wp-admin3.39 ▲0.0450.24 ▼20.21
Posts /wp-admin/edit.php3.44 ▲0.0854.34 ▼1.89
Add New Post /wp-admin/post-new.php5.97 ▲0.08102.46 ▼3.55
Media Library /wp-admin/upload.php3.31 ▲0.0854.37 ▲18.54

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

Zarinpal Gateway: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.24 ▼0.131.85 ▼0.2546.83 ▼0.43
Dashboard /wp-admin2,192 ▲115.52 ▼0.2190.42 ▼16.4537.52 ▼6.79
Posts /wp-admin/edit.php2,100 ▼02.02 ▼0.0140.08 ▼1.8736.32 ▼2.58
Add New Post /wp-admin/post-new.php1,526 ▼523.11 ▲0.11630.52 ▼48.9849.20 ▼7.05
Media Library /wp-admin/upload.php1,400 ▼04.23 ▲0.0799.92 ▼9.5542.45 ▼2.46

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

SRP Passed 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
Everything seems fine, however this is by no means an exhaustive test

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% 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
10 plugin tags: payment gateway, zarinpal woocommerce, e-commerce, woocommerce, persian...

zarinpal-woocommerce-payment-gateway/index.php 85% from 13 tests

The main PHP file in "Zarinpal Gateway" ver. 4.8.1 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("zarinpal-woocommerce-payment-gateway.php" instead of "index.php")
  • Plugin Name: It is recommended to keep the plugin name shorter than 70 characters (currently 74 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin423 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP211923423

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity66.00
▷ Minimum class complexity66.00
▷ Maximum class complexity66.00
Average method complexity11.83
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods6
▷ Static methods00.00%
▷ Public methods6100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
11 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/logo_4.png1.18KB0.60KB▼ 49.59%
assets/images/logo_5.png3.50KB1.95KB▼ 44.25%
assets/images/logo_2.png0.91KB0.72KB▼ 20.88%
assets/images/logo_8.png2.67KB2.00KB▼ 24.91%
assets/images/logo_10.png4.85KB2.42KB▼ 50.07%