10% reward-points-for-woocommerce

Code Review | Reward Points for Woocommerce

WordPress plugin Reward Points for Woocommerce scored 10% from 54 tests.

About plugin

  • Plugin page: reward-points-for...
  • Plugin version: 4.6.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2
  • WordPress version: 6.3.1
  • First release: Oct 20, 2016
  • Latest release: Aug 1, 2023
  • Number of updates: 136
  • Update frequency: every 18.2 days
  • Top authors: phoeniixx (100%)

Code review

54 tests

User reviews

28 reviews

Install metrics

100+ active / 28,761 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The following installer errors require your attention
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/reward-points-for-woocommerce/public/class-phoen-rewpts-public.php+81
    Trying to access array offset on value of type bool

Server metrics [RAM: ▼0.96MB] [CPU: ▼43.39ms] Passed 4 tests

An overview of server-side resources used by Reward Points for Woocommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.01 ▼0.4416.53 ▼26.72
Dashboard /wp-admin3.05 ▼0.2516.16 ▼33.11
Posts /wp-admin/edit.php3.05 ▼0.3018.54 ▼30.21
Add New Post /wp-admin/post-new.php3.05 ▼2.8317.46 ▼83.50
Media Library /wp-admin/upload.php3.05 ▼0.1719.45 ▼15.57
Reward Points /wp-admin/admin.php?page=Phoeniixx_reward_settings3.0520.66

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 95 new files
Database: no new tables, 11 new options
New WordPress options
phoe_set_point_value
widget_recent-posts
phoen_rewpts_custom_btn_styling
db_upgraded
phoe_rewpts_page_settings_value
widget_recent-comments
phoen_reward_point_plugin_acivation_date
can_compress_scripts
phoen_rewpts_notification_settings
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

A check of browser resources used by Reward Points for Woocommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,941 ▲20613.78 ▼0.607.02 ▲5.3444.97 ▼5.57
Dashboard /wp-admin2,227 ▲725.09 ▼0.60111.98 ▲11.2143.78 ▲4.80
Posts /wp-admin/edit.php2,112 ▲262.29 ▲0.3342.93 ▲6.8237.45 ▲1.93
Add New Post /wp-admin/post-new.php1,531 ▲723.38 ▲0.27589.11 ▼23.1831.42 ▼21.39
Media Library /wp-admin/upload.php1,409 ▲214.48 ▲0.2897.70 ▲1.0245.05 ▲3.71
Reward Points /wp-admin/admin.php?page=Phoeniixx_reward_settings9441.9928.6527.07

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
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/reward-points-for-woocommerce/public/class-phoen-rewpts-public.php+744
    Undefined offset: 1
  • The uninstall procedure has failed, leaving 11 options in the database
    • widget_recent-comments
    • phoen_rewpts_custom_btn_styling
    • phoen_rewpts_notification_settings
    • phoen_reward_point_plugin_acivation_date
    • widget_recent-posts
    • phoe_set_point_value
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • phoe_rewpts_page_settings_value
    • ...

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/admin.php?page=Phoeniixx_reward_settings
    • > Notice in wp-content/plugins/reward-points-for-woocommerce/public/class-phoen-rewpts-public.php+744
    Undefined offset: 1

SRP 0% from 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
Please take a closer look at the following
  • 4× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/reward-points-for-woocommerce/public/partials/phoen-rewpts-public-display.php
    • > /wp-content/plugins/reward-points-for-woocommerce/admin/partials/phoen-rewpts-admin-display.php
    • > /wp-content/plugins/reward-points-for-woocommerce/public/phoen-reward-frontend/my-account/reward.php
    • > /wp-content/plugins/reward-points-for-woocommerce/admin/phoen-reward-backend/customer-reports/phoen_reward_upate_user_point_form.php
  • 13× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'PHOEN_REWPTSPLUGPATHpublic/phoen-reward-frontend/phoen_cart_page_class.php' (include_path='.:/usr/share/php') in wp-content/plugins/reward-points-for-woocommerce/public/class-phoen-rewpts-public.php on line 2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/reward-points-for-woocommerce/public/phoen-reward-frontend/single-product/single-product-notification.php:3
    • > PHP Warning
      Use of undefined constant PHOEN_REWPTSPLUGPATH - assumed 'PHOEN_REWPTSPLUGPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/reward-points-for-woocommerce/public/class-phoen-rewpts-public.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/reward-points-for-woocommerce/public/phoen-reward-frontend/cart/apply_points_cart_page.php:5
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/reward-points-for-woocommerce/admin/phoen-reward-backend/customer-reports/phoen_all_user_wp_list_table.php on line 4
    • > PHP Warning
      require_once(PHOEN_REWPTSPLUGPATHpublic/phoen-reward-frontend/phoen_cart_page_class.php): failed to open stream: No such file or directory in wp-content/plugins/reward-points-for-woocommerce/public/class-phoen-rewpts-public.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function phoen_reward_check_first_order() in wp-content/plugins/reward-points-for-woocommerce/public/phoen-reward-frontend/checkout/checkout_notification.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/reward-points-for-woocommerce/public/phoen-reward-frontend/checkout/apply_point_checkout_page.php:5
    • > 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/reward-points-for-woocommerce/admin/phoen-reward-backend/customer-reports/phoen_all_user_wp_list_table.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/reward-points-for-woocommerce/admin/phoen-reward-backend/customer-reports/phoen_all_user_function.php:4

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=Phoeniixx_reward_settings
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: jQuery(...).datepicker is not a function" "TypeError: jQuery(...).datepicker is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/reward-points-for-woocommerce/admin/js/phoen-rewpts-admin.js?ver=1.0.0:54:71)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=Phoeniixx_reward_settings
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: jQuery(...).datepicker is not a function

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Tags: Too many tags (24 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

reward-points-for-woocommerce/phoen-rewpts.php 77% from 13 tests

The main file in "Reward Points for Woocommerce" v. 4.6.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("reward-points-for-woocommerce.php" instead of "phoen-rewpts.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Description: The description should be shorter than 140 characters (currently 142 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected4,191 lines of code in 45 files:
LanguageFilesBlank linesComment linesLines of code
PHP381,9906383,875
JavaScript47057230
CSS313586

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity15.08
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity3.20
▷ Minimum method complexity1.00
▷ Maximum method complexity39.00
Code structure
Namespaces0
Interfaces0
Traits5
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods83
▷ Static methods11.20%
▷ Public methods6072.29%
▷ Protected methods00.00%
▷ Private methods2327.71%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants14
▷ Global constants14100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
43 PNG files occupy 0.77MB with 0.34MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/manage_customer_points.png35.20KB12.01KB▼ 65.88%
admin/images/Extra-Points.png21.04KB7.55KB▼ 64.11%
admin/images/image-frame-odd.png0.90KB0.81KB▼ 10.31%
admin/images/head-arrow.png1.68KB1.43KB▼ 14.83%
admin/images/payment_gateway_points.png5.95KB2.16KB▼ 63.66%