WP-Polls - Version 2.76.0

Version Description

Download this release

Release Info

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

Code changes from version 2.75.6 to 2.76.0

Files changed (4) hide show
  1. polls-options.php +17 -19
  2. readme.txt +5 -2
  3. uninstall.php +1 -0
  4. wp-polls.php +14 -4
polls-options.php CHANGED
@@ -1,22 +1,4 @@
1
  <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress Plugin: WP-Polls |
6
- | Copyright (c) 2012 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Configure Poll Options |
14
- | - wp-content/plugins/wp-polls/polls-options.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
  ### Check Whether User Can Manage Polls
21
  if( ! current_user_can( 'manage_polls' ) ) {
22
  die( 'Access Denied' );
@@ -72,7 +54,12 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
72
  $poll_logging_method = isset( $_POST['poll_logging_method'] ) ? (int) sanitize_key( $_POST['poll_logging_method'] ) : 0;
73
  $poll_cookielog_expiry = isset( $_POST['poll_cookielog_expiry'] ) ? (int) sanitize_key ($_POST['poll_cookielog_expiry'] ) : 0;
74
  $poll_allowtovote = isset( $_POST['poll_allowtovote'] ) ? (int) sanitize_key( $_POST['poll_allowtovote'] ) : 0;
75
- $update_poll_queries = array();
 
 
 
 
 
76
  $update_poll_text = array();
77
  $update_poll_queries[] = update_option('poll_bar', $poll_bar);
78
  $update_poll_queries[] = update_option('poll_ajax_style', $poll_ajax_style);
@@ -88,6 +75,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
88
  $update_poll_queries[] = update_option('poll_logging_method', $poll_logging_method);
89
  $update_poll_queries[] = update_option('poll_cookielog_expiry', $poll_cookielog_expiry);
90
  $update_poll_queries[] = update_option('poll_allowtovote', $poll_allowtovote);
 
91
  $update_poll_text[] = __('Poll Bar Style', 'wp-polls');
92
  $update_poll_text[] = __('Poll AJAX Style', 'wp-polls');
93
  $update_poll_text[] = __('Sort Poll Answers By Option', 'wp-polls');
@@ -103,6 +91,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
103
  $update_poll_text[] = __('Logging Method', 'wp-polls');
104
  $update_poll_text[] = __('Cookie And Log Expiry Option', 'wp-polls');
105
  $update_poll_text[] = __('Allow To Vote Option', 'wp-polls');
 
106
  $i=0;
107
  $text = '';
108
  foreach($update_poll_queries as $update_poll_query) {
@@ -116,6 +105,11 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
116
  }
117
  cron_polls_place();
118
  }
 
 
 
 
 
119
  ?>
120
  <script type="text/javascript">
121
  /* <![CDATA[*/
@@ -310,6 +304,10 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
310
  <th scope="row" valign="top"><?php _e('Expiry Time For Cookie And Log:', 'wp-polls'); ?></th>
311
  <td><input type="text" name="poll_cookielog_expiry" value="<?php echo (int) esc_attr( get_option( 'poll_cookielog_expiry' ) ); ?>" size="10" /> <?php _e('seconds (0 to disable)', 'wp-polls'); ?></td>
312
  </tr>
 
 
 
 
313
  </table>
314
 
315
  <!-- Poll Archive -->
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  ### Check Whether User Can Manage Polls
3
  if( ! current_user_can( 'manage_polls' ) ) {
4
  die( 'Access Denied' );
54
  $poll_logging_method = isset( $_POST['poll_logging_method'] ) ? (int) sanitize_key( $_POST['poll_logging_method'] ) : 0;
55
  $poll_cookielog_expiry = isset( $_POST['poll_cookielog_expiry'] ) ? (int) sanitize_key ($_POST['poll_cookielog_expiry'] ) : 0;
56
  $poll_allowtovote = isset( $_POST['poll_allowtovote'] ) ? (int) sanitize_key( $_POST['poll_allowtovote'] ) : 0;
57
+
58
+ // New options we just need a single poll_options
59
+ $poll_options = array();
60
+ $poll_options['ip_header'] = ! empty( $_POST['poll_ip_header'] ) ? sanitize_text_field( $_POST['poll_ip_header'] ) : '';
61
+
62
+ $update_poll_queries = array();
63
  $update_poll_text = array();
64
  $update_poll_queries[] = update_option('poll_bar', $poll_bar);
65
  $update_poll_queries[] = update_option('poll_ajax_style', $poll_ajax_style);
75
  $update_poll_queries[] = update_option('poll_logging_method', $poll_logging_method);
76
  $update_poll_queries[] = update_option('poll_cookielog_expiry', $poll_cookielog_expiry);
77
  $update_poll_queries[] = update_option('poll_allowtovote', $poll_allowtovote);
78
+ $update_poll_queries[] = update_option( 'poll_options', $poll_options );
79
  $update_poll_text[] = __('Poll Bar Style', 'wp-polls');
80
  $update_poll_text[] = __('Poll AJAX Style', 'wp-polls');
81
  $update_poll_text[] = __('Sort Poll Answers By Option', 'wp-polls');
91
  $update_poll_text[] = __('Logging Method', 'wp-polls');
92
  $update_poll_text[] = __('Cookie And Log Expiry Option', 'wp-polls');
93
  $update_poll_text[] = __('Allow To Vote Option', 'wp-polls');
94
+ $update_poll_text[] = __( 'Poll Options', 'wp-polls' );
95
  $i=0;
96
  $text = '';
97
  foreach($update_poll_queries as $update_poll_query) {
105
  }
106
  cron_polls_place();
107
  }
108
+
109
+ $poll_options = get_option( 'poll_options' );
110
+ if ( empty( $poll_options ) ) {
111
+ $poll_options['ip_header'] = '';
112
+ }
113
  ?>
114
  <script type="text/javascript">
115
  /* <![CDATA[*/
304
  <th scope="row" valign="top"><?php _e('Expiry Time For Cookie And Log:', 'wp-polls'); ?></th>
305
  <td><input type="text" name="poll_cookielog_expiry" value="<?php echo (int) esc_attr( get_option( 'poll_cookielog_expiry' ) ); ?>" size="10" /> <?php _e('seconds (0 to disable)', 'wp-polls'); ?></td>
306
  </tr>
307
+ <tr>
308
+ <th scope="row" valign="top"><?php _e( 'Header That Contains The IP:', 'wp-polls' ); ?></th>
309
+ <td><input type="text" name="poll_ip_header" value="<?php echo esc_attr( $poll_options['ip_header'] ); ?>" size="30" /> <?php _e( 'You can leave it blank to use the default', 'wp-polls' ); ?><br /><?php _e( 'Example: REMOTE_ADDR', 'wp-polls' ); ?></td>
310
+ </tr>
311
  </table>
312
 
313
  <!-- Poll Archive -->
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: GamerZ
3
  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.9
7
- Stable tag: 2.75.6
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
 
@@ -25,6 +25,9 @@ I spent most of my free time creating, updating, maintaining and supporting thes
25
 
26
  ## Changelog
27
 
 
 
 
28
  ### Version 2.75.6
29
  * NEW: New filter for template variables: wp_polls_template_votebody_variables, wp_polls_template_votefooter, wp_polls_template_resultheader_variables, wp_polls_template_resultbody_variables, wp_polls_template_resultfooter_variables. Props @Liblastic.
30
  * NEW: composer.json
3
  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: 6.0
7
+ Stable tag: 2.76.0
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
 
25
 
26
  ## Changelog
27
 
28
+ ### Version 2.76.0
29
+ * NEW: Supports specifying which header to read the user's IP from. Props Marc Montpas.
30
+
31
  ### Version 2.75.6
32
  * NEW: New filter for template variables: wp_polls_template_votebody_variables, wp_polls_template_votefooter, wp_polls_template_resultheader_variables, wp_polls_template_resultbody_variables, wp_polls_template_resultfooter_variables. Props @Liblastic.
33
  * NEW: composer.json
uninstall.php CHANGED
@@ -36,6 +36,7 @@ $option_names = array(
36
  , 'poll_template_pollarchiveheader'
37
  , 'poll_template_pollarchivefooter'
38
  , 'poll_cookielog_expiry'
 
39
  , 'widget_polls-widget'
40
  );
41
 
36
  , 'poll_template_pollarchiveheader'
37
  , 'poll_template_pollarchivefooter'
38
  , 'poll_cookielog_expiry'
39
+ , 'poll_options'
40
  , 'widget_polls-widget'
41
  );
42
 
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.75.6
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 2021 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.75.6' );
33
 
34
 
35
  ### Create Text Domain For Translations
@@ -750,7 +750,13 @@ if ( ! function_exists( 'get_ipaddress' ) ) {
750
  }
751
  }
752
  function poll_get_ipaddress() {
753
- return apply_filters( 'wp_polls_ipaddress', wp_hash( get_ipaddress() ) );
 
 
 
 
 
 
754
  }
755
  function poll_get_hostname() {
756
  $hostname = gethostbyaddr( get_ipaddress() );
@@ -1939,9 +1945,13 @@ function polls_activate() {
1939
  add_option('poll_cookielog_expiry', 0);
1940
  add_option('poll_template_pollarchivepagingheader', '');
1941
  add_option('poll_template_pollarchivepagingfooter', '');
 
1942
  // Database Upgrade For WP-Polls 2.50
1943
  delete_option('poll_archive_show');
1944
 
 
 
 
1945
  // Index
1946
  $index = $wpdb->get_results( "SHOW INDEX FROM $wpdb->pollsip;" );
1947
  $key_name = array();
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.76.0
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: https://lesterchan.net
9
  Text Domain: wp-polls
11
 
12
 
13
  /*
14
+ Copyright 2022 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.76.0' );
33
 
34
 
35
  ### Create Text Domain For Translations
750
  }
751
  }
752
  function poll_get_ipaddress() {
753
+ $ip = get_ipaddress();
754
+ $poll_options = get_option( 'poll_options' );
755
+ if ( ! empty( $poll_options ) && ! empty( $poll_options['ip_header'] ) && ! empty( $_SERVER[ $poll_options['ip_header'] ] ) ) {
756
+ $ip = esc_attr( $_SERVER[ $poll_options['ip_header'] ] );
757
+ }
758
+
759
+ return apply_filters( 'wp_polls_ipaddress', wp_hash( $ip ) );
760
  }
761
  function poll_get_hostname() {
762
  $hostname = gethostbyaddr( get_ipaddress() );
1945
  add_option('poll_cookielog_expiry', 0);
1946
  add_option('poll_template_pollarchivepagingheader', '');
1947
  add_option('poll_template_pollarchivepagingfooter', '');
1948
+
1949
  // Database Upgrade For WP-Polls 2.50
1950
  delete_option('poll_archive_show');
1951
 
1952
+ // Database Upgrade for WP-Polls 2.76
1953
+ add_option( 'poll_options', array( 'ip_header' => '' ) );
1954
+
1955
  // Index
1956
  $index = $wpdb->get_results( "SHOW INDEX FROM $wpdb->pollsip;" );
1957
  $key_name = array();