57% predict-when

Code Review | Predict When

WordPress plugin Predict When scored 57% from 54 tests.

About plugin

  • Plugin page: predict-when
  • Plugin version: 1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.5
  • WordPress version: 5.8.1
  • First release: Sep 11, 2012
  • Latest release: Jan 16, 2013
  • Number of updates: 17
  • Update frequency: every 15.1 days
  • Top authors: ianhaycox (76.47%)Cojecto (29.41%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,443 total downloads

Benchmarks

Plugin footprint 48% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.38MB] [CPU: ▼202.35ms] Passed 4 tests

Analyzing server-side resources used by Predict When
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.13 ▲0.2933.05 ▼1.31
Dashboard /wp-admin3.27 ▲0.2229.93 ▼17.52
Posts /wp-admin/edit.php3.27 ▲0.1721.71 ▼25.43
Add New Post /wp-admin/post-new.php3.27 ▼2.1623.27 ▼750.89
Media Library /wp-admin/upload.php3.27 ▲0.2723.09 ▼15.57
Add New Question /wp-admin/admin.php?page=predictwhen_add_question3.2724.08
All Questions /wp-admin/admin.php?page=predictwhen_menu3.2725.31
Predict When /wp-admin/options-general.php?page=predictwhen_options3.2724.14
Predictions /wp-admin/admin.php?page=predictwhen_prediction3.2724.98

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 39 new files
Database: 2 new tables, 17 new options
New tables
wp_predictwhen_question
wp_predictwhen_prediction
New WordPress options
predictwhen_embed
predictwhen_db_version
predictwhen_reject_body
predictwhen_font_chart
predictwhen_reject_subject
predictwhen_color_predicted_date
predictwhen_hide_grid_chart
predictwhen_color_predicted_user
predictwhen_color_chart_background
predictwhen_approve_subject
...

Browser metrics Passed 4 tests

An overview of browser requirements for Predict When
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,752 ▲15616.45 ▲0.828.69 ▼0.3146.74 ▼0.58
Dashboard /wp-admin3,034 ▲976.95 ▲0.99142.00 ▼20.97130.42 ▲18.84
Posts /wp-admin/edit.php2,826 ▲872.99 ▲0.2879.53 ▲14.85107.71 ▲21.15
Add New Post /wp-admin/post-new.php1,655 ▼2818.33 ▼0.43370.30 ▼34.94122.70 ▲20.02
Media Library /wp-admin/upload.php1,829 ▲225.65 ▲0.64155.39 ▼0.54127.43 ▲15.31
Add New Question /wp-admin/admin.php?page=predictwhen_add_question2,1703.1290.62113.24
All Questions /wp-admin/admin.php?page=predictwhen_menu1,7172.9058.2082.55
Predict When /wp-admin/options-general.php?page=predictwhen_options1,0922.1743.1344.96
Predictions /wp-admin/admin.php?page=predictwhen_prediction1,4412.8658.9197.88

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Uninstall procedure had uncaught errors
    • > User deprecated in wp-includes/functions.php+5211
    add_object_page is deprecated since version 4.5.0! Use add_menu_page() instead.
  • Zombie tables were found after uninstall: 2 tables
    • wp_predictwhen_prediction
    • wp_predictwhen_question
  • Zombie WordPress options were found after uninstall: 17 options
    • predictwhen_hide_grid_chart
    • predictwhen_approve_body
    • predictwhen_color_predicted_date
    • predictwhen_reject_body
    • predictwhen_color_chart_bars
    • predictwhen_color_chart_background
    • predictwhen_font_color_chart
    • predictwhen_font_chart
    • predictwhen_sharing
    • recovery_mode_email_last_sent
    • ...

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=predictwhen_prediction
    • > User deprecated in wp-includes/functions.php+5211
    add_object_page is deprecated since version 4.5.0! Use add_menu_page() instead.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=predictwhen_menu
    • > Notice in wp-content/plugins/predict-when/admin/questions.php+510
    Undefined index: question_filter
    • > GET request to /wp-admin/options-general.php?page=predictwhen_options
    • > Error in wp-content/plugins/predict-when/predict-when.php+804
    Uncaught Error: Call to undefined function split() in wp-content/plugins/predict-when/predict-when.php:804
    Stack trace:
    #0 wp-content/plugins/predict-when/admin/admin.php(755): PredictWhen->load_google_chart_api()
    #1 wp-includes/class-wp-hook.php(303): PredictWhenAdmin->options()
    #2 wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(470): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 wp-admin/options-general.php(10): require_once('/var/www/wordpr...')
    #6 {main}
    thrown

SRP 50% 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
Please fix the following items
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'PredictWhenAdmin' not found in wp-content/plugins/predict-when/admin/predictions.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PredictWhenAdmin' not found in wp-content/plugins/predict-when/admin/questions.php:12

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Open question prompting for a predicted date), #2 (Closed question with the event date shown), #3 (List of questions in the admin menu), #4 (Adding a new question), #5 (User facing form to submit a suggested question), #6 (Scoring), #7 (Settings)
The official readme.txt is a good inspiration

predict-when/predict-when.php 85% from 13 tests

"Predict When" version 1.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Description: Please keep the plugin description shorter than 140 characters (currently 190 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin5,599 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP41,1091,0353,801
JavaScript51822631,290
CSS27581508

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity93.17
▷ Minimum class complexity15.00
▷ Maximum class complexity258.00
Average method complexity5.69
▷ Minimum method complexity1.00
▷ Maximum method complexity48.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods118
▷ Static methods10.85%
▷ Public methods10488.14%
▷ Protected methods10.85%
▷ Private methods1311.02%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
24 compressed PNG files occupy 0.32MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/icon32-grey.png0.91KB1.89KB0.00%
screenshot-7.png71.47KB31.27KB▼ 56.24%
images/icon-hover.png0.43KB0.54KB0.00%
images/icon-grey.png0.31KB0.54KB0.00%
css/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%