62% wp-contest

Code Review | WP Contest

WordPress plugin WP Contest scored62%from 54 tests.

About plugin

  • Plugin page: wp-contest
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.9.8
  • WordPress version: 6.3.1
  • First release: Aug 13, 2018
  • Latest release: Sep 28, 2018
  • Number of updates: 3
  • Update frequency: every 15.7 days
  • Top authors: andsonsdesign (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

30+ active /2,345 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.04MB] [CPU: ▼4.60ms] Passed 4 tests

An overview of server-side resources used by WP Contest
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0441.84 ▲1.65
Dashboard /wp-admin3.35 ▲0.0447.83 ▼0.36
Posts /wp-admin/edit.php3.46 ▲0.1047.16 ▼0.60
Add New Post /wp-admin/post-new.php5.93 ▲0.0480.33 ▼18.90
Media Library /wp-admin/upload.php3.27 ▲0.0435.15 ▲1.47
Entries /wp-admin/admin.php?page=wpc_entries3.3029.90
General Settings /wp-admin/admin.php?page=wpc_general_settings3.2940.00
Add Contest /wp-admin/admin.php?page=wpc_setting3.2636.27
Contests /wp-admin/admin.php?page=wpc_contests3.3631.26
Voting /wp-admin/admin.php?page=wpc_phase_two3.2730.54
Shortcodes /wp-admin/admin.php?page=wpc_shortcodes3.2629.63
View Editing Reason /wp-admin/admin.php?page=editing_reason3.2833.04

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 154 new files
Database: 4 new tables, 7 new options
New tables
wp_wpc_phase_two_votiong
wp_wpc_contests
wp_wpc_phase_one_votiong
wp_wpc_entry
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
wpc_general_settings
widget_recent-posts
db_upgraded
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by WP Contest
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,043 ▲28613.63 ▼0.7412.60 ▲10.5838.40 ▼11.37
Dashboard /wp-admin2,246 ▲585.83 ▲0.9296.86 ▼5.0837.50 ▼9.08
Posts /wp-admin/edit.php2,132 ▲432.05 ▲0.0439.41 ▼2.0835.03 ▼2.95
Add New Post /wp-admin/post-new.php1,571 ▲2923.13 ▲4.80681.00 ▲72.3552.07 ▲2.87
Media Library /wp-admin/upload.php1,431 ▲404.30 ▲0.0895.18 ▼3.2841.43 ▼3.38
Entries /wp-admin/admin.php?page=wpc_entries8421.8126.5042.34
General Settings /wp-admin/admin.php?page=wpc_general_settings1,1361.9635.5642.99
Add Contest /wp-admin/admin.php?page=wpc_setting8722.0232.5527.14
Contests /wp-admin/admin.php?page=wpc_contests8392.1734.5622.74
Voting /wp-admin/admin.php?page=wpc_phase_two8201.7224.4426.36
Shortcodes /wp-admin/admin.php?page=wpc_shortcodes9382.3223.7146.10
View Editing Reason /wp-admin/admin.php?page=editing_reason8041.7125.3626.97

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
You still need to fix the following
  • The uninstall procedure failed, leaving 4 tables in the database
    • wp_wpc_phase_one_votiong
    • wp_wpc_contests
    • wp_wpc_phase_two_votiong
    • wp_wpc_entry
  • The uninstall procedure has failed, leaving 7 options in the database
    • can_compress_scripts
    • wpc_general_settings
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 19× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/wp-contest/pdf/font/courier.php
    • > /wp-content/plugins/wp-contest/pdf/font/courierb.php
    • > /wp-content/plugins/wp-contest/pdf/font/timesb.php
    • > /wp-content/plugins/wp-contest/pdf/makefont/makefont.php
    • > /wp-content/plugins/wp-contest/pdf/font/zapfdingbats.php
    • > /wp-content/plugins/wp-contest/pdf/font/timesi.php
    • > /wp-content/plugins/wp-contest/pdf/font/courieri.php
    • > /wp-content/plugins/wp-contest/pdf/font/timesbi.php
    • > /wp-content/plugins/wp-contest/pdf/font/times.php
    • > /wp-content/plugins/wp-contest/pdf/font/helvetica.php
  • 9× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-contest/inc/admin_pages/add_contest.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wpc_get_all_contest_id() in wp-content/plugins/wp-contest/inc/admin_pages/phase_two.php:15
    • > PHP Fatal error
      require(): Failed opening required 'WPC_PATH/pdf/fpdf.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-contest/inc/pdf_download.php on line 8
    • > PHP Warning
      Use of undefined constant WPC_PATH - assumed 'WPC_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-contest/inc/pdf_download.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-contest/inc/admin_pages/editing_reason.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wpc_get_judges() in wp-content/plugins/wp-contest/inc/admin_pages/contests.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-contest/inc/admin_pages/general_settings.php:8
    • > PHP Warning
      require(WPC_PATH/pdf/fpdf.php): failed to open stream: No such file or directory in wp-content/plugins/wp-contest/inc/pdf_download.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wpc_get_all_contest_id() in wp-content/plugins/wp-contest/inc/admin_pages/entries.php:155

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)
There are user-side issues you should fix
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=editing_reason
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).tooltip is not a function" "TypeError: $(...).tooltip is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/wp-contest/js/pop_admin_js.js?ver=6.3.1:345:32)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,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,utils&ver=6.3.1:2:27292)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=editing_reason
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: $(...).tooltip is not a function

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: voting, vote, judging, photo contest, contest

wp-contest/wpc_contest.php 77% from 13 tests

The main PHP file in "WP Contest" ver. 1.0.0 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Domain Path: The domain path folder was not found ("/lang")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: The principal plugin file should be the same as the plugin slug ("wp-contest.php" instead of "wpc_contest.php")

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
Everything looks great! No dangerous files found in this plugin14,296 lines of code in 125 files:
LanguageFilesBlank linesComment linesLines of code
CSS81,148236,695
PHP584233524,023
HTML49401,971
JavaScript95673551,378
SVG100229

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity44.38
▷ Minimum class complexity1.00
▷ Maximum class complexity338.00
Average method complexity4.69
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes00.00%
Methods153
▷ Static methods00.00%
▷ Public methods11474.51%
▷ Protected methods3824.84%
▷ Private methods10.65%
Functions100
▷ Named functions100100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/close.png0.27KB0.29KB0.00%
images/next.png1.32KB1.58KB0.00%
images/prev.png1.33KB1.59KB0.00%
images/camera.png1.43KB0.51KB▼ 64.32%