WP-Polls - Version 2.75.1

Version Description

Download this release

Release Info

Developer GamerZ
Plugin Icon WP-Polls
Version 2.75.1
Comparing to
See all releases

Code changes from version 2.74.1 to 2.75.1

Files changed (4) hide show
  1. polls-logs.php +2 -2
  2. polls-manager.php +3 -3
  3. readme.txt +9 -1
  4. wp-polls.php +16 -16
polls-logs.php CHANGED
@@ -120,7 +120,7 @@ if( ! empty( $_POST['do'] ) ) {
120
  <?php printf(_n('<strong>&raquo;</strong> <strong>%s</strong> vote is cast by guests', '<strong>&raquo;</strong> <strong>%s</strong> votes are cast by guests', $poll_guest, 'wp-polls'), number_format_i18n($poll_guest)); ?>
121
  </p>
122
  </div>
123
- <?php if($poll_totalrecorded > 0 && apply_filters( 'poll_log_show_log_filter', true )) { ?>
124
  <div class="wrap">
125
  <h3><?php _e('Filter Poll\'s Logs', 'wp-polls') ?></h3>
126
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
@@ -310,7 +310,7 @@ if( ! empty( $_POST['do'] ) ) {
310
  } else {
311
  foreach($poll_ips as $poll_ip) {
312
  $pollip_aid = (int) $poll_ip->pollip_aid;
313
- $pollip_user = apply_filters( 'poll_log_secret_ballot', removeslashes($poll_ip->pollip_user) );
314
  $pollip_ip = $poll_ip->pollip_ip;
315
  $pollip_host = $poll_ip->pollip_host;
316
  $pollip_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll_ip->pollip_timestamp));
120
  <?php printf(_n('<strong>&raquo;</strong> <strong>%s</strong> vote is cast by guests', '<strong>&raquo;</strong> <strong>%s</strong> votes are cast by guests', $poll_guest, 'wp-polls'), number_format_i18n($poll_guest)); ?>
121
  </p>
122
  </div>
123
+ <?php if($poll_totalrecorded > 0 && apply_filters( 'wp_polls_log_show_log_filter', true )) { ?>
124
  <div class="wrap">
125
  <h3><?php _e('Filter Poll\'s Logs', 'wp-polls') ?></h3>
126
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
310
  } else {
311
  foreach($poll_ips as $poll_ip) {
312
  $pollip_aid = (int) $poll_ip->pollip_aid;
313
+ $pollip_user = apply_filters( 'wp_polls_log_secret_ballot', removeslashes( $poll_ip->pollip_user ) );
314
  $pollip_ip = $poll_ip->pollip_ip;
315
  $pollip_host = $poll_ip->pollip_host;
316
  $pollip_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll_ip->pollip_timestamp));
polls-manager.php CHANGED
@@ -39,14 +39,14 @@ if(!empty($_POST['do'])) {
39
  $pollq_timestamp_minute = (int) sanitize_key($_POST['pollq_timestamp_minute']);
40
  $pollq_timestamp_second = (int) sanitize_key($_POST['pollq_timestamp_second']);
41
  $pollq_timestamp = gmmktime($pollq_timestamp_hour, $pollq_timestamp_minute, $pollq_timestamp_second, $pollq_timestamp_month, $pollq_timestamp_day, $pollq_timestamp_year);
42
- if($pollq_timestamp > current_time('timestamp')) {
43
  $pollq_active = -1;
44
  }
45
  }
46
  // Poll End Date
47
  $pollq_expiry_no = isset( $_POST['pollq_expiry_no'] ) ? (int) sanitize_key( $_POST['pollq_expiry_no'] ) : 0;
48
- if($pollq_expiry_no == 1) {
49
- $pollq_expiry = '';
50
  } else {
51
  $pollq_expiry_day = (int) sanitize_key($_POST['pollq_expiry_day']);
52
  $pollq_expiry_month = (int) sanitize_key($_POST['pollq_expiry_month']);
39
  $pollq_timestamp_minute = (int) sanitize_key($_POST['pollq_timestamp_minute']);
40
  $pollq_timestamp_second = (int) sanitize_key($_POST['pollq_timestamp_second']);
41
  $pollq_timestamp = gmmktime($pollq_timestamp_hour, $pollq_timestamp_minute, $pollq_timestamp_second, $pollq_timestamp_month, $pollq_timestamp_day, $pollq_timestamp_year);
42
+ if ( $pollq_timestamp > current_time( 'timestamp' ) ) {
43
  $pollq_active = -1;
44
  }
45
  }
46
  // Poll End Date
47
  $pollq_expiry_no = isset( $_POST['pollq_expiry_no'] ) ? (int) sanitize_key( $_POST['pollq_expiry_no'] ) : 0;
48
+ if ( $pollq_expiry_no === 1 ) {
49
+ $pollq_expiry = 0;
50
  } else {
51
  $pollq_expiry_day = (int) sanitize_key($_POST['pollq_expiry_day']);
52
  $pollq_expiry_month = (int) sanitize_key($_POST['pollq_expiry_month']);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://lesterchan.net/site/donation/
4
  Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
5
  Requires at least: 4.9.6
6
  Tested up to: 5.0
7
- Stable tag: 2.74.1
8
 
9
  Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
10
 
@@ -24,6 +24,14 @@ WP-Polls is extremely customizable via templates and css styles and there are to
24
  I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
25
 
26
  ## Changelog
 
 
 
 
 
 
 
 
27
  ### Version 2.74.1
28
  * FIXED: Don't use PHP 5.4 Short array syntax.
29
  * FIXED: Division by zero
4
  Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
5
  Requires at least: 4.9.6
6
  Tested up to: 5.0
7
+ Stable tag: 2.75.1
8
 
9
  Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
10
 
24
  I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
25
 
26
  ## Changelog
27
+ ### Version 2.75.1
28
+ * FIXED: Use array() instead of [] as a few users are still on < PHP 5.4. Props @bearlydoug.
29
+ * FIXED: pollq_expiry is now 0 instead of blank string. Props @hpiirainen.
30
+
31
+ ### Version 2.75
32
+ * FIXED: Standardize all filters to begin with `wp_polls` rather than `poll`
33
+ * NEW: Added `wp_polls_ipaddress` and `wp_polls_hostname` to allow user to overwrite it.
34
+
35
  ### Version 2.74.1
36
  * FIXED: Don't use PHP 5.4 Short array syntax.
37
  * FIXED: Division by zero
wp-polls.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Polls
4
  Plugin URI: https://lesterchan.net/portfolio/programming/php/
5
  Description: Adds an AJAX poll system to your WordPress blog. You can easily include a poll into your WordPress's blog post/page. WP-Polls is extremely customizable via templates and css styles and there are tons of options for you to choose to ensure that WP-Polls runs the way you wanted. It now supports multiple selection of answers.
6
- Version: 2.74.1
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: https://lesterchan.net
9
  Text Domain: wp-polls
@@ -11,7 +11,7 @@ Text Domain: wp-polls
11
 
12
 
13
  /*
14
- Copyright 2018 Lester Chan (email : lesterchan@gmail.com)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ Text Domain: wp-polls
29
  */
30
 
31
  ### Version
32
- define( 'WP_POLLS_VERSION', '2.74.1' );
33
 
34
 
35
  ### Create Text Domain For Translations
@@ -445,7 +445,7 @@ function display_pollvote($poll_id, $display_loading = true) {
445
 
446
  $template_question = removeslashes(get_option('poll_template_voteheader'));
447
 
448
- $template_question = apply_filters('poll_template_voteheader_markup', $template_question, $poll_question, array(
449
  '%POLL_QUESTION%' => $poll_question_text,
450
  '%POLL_ID%' => $poll_question_id,
451
  '%POLL_TOTALVOTES%' => $poll_question_totalvotes,
@@ -479,7 +479,7 @@ function display_pollvote($poll_id, $display_loading = true) {
479
  $poll_multiple_answer_percentage = $poll_question_totalvoters > 0 ? round( ( $poll_answer_votes / $poll_question_totalvoters ) * 100 ) : 0;
480
  $template_answer = removeslashes( get_option( 'poll_template_votebody' ) );
481
 
482
- $template_answer = apply_filters( 'poll_template_votebody_markup', $template_answer, $poll_answer, array(
483
  '%POLL_ID%' => $poll_question_id,
484
  '%POLL_ANSWER_ID%' => $poll_answer_id,
485
  '%POLL_ANSWER%' => $poll_answer_text,
@@ -505,7 +505,7 @@ function display_pollvote($poll_id, $display_loading = true) {
505
  // Voting Form Footer Variables
506
  $template_footer = removeslashes(get_option('poll_template_votefooter'));
507
 
508
- $template_footer = apply_filters('poll_template_votefooter_markup', $template_footer, $poll_question, array(
509
  '%POLL_ID%' => $poll_question_id,
510
  '%POLL_RESULT_URL%' => $poll_result_url,
511
  '%POLL_START_DATE%' => $poll_start_date,
@@ -739,7 +739,7 @@ function display_pollresult( $poll_id, $user_voted = array(), $display_loading =
739
  $temp_pollresult .= removeslashes( get_option ('poll_template_disable' ) );
740
  }
741
  // Return Poll Result
742
- return apply_filters( 'poll_result_markup', $temp_pollresult );
743
  }
744
 
745
 
@@ -759,19 +759,19 @@ if ( ! function_exists( 'get_ipaddress' ) ) {
759
  }
760
  }
761
  function poll_get_ipaddress() {
762
- return wp_hash( get_ipaddress() );
763
  }
764
  function poll_get_hostname() {
765
  $hostname = gethostbyaddr( get_ipaddress() );
766
  if ( $hostname === get_ipaddress() ) {
767
- return wp_privacy_anonymize_ip( get_ipaddress() );
768
  }
769
 
770
  if ( false !== $hostname ) {
771
- return substr( $hostname, strpos( $hostname, '.' ) + 1 );
772
  }
773
 
774
- return false;
775
  }
776
 
777
  ### Function: Short Code For Inserting Polls Archive Into Page
@@ -1078,7 +1078,7 @@ function polls_archive() {
1078
  $template_answer = removeslashes(get_option('poll_template_resultbody'));
1079
  }
1080
 
1081
- $template_answer = str_replace( [
1082
  '%POLL_ID%',
1083
  '%POLL_ANSWER_ID%',
1084
  '%POLL_ANSWER%',
@@ -1087,7 +1087,7 @@ function polls_archive() {
1087
  '%POLL_ANSWER_PERCENTAGE%',
1088
  '%POLL_MULTIPLE_ANSWER_PERCENTAGE%',
1089
  '%POLL_ANSWER_IMAGEWIDTH%',
1090
- ], [
1091
  $polls_question['id'],
1092
  $polls_answer['aid'],
1093
  $polls_answer['answers'],
@@ -1096,7 +1096,7 @@ function polls_archive() {
1096
  $poll_answer_percentage,
1097
  $poll_multiple_answer_percentage,
1098
  $poll_answer_imagewidth,
1099
- ],
1100
  $template_answer );
1101
 
1102
  // Print Out Results Body Template
@@ -1195,7 +1195,7 @@ function polls_archive() {
1195
  }
1196
 
1197
  // Output Polls Archive Page
1198
- return apply_filters('polls_archive', $pollsarchive_output_archive);
1199
  }
1200
 
1201
 
@@ -1288,7 +1288,7 @@ add_action('polls_cron', 'cron_polls_status');
1288
  function cron_polls_status() {
1289
  global $wpdb;
1290
  // Close Poll
1291
- $close_polls = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 0 WHERE pollq_expiry < '".current_time('timestamp')."' AND pollq_expiry != '' AND pollq_active != 0");
1292
  // Open Future Polls
1293
  $active_polls = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 1 WHERE pollq_timestamp <= '".current_time('timestamp')."' AND pollq_active = -1");
1294
  // Update Latest Poll If Future Poll Is Opened
3
  Plugin Name: WP-Polls
4
  Plugin URI: https://lesterchan.net/portfolio/programming/php/
5
  Description: Adds an AJAX poll system to your WordPress blog. You can easily include a poll into your WordPress's blog post/page. WP-Polls is extremely customizable via templates and css styles and there are tons of options for you to choose to ensure that WP-Polls runs the way you wanted. It now supports multiple selection of answers.
6
+ Version: 2.75.1
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: https://lesterchan.net
9
  Text Domain: wp-polls
11
 
12
 
13
  /*
14
+ Copyright 2019 Lester Chan (email : lesterchan@gmail.com)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
29
  */
30
 
31
  ### Version
32
+ define( 'WP_POLLS_VERSION', '2.75.1' );
33
 
34
 
35
  ### Create Text Domain For Translations
445
 
446
  $template_question = removeslashes(get_option('poll_template_voteheader'));
447
 
448
+ $template_question = apply_filters( 'wp_polls_template_voteheader_markup', $template_question, $poll_question, array(
449
  '%POLL_QUESTION%' => $poll_question_text,
450
  '%POLL_ID%' => $poll_question_id,
451
  '%POLL_TOTALVOTES%' => $poll_question_totalvotes,
479
  $poll_multiple_answer_percentage = $poll_question_totalvoters > 0 ? round( ( $poll_answer_votes / $poll_question_totalvoters ) * 100 ) : 0;
480
  $template_answer = removeslashes( get_option( 'poll_template_votebody' ) );
481
 
482
+ $template_answer = apply_filters( 'wp_polls_template_votebody_markup', $template_answer, $poll_answer, array(
483
  '%POLL_ID%' => $poll_question_id,
484
  '%POLL_ANSWER_ID%' => $poll_answer_id,
485
  '%POLL_ANSWER%' => $poll_answer_text,
505
  // Voting Form Footer Variables
506
  $template_footer = removeslashes(get_option('poll_template_votefooter'));
507
 
508
+ $template_footer = apply_filters( 'wp_polls_template_votefooter_markup', $template_footer, $poll_question, array(
509
  '%POLL_ID%' => $poll_question_id,
510
  '%POLL_RESULT_URL%' => $poll_result_url,
511
  '%POLL_START_DATE%' => $poll_start_date,
739
  $temp_pollresult .= removeslashes( get_option ('poll_template_disable' ) );
740
  }
741
  // Return Poll Result
742
+ return apply_filters( 'wp_polls_result_markup', $temp_pollresult );
743
  }
744
 
745
 
759
  }
760
  }
761
  function poll_get_ipaddress() {
762
+ return apply_filters( 'wp_polls_ipaddress', wp_hash( get_ipaddress() ) );
763
  }
764
  function poll_get_hostname() {
765
  $hostname = gethostbyaddr( get_ipaddress() );
766
  if ( $hostname === get_ipaddress() ) {
767
+ $hostname = wp_privacy_anonymize_ip( get_ipaddress() );
768
  }
769
 
770
  if ( false !== $hostname ) {
771
+ $hostname = substr( $hostname, strpos( $hostname, '.' ) + 1 );
772
  }
773
 
774
+ return apply_filters( 'wp_polls_hostname', $hostname );
775
  }
776
 
777
  ### Function: Short Code For Inserting Polls Archive Into Page
1078
  $template_answer = removeslashes(get_option('poll_template_resultbody'));
1079
  }
1080
 
1081
+ $template_answer = str_replace( array(
1082
  '%POLL_ID%',
1083
  '%POLL_ANSWER_ID%',
1084
  '%POLL_ANSWER%',
1087
  '%POLL_ANSWER_PERCENTAGE%',
1088
  '%POLL_MULTIPLE_ANSWER_PERCENTAGE%',
1089
  '%POLL_ANSWER_IMAGEWIDTH%',
1090
+ ), array(
1091
  $polls_question['id'],
1092
  $polls_answer['aid'],
1093
  $polls_answer['answers'],
1096
  $poll_answer_percentage,
1097
  $poll_multiple_answer_percentage,
1098
  $poll_answer_imagewidth,
1099
+ ),
1100
  $template_answer );
1101
 
1102
  // Print Out Results Body Template
1195
  }
1196
 
1197
  // Output Polls Archive Page
1198
+ return apply_filters( 'wp_polls_archive', $pollsarchive_output_archive );
1199
  }
1200
 
1201
 
1288
  function cron_polls_status() {
1289
  global $wpdb;
1290
  // Close Poll
1291
+ $close_polls = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 0 WHERE pollq_expiry < '".current_time('timestamp')."' AND pollq_expiry != 0 AND pollq_active != 0");
1292
  // Open Future Polls
1293
  $active_polls = $wpdb->query("UPDATE $wpdb->pollsq SET pollq_active = 1 WHERE pollq_timestamp <= '".current_time('timestamp')."' AND pollq_active = -1");
1294
  // Update Latest Poll If Future Poll Is Opened