10% shopper-rewards-free-for-wp-ecommerce

Code Review | Shopper Rewards for WP-eCommerce

WordPress plugin Shopper Rewards for WP-eCommerce scored 10% from 54 tests.

About plugin

  • Plugin page: shopper-rewards-f...
  • Plugin version: 2013.07.15.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-3.6
  • WordPress version: 6.3.1
  • First release: Jul 14, 2013
  • Latest release: Jul 22, 2013
  • Number of updates: 19
  • Update frequency: every 0.4 days
  • Top authors: jeff@pyebrook.com (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 2,476 total downloads

Benchmarks

Plugin footprint 39% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
It is recommended to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/pbci-product-manager-client.class.php+4
    Methods with the same name as their class will not be constructors in a future version of PHP; PBCI_Product_Manager_Client has a deprecated constructor

Server metrics [RAM: ▲0.07MB] [CPU: ▲606.44ms] 50% from 4 tests

Server-side resources used by Shopper Rewards for WP-eCommerce
The following require your attention
  • CPU: Total CPU usage should be kept under 500.00ms (currently 1,285.51ms on /wp-admin/admin.php?page=pbci_shopper_rewards_redeem)
  • Extra CPU: Extra CPU usage must be kept under 200.00ms (currently 606.44ms on /wp-admin/admin.php?page=pbci_shopper_rewards_redeem)
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0338.69 ▼1.01
Dashboard /wp-admin3.43 ▲0.13900.03 ▲852.08
Posts /wp-admin/edit.php3.48 ▲0.12847.81 ▲804.21
Add New Post /wp-admin/post-new.php5.95 ▲0.06908.19 ▲808.91
Media Library /wp-admin/upload.php3.29 ▲0.06843.62 ▲813.64
Upgrade to Basic /wp-admin/admin.php?page=registration_page_callback3.252,707.61
Exclude Categories /wp-admin/admin.php?page=pbci_shopper_rewards_categories3.23809.51
Get Coupon /wp-admin/admin.php?page=pbci_shopper_rewards_get_coupon3.23811.94
Redemption Levels /wp-admin/admin.php?page=pbci_shopper_rewards_redemption_levels3.25823.20
Points Details /wp-admin/admin.php?page=points_details_list_page3.26811.48
Import /wp-admin/admin.php?page=pbci_shopper_rewards_import3.25807.33
Welcome /wp-admin/admin.php?page=pbci_shopper_rewards_admin3.23826.98
Settings /wp-admin/admin.php?page=pbci_shopper_rewards_settings3.23867.38
Redeem /wp-admin/admin.php?page=pbci_shopper_rewards_redeem3.251,285.51

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 39 new files
Database: 1 new table, 7 new options
New tables
wp_shopper_rewards
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_recent-posts
db_upgraded
can_compress_scripts
recovery_mode_email_last_sent
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Shopper Rewards for WP-eCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,846 ▲11113.65 ▼0.751.86 ▼0.0145.78 ▼1.47
Dashboard /wp-admin2,238 ▲495.82 ▲0.8599.84 ▼24.9081.14 ▲36.30
Posts /wp-admin/edit.php2,136 ▲471.98 ▼0.0233.85 ▼5.2333.24 ▼1.19
Add New Post /wp-admin/post-new.php1,703 ▲18921.93 ▲4.40725.89 ▲51.6946.13 ▼10.97
Media Library /wp-admin/upload.php1,432 ▲414.22 ▼0.0397.17 ▼2.2776.48 ▲30.16
Upgrade to Basic /wp-admin/admin.php?page=registration_page_callback8702.0224.6029.95
Exclude Categories /wp-admin/admin.php?page=pbci_shopper_rewards_categories8852.0122.6031.62
Get Coupon /wp-admin/admin.php?page=pbci_shopper_rewards_get_coupon8332.0222.9823.17
Redemption Levels /wp-admin/admin.php?page=pbci_shopper_rewards_redemption_levels9532.0624.2226.56
Points Details /wp-admin/admin.php?page=points_details_list_page1,0012.2024.9128.54
Import /wp-admin/admin.php?page=pbci_shopper_rewards_import8242.0326.7926.69
Welcome /wp-admin/admin.php?page=pbci_shopper_rewards_admin9022.0223.5238.78
Settings /wp-admin/admin.php?page=pbci_shopper_rewards_settings7551.146.5618.66
Redeem /wp-admin/admin.php?page=pbci_shopper_rewards_redeem8052.0222.9920.86

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_shopper_rewards
  • Zombie WordPress options detected upon uninstall: 7 options
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • recovery_mode_email_last_sent

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pbci_shopper_rewards_categories
    • > Notice in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/categories.php+81
    Trying to get property 'term_id' of non-object
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pbci_shopper_rewards_categories
    • > Notice in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/categories.php+81
    Trying to get property 'name' of non-object
    • > GET request to /wp-admin/admin.php?page=pbci_shopper_rewards_get_coupon
    • > Notice in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/redeem.php+228
    Undefined index: redemption
    • > GET request to /wp-admin/admin.php?page=pbci_shopper_rewards_get_coupon
    • > Notice in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/util.php+148
    Undefined index: HTTP_REFERER
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pbci_shopper_rewards_admin
    • > Warning in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/db.php+157
    Use of undefined constant WPSC_TABLE_COUPON_CODES - assumed 'WPSC_TABLE_COUPON_CODES' (this will throw an Error in a future version of PHP)
    • > GET request to /wp-admin/admin.php?page=pbci_shopper_rewards_settings
    • > Warning in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/messages.php+61
    _() expects exactly 1 parameter, 2 given
    • > GET request to /wp-admin/admin.php?page=pbci_shopper_rewards_settings
    • > Error in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/settings.php+93
    Uncaught Error: Call to undefined function wpsc_currency_display() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/settings.php:93
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): pbci_shopper_rewards_settings()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin.php(259): do_action()
    #4 {main}
    thrown

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 15× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/wpsc-hooks-and-filters.php:72
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/userprofile.php:69
    • > PHP Fatal error
      Uncaught Error: Call to undefined function has_action() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/pbci-product-manager-client.class.php:890
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/loginbyemail.php:58
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/list-totals.php on line 65
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/style.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/status.php:219
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/list-totals.php on line 65
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/list-details.php on line 64
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/shopper-rewards-free-for-wp-ecommerce/core/receipt.php:67

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
5 plugin tags: rewards, points, shopping, store, wp-ecommerce

shopper-rewards-free-for-wp-ecommerce/pbci-shopper-rewards-for-wpec.php 92% from 13 tests

The entry point to "Shopper Rewards for WP-eCommerce" version 2013.07.15.1 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("shopper-rewards-free-for-wp-ecommerce.php" instead of "pbci-shopper-rewards-for-wpec.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
Good job! No executable or dangerous file extensions detected3,320 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP217321,4802,497
HTML11080626
PO File15455148
CSS1102049

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity28.50
▷ Minimum class complexity1.00
▷ Maximum class complexity85.00
Average method complexity2.75
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods63
▷ Static methods11.59%
▷ Public methods5587.30%
▷ Protected methods00.00%
▷ Private methods812.70%
Functions99
▷ Named functions99100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
7 PNG files occupy 0.11MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/pye-brook-shopper-rewards-logo-16.png0.84KB0.95KB0.00%
images/bpicon32.png1.37KB1.38KB0.00%
images/pye-brook-shopper-rewards-logo-100.png11.07KB5.11KB▼ 53.84%
images/pye-brook-shopper-rewards-logo-32.png2.32KB1.77KB▼ 23.62%
images/pye-brook-logo-16-16.png0.57KB0.52KB▼ 7.77%