57% sodahead-polls

Code Review | SodaHead Polls

WordPress plugin SodaHead Polls scored57%from 54 tests.

About plugin

  • Plugin page: sodahead-polls
  • Plugin version: 3.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6.1-3.6.1
  • WordPress version: 6.3.1
  • First release: Jan 21, 2008
  • Latest release: Jan 15, 2014
  • Number of updates: 56
  • Update frequency: every 39.5 days
  • Top authors: SodaHead (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

60+ active /72,542 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.05MB] [CPU: ▼13.68ms] Passed 4 tests

A check of server-side resources used by SodaHead Polls
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1337.28 ▼2.76
Dashboard /wp-admin3.32 ▲0.0132.34 ▼16.52
Posts /wp-admin/edit.php3.38 ▲0.0236.07 ▼10.14
Add New Post /wp-admin/post-new.php5.57 ▼0.3265.75 ▼25.31
Media Library /wp-admin/upload.php3.33 ▲0.0930.42 ▼1.36
Templates /wp-admin/admin.php?page=sh_menu_options_templates3.2928.32
Poll Edit /wp-admin/admin.php?page=sh_menu_options_poll_edit3.3027.77
Polls /wp-admin/admin.php?page=sh_menu_options3.3029.36
Template Edit /wp-admin/admin.php?page=sh_menu_options_template_edit3.3028.07
Settings /wp-admin/admin.php?page=sh_menu_options_settings3.3029.32

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 44 new files
Database: 1 new table, 10 new options
New tables
wp_sodahead_templates
New WordPress options
widget_theysaidso_widget
sh_secret
widget_recent-comments
theysaidso_admin_options
can_compress_scripts
sh_action_key
widget_foo_widget
widget_recent-posts
db_upgraded
sh_default_template_id

Browser metrics Passed 4 tests

A check of browser resources used by SodaHead Polls
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,830 ▲8413.55 ▼0.751.72 ▼0.0739.59 ▼5.31
Dashboard /wp-admin2,236 ▲485.83 ▲0.94108.42 ▼8.8170.19 ▲20.20
Posts /wp-admin/edit.php2,122 ▲332.02 ▲0.0234.64 ▼2.3433.03 ▼3.36
Add New Post /wp-admin/post-new.php1,562 ▲4823.20 ▲5.68680.06 ▲61.67183.24 ▲128.49
Media Library /wp-admin/upload.php1,418 ▲304.19 ▼0.0796.20 ▼2.8074.69 ▲30.30
Templates /wp-admin/admin.php?page=sh_menu_options_templates9402.0626.6227.66
Poll Edit /wp-admin/admin.php?page=sh_menu_options_poll_edit1,1071.8926.3334.03
Polls /wp-admin/admin.php?page=sh_menu_options8622.0824.6027.65
Template Edit /wp-admin/admin.php?page=sh_menu_options_template_edit1,5361.8525.3730.38
Settings /wp-admin/admin.php?page=sh_menu_options_settings1,3986.84197.6138.15

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • Zombie tables were found after uninstall: 1 table
    • wp_sodahead_templates
  • Zombie WordPress options were found after uninstall: 10 options
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • sh_default_template_id
    • widget_recent-comments
    • db_upgraded
    • sh_secret
    • can_compress_scripts
    • widget_foo_widget
    • widget_recent-posts
    • sh_action_key

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Almost there, just fix the following server-side errors
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_settings
    • > User deprecated in wp-includes/functions.php+5828
    Hook contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_poll_edit
    • > Notice in wp-content/plugins/sodahead-polls/poll.php+11
    Undefined index: poll_id
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_template_edit
    • > Notice in wp-content/plugins/sodahead-polls/template.php+8
    Undefined index: template_id
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_template_edit
    • > Notice in wp-content/plugins/sodahead-polls/template.php+11
    Undefined index: title
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_template_edit
    • > Notice in wp-content/plugins/sodahead-polls/template.php+29
    Undefined index: default_template
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_settings
    • > Notice in wp-content/plugins/sodahead-polls/include/sodahead_settings.php+13
    Undefined variable: message
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_template_edit
    • > Notice in wp-content/plugins/sodahead-polls/include/sodahead_template_edit.php+39
    Trying to get property 'name' of non-object
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_template_edit
    • > Notice in wp-content/plugins/sodahead-polls/include/sodahead_template_edit.php+44
    Trying to get property 'template' of non-object
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_template_edit
    • > Notice in wp-content/plugins/sodahead-polls/include/sodahead_template_edit.php+62
    Trying to get property 'display_results' of non-object
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_settings
    • > Notice in wp-content/plugins/sodahead-polls/settings.php+8
    Undefined index: submit

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/sodahead-polls/include/sodahead_templates.php
  • 56× 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 get_option() in wp-content/plugins/sodahead-polls/include/sodahead_manage_polls.php:54
    • > PHP Notice
      Undefined variable: SODAHEAD_ROOT in wp-content/plugins/sodahead-polls/include/sodahead_delete.php on line 22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/sodahead-polls/include/sodahead_widget_js.php:14
    • > PHP Notice
      Trying to get property 'id' of non-object in wp-content/plugins/sodahead-polls/include/sodahead_widget.php on line 45
    • > PHP Notice
      Undefined variable: template in wp-content/plugins/sodahead-polls/include/sodahead_widget.php on line 58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_user_logged_in() in wp-content/plugins/sodahead-polls/include/sodahead_delete.php:25
    • > PHP Notice
      Undefined variable: is_new_template in wp-content/plugins/sodahead-polls/include/sodahead_edit_template.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_user_logged_in() in wp-content/plugins/sodahead-polls/include/sodahead_delete_poll.php:8
    • > PHP Notice
      Undefined variable: is_new_template in wp-content/plugins/sodahead-polls/include/sodahead_template_edit.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/sodahead-polls/include/sodahead_widget.php:60

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 take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_poll_edit
    • > Network (severe)
    http://d6fekxp9qbg3b.cloudfront.net/js/polls/widget-v1.js?ver=1.0 - Failed to load resource: net::ERR_NAME_NOT_RESOLVED
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_poll_edit
    • > Network (severe)
    http://partners.sodahead.com/api/polls/0/?jsonp=json_pafc11b9a_2afc_50ce_440e_a328184aebf6 - Failed to load resource: net::ERR_NAME_NOT_RESOLVED
    • > GET request to /wp-admin/admin.php?page=sh_menu_options
    • > Network (severe)
    http://partners.sodahead.com/api/polls/author/undefined/?page=1&jsonp=json_p6dd7f4d4_ce46_75e6_7231_24a678d2d388 - Failed to load resource: net::ERR_NAME_NOT_RESOLVED
    • > GET request to /wp-admin/admin.php?page=sh_menu_options_settings
    • > Other (severe) in unknown
    chrome-error://chromewebdata/ - Refused to display 'https://developers.google.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
8 plugin tags: poll, vote, wp polls, polling, sodahead...

sodahead-polls/main.php 92% from 13 tests

This is the main PHP file of "SodaHead Polls" version 3.0.4, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("sodahead-polls.php" instead of "main.php")

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 plugin3,193 lines of code in 37 files:
LanguageFilesBlank linesComment linesLines of code
PHP26782242,423
JavaScript45033605
CSS170110
HTML60055

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity19.00
▷ Minimum class complexity19.00
▷ Maximum class complexity19.00
Average method complexity4.60
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods5
▷ Static methods120.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions25
▷ Named functions25100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
5 compressed PNG files occupy 0.00MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/icon.png0.42KB0.64KB0.00%
img/close.png0.59KB0.33KB▼ 44.32%
img/dailypoll.png0.61KB0.48KB▼ 20.45%
img/logo.png1.23KB1.63KB0.00%
img/button.png0.41KB0.65KB0.00%