10% zarinpal-paid-downloads

Code Review | Zarinpal Paid Download

WordPress plugin Zarinpal Paid Download scored 10% from 54 tests.

About plugin

  • Plugin page: zarinpal-paid-dow...
  • Plugin version: 2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.3
  • WordPress version: 6.3.1
  • First release: Apr 19, 2016
  • Latest release: Dec 25, 2019
  • Number of updates: 10
  • Update frequency: every 134.6 days
  • Top authors: Amini7 (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

600+ active / 17,161 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The following installer errors require your attention
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+39
    Undefined variable: zarinpal_currency_list

Server metrics [RAM: ▼1.96MB] [CPU: ▼53.72ms] Passed 4 tests

Server-side resources used by Zarinpal Paid Download
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.03 ▼1.435.04 ▼37.53
Dashboard /wp-admin2.05 ▼1.265.30 ▼46.52
Posts /wp-admin/edit.php2.05 ▼1.315.51 ▼38.77
Add New Post /wp-admin/post-new.php2.05 ▼3.845.99 ▼92.06
Media Library /wp-admin/upload.php2.05 ▼1.184.82 ▼29.00
فايلها /wp-admin/admin.php?page=paid-downloads-files2.055.82
پرداخت ها /wp-admin/admin.php?page=paid-downloads-transactions2.055.31
لينک هاي دريافت /wp-admin/admin.php?page=paid-downloads-links2.057.11
اضافه کردن فايل /wp-admin/admin.php?page=paid-downloads-add2.055.66
تنظيمات /wp-admin/admin.php?page=paid-downloads2.055.62
اضافه کردن لينک /wp-admin/admin.php?page=paid-downloads-add-link2.055.18

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 22 new files
Database: 4 new tables, 6 new options
New tables
wp_pd_orders
wp_pd_transactions
wp_pd_files
wp_pd_downloadlinks
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Zarinpal Paid Download: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,940 ▲20514.04 ▼0.334.79 ▲2.7041.58 ▼2.94
Dashboard /wp-admin2,267 ▲794.85 ▼0.23107.12 ▼3.2156.35 ▲14.50
Posts /wp-admin/edit.php2,147 ▲612.03 ▼0.0139.26 ▲1.8553.11 ▲17.87
Add New Post /wp-admin/post-new.php1,563 ▲3523.22 ▲4.98646.42 ▲3.7662.89 ▲14.00
Media Library /wp-admin/upload.php1,443 ▲524.20 ▼0.1295.54 ▲0.0954.04 ▲8.02
فايلها /wp-admin/admin.php?page=paid-downloads-files9112.1426.4057.91
پرداخت ها /wp-admin/admin.php?page=paid-downloads-transactions8522.0324.4144.97
لينک هاي دريافت /wp-admin/admin.php?page=paid-downloads-links8702.0626.7043.73
اضافه کردن فايل /wp-admin/admin.php?page=paid-downloads-add1,0392.2026.15107.86
تنظيمات /wp-admin/admin.php?page=paid-downloads1,1901.8124.8559.90
اضافه کردن لينک /wp-admin/admin.php?page=paid-downloads-add-link8122.0425.1638.64

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • The plugin did not uninstall gracefully
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • Zombie tables detected upon uninstall: 4 tables
    • wp_pd_orders
    • wp_pd_files
    • wp_pd_downloadlinks
    • wp_pd_transactions
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Almost there, just fix the following server-side errors
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=paid-downloads-add-link
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=paid-downloads-add-link
    • > Notice in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+39
    Undefined variable: zarinpal_currency_list
  • 12 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=paid-downloads-add-link
    • > Notice in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+39
    Trying to access array offset on value of type null
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=paid-downloads-add
    • > Notice in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+648
    Undefined variable: message
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=paid-downloads-add
    • > Notice in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+720
    Undefined variable: file_details
    • > GET request to /wp-admin/admin.php?page=paid-downloads-add
    • > Notice in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+680
    Undefined variable: files
    • > GET request to /wp-admin/admin.php?page=paid-downloads-add
    • > Warning in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+680
    Invalid argument supplied for foreach()
    • > GET request to /wp-admin/admin.php?page=paid-downloads
    • > Notice in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php+314
    Undefined index: updated

SRP 50% 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
Please take a closer look at the following
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/zarinpal-paid-downloads/zarinpalpaid-downloads.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
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
1 plugin tags: zarinpal

zarinpal-paid-downloads/zarinpalpaid-downloads.php 85% from 13 tests

This is the main PHP file of "Zarinpal Paid Download" version 2.3, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 154 characters long)
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("zarinpal-paid-downloads.php" instead of "zarinpalpaid-downloads.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 plugin3,035 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP1166331,842
PO File2414556857
CSS1510335
HTML1001

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.48
Average class complexity295.00
▷ Minimum class complexity295.00
▷ Maximum class complexity295.00
Average method complexity11.89
▷ Minimum method complexity1.00
▷ Maximum method complexity81.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods27
▷ Static methods00.00%
▷ Public methods27100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
11 PNG files occupy 0.02MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/success01.png0.50KB0.35KB▼ 29.16%
images/transactions.png0.51KB0.37KB▼ 27.06%
images/linkhistory.png0.52KB0.56KB0.00%
images/failed01.png0.57KB0.43KB▼ 25.00%
images/downloadlink.png0.54KB0.65KB0.00%