74% pw-woocommerce-gift-cards

Code Review | PW WooCommerce Gift Cards

WordPress plugin PW WooCommerce Gift Cards scored74%from 54 tests.

About plugin

  • Plugin page: pw-woocommerce-gi...
  • Plugin version: 1.250
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.4
  • WordPress version: 6.3.1
  • First release: Jan 25, 2018
  • Latest release: Nov 30, 2023
  • Number of updates: 251
  • Update frequency: every 8.5 days
  • Top authors: pimwick (100%)

Code review

54 tests

User reviews

170 reviews

Install metrics

30,000+ active /1,509,673 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.27MB] [CPU: ▼3.49ms] Passed 4 tests

Server-side resources used by PW WooCommerce Gift Cards
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.76 ▲0.2936.34 ▲2.66
Dashboard /wp-admin3.62 ▲0.2846.77 ▼14.83
Posts /wp-admin/edit.php3.67 ▲0.3149.38 ▲1.61
Add New Post /wp-admin/post-new.php6.14 ▲0.2590.69 ▼3.41
Media Library /wp-admin/upload.php3.48 ▲0.2536.66 ▲6.55

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 92 new files
Database: 2 new tables, 6 new options
New tables
wp_pimwick_gift_card
wp_pimwick_gift_card_activity
New WordPress options
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for PW WooCommerce Gift Cards
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲5314.19 ▼0.151.83 ▲0.2436.39 ▲0.00
Dashboard /wp-admin2,195 ▲175.58 ▼0.1395.07 ▼21.1842.85 ▼4.85
Posts /wp-admin/edit.php2,100 ▼31.95 ▼0.0240.09 ▼0.5237.30 ▲0.01
Add New Post /wp-admin/post-new.php1,526 ▼023.27 ▼0.40589.59 ▼134.0255.03 ▲3.36
Media Library /wp-admin/upload.php1,403 ▲34.23 ▲0.0396.45 ▼6.1940.23 ▼4.62

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • Zombie tables were found after uninstall: 2 tables
    • wp_pimwick_gift_card_activity
    • wp_pimwick_gift_card
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% 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 no errors were found, this is by no means an exhaustive test

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 fix the following items
  • 5× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/pw-woocommerce-gift-cards/templates/woocommerce/emails/plain/customer-pw-gift-card.php:26
    • > PHP Notice
      Undefined variable: item_data in wp-content/plugins/pw-woocommerce-gift-cards/templates/woocommerce/emails/customer-pw-gift-card.php on line 21
    • > PHP Notice
      Undefined variable: email_heading in wp-content/plugins/pw-woocommerce-gift-cards/templates/woocommerce/emails/plain/customer-pw-gift-card.php on line 23
    • > PHP Notice
      Trying to get property 'preview' of non-object in wp-content/plugins/pw-woocommerce-gift-cards/templates/woocommerce/emails/customer-pw-gift-card.php on line 21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/pw-woocommerce-gift-cards/templates/woocommerce/emails/customer-pw-gift-card.php:22

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

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
4 plugin tags: woocommerce, pimwick, gift certificates, gift cards

pw-woocommerce-gift-cards/pw-gift-cards.php 85% from 13 tests

This is the main PHP file of "PW WooCommerce Gift Cards" version 1.250, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("pw-woocommerce-gift-cards.php" instead of "pw-gift-cards.php")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.5" instead of "4.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin13,846 lines of code in 65 files:
LanguageFilesBlank linesComment linesLines of code
PO File153,6145,8518,293
PHP391,1897024,378
CSS512010635
JavaScript59713524
XML10016

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity45.31
▷ Minimum class complexity1.00
▷ Maximum class complexity166.00
Average method complexity3.62
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes538.46%
Methods218
▷ Static methods115.05%
▷ Public methods20895.41%
▷ Protected methods83.67%
▷ Private methods20.92%
Functions24
▷ Named functions2291.67%
▷ Anonymous functions28.33%
Constants2
▷ Global constants2100.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
4 PNG files occupy 0.29MB with 0.14MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/pw-gift-card.png161.65KB59.72KB▼ 63.05%
assets/images/pro-design-example.png126.68KB41.10KB▼ 67.56%
admin/assets/images/pimwick-icon-120x120.png3.89KB1.99KB▼ 48.71%
admin/assets/images/pimwick.png2.74KB2.49KB▼ 9.09%