62% woo-notification-and-alerts

Code Review | Recent Sales Notifications for WooCommerce

WordPress plugin Recent Sales Notifications for WooCommerce scored62%from 54 tests.

About plugin

  • Plugin page: woo-notification-...
  • Plugin version: 1.1.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.0-5.8
  • WordPress version: 6.3.1
  • First release: Nov 6, 2019
  • Latest release: Nov 25, 2021
  • Number of updates: 16
  • Update frequency: every 46.9 days
  • Top authors: woobewoo (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,509 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲1.80MB] [CPU: ▲10.08ms] 75% from 4 tests

A check of server-side resources used by Recent Sales Notifications for WooCommerce
Please take the time to fix the following items
  • CPU: Try to keep total CPU usage under 500.00ms (currently 1,098.68ms on /wp-admin/admin.php?page=wns-notifications&tab=overview)
PageMemory (MB)CPU Time (ms)
Home /5.12 ▲1.6677.61 ▲40.88
Dashboard /wp-admin5.18 ▲1.8367.01 ▲6.93
Posts /wp-admin/edit.php5.24 ▲1.8964.37 ▲13.94
Add New Post /wp-admin/post-new.php7.71 ▲1.82111.68 ▲2.31
Media Library /wp-admin/upload.php5.18 ▲1.9552.82 ▲17.13
Overview /wp-admin/admin.php?page=wns-notifications&tab=overview5.511,098.68
/wp-admin/admin.php?page=wns-notifications5.2265.24
Settings /wp-admin/admin.php?page=wns-notifications&tab=settings5.2249.33
Show All Notifications /wp-admin/admin.php?page=wns-notifications&tab=woonotifications5.2246.62

Server storage [IO: ▲7.18MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 444 new files
Database: 5 new tables, 12 new options
New tables
wp_wns_usage_stat
wp_wns_notifications
wp_wns_modules_type
wp_wns_modules
wp_wns_notifications_templates
New WordPress options
wp_wns_db_installed
can_compress_scripts
db_upgraded
widget_wnswoonotificationswidget
wp_wns_db_version
widget_theysaidso_widget
wns_opts_data
theysaidso_admin_options
wns_plugin_activation_errors
wns_plug_was_used
...

Browser metrics Passed 4 tests

Recent Sales Notifications for WooCommerce: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,000 ▲23914.15 ▼0.2110.52 ▲8.8443.14 ▼2.21
Dashboard /wp-admin2,253 ▲795.44 ▼0.2292.96 ▲0.8743.79 ▲3.07
Posts /wp-admin/edit.php2,158 ▲582.59 ▲0.5734.19 ▼5.8932.59 ▼4.55
Add New Post /wp-admin/post-new.php1,585 ▲5918.95 ▼4.68634.28 ▲17.2444.33 ▼9.11
Media Library /wp-admin/upload.php1,465 ▲684.99 ▲0.84106.11 ▼1.4744.31 ▼3.06
Overview /wp-admin/admin.php?page=wns-notifications&tab=overview1,94010.99307.8634.10
/wp-admin/admin.php?page=wns-notifications1,6985.78101.8489.76
Settings /wp-admin/admin.php?page=wns-notifications&tab=settings1,2704.7770.0424.84
Show All Notifications /wp-admin/admin.php?page=wns-notifications&tab=woonotifications1,6955.7197.3934.91
Add New Notification /wp-admin/admin.php?page=wns-notifications&tab=woonotifications#wnsadd1,7214.97109.6138.32

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • The uninstall procedure failed, leaving 2 tables in the database
    • wp_wns_notifications_templates
    • wp_wns_notifications
  • This plugin did not uninstall successfully, leaving 10 options in the database
    • wns_plugin_activation_errors
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • wns_opts_data
    • widget_theysaidso_widget
    • wns_plug_was_used
    • widget_wnswoonotificationswidget
    • widget_recent-posts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These server-side errors were triggered
  • 12 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wns-notifications&tab=woonotifications
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)

SRP 0% 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
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/woo-notification-and-alerts/modules/woonotifications_widgets/views/tpl/widget.php
  • 87× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/woo-notification-and-alerts/modules/promo/views/tpl/layeredStylePromo.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/woo-notification-and-alerts/modules/woonotifications/views/tpl/woonotificationsNavTabABSettings.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/woo-notification-and-alerts/modules/options/views/tpl/optionsSettingsTabContent.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'viewWns' not found in wp-content/plugins/woo-notification-and-alerts/modules/mail/views/mail.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'controllerWns' not found in wp-content/plugins/woo-notification-and-alerts/modules/promo/controller.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'baseObjectWns' not found in wp-content/plugins/woo-notification-and-alerts/classes/module.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/woo-notification-and-alerts/modules/promo/views/tpl/adminFooter.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'controllerWns' not found in wp-content/plugins/woo-notification-and-alerts/modules/mail/controller.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/woo-notification-and-alerts/modules/woonotifications/views/tpl/woonotificationsNavTabContent.php:1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/woo-notification-and-alerts/modules/woonotifications/views/tpl/showAdminNotice.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
8 plugin tags: live sales feed, woocommerce notifications, woocommerce, popup, coupon...

woo-notification-and-alerts/wns.php 85% from 13 tests

Analyzing the main PHP file in "Recent Sales Notifications for WooCommerce" version 1.1.6
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("woo-notification-and-alerts.php" instead of "wns.php")
  • Requires at least: The required version number did not match the one declared in readme.txt ("3.3" instead of "3.4.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected38,533 lines of code in 271 files:
LanguageFilesBlank linesComment linesLines of code
PHP1219973,37517,817
JavaScript1069822,35712,089
CSS424702985,016
SVG1002,671
PO File1367424940

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity25.61
▷ Minimum class complexity1.00
▷ Maximum class complexity194.00
Average method complexity3.16
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes82
▷ Abstract classes910.98%
▷ Concrete classes7389.02%
▷ Final classes00.00%
Methods935
▷ Static methods26228.02%
▷ Public methods83789.52%
▷ Protected methods747.91%
▷ Private methods242.57%
Functions30
▷ Named functions2996.67%
▷ Anonymous functions13.33%
Constants87
▷ Global constants6271.26%
▷ Class constants2528.74%
▷ Public constants25100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
67 PNG files occupy 0.64MB with 0.29MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/ui-icons_666666_256x240.png6.82KB4.17KB▼ 38.82%
modules/woonotifications/img/assets/close_btns/close-orange.png2.00KB1.36KB▼ 32.10%
modules/woonotifications/img/ad/price_skin_big.png45.91KB14.84KB▼ 67.67%
modules/woonotifications/img/assets/close_btns/lists_black.png0.88KB0.53KB▼ 39.76%
modules/woonotifications/img/skin1.png2.61KB1.43KB▼ 45.34%