65% clover-online-orders

Code Review | Smart Online Order for Clover

WordPress plugin Smart Online Order for Clover scored65%from 54 tests.

About plugin

  • Plugin page: clover-online-orders
  • Plugin version: 1.5.5
  • PHP compatiblity: 5.2.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7.1-6.3.2
  • WordPress version: 6.3.1
  • First release: Feb 13, 2016
  • Latest release: Oct 31, 2023
  • Number of updates: 206
  • Update frequency: every 13.7 days
  • Top authors: elbanyaoui (100%)

Code review

54 tests

User reviews

34 reviews

Install metrics

2,000+ active /47,018 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.45MB] [CPU: ▲1,230.57ms] 50% from 4 tests

Analyzing server-side resources used by Smart Online Order for Clover
The following require your attention
  • CPU: You should keep total CPU usage under 500.00ms (currently 2,789.91ms on /wp-admin/admin.php?page=moo_orders)
  • Extra CPU: The extra CPU usage must be under 200.00ms (currently 1,230.57ms on /wp-admin/admin.php?page=moo_orders)
PageMemory (MB)CPU Time (ms)
Home /3.81 ▲0.3542.40 ▲0.07
Dashboard /wp-admin3.86 ▲0.511,737.67 ▲1,674.69
Posts /wp-admin/edit.php3.86 ▲0.501,684.02 ▲1,634.50
Add New Post /wp-admin/post-new.php6.75 ▲0.861,748.30 ▲1,650.46
Media Library /wp-admin/upload.php3.66 ▲0.431,673.86 ▲1,637.24
Items / Images / Description /wp-admin/admin.php?page=moo_items4.032,543.38
Loyalty Dashboard /wp-admin/admin.php?page=moo_dashboard3.623,454.16
Reports /wp-admin/admin.php?page=moo_reports3.571,678.38
Store Interfaces /wp-admin/admin.php?page=moo_themes3.651,671.41
Settings /wp-admin/admin.php?page=moo_index3.791,673.45
Coupons /wp-admin/admin.php?page=moo_coupons3.752,394.39
Orders /wp-admin/admin.php?page=moo_orders3.642,789.91

Server storage [IO: ▲6.98MB] [DB: ▲0.02MB] Passed 3 tests

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 245 new files
Database: 17 new tables, 12 new options
New tables
wp_moo_item_group
wp_moo_tag
wp_moo_order
wp_moo_item_tax_rate
wp_moo_item_order
wp_moo_tax_rate
wp_moo_modifier
wp_moo_images
wp_moo_order_types
wp_moo_item_modifier_group
...
New WordPress options
can_compress_scripts
moo_new_checkout_enabled
moo_onlineOrders_version
widget_recent-comments
theysaidso_admin_options
widget_moo_widget_oh
db_upgraded
widget_theysaidso_widget
widget_recent-posts
moo_settings
...

Browser metrics Passed 4 tests

Smart Online Order for Clover: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,195 ▲44916.66 ▲2.1914.68 ▲12.9542.41 ▼1.13
Dashboard /wp-admin2,475 ▲2987.03 ▲1.38141.50 ▲44.2238.46 ▼7.43
Posts /wp-admin/edit.php2,412 ▲3124.64 ▲2.6065.78 ▲26.0292.85 ▲59.66
Add New Post /wp-admin/post-new.php1,822 ▲29624.48 ▲0.82680.90 ▲1.84211.52 ▲151.03
Media Library /wp-admin/upload.php1,546 ▲1495.87 ▲1.6999.63 ▼4.2596.22 ▲54.86
Items / Images / Description /wp-admin/admin.php?page=moo_items1,4214.4669.4252.48
Loyalty Dashboard /wp-admin/admin.php?page=moo_dashboard26712.23352.8151.98
Reports /wp-admin/admin.php?page=moo_reports8002.8432.2018.39
Store Interfaces /wp-admin/admin.php?page=moo_themes1,2624.5868.6997.91
Settings /wp-admin/admin.php?page=moo_index6,06221.58583.49133.26
Coupons /wp-admin/admin.php?page=moo_coupons1,3384.4661.0284.67
Orders /wp-admin/admin.php?page=moo_orders1,2534.4559.5976.56

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin does not fully uninstall, leaving 16 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • moo_new_checkout_enabled
    • moo_next_order_number
    • db_upgraded
    • moo_slug
    • moo_pakms_key
    • widget_moo_widget_oh
    • can_compress_scripts
    • theysaidso_admin_options
    • ...

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These errors were triggered by the plugin
    • > GET request to /wp-admin/admin.php?page=moo_coupons
    • > Notice in wp-content/plugins/clover-online-orders/admin/includes/class-moo-coupons-list.php+63
    Trying to get property 'elements' of non-object
    • > GET request to /wp-admin/admin.php?page=moo_coupons
    • > Notice in wp-content/plugins/clover-online-orders/admin/includes/class-moo-coupons-list.php+31
    Trying to access array offset on value of type null
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=moo_orders
    • > Notice in wp-content/plugins/clover-online-orders/admin/includes/class-moo-orders-list.php+33
    Trying to access array offset on value of type bool

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/clover-online-orders/admin/partials/moo-OnlineOrders-admin-display.php
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/clover-online-orders/includes/moo-OnlineOrders-widgets.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/clover-online-orders/includes/moo-OnlineOrders-Restapi.php:8

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There are user-side issues you should fix
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=moo_orders
    • > Console-api (warning) in unknown
    https://maps.googleapis.com/maps/api/js?key=AIzaSyBv1TkdxvWkbFaDz2r0Yx7xvlNKe-2uyRc&libraries=drawing&geometry&ver=6.3.1 213:51 "Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading"
    • > GET request to /wp-admin/admin.php?page=moo_dashboard
    • > Console-api (warning) in unknown
    https://maps.googleapis.com/maps/api/js?key=AIzaSyBv1TkdxvWkbFaDz2r0Yx7xvlNKe-2uyRc 210:51 "Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading"
    • > GET request to /wp-admin/admin.php?page=moo_dashboard
    • > Security (warning) in unknown
    https://apis.google.com/_/scs/abc-static/_/js/k=gapi.lb.en.AOzoyjtjrhQ.O/m=auth2,client/rt=j/sv=1/d=1/ed=1/rs=AHpOoo9-fA1P7IZFa1fdRj158NoDqrnbYA/cb=gapi.loaded_0?le=scs 184 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
    • > GET request to /wp-admin/admin.php?page=moo_reports
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).wpColorPicker is not a function" "TypeError: $(...).wpColorPicker is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/clover-online-orders/admin/js/moo-OnlineOrders-admin.js?ver=1.5.5:203:31)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&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,moxiejs,plupload&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=moo_reports
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28721 Uncaught TypeError: $(...).wpColorPicker is not a function

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Screenshots: Add descriptions for screenshots #1, #10, #2, #3, #4, #5, #6, #7, #8, #9 in clover-online-orders/assets to your readme.txt
The official readme.txt might help

clover-online-orders/moo_OnlineOrders.php 85% from 13 tests

The principal PHP file in "Smart Online Order for Clover" v. 1.5.5 is loaded by WordPress automatically on each request
The following require your attention:
  • Text Domain: The text domain name should consist of only dashes and lowercase characters
  • Main file name: Name the main plugin file the same as the plugin slug ("clover-online-orders.php" instead of "moo_OnlineOrders.php")

Code Analysis 97% from 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 detected57,371 lines of code in 114 files:
LanguageFilesBlank linesComment linesLines of code
PHP362,2532,82120,413
SVG240120,144
CSS223693067,997
JavaScript266273737,446
JSON450773
PO File1257305596
Markdown1002

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 167)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity87.12
▷ Minimum class complexity1.00
▷ Maximum class complexity457.00
Average method complexity5.17
▷ Minimum method complexity1.00
▷ Maximum method complexity167.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes34
▷ Abstract classes00.00%
▷ Concrete classes34100.00%
▷ Final classes00.00%
Methods703
▷ Static methods233.27%
▷ Public methods59484.50%
▷ Protected methods304.27%
▷ Private methods7911.24%
Functions18
▷ Named functions18100.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants8100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
66 PNG files occupy 0.79MB with 0.22MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/img/si5.png61.39KB24.82KB▼ 59.57%
admin/img/edit-icon.png0.26KB0.20KB▼ 21.13%
public/img/ic_launcher2.old.png0.53KB0.63KB0.00%
public/img/substract.png0.18KB0.11KB▼ 40.33%
public/img/last.png0.35KB0.28KB▼ 21.27%