10% contest

Code Review | Contest

WordPress plugin Contest scored10%from 54 tests.

About plugin

  • Plugin page: contest
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-4.3
  • WordPress version: 6.3.1
  • First release: Nov 17, 2015
  • Latest release: Nov 22, 2015
  • Number of updates: 5
  • Update frequency: every 1.0 days
  • Top authors: spot-the-cat (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,732 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
These installer errors require your attention
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/contest/contest.php+714
    Array and string offset access syntax with curly braces is deprecated

Server metrics [RAM: ▼1.60MB] [CPU: ▼57.55ms] Passed 4 tests

This is a short check of server-side resources used by Contest
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.40 ▼1.065.16 ▼39.21
Dashboard /wp-admin2.42 ▼0.936.91 ▼55.23
Posts /wp-admin/edit.php2.42 ▼0.947.76 ▼43.92
Add New Post /wp-admin/post-new.php2.42 ▼3.476.87 ▼91.85
Media Library /wp-admin/upload.php2.42 ▼0.818.17 ▼26.22
Settings /wp-admin/admin.php?page=contest-settings2.426.61
Contest List /wp-admin/admin.php?page=contest-admin-list2.429.06
/wp-admin/admin.php?page=contest-admin2.426.54
All Contests /wp-admin/edit.php?post_type=contest2.427.71
Add Contest /wp-admin/post-new.php?post_type=contest2.428.22

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 31 new files
Database: 2 new tables, 7 new options
New tables
wp_contest_entry
wp_contest
New WordPress options
widget_contest
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Contest
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,878 ▲11714.47 ▲0.112.26 ▲0.3739.42 ▼3.68
Dashboard /wp-admin2,279 ▲764.88 ▼0.97114.75 ▼4.1643.09 ▲0.68
Posts /wp-admin/edit.php2,158 ▲582.03 ▼0.0241.81 ▲4.6036.29 ▼0.23
Add New Post /wp-admin/post-new.php1,581 ▲2823.09 ▲0.11663.52 ▲23.2954.96 ▼1.41
Media Library /wp-admin/upload.php1,452 ▲494.24 ▲0.06103.57 ▼3.3945.84 ▼0.72
Settings /wp-admin/admin.php?page=contest-settings1,5422.2124.0134.48
Contest List /wp-admin/admin.php?page=contest-admin-list8482.0325.0728.10
/wp-admin/admin.php?page=contest-admin9632.0222.1330.33
All Contests /wp-admin/edit.php?post_type=contest1,1311.9430.9731.98
Add Contest /wp-admin/post-new.php?post_type=contest3,0307.63172.4767.07

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Uninstall procedure had uncaught errors
    • > Deprecated in wp-content/plugins/contest/contest.php+714
    Array and string offset access syntax with curly braces is deprecated
  • This plugin has failed uninstalling correctly, leaving 31 files (0.24MB) in the plugin directory
    • (new file) assets/screenshot-1.png
    • (new file) contest_entry_trans.php
    • (new file) readme.txt
    • (new file) ContestUser.php
    • (new file) css/contest.css
    • (new file) contest_install.php
    • (new file) contest_admin_trans.php
    • (new file) js/contest.js
    • (new file) contest.php
    • (new file) ContestBlock.php
    • ...
  • Zombie WordPress options detected upon uninstall: 8 options
    • theysaidso_admin_options
    • widget_recent-posts
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_contest
    • widget_recent-comments
    • 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
Please fix the following server-side errors
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=contest
    • > Deprecated in wp-content/plugins/contest/contest.php+714
    Array and string offset access syntax with curly braces is deprecated
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=contest-admin
    • > Warning in wp-content/plugins/contest/templates/contest-admin.tpl.php+82
    date() expects parameter 2 to be int, string given

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 take a closer look at the following
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/contest/templates/contest-date.tpl.php
    • > /wp-content/plugins/contest/templates/contest-state.tpl.php
  • 61× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: months in wp-content/plugins/contest/templates/contest-date.tpl.php on line 21
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/contest/ContestBlock.php:11
    • > PHP Warning
      Use of undefined constant WP_DEBUG - assumed 'WP_DEBUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/contest/templates/contest-block-view.tpl.php on line 29
    • > PHP Notice
      Undefined variable: field_name in wp-content/plugins/contest/templates/contest-date.tpl.php on line 39
    • > PHP Notice
      Undefined variable: states in wp-content/plugins/contest/templates/contest-state.tpl.php on line 15
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/contest/templates/contest-state.tpl.php on line 15
    • > PHP Warning
      Use of undefined constant WP_DEBUG - assumed 'WP_DEBUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/contest/templates/contest-date.tpl.php on line 15
    • > PHP Notice
      Undefined variable: field_name in wp-content/plugins/contest/templates/contest-date.tpl.php on line 29
    • > PHP Notice
      Undefined variable: field_name in wp-content/plugins/contest/templates/contest-date.tpl.php on line 19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_permalink() in wp-content/plugins/contest/templates/contest-admin.tpl.php:55

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% 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
Please fix the following attributes:
  • Screenshots: Add an image for screenshot #1 (Create random drawings for prizes.)
The official readme.txt is a good inspiration

contest/contest.php Passed 13 tests

The main PHP file in "Contest" ver. 1.1 adds more information about the plugin and also serves as the entry point for this plugin
86 characters long description:
Allows your site to host a sweepstakes, (contestants win prizes via a random drawing).

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Good job! No executable or dangerous file extensions detected2,148 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP272467831,890
CSS101194
JavaScript1196964

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity50.50
▷ Minimum class complexity10.00
▷ Maximum class complexity91.00
Average method complexity7.19
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods16
▷ Static methods00.00%
▷ Public methods1275.00%
▷ Protected methods425.00%
▷ Private methods00.00%
Functions65
▷ Named functions65100.00%
▷ Anonymous functions00.00%
Constants15
▷ Global constants426.67%
▷ Class constants1173.33%
▷ Public constants11100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.12MB with 0.08MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png123.08KB43.19KB▼ 64.91%