78% digital-lottery

Code Review | Digital Lottery

WordPress plugin Digital Lottery scored78%from 54 tests.

About plugin

  • Plugin page: digital-lottery
  • Plugin version: 3.0.2
  • PHP compatiblity: 7.4 or greater+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8-6.4.1
  • WordPress version: 6.3.1
  • First release: Feb 13, 2023
  • Latest release: Dec 2, 2023
  • Number of updates: 48
  • Update frequency: every 6.2 days
  • Top authors: shafiqul6171 (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active /2,851 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼4.62ms] Passed 4 tests

Server-side resources used by Digital Lottery
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.97 ▼0.62
Dashboard /wp-admin3.31 ▼0.0444.16 ▼17.86
Posts /wp-admin/edit.php3.36 ▲0.0048.82 ▲0.59
Add New Post /wp-admin/post-new.php5.89 ▲0.0088.96 ▲0.10
Media Library /wp-admin/upload.php3.23 ▲0.0033.16 ▼0.11

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 130 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Digital Lottery
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲6814.54 ▲0.162.09 ▲0.4944.38 ▲5.53
Dashboard /wp-admin2,198 ▲205.63 ▼0.0689.56 ▼20.9043.25 ▲0.44
Posts /wp-admin/edit.php2,103 ▲31.94 ▼0.0043.26 ▲2.5940.93 ▲4.00
Add New Post /wp-admin/post-new.php1,526 ▼023.33 ▲0.04645.43 ▼34.3149.24 ▼7.69
Media Library /wp-admin/upload.php1,403 ▲94.20 ▲0.0498.43 ▼4.0941.47 ▼2.29

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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 items
  • 4× PHP files output text when accessed directly:
    • > /wp-content/plugins/digital-lottery/templates/content-single-entry.php
    • > /wp-content/plugins/digital-lottery/templates/order/ticket.php
    • > /wp-content/plugins/digital-lottery/public/partials/digital-lottery-public-display.php
    • > /wp-content/plugins/digital-lottery/templates/order/order-details-customer.php
  • 16× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/digital-lottery/admin/partials/digital-lottery-packages.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/digital-lottery/includes/functions.php:140
    • > 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/digital-lottery/public/class-digital-lottery-entry-list-tables.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/digital-lottery/includes/hooks.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/digital-lottery/admin/partials/html-product-lottery-answers.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shortcodes' not found in wp-content/plugins/digital-lottery/public/class-digital-lottery-shortcodes.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_user_logged_in() in wp-content/plugins/digital-lottery/templates/myaccount/form-registration.php:2
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/digital-lottery/public/class-digital-lottery-entry-list-tables.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function woocommerce_wp_textarea_input() in wp-content/plugins/digital-lottery/admin/partials/html-meta-box-answers.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/digital-lottery/includes/single-product-hooks.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Requires php: Invalid plugin version format
Please take inspiration from this readme.txt

digital-lottery/digital-lottery.php 92% from 13 tests

The main PHP file in "Digital Lottery" ver. 3.0.2 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Requires PHP: Required version number formatted incorrectly (ex. "7.0" instead of "7.4 or greater")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin12,329 lines of code in 114 files:
LanguageFilesBlank linesComment linesLines of code
PHP931,3982,5778,339
PO File27081,0721,687
JavaScript141471391,500
CSS57847803

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity33.74
▷ Minimum class complexity1.00
▷ Maximum class complexity281.00
Average method complexity3.70
▷ Minimum method complexity1.00
▷ Maximum method complexity74.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes26
▷ Abstract classes00.00%
▷ Concrete classes26100.00%
▷ Final classes13.85%
Methods327
▷ Static methods216.42%
▷ Public methods28286.24%
▷ Protected methods3911.93%
▷ Private methods61.83%
Functions56
▷ Named functions5598.21%
▷ Anonymous functions11.79%
Constants3
▷ Global constants266.67%
▷ Class constants133.33%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
6 compressed PNG files occupy 0.00MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/js/DataTables/images/sort_asc_disabled.png0.14KB0.25KB0.00%
admin/js/DataTables/images/sort_desc_disabled.png0.14KB0.25KB0.00%
admin/js/DataTables/images/sort_asc.png0.16KB0.25KB0.00%
admin/js/DataTables/images/sort_desc.png0.15KB0.25KB0.00%
admin/js/DataTables/images/sort_both.png0.20KB0.29KB0.00%