73% sweepstakes

Code Review | Sweepstakes

WordPress plugin Sweepstakes scored73%from 54 tests.

About plugin

  • Plugin page: sweepstakes
  • Plugin version: 0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-3.4.1
  • WordPress version: 6.3.1
  • First release: Jul 20, 2012
  • Latest release: Sep 27, 2012
  • Number of updates: 15
  • Update frequency: every 4.6 days
  • Top authors: carlos_a_sanz (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /3,343 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.26MB] [CPU: ▼3.76ms] Passed 4 tests

An overview of server-side resources used by Sweepstakes
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.72 ▲0.2635.66 ▼0.77
Dashboard /wp-admin3.56 ▲0.2645.18 ▼5.02
Posts /wp-admin/edit.php3.67 ▲0.3248.39 ▼0.71
Add New Post /wp-admin/post-new.php6.15 ▲0.2690.91 ▼8.53
Media Library /wp-admin/upload.php3.48 ▲0.2635.26 ▲0.95
Add new promo /wp-admin/post-new.php?post_type=promo3.5943.53
Promos /wp-admin/edit.php?post_type=promo3.5236.14

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 15 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

Sweepstakes: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,820 ▲5914.37 ▼0.181.65 ▲0.1042.07 ▲3.64
Dashboard /wp-admin2,220 ▲435.67 ▲0.0792.64 ▲8.1938.51 ▲1.64
Posts /wp-admin/edit.php2,135 ▲352.18 ▲0.1738.77 ▲1.4934.51 ▲0.16
Add New Post /wp-admin/post-new.php1,550 ▲2423.11 ▼0.57654.33 ▼10.7640.46 ▼15.34
Media Library /wp-admin/upload.php1,431 ▲314.15 ▼0.1299.60 ▼12.0841.56 ▼5.35
Add new promo /wp-admin/post-new.php?post_type=promo2,5927.78168.2766.38
Promos /wp-admin/edit.php?post_type=promo1,1202.1432.2127.97

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Smoke test failed, please fix the following
    • > GET request to /wp-admin/post-new.php?post_type=promo
    • > Notice in wp-content/plugins/sweepstakes/sweepstakes.php+515
    Undefined index: terms
    • > GET request to /wp-admin/post-new.php?post_type=promo
    • > Notice in wp-content/plugins/sweepstakes/sweepstakes.php+547
    Undefined index: winners
    • > GET request to /wp-admin/post-new.php?post_type=promo
    • > Warning in wp-content/plugins/sweepstakes/sweepstakes.php+547
    Invalid argument supplied for foreach()
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=promo
    • > Warning in wp-content/plugins/sweepstakes/sweepstakes.php+593
    count(): Parameter must be an array or an object that implements Countable

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sweepstakes/sweepstakes.php:48

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
    • > GET request to /wp-admin/post-new.php?post_type=promo
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,utils,moxiejs,plupload&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/sweepstakes/assets/js/admin-scripts.js:98:23)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,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,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,utils,moxiejs,plupload&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/post-new.php?post_type=promo
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,utils,moxiejs,plupload&ver=6.3.1 1:28721 Uncaught TypeError: $(...).live is not a function
    • > GET request to /wp-admin/edit.php?post_type=promo
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/sweepstakes/assets/js/admin-scripts.js:98:23)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,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,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/edit.php?post_type=promo
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable,utils&ver=6.3.1 1:28721 Uncaught TypeError: $(...).live is not a function

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: These screenshots require images: #1 (Custimoze Serial promo code), #2 (Customize Register form), #3 (Control participants list)
You can look at the official readme.txt

sweepstakes/sweepstakes.php Passed 13 tests

"Sweepstakes" version 0.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
71 characters long description:
adds sweepstakes on site when users can register with a serialized code

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin1,532 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP1443368948
PO File2144146306
JavaScript24640173
CSS2252105

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions47
▷ Named functions47100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
3 PNG files occupy 0.14MB with 0.09MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png38.83KB16.46KB▼ 57.62%
screenshot-2.png37.66KB16.45KB▼ 56.33%
screenshot-3.png70.76KB21.28KB▼ 69.93%