Version Description
N/A
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-Polls |
Version | 2.73 |
Comparing to | |
See all releases |
Code changes from version 2.72 to 2.73
- polls-add.php +1 -1
- polls-logs.php +14 -9
- polls-manager.php +7 -7
- polls-options.php +1 -1
- polls-templates.php +15 -15
- readme.txt +6 -2
- wp-polls.php +48 -42
polls-add.php
CHANGED
@@ -132,7 +132,7 @@ if(!empty($_POST['do'])) {
|
|
132 |
$poll_noquestion = 2;
|
133 |
$count = 0;
|
134 |
?>
|
135 |
-
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade">'.
|
136 |
<form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__)); ?>">
|
137 |
<?php wp_nonce_field('wp-polls_add-poll'); ?>
|
138 |
<div class="wrap">
|
132 |
$poll_noquestion = 2;
|
133 |
$count = 0;
|
134 |
?>
|
135 |
+
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade">'.removeslashes($text).'</div>'; } ?>
|
136 |
<form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__)); ?>">
|
137 |
<?php wp_nonce_field('wp-polls_add-poll'); ?>
|
138 |
<div class="wrap">
|
polls-logs.php
CHANGED
@@ -9,7 +9,7 @@ if( ! current_user_can( 'manage_polls' ) ) {
|
|
9 |
$max_records = 2000;
|
10 |
$pollip_answers = array();
|
11 |
$poll_question_data = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_multiple, pollq_question, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d", $poll_id ) );
|
12 |
-
$poll_question = wp_kses_post(
|
13 |
$poll_totalvoters = intval( $poll_question_data->pollq_totalvoters );
|
14 |
$poll_multiple = intval( $poll_question_data->pollq_multiple );
|
15 |
$poll_registered = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(pollip_userid) FROM $wpdb->pollsip WHERE pollip_qid = %d AND pollip_userid > 0", $poll_id ) );
|
@@ -25,6 +25,9 @@ $exclude_registered = 0;
|
|
25 |
$exclude_comment = 0;
|
26 |
$exclude_guest = 0;
|
27 |
|
|
|
|
|
|
|
28 |
### Process Filters
|
29 |
if(!empty($_POST['do'])) {
|
30 |
check_admin_referer('wp-polls_logs');
|
@@ -106,7 +109,7 @@ if(!empty($_POST['do'])) {
|
|
106 |
$poll_ips = $wpdb->get_results( $wpdb->prepare( "SELECT pollip_aid, pollip_ip, pollip_host, pollip_timestamp, pollip_user FROM $wpdb->pollsip WHERE pollip_qid = %d ORDER BY pollip_aid ASC, pollip_user ASC LIMIT %d", $poll_id, $max_records ) );
|
107 |
}
|
108 |
?>
|
109 |
-
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade">'.
|
110 |
<div class="wrap">
|
111 |
<h2><?php _e('Poll\'s Logs', 'wp-polls'); ?></h2>
|
112 |
<h3><?php echo $poll_question; ?></h3>
|
@@ -135,7 +138,7 @@ if(!empty($_POST['do'])) {
|
|
135 |
if($poll_answers_data) {
|
136 |
foreach($poll_answers_data as $data) {
|
137 |
$polla_id = intval($data->polla_aid);
|
138 |
-
$polla_answers =
|
139 |
if($polla_id == $users_voted_for) {
|
140 |
echo '<option value="'.$polla_id .'" selected="selected">'.$polla_answers.'</option>';
|
141 |
} else {
|
@@ -229,9 +232,9 @@ if(!empty($_POST['do'])) {
|
|
229 |
if($poll_voters) {
|
230 |
foreach($poll_voters as $pollip_user) {
|
231 |
if($pollip_user == $what_user_voted) {
|
232 |
-
echo '<option value="' .
|
233 |
} else {
|
234 |
-
echo '<option value="' .
|
235 |
}
|
236 |
}
|
237 |
}
|
@@ -263,6 +266,7 @@ if(!empty($_POST['do'])) {
|
|
263 |
echo '<p>'.sprintf(__('This default filter is limited to display only <strong>%s</strong> records.', 'wp-polls'), number_format_i18n($max_records)).'</p>';
|
264 |
}
|
265 |
echo '<table class="widefat">'."\n";
|
|
|
266 |
$k = 1;
|
267 |
$j = 0;
|
268 |
$poll_last_aid = -1;
|
@@ -276,7 +280,7 @@ if(!empty($_POST['do'])) {
|
|
276 |
echo "</tr>\n";
|
277 |
foreach($poll_ips as $poll_ip) {
|
278 |
$pollip_aid = intval($poll_ip->pollip_aid);
|
279 |
-
$pollip_user =
|
280 |
$pollip_ip = $poll_ip->pollip_ip;
|
281 |
$pollip_host = $poll_ip->pollip_host;
|
282 |
$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));
|
@@ -306,7 +310,7 @@ if(!empty($_POST['do'])) {
|
|
306 |
} else {
|
307 |
foreach($poll_ips as $poll_ip) {
|
308 |
$pollip_aid = intval($poll_ip->pollip_aid);
|
309 |
-
$pollip_user = apply_filters( 'poll_log_secret_ballot',
|
310 |
$pollip_ip = $poll_ip->pollip_ip;
|
311 |
$pollip_host = $poll_ip->pollip_host;
|
312 |
$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));
|
@@ -314,7 +318,8 @@ if(!empty($_POST['do'])) {
|
|
314 |
if($pollip_aid == 0) {
|
315 |
echo "<tr class=\"highlight\">\n<td colspan=\"4\"><strong>$pollip_answers[$pollip_aid]</strong></td>\n</tr>\n";
|
316 |
} else {
|
317 |
-
|
|
|
318 |
$k++;
|
319 |
}
|
320 |
echo "<tr class=\"thead\">\n";
|
@@ -372,4 +377,4 @@ if(!empty($_POST['do'])) {
|
|
372 |
?>
|
373 |
</div>
|
374 |
<p><?php _e('Note: If your logging method is by IP and Cookie or by Cookie, users may still be unable to vote if they have voted before as the cookie is still stored in their computer.', 'wp-polls'); ?></p>
|
375 |
-
</div>
|
9 |
$max_records = 2000;
|
10 |
$pollip_answers = array();
|
11 |
$poll_question_data = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_multiple, pollq_question, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d", $poll_id ) );
|
12 |
+
$poll_question = wp_kses_post( removeslashes( $poll_question_data->pollq_question ) );
|
13 |
$poll_totalvoters = intval( $poll_question_data->pollq_totalvoters );
|
14 |
$poll_multiple = intval( $poll_question_data->pollq_multiple );
|
15 |
$poll_registered = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(pollip_userid) FROM $wpdb->pollsip WHERE pollip_qid = %d AND pollip_userid > 0", $poll_id ) );
|
25 |
$exclude_comment = 0;
|
26 |
$exclude_guest = 0;
|
27 |
|
28 |
+
$users_voted_for = null;
|
29 |
+
$what_user_voted = null;
|
30 |
+
|
31 |
### Process Filters
|
32 |
if(!empty($_POST['do'])) {
|
33 |
check_admin_referer('wp-polls_logs');
|
109 |
$poll_ips = $wpdb->get_results( $wpdb->prepare( "SELECT pollip_aid, pollip_ip, pollip_host, pollip_timestamp, pollip_user FROM $wpdb->pollsip WHERE pollip_qid = %d ORDER BY pollip_aid ASC, pollip_user ASC LIMIT %d", $poll_id, $max_records ) );
|
110 |
}
|
111 |
?>
|
112 |
+
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade">'.removeslashes($text).'</div>'; } else { echo '<div id="message" class="updated" style="display: none;"></div>'; } ?>
|
113 |
<div class="wrap">
|
114 |
<h2><?php _e('Poll\'s Logs', 'wp-polls'); ?></h2>
|
115 |
<h3><?php echo $poll_question; ?></h3>
|
138 |
if($poll_answers_data) {
|
139 |
foreach($poll_answers_data as $data) {
|
140 |
$polla_id = intval($data->polla_aid);
|
141 |
+
$polla_answers = removeslashes( strip_tags( esc_attr( $data->polla_answers ) ) );
|
142 |
if($polla_id == $users_voted_for) {
|
143 |
echo '<option value="'.$polla_id .'" selected="selected">'.$polla_answers.'</option>';
|
144 |
} else {
|
232 |
if($poll_voters) {
|
233 |
foreach($poll_voters as $pollip_user) {
|
234 |
if($pollip_user == $what_user_voted) {
|
235 |
+
echo '<option value="' . removeslashes( esc_attr( $pollip_user ) ) . '" selected="selected">' . removeslashes( esc_attr( $pollip_user ) ) . '</option>';
|
236 |
} else {
|
237 |
+
echo '<option value="' . removeslashes( esc_attr( $pollip_user ) ) . '">' . removeslashes( esc_attr( $pollip_user ) ) . '</option>';
|
238 |
}
|
239 |
}
|
240 |
}
|
266 |
echo '<p>'.sprintf(__('This default filter is limited to display only <strong>%s</strong> records.', 'wp-polls'), number_format_i18n($max_records)).'</p>';
|
267 |
}
|
268 |
echo '<table class="widefat">'."\n";
|
269 |
+
echo "<tr class=\"highlight\"><td colspan=\"4\">". $poll_question . "</td></tr>";
|
270 |
$k = 1;
|
271 |
$j = 0;
|
272 |
$poll_last_aid = -1;
|
280 |
echo "</tr>\n";
|
281 |
foreach($poll_ips as $poll_ip) {
|
282 |
$pollip_aid = intval($poll_ip->pollip_aid);
|
283 |
+
$pollip_user = removeslashes($poll_ip->pollip_user);
|
284 |
$pollip_ip = $poll_ip->pollip_ip;
|
285 |
$pollip_host = $poll_ip->pollip_host;
|
286 |
$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));
|
310 |
} else {
|
311 |
foreach($poll_ips as $poll_ip) {
|
312 |
$pollip_aid = intval($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));
|
318 |
if($pollip_aid == 0) {
|
319 |
echo "<tr class=\"highlight\">\n<td colspan=\"4\"><strong>$pollip_answers[$pollip_aid]</strong></td>\n</tr>\n";
|
320 |
} else {
|
321 |
+
$polla_answer = ! empty( $pollip_answers[$pollip_aid] ) ? $pollip_answers[ $pollip_aid ] : $poll_answers_data[ $k-1 ]->polla_answers;
|
322 |
+
echo "<tr class=\"highlight\">\n<td colspan=\"4\"><strong>".__('Answer', 'wp-polls')." ".number_format_i18n($k).": " . $polla_answer . "</strong></td>\n</tr>\n";
|
323 |
$k++;
|
324 |
}
|
325 |
echo "<tr class=\"thead\">\n";
|
377 |
?>
|
378 |
</div>
|
379 |
<p><?php _e('Note: If your logging method is by IP and Cookie or by Cookie, users may still be unable to vote if they have voted before as the cookie is still stored in their computer.', 'wp-polls'); ?></p>
|
380 |
+
</div>
|
polls-manager.php
CHANGED
@@ -102,7 +102,7 @@ if(!empty($_POST['do'])) {
|
|
102 |
)
|
103 |
);
|
104 |
if( ! $edit_poll_question ) {
|
105 |
-
$text = '<p style="color: blue">'.sprintf(__('No Changes Had Been Made To Poll\'s Question \'%s\'.', 'wp-polls'),
|
106 |
}
|
107 |
// Update Polls' Answers
|
108 |
$polla_aids = array();
|
@@ -140,7 +140,7 @@ if(!empty($_POST['do'])) {
|
|
140 |
}
|
141 |
}
|
142 |
} else {
|
143 |
-
$text .= '<p style="color: red">'.sprintf(__('Invalid Poll \'%s\'.', 'wp-polls'),
|
144 |
}
|
145 |
// Add Poll Answers (If Needed)
|
146 |
$polla_answers_new = isset($_POST['polla_answers_new']) ? $_POST['polla_answers_new'] : null;
|
@@ -174,7 +174,7 @@ if(!empty($_POST['do'])) {
|
|
174 |
}
|
175 |
}
|
176 |
if(empty($text)) {
|
177 |
-
$text = '<p style="color: green">'.sprintf(__('Poll \'%s\' Edited Successfully.', 'wp-polls'),
|
178 |
}
|
179 |
// Update Lastest Poll ID To Poll Options
|
180 |
$latest_pollid = polls_latest_id();
|
@@ -197,7 +197,7 @@ switch($mode) {
|
|
197 |
$poll_question = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_question, pollq_timestamp, pollq_totalvotes, pollq_active, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d", $poll_id ) );
|
198 |
$poll_answers = $wpdb->get_results( $wpdb->prepare( "SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = %d ORDER BY polla_aid ASC", $poll_id ) );
|
199 |
$poll_noquestion = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(polla_aid) FROM $wpdb->pollsa WHERE polla_qid = %d", $poll_id ) );
|
200 |
-
$poll_question_text =
|
201 |
$poll_totalvotes = intval($poll_question->pollq_totalvotes);
|
202 |
$poll_timestamp = $poll_question->pollq_timestamp;
|
203 |
$poll_active = intval($poll_question->pollq_active);
|
@@ -205,7 +205,7 @@ switch($mode) {
|
|
205 |
$poll_multiple = intval($poll_question->pollq_multiple);
|
206 |
$poll_totalvoters = intval($poll_question->pollq_totalvoters);
|
207 |
?>
|
208 |
-
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade">'.
|
209 |
|
210 |
<!-- Edit Poll -->
|
211 |
<form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__).'&mode=edit&id='.$poll_id); ?>">
|
@@ -242,7 +242,7 @@ switch($mode) {
|
|
242 |
$pollip_answers[0] = __('Null Votes', 'wp-polls');
|
243 |
foreach($poll_answers as $poll_answer) {
|
244 |
$polla_aid = intval($poll_answer->polla_aid);
|
245 |
-
$polla_answers =
|
246 |
$polla_votes = intval($poll_answer->polla_votes);
|
247 |
$pollip_answers[$polla_aid] = $polla_answers;
|
248 |
echo "<tr id=\"poll-answer-$polla_aid\">\n";
|
@@ -392,7 +392,7 @@ switch($mode) {
|
|
392 |
$latest_poll = intval(get_option('poll_latestpoll'));
|
393 |
foreach($polls as $poll) {
|
394 |
$poll_id = intval($poll->pollq_id);
|
395 |
-
$poll_question =
|
396 |
$poll_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll->pollq_timestamp));
|
397 |
$poll_totalvotes = intval($poll->pollq_totalvotes);
|
398 |
$poll_totalvoters = intval($poll->pollq_totalvoters);
|
102 |
)
|
103 |
);
|
104 |
if( ! $edit_poll_question ) {
|
105 |
+
$text = '<p style="color: blue">'.sprintf(__('No Changes Had Been Made To Poll\'s Question \'%s\'.', 'wp-polls'), removeslashes($pollq_question)).'</p>';
|
106 |
}
|
107 |
// Update Polls' Answers
|
108 |
$polla_aids = array();
|
140 |
}
|
141 |
}
|
142 |
} else {
|
143 |
+
$text .= '<p style="color: red">'.sprintf(__('Invalid Poll \'%s\'.', 'wp-polls'), removeslashes($pollq_question)).'</p>';
|
144 |
}
|
145 |
// Add Poll Answers (If Needed)
|
146 |
$polla_answers_new = isset($_POST['polla_answers_new']) ? $_POST['polla_answers_new'] : null;
|
174 |
}
|
175 |
}
|
176 |
if(empty($text)) {
|
177 |
+
$text = '<p style="color: green">'.sprintf(__('Poll \'%s\' Edited Successfully.', 'wp-polls'), removeslashes($pollq_question)).'</p>';
|
178 |
}
|
179 |
// Update Lastest Poll ID To Poll Options
|
180 |
$latest_pollid = polls_latest_id();
|
197 |
$poll_question = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_question, pollq_timestamp, pollq_totalvotes, pollq_active, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d", $poll_id ) );
|
198 |
$poll_answers = $wpdb->get_results( $wpdb->prepare( "SELECT polla_aid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid = %d ORDER BY polla_aid ASC", $poll_id ) );
|
199 |
$poll_noquestion = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(polla_aid) FROM $wpdb->pollsa WHERE polla_qid = %d", $poll_id ) );
|
200 |
+
$poll_question_text = removeslashes($poll_question->pollq_question);
|
201 |
$poll_totalvotes = intval($poll_question->pollq_totalvotes);
|
202 |
$poll_timestamp = $poll_question->pollq_timestamp;
|
203 |
$poll_active = intval($poll_question->pollq_active);
|
205 |
$poll_multiple = intval($poll_question->pollq_multiple);
|
206 |
$poll_totalvoters = intval($poll_question->pollq_totalvoters);
|
207 |
?>
|
208 |
+
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade">'.removeslashes($text).'</div>'; } else { echo '<div id="message" class="updated" style="display: none;"></div>'; } ?>
|
209 |
|
210 |
<!-- Edit Poll -->
|
211 |
<form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__).'&mode=edit&id='.$poll_id); ?>">
|
242 |
$pollip_answers[0] = __('Null Votes', 'wp-polls');
|
243 |
foreach($poll_answers as $poll_answer) {
|
244 |
$polla_aid = intval($poll_answer->polla_aid);
|
245 |
+
$polla_answers = removeslashes($poll_answer->polla_answers);
|
246 |
$polla_votes = intval($poll_answer->polla_votes);
|
247 |
$pollip_answers[$polla_aid] = $polla_answers;
|
248 |
echo "<tr id=\"poll-answer-$polla_aid\">\n";
|
392 |
$latest_poll = intval(get_option('poll_latestpoll'));
|
393 |
foreach($polls as $poll) {
|
394 |
$poll_id = intval($poll->pollq_id);
|
395 |
+
$poll_question = removeslashes($poll->pollq_question);
|
396 |
$poll_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll->pollq_timestamp));
|
397 |
$poll_totalvotes = intval($poll->pollq_totalvotes);
|
398 |
$poll_totalvoters = intval($poll->pollq_totalvoters);
|
polls-options.php
CHANGED
@@ -337,7 +337,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
337 |
$polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
|
338 |
if($polls) {
|
339 |
foreach($polls as $poll) {
|
340 |
-
$poll_question =
|
341 |
$poll_id = intval($poll->pollq_id);
|
342 |
if($poll_id == intval(get_option('poll_currentpoll'))) {
|
343 |
echo '<option value="' . $poll_id . '" selected="selected">' . esc_attr( $poll_question ) . '</option>';
|
337 |
$polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
|
338 |
if($polls) {
|
339 |
foreach($polls as $poll) {
|
340 |
+
$poll_question = removeslashes($poll->pollq_question);
|
341 |
$poll_id = intval($poll->pollq_id);
|
342 |
if($poll_id == intval(get_option('poll_currentpoll'))) {
|
343 |
echo '<option value="' . $poll_id . '" selected="selected">' . esc_attr( $poll_question ) . '</option>';
|
polls-templates.php
CHANGED
@@ -290,7 +290,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
290 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
291 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('voteheader');" class="button" />
|
292 |
</td>
|
293 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_voteheader" name="poll_template_voteheader"><?php echo esc_textarea(
|
294 |
</tr>
|
295 |
<tr>
|
296 |
<td width="30%" valign="top">
|
@@ -303,7 +303,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
303 |
<p style="margin: 2px 0">- %POLL_CHECKBOX_RADIO%</p><br />
|
304 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('votebody');" class="button" />
|
305 |
</td>
|
306 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_votebody" name="poll_template_votebody"><?php echo esc_textarea(
|
307 |
</tr>
|
308 |
<tr>
|
309 |
<td width="30%" valign="top">
|
@@ -314,7 +314,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
314 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
315 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('votefooter');" class="button" />
|
316 |
</td>
|
317 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_votefooter" name="poll_template_votefooter"><?php echo esc_textarea(
|
318 |
</tr>
|
319 |
</table>
|
320 |
|
@@ -334,7 +334,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
334 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
335 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultheader');" class="button" />
|
336 |
</td>
|
337 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultheader" name="poll_template_resultheader"><?php echo esc_textarea(
|
338 |
</tr>
|
339 |
<tr>
|
340 |
<td width="30%" valign="top">
|
@@ -349,7 +349,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
349 |
<p style="margin: 2px 0">- %POLL_ANSWER_IMAGEWIDTH%</p><br />
|
350 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultbody');" class="button" />
|
351 |
</td>
|
352 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultbody" name="poll_template_resultbody"><?php echo esc_textarea(
|
353 |
</tr>
|
354 |
<tr>
|
355 |
<td width="30%" valign="top">
|
@@ -364,7 +364,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
364 |
<p style="margin: 2px 0">- %POLL_ANSWER_IMAGEWIDTH%</p><br />
|
365 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultbody2');" class="button" />
|
366 |
</td>
|
367 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultbody2" name="poll_template_resultbody2"><?php echo esc_textarea(
|
368 |
</tr>
|
369 |
<tr>
|
370 |
<td width="30%" valign="top">
|
@@ -384,7 +384,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
384 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
385 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultfooter');" class="button" />
|
386 |
</td>
|
387 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultfooter" name="poll_template_resultfooter"><?php echo esc_textarea(
|
388 |
</tr>
|
389 |
<tr>
|
390 |
<td width="30%" valign="top">
|
@@ -404,7 +404,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
404 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
405 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultfooter2');" class="button" />
|
406 |
</td>
|
407 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultfooter2" name="poll_template_resultfooter2"><?php echo esc_textarea(
|
408 |
</tr>
|
409 |
</table>
|
410 |
|
@@ -418,7 +418,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
418 |
<p style="margin: 2px 0">- %POLL_ARCHIVE_URL%</p><br />
|
419 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivelink');" class="button" />
|
420 |
</td>
|
421 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivelink" name="poll_template_pollarchivelink"><?php echo esc_textarea(
|
422 |
</tr>
|
423 |
<tr>
|
424 |
<td width="30%" valign="top">
|
@@ -427,7 +427,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
427 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
428 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchiveheader');" class="button" />
|
429 |
</td>
|
430 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchiveheader" name="poll_template_pollarchiveheader"><?php echo esc_textarea(
|
431 |
</tr>
|
432 |
<tr>
|
433 |
<td width="30%" valign="top">
|
@@ -446,7 +446,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
446 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
447 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivefooter');" class="button" />
|
448 |
</td>
|
449 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivefooter" name="poll_template_pollarchivefooter"><?php echo esc_textarea(
|
450 |
</tr>
|
451 |
<tr>
|
452 |
<td width="30%" valign="top">
|
@@ -455,7 +455,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
455 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
456 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivepagingheader');" class="button" />
|
457 |
</td>
|
458 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivepagingheader" name="poll_template_pollarchivepagingheader"><?php echo esc_textarea(
|
459 |
</tr>
|
460 |
<tr>
|
461 |
<td width="30%" valign="top">
|
@@ -464,7 +464,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
464 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
465 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivepagingfooter');" class="button" />
|
466 |
</td>
|
467 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivepagingfooter" name="poll_template_pollarchivepagingfooter"><?php echo esc_textarea(
|
468 |
</tr>
|
469 |
</table>
|
470 |
|
@@ -478,7 +478,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
478 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
479 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('disable');" class="button" />
|
480 |
</td>
|
481 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_disable" name="poll_template_disable"><?php echo esc_textarea(
|
482 |
</tr>
|
483 |
<tr>
|
484 |
<td width="30%" valign="top">
|
@@ -487,7 +487,7 @@ if( isset($_POST['Submit']) && $_POST['Submit'] ) {
|
|
487 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?><br /><br />
|
488 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('error');" class="button" />
|
489 |
</td>
|
490 |
-
<td valign="top"><textarea cols="80" rows="15" id="poll_template_error" name="poll_template_error"><?php echo esc_textarea(
|
491 |
</tr>
|
492 |
</table>
|
493 |
<p class="submit">
|
290 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
291 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('voteheader');" class="button" />
|
292 |
</td>
|
293 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_voteheader" name="poll_template_voteheader"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_voteheader' ) ) ); ?></textarea></td>
|
294 |
</tr>
|
295 |
<tr>
|
296 |
<td width="30%" valign="top">
|
303 |
<p style="margin: 2px 0">- %POLL_CHECKBOX_RADIO%</p><br />
|
304 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('votebody');" class="button" />
|
305 |
</td>
|
306 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_votebody" name="poll_template_votebody"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_votebody' ) ) ); ?></textarea></td>
|
307 |
</tr>
|
308 |
<tr>
|
309 |
<td width="30%" valign="top">
|
314 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
315 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('votefooter');" class="button" />
|
316 |
</td>
|
317 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_votefooter" name="poll_template_votefooter"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_votefooter' ) ) ); ?></textarea></td>
|
318 |
</tr>
|
319 |
</table>
|
320 |
|
334 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
335 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultheader');" class="button" />
|
336 |
</td>
|
337 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultheader" name="poll_template_resultheader"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_resultheader' ) ) ); ?></textarea></td>
|
338 |
</tr>
|
339 |
<tr>
|
340 |
<td width="30%" valign="top">
|
349 |
<p style="margin: 2px 0">- %POLL_ANSWER_IMAGEWIDTH%</p><br />
|
350 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultbody');" class="button" />
|
351 |
</td>
|
352 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultbody" name="poll_template_resultbody"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_resultbody' ) ) ); ?></textarea></td>
|
353 |
</tr>
|
354 |
<tr>
|
355 |
<td width="30%" valign="top">
|
364 |
<p style="margin: 2px 0">- %POLL_ANSWER_IMAGEWIDTH%</p><br />
|
365 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultbody2');" class="button" />
|
366 |
</td>
|
367 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultbody2" name="poll_template_resultbody2"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_resultbody2' ) ) ); ?></textarea></td>
|
368 |
</tr>
|
369 |
<tr>
|
370 |
<td width="30%" valign="top">
|
384 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
385 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultfooter');" class="button" />
|
386 |
</td>
|
387 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultfooter" name="poll_template_resultfooter"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_resultfooter' ) ) ); ?></textarea></td>
|
388 |
</tr>
|
389 |
<tr>
|
390 |
<td width="30%" valign="top">
|
404 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
405 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('resultfooter2');" class="button" />
|
406 |
</td>
|
407 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_resultfooter2" name="poll_template_resultfooter2"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_resultfooter2' ) ) ); ?></textarea></td>
|
408 |
</tr>
|
409 |
</table>
|
410 |
|
418 |
<p style="margin: 2px 0">- %POLL_ARCHIVE_URL%</p><br />
|
419 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivelink');" class="button" />
|
420 |
</td>
|
421 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivelink" name="poll_template_pollarchivelink"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_pollarchivelink' ) ) ); ?></textarea></td>
|
422 |
</tr>
|
423 |
<tr>
|
424 |
<td width="30%" valign="top">
|
427 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
428 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchiveheader');" class="button" />
|
429 |
</td>
|
430 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchiveheader" name="poll_template_pollarchiveheader"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_pollarchiveheader' ) ) ); ?></textarea></td>
|
431 |
</tr>
|
432 |
<tr>
|
433 |
<td width="30%" valign="top">
|
446 |
<p style="margin: 2px 0">- %POLL_MULTIPLE_ANS_MAX%</p><br />
|
447 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivefooter');" class="button" />
|
448 |
</td>
|
449 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivefooter" name="poll_template_pollarchivefooter"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_pollarchivefooter' ) ) ); ?></textarea></td>
|
450 |
</tr>
|
451 |
<tr>
|
452 |
<td width="30%" valign="top">
|
455 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
456 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivepagingheader');" class="button" />
|
457 |
</td>
|
458 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivepagingheader" name="poll_template_pollarchivepagingheader"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_pollarchivepagingheader' ) ) ); ?></textarea></td>
|
459 |
</tr>
|
460 |
<tr>
|
461 |
<td width="30%" valign="top">
|
464 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
465 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('pollarchivepagingfooter');" class="button" />
|
466 |
</td>
|
467 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_pollarchivepagingfooter" name="poll_template_pollarchivepagingfooter"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_pollarchivepagingfooter' ) ) ); ?></textarea></td>
|
468 |
</tr>
|
469 |
</table>
|
470 |
|
478 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?></p><br />
|
479 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('disable');" class="button" />
|
480 |
</td>
|
481 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_disable" name="poll_template_disable"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_disable' ) ) ); ?></textarea></td>
|
482 |
</tr>
|
483 |
<tr>
|
484 |
<td width="30%" valign="top">
|
487 |
<p style="margin: 2px 0">- <?php _e('N/A', 'wp-polls'); ?><br /><br />
|
488 |
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-polls'); ?>" onclick="poll_default_templates('error');" class="button" />
|
489 |
</td>
|
490 |
+
<td valign="top"><textarea cols="80" rows="15" id="poll_template_error" name="poll_template_error"><?php echo esc_textarea( removeslashes( get_option( 'poll_template_error' ) ) ); ?></textarea></td>
|
491 |
</tr>
|
492 |
</table>
|
493 |
<p class="submit">
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: GamerZ
|
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
|
5 |
Requires at least: 3.9
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.
|
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 |
|
@@ -27,6 +27,10 @@ WP-Polls is extremely customizable via templates and css styles and there are to
|
|
27 |
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.
|
28 |
|
29 |
== Changelog ==
|
|
|
|
|
|
|
|
|
30 |
= Version 2.72 =
|
31 |
* NEW: Use translate.wordpress.org to translate the plugin
|
32 |
* FIXED: SQL Injection fixes. Props [Jay Dansand](https://github.com/jaydansand)
|
3 |
Donate link: http://lesterchan.net/site/donation/
|
4 |
Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
|
5 |
Requires at least: 3.9
|
6 |
+
Tested up to: 4.5
|
7 |
+
Stable tag: 2.73
|
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 |
|
27 |
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.
|
28 |
|
29 |
== Changelog ==
|
30 |
+
= Version 2.73 =
|
31 |
+
* NEW: Display Poll Questions at the top of the Poll Logs table
|
32 |
+
* FIXED: Remove slashes
|
33 |
+
|
34 |
= Version 2.72 =
|
35 |
* NEW: Use translate.wordpress.org to translate the plugin
|
36 |
* FIXED: SQL Injection fixes. Props [Jay Dansand](https://github.com/jaydansand)
|
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.
|
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
|
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
|
@@ -30,7 +30,7 @@ Text Domain: wp-polls
|
|
30 |
|
31 |
|
32 |
### Version
|
33 |
-
define( 'WP_POLLS_VERSION', 2.
|
34 |
|
35 |
|
36 |
### Create Text Domain For Translations
|
@@ -72,10 +72,10 @@ function get_poll($temp_poll_id = 0, $display = true) {
|
|
72 |
// Check Whether Poll Is Disabled
|
73 |
if(intval(get_option('poll_currentpoll')) == -1) {
|
74 |
if($display) {
|
75 |
-
echo
|
76 |
return;
|
77 |
} else {
|
78 |
-
return
|
79 |
}
|
80 |
// Poll Is Enabled
|
81 |
} else {
|
@@ -430,7 +430,7 @@ function display_pollvote($poll_id, $display_loading = true) {
|
|
430 |
$poll_question = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_timestamp, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id ) );
|
431 |
|
432 |
// Poll Question Variables
|
433 |
-
$poll_question_text = wp_kses_post(
|
434 |
$poll_question_id = intval($poll_question->pollq_id);
|
435 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
436 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
@@ -443,7 +443,7 @@ function display_pollvote($poll_id, $display_loading = true) {
|
|
443 |
}
|
444 |
$poll_multiple_ans = intval($poll_question->pollq_multiple);
|
445 |
|
446 |
-
$template_question =
|
447 |
|
448 |
$template_question = apply_filters('poll_template_voteheader_markup', $template_question, $poll_question, array(
|
449 |
'%POLL_QUESTION%' => $poll_question_text,
|
@@ -473,10 +473,10 @@ function display_pollvote($poll_id, $display_loading = true) {
|
|
473 |
foreach($poll_answers as $poll_answer) {
|
474 |
// Poll Answer Variables
|
475 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
476 |
-
$poll_answer_text = wp_kses_post(
|
477 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
478 |
$poll_answer_percentage = $poll_question_totalvoters > 0 ? round((($poll_answer_votes/$poll_question_totalvoters)*100)) : 0;
|
479 |
-
$template_answer =
|
480 |
|
481 |
$template_answer = apply_filters('poll_template_votebody_markup', $template_answer, $poll_answer, array(
|
482 |
'%POLL_ID%' => $poll_question_id,
|
@@ -501,7 +501,7 @@ function display_pollvote($poll_id, $display_loading = true) {
|
|
501 |
}
|
502 |
}
|
503 |
// Voting Form Footer Variables
|
504 |
-
$template_footer =
|
505 |
|
506 |
$template_footer = apply_filters('poll_template_votefooter_markup', $template_footer, $poll_question, array(
|
507 |
'%POLL_ID%' => $poll_question_id,
|
@@ -522,7 +522,7 @@ function display_pollvote($poll_id, $display_loading = true) {
|
|
522 |
}
|
523 |
}
|
524 |
} else {
|
525 |
-
$temp_pollvote .=
|
526 |
}
|
527 |
// Return Poll Vote Template
|
528 |
return $temp_pollvote;
|
@@ -551,10 +551,10 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
551 |
$poll_question = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_active, pollq_timestamp, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id ) );
|
552 |
// No poll could be loaded from the database
|
553 |
if (!$poll_question) {
|
554 |
-
return
|
555 |
}
|
556 |
// Poll Question Variables
|
557 |
-
$poll_question_text = wp_kses_post(
|
558 |
$poll_question_id = intval($poll_question->pollq_id);
|
559 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
560 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
@@ -567,7 +567,7 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
567 |
$poll_end_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll_expiry));
|
568 |
}
|
569 |
$poll_multiple_ans = intval($poll_question->pollq_multiple);
|
570 |
-
$template_question =
|
571 |
$template_question = str_replace("%POLL_QUESTION%", $poll_question_text, $template_question);
|
572 |
$template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question);
|
573 |
$template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question);
|
@@ -597,7 +597,7 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
597 |
foreach($poll_answers as $poll_answer) {
|
598 |
// Poll Answer Variables
|
599 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
600 |
-
$poll_answer_text = wp_kses_post(
|
601 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
602 |
// Calculate Percentage And Image Bar Width
|
603 |
if(!$poll_totalvotes_zero) {
|
@@ -633,7 +633,7 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
633 |
// Let User See What Options They Voted
|
634 |
if(in_array($poll_answer_id, $user_voted)) {
|
635 |
// Results Body Variables
|
636 |
-
$template_answer =
|
637 |
$template_answer = str_replace("%POLL_ID%", $poll_question_id, $template_answer);
|
638 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
|
639 |
$template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
|
@@ -645,7 +645,7 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
645 |
$temp_pollresult .= "\t\t$template_answer\n";
|
646 |
} else {
|
647 |
// Results Body Variables
|
648 |
-
$template_answer =
|
649 |
$template_answer = str_replace("%POLL_ID%", $poll_question_id, $template_answer);
|
650 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
|
651 |
$template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
|
@@ -674,9 +674,9 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
674 |
}
|
675 |
// Results Footer Variables
|
676 |
if(!empty($user_voted) || $poll_question_active == 0 || !check_allowtovote()) {
|
677 |
-
$template_footer =
|
678 |
} else {
|
679 |
-
$template_footer =
|
680 |
}
|
681 |
$template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer);
|
682 |
$template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer);
|
@@ -705,7 +705,7 @@ function display_pollresult($poll_id, $user_voted = '', $display_loading = true)
|
|
705 |
}
|
706 |
}
|
707 |
} else {
|
708 |
-
$temp_pollresult .=
|
709 |
}
|
710 |
// Return Poll Result
|
711 |
return $temp_pollresult;
|
@@ -765,7 +765,7 @@ if(!function_exists('get_poll_question')) {
|
|
765 |
global $wpdb;
|
766 |
$poll_id = intval( $poll_id );
|
767 |
$poll_question = $wpdb->get_var( $wpdb->prepare( "SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id ) );
|
768 |
-
return wp_kses_post(
|
769 |
}
|
770 |
}
|
771 |
|
@@ -856,7 +856,7 @@ function polls_archive_link($page) {
|
|
856 |
|
857 |
### Function: Displays Polls Archive Link
|
858 |
function display_polls_archive_link($display = true) {
|
859 |
-
$template_pollarchivelink =
|
860 |
$template_pollarchivelink = str_replace("%POLL_ARCHIVE_URL%", get_option('poll_archive_url'), $template_pollarchivelink);
|
861 |
if($display) {
|
862 |
echo $template_pollarchivelink;
|
@@ -941,7 +941,7 @@ function polls_archive() {
|
|
941 |
$questions = $wpdb->get_results("SELECT * FROM $wpdb->pollsq WHERE $polls_type_sql ORDER BY pollq_id DESC LIMIT $offset, $polls_perpage");
|
942 |
if($questions) {
|
943 |
foreach($questions as $question) {
|
944 |
-
$polls_questions[] = array('id' => intval($question->pollq_id), 'question' => wp_kses_post(
|
945 |
$poll_questions_ids .= intval($question->pollq_id).', ';
|
946 |
}
|
947 |
$poll_questions_ids = substr($poll_questions_ids, 0, -2);
|
@@ -952,7 +952,7 @@ function polls_archive() {
|
|
952 |
$answers = $wpdb->get_results("SELECT polla_aid, polla_qid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid IN ($poll_questions_ids) ORDER BY $order_by $sort_order");
|
953 |
if($answers) {
|
954 |
foreach($answers as $answer) {
|
955 |
-
$polls_answers[intval($answer->polla_qid)][] = array('aid' => intval($answer->polla_aid), 'qid' => intval($answer->polla_qid), 'answers' => wp_kses_post(
|
956 |
}
|
957 |
}
|
958 |
|
@@ -985,9 +985,9 @@ function polls_archive() {
|
|
985 |
$poll_end_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $polls_question['end']));
|
986 |
}
|
987 |
// Archive Poll Header
|
988 |
-
$template_archive_header =
|
989 |
// Poll Question Variables
|
990 |
-
$template_question =
|
991 |
$template_question = str_replace("%POLL_QUESTION%", $polls_question['question'], $template_question);
|
992 |
$template_question = str_replace("%POLL_ID%", $polls_question['id'], $template_question);
|
993 |
$template_question = str_replace("%POLL_TOTALVOTES%", number_format_i18n($polls_question['totalvotes']), $template_question);
|
@@ -1033,7 +1033,7 @@ function polls_archive() {
|
|
1033 |
// Let User See What Options They Voted
|
1034 |
if(isset($polls_ips[$polls_question['id']]) && in_array($polls_answer['aid'], check_voted_multiple($polls_question['id'], $polls_ips[$polls_question['id']]))) {
|
1035 |
// Results Body Variables
|
1036 |
-
$template_answer =
|
1037 |
$template_answer = str_replace("%POLL_ID%", $polls_question['id'], $template_answer);
|
1038 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
|
1039 |
$template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
|
@@ -1045,7 +1045,7 @@ function polls_archive() {
|
|
1045 |
$pollsarchive_output_archive .= $template_answer;
|
1046 |
} else {
|
1047 |
// Results Body Variables
|
1048 |
-
$template_answer =
|
1049 |
$template_answer = str_replace("%POLL_ID%", $polls_question['id'], $template_answer);
|
1050 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
|
1051 |
$template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
|
@@ -1073,7 +1073,7 @@ function polls_archive() {
|
|
1073 |
}
|
1074 |
}
|
1075 |
// Results Footer Variables
|
1076 |
-
$template_footer =
|
1077 |
$template_footer = str_replace("%POLL_ID%", $polls_question['id'], $template_footer);
|
1078 |
$template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer);
|
1079 |
$template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer);
|
@@ -1091,7 +1091,7 @@ function polls_archive() {
|
|
1091 |
$template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_footer);
|
1092 |
}
|
1093 |
// Archive Poll Footer
|
1094 |
-
$template_archive_footer =
|
1095 |
$template_archive_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_archive_footer);
|
1096 |
$template_archive_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_archive_footer);
|
1097 |
$template_archive_footer = str_replace("%POLL_TOTALVOTES%", number_format_i18n($polls_question['totalvotes']), $template_archive_footer);
|
@@ -1116,7 +1116,7 @@ function polls_archive() {
|
|
1116 |
|
1117 |
// Polls Archive Paging
|
1118 |
if($max_page > 1) {
|
1119 |
-
$pollsarchive_output_archive .=
|
1120 |
if(function_exists('wp_pagenavi')) {
|
1121 |
$pollsarchive_output_archive .= '<div class="wp-pagenavi">'."\n";
|
1122 |
} else {
|
@@ -1145,7 +1145,7 @@ function polls_archive() {
|
|
1145 |
$pollsarchive_output_archive .= '<a href="'.polls_archive_link($max_page).'" title="'.__('Last »', 'wp-polls').'"> '.__('Last »', 'wp-polls').' </a>';
|
1146 |
}
|
1147 |
$pollsarchive_output_archive .= '</div>';
|
1148 |
-
$pollsarchive_output_archive .=
|
1149 |
}
|
1150 |
|
1151 |
// Output Polls Archive Page
|
@@ -1436,9 +1436,9 @@ function manage_poll() {
|
|
1436 |
if(trim($_POST['delete_logs_yes']) == 'yes') {
|
1437 |
$delete_logs = $wpdb->delete( $wpdb->pollsip, array( 'pollip_qid' => $pollq_id ), array( '%d' ) );
|
1438 |
if( $delete_logs ) {
|
1439 |
-
echo '<p style="color: green;">'.sprintf(__('All Logs For \'%s\' Has Been Deleted.', 'wp-polls'), wp_kses_post(
|
1440 |
} else {
|
1441 |
-
echo '<p style="color: red;">'.sprintf(__('An Error Has Occurred While Deleting All Logs For \'%s\'', 'wp-polls'), wp_kses_post(
|
1442 |
}
|
1443 |
}
|
1444 |
break;
|
@@ -1449,7 +1449,7 @@ function manage_poll() {
|
|
1449 |
$polla_aid = intval($_POST['polla_aid']);
|
1450 |
$poll_answers = $wpdb->get_row( $wpdb->prepare( "SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = %d AND polla_qid = %d", $polla_aid, $pollq_id ) );
|
1451 |
$polla_votes = intval($poll_answers->polla_votes);
|
1452 |
-
$polla_answers = wp_kses_post(
|
1453 |
$delete_polla_answers = $wpdb->delete( $wpdb->pollsa, array( 'polla_aid' => $polla_aid, 'polla_qid' => $pollq_id ), array( '%d', '%d' ) );
|
1454 |
$delete_pollip = $wpdb->delete( $wpdb->pollsip, array( 'pollip_qid' => $pollq_id, 'pollip_aid' => $polla_aid ), array( '%d', '%d' ) );
|
1455 |
$update_pollq_totalvotes = $wpdb->query( "UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes - $polla_votes) WHERE pollq_id = $pollq_id" );
|
@@ -1480,9 +1480,9 @@ function manage_poll() {
|
|
1480 |
)
|
1481 |
);
|
1482 |
if( $open_poll ) {
|
1483 |
-
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Opened', 'wp-polls'), wp_kses_post(
|
1484 |
} else {
|
1485 |
-
echo '<p style="color: red;">'.sprintf(__('Error Opening Poll \'%s\'', 'wp-polls'), wp_kses_post(
|
1486 |
}
|
1487 |
break;
|
1488 |
// Close Poll
|
@@ -1506,9 +1506,9 @@ function manage_poll() {
|
|
1506 |
)
|
1507 |
);
|
1508 |
if( $close_poll ) {
|
1509 |
-
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Closed', 'wp-polls'), wp_kses_post(
|
1510 |
} else {
|
1511 |
-
echo '<p style="color: red;">'.sprintf(__('Error Closing Poll \'%s\'', 'wp-polls'), wp_kses_post(
|
1512 |
}
|
1513 |
break;
|
1514 |
// Delete Poll
|
@@ -1521,10 +1521,10 @@ function manage_poll() {
|
|
1521 |
$delete_poll_ip = $wpdb->delete( $wpdb->pollsip, array( 'pollip_qid' => $pollq_id ), array( '%d' ) );
|
1522 |
$poll_option_lastestpoll = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_latestpoll'");
|
1523 |
if(!$delete_poll_question) {
|
1524 |
-
echo '<p style="color: red;">'.sprintf(__('Error In Deleting Poll \'%s\' Question', 'wp-polls'), wp_kses_post(
|
1525 |
}
|
1526 |
if(empty($text)) {
|
1527 |
-
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Deleted Successfully', 'wp-polls'), wp_kses_post(
|
1528 |
}
|
1529 |
// Update Lastest Poll ID To Poll Options
|
1530 |
$latest_pollid = polls_latest_id();
|
@@ -1671,7 +1671,7 @@ function polls_page_general_stats($content) {
|
|
1671 |
$polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
|
1672 |
if($polls) {
|
1673 |
foreach($polls as $poll) {
|
1674 |
-
$pollq_question = wp_kses_post(
|
1675 |
$pollq_id = intval($poll->pollq_id);
|
1676 |
if($pollq_id == $poll_id) {
|
1677 |
echo "<option value=\"$pollq_id\" selected=\"selected\">$pollq_question</option>\n";
|
@@ -1697,6 +1697,12 @@ function widget_polls_init() {
|
|
1697 |
register_widget('WP_Widget_Polls');
|
1698 |
}
|
1699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1700 |
|
1701 |
### Function: Activate Plugin
|
1702 |
register_activation_hook( __FILE__, 'polls_activation' );
|
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.73
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: https://lesterchan.net
|
9 |
Text Domain: wp-polls
|
11 |
|
12 |
|
13 |
/*
|
14 |
+
Copyright 2016 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
|
30 |
|
31 |
|
32 |
### Version
|
33 |
+
define( 'WP_POLLS_VERSION', 2.73 );
|
34 |
|
35 |
|
36 |
### Create Text Domain For Translations
|
72 |
// Check Whether Poll Is Disabled
|
73 |
if(intval(get_option('poll_currentpoll')) == -1) {
|
74 |
if($display) {
|
75 |
+
echo removeslashes(get_option('poll_template_disable'));
|
76 |
return;
|
77 |
} else {
|
78 |
+
return removeslashes(get_option('poll_template_disable'));
|
79 |
}
|
80 |
// Poll Is Enabled
|
81 |
} else {
|
430 |
$poll_question = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_timestamp, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id ) );
|
431 |
|
432 |
// Poll Question Variables
|
433 |
+
$poll_question_text = wp_kses_post( removeslashes( $poll_question->pollq_question ) );
|
434 |
$poll_question_id = intval($poll_question->pollq_id);
|
435 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
436 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
443 |
}
|
444 |
$poll_multiple_ans = intval($poll_question->pollq_multiple);
|
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,
|
473 |
foreach($poll_answers as $poll_answer) {
|
474 |
// Poll Answer Variables
|
475 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
476 |
+
$poll_answer_text = wp_kses_post( removeslashes( $poll_answer->polla_answers ) );
|
477 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
478 |
$poll_answer_percentage = $poll_question_totalvoters > 0 ? round((($poll_answer_votes/$poll_question_totalvoters)*100)) : 0;
|
479 |
+
$template_answer = removeslashes(get_option('poll_template_votebody'));
|
480 |
|
481 |
$template_answer = apply_filters('poll_template_votebody_markup', $template_answer, $poll_answer, array(
|
482 |
'%POLL_ID%' => $poll_question_id,
|
501 |
}
|
502 |
}
|
503 |
// Voting Form Footer Variables
|
504 |
+
$template_footer = removeslashes(get_option('poll_template_votefooter'));
|
505 |
|
506 |
$template_footer = apply_filters('poll_template_votefooter_markup', $template_footer, $poll_question, array(
|
507 |
'%POLL_ID%' => $poll_question_id,
|
522 |
}
|
523 |
}
|
524 |
} else {
|
525 |
+
$temp_pollvote .= removeslashes(get_option('poll_template_disable'));
|
526 |
}
|
527 |
// Return Poll Vote Template
|
528 |
return $temp_pollvote;
|
551 |
$poll_question = $wpdb->get_row( $wpdb->prepare( "SELECT pollq_id, pollq_question, pollq_totalvotes, pollq_active, pollq_timestamp, pollq_expiry, pollq_multiple, pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id ) );
|
552 |
// No poll could be loaded from the database
|
553 |
if (!$poll_question) {
|
554 |
+
return removeslashes(get_option('poll_template_disable'));
|
555 |
}
|
556 |
// Poll Question Variables
|
557 |
+
$poll_question_text = wp_kses_post( removeslashes( $poll_question->pollq_question ) );
|
558 |
$poll_question_id = intval($poll_question->pollq_id);
|
559 |
$poll_question_totalvotes = intval($poll_question->pollq_totalvotes);
|
560 |
$poll_question_totalvoters = intval($poll_question->pollq_totalvoters);
|
567 |
$poll_end_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $poll_expiry));
|
568 |
}
|
569 |
$poll_multiple_ans = intval($poll_question->pollq_multiple);
|
570 |
+
$template_question = removeslashes(get_option('poll_template_resultheader'));
|
571 |
$template_question = str_replace("%POLL_QUESTION%", $poll_question_text, $template_question);
|
572 |
$template_question = str_replace("%POLL_ID%", $poll_question_id, $template_question);
|
573 |
$template_question = str_replace("%POLL_TOTALVOTES%", $poll_question_totalvotes, $template_question);
|
597 |
foreach($poll_answers as $poll_answer) {
|
598 |
// Poll Answer Variables
|
599 |
$poll_answer_id = intval($poll_answer->polla_aid);
|
600 |
+
$poll_answer_text = wp_kses_post( removeslashes($poll_answer->polla_answers) );
|
601 |
$poll_answer_votes = intval($poll_answer->polla_votes);
|
602 |
// Calculate Percentage And Image Bar Width
|
603 |
if(!$poll_totalvotes_zero) {
|
633 |
// Let User See What Options They Voted
|
634 |
if(in_array($poll_answer_id, $user_voted)) {
|
635 |
// Results Body Variables
|
636 |
+
$template_answer = removeslashes(get_option('poll_template_resultbody2'));
|
637 |
$template_answer = str_replace("%POLL_ID%", $poll_question_id, $template_answer);
|
638 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
|
639 |
$template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
|
645 |
$temp_pollresult .= "\t\t$template_answer\n";
|
646 |
} else {
|
647 |
// Results Body Variables
|
648 |
+
$template_answer = removeslashes(get_option('poll_template_resultbody'));
|
649 |
$template_answer = str_replace("%POLL_ID%", $poll_question_id, $template_answer);
|
650 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $poll_answer_id, $template_answer);
|
651 |
$template_answer = str_replace("%POLL_ANSWER%", $poll_answer_text, $template_answer);
|
674 |
}
|
675 |
// Results Footer Variables
|
676 |
if(!empty($user_voted) || $poll_question_active == 0 || !check_allowtovote()) {
|
677 |
+
$template_footer = removeslashes(get_option('poll_template_resultfooter'));
|
678 |
} else {
|
679 |
+
$template_footer = removeslashes(get_option('poll_template_resultfooter2'));
|
680 |
}
|
681 |
$template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer);
|
682 |
$template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer);
|
705 |
}
|
706 |
}
|
707 |
} else {
|
708 |
+
$temp_pollresult .= removeslashes(get_option('poll_template_disable'));
|
709 |
}
|
710 |
// Return Poll Result
|
711 |
return $temp_pollresult;
|
765 |
global $wpdb;
|
766 |
$poll_id = intval( $poll_id );
|
767 |
$poll_question = $wpdb->get_var( $wpdb->prepare( "SELECT pollq_question FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id ) );
|
768 |
+
return wp_kses_post( removeslashes( $poll_question ) );
|
769 |
}
|
770 |
}
|
771 |
|
856 |
|
857 |
### Function: Displays Polls Archive Link
|
858 |
function display_polls_archive_link($display = true) {
|
859 |
+
$template_pollarchivelink = removeslashes(get_option('poll_template_pollarchivelink'));
|
860 |
$template_pollarchivelink = str_replace("%POLL_ARCHIVE_URL%", get_option('poll_archive_url'), $template_pollarchivelink);
|
861 |
if($display) {
|
862 |
echo $template_pollarchivelink;
|
941 |
$questions = $wpdb->get_results("SELECT * FROM $wpdb->pollsq WHERE $polls_type_sql ORDER BY pollq_id DESC LIMIT $offset, $polls_perpage");
|
942 |
if($questions) {
|
943 |
foreach($questions as $question) {
|
944 |
+
$polls_questions[] = array('id' => intval($question->pollq_id), 'question' => wp_kses_post( removeslashes( $question->pollq_question ) ), 'timestamp' => $question->pollq_timestamp, 'totalvotes' => intval($question->pollq_totalvotes), 'start' => $question->pollq_timestamp, 'end' => trim($question->pollq_expiry), 'multiple' => intval($question->pollq_multiple), 'totalvoters' => intval($question->pollq_totalvoters));
|
945 |
$poll_questions_ids .= intval($question->pollq_id).', ';
|
946 |
}
|
947 |
$poll_questions_ids = substr($poll_questions_ids, 0, -2);
|
952 |
$answers = $wpdb->get_results("SELECT polla_aid, polla_qid, polla_answers, polla_votes FROM $wpdb->pollsa WHERE polla_qid IN ($poll_questions_ids) ORDER BY $order_by $sort_order");
|
953 |
if($answers) {
|
954 |
foreach($answers as $answer) {
|
955 |
+
$polls_answers[intval($answer->polla_qid)][] = array('aid' => intval($answer->polla_aid), 'qid' => intval($answer->polla_qid), 'answers' => wp_kses_post( removeslashes( $answer->polla_answers ) ), 'votes' => intval($answer->polla_votes));
|
956 |
}
|
957 |
}
|
958 |
|
985 |
$poll_end_date = mysql2date(sprintf(__('%s @ %s', 'wp-polls'), get_option('date_format'), get_option('time_format')), gmdate('Y-m-d H:i:s', $polls_question['end']));
|
986 |
}
|
987 |
// Archive Poll Header
|
988 |
+
$template_archive_header = removeslashes(get_option('poll_template_pollarchiveheader'));
|
989 |
// Poll Question Variables
|
990 |
+
$template_question = removeslashes(get_option('poll_template_resultheader'));
|
991 |
$template_question = str_replace("%POLL_QUESTION%", $polls_question['question'], $template_question);
|
992 |
$template_question = str_replace("%POLL_ID%", $polls_question['id'], $template_question);
|
993 |
$template_question = str_replace("%POLL_TOTALVOTES%", number_format_i18n($polls_question['totalvotes']), $template_question);
|
1033 |
// Let User See What Options They Voted
|
1034 |
if(isset($polls_ips[$polls_question['id']]) && in_array($polls_answer['aid'], check_voted_multiple($polls_question['id'], $polls_ips[$polls_question['id']]))) {
|
1035 |
// Results Body Variables
|
1036 |
+
$template_answer = removeslashes(get_option('poll_template_resultbody2'));
|
1037 |
$template_answer = str_replace("%POLL_ID%", $polls_question['id'], $template_answer);
|
1038 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
|
1039 |
$template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
|
1045 |
$pollsarchive_output_archive .= $template_answer;
|
1046 |
} else {
|
1047 |
// Results Body Variables
|
1048 |
+
$template_answer = removeslashes(get_option('poll_template_resultbody'));
|
1049 |
$template_answer = str_replace("%POLL_ID%", $polls_question['id'], $template_answer);
|
1050 |
$template_answer = str_replace("%POLL_ANSWER_ID%", $polls_answer['aid'], $template_answer);
|
1051 |
$template_answer = str_replace("%POLL_ANSWER%", $polls_answer['answers'], $template_answer);
|
1073 |
}
|
1074 |
}
|
1075 |
// Results Footer Variables
|
1076 |
+
$template_footer = removeslashes(get_option('poll_template_resultfooter'));
|
1077 |
$template_footer = str_replace("%POLL_ID%", $polls_question['id'], $template_footer);
|
1078 |
$template_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_footer);
|
1079 |
$template_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_footer);
|
1091 |
$template_footer = str_replace("%POLL_MULTIPLE_ANS_MAX%", '1', $template_footer);
|
1092 |
}
|
1093 |
// Archive Poll Footer
|
1094 |
+
$template_archive_footer = removeslashes(get_option('poll_template_pollarchivefooter'));
|
1095 |
$template_archive_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_archive_footer);
|
1096 |
$template_archive_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_archive_footer);
|
1097 |
$template_archive_footer = str_replace("%POLL_TOTALVOTES%", number_format_i18n($polls_question['totalvotes']), $template_archive_footer);
|
1116 |
|
1117 |
// Polls Archive Paging
|
1118 |
if($max_page > 1) {
|
1119 |
+
$pollsarchive_output_archive .= removeslashes(get_option('poll_template_pollarchivepagingheader'));
|
1120 |
if(function_exists('wp_pagenavi')) {
|
1121 |
$pollsarchive_output_archive .= '<div class="wp-pagenavi">'."\n";
|
1122 |
} else {
|
1145 |
$pollsarchive_output_archive .= '<a href="'.polls_archive_link($max_page).'" title="'.__('Last »', 'wp-polls').'"> '.__('Last »', 'wp-polls').' </a>';
|
1146 |
}
|
1147 |
$pollsarchive_output_archive .= '</div>';
|
1148 |
+
$pollsarchive_output_archive .= removeslashes(get_option('poll_template_pollarchivepagingfooter'));
|
1149 |
}
|
1150 |
|
1151 |
// Output Polls Archive Page
|
1436 |
if(trim($_POST['delete_logs_yes']) == 'yes') {
|
1437 |
$delete_logs = $wpdb->delete( $wpdb->pollsip, array( 'pollip_qid' => $pollq_id ), array( '%d' ) );
|
1438 |
if( $delete_logs ) {
|
1439 |
+
echo '<p style="color: green;">'.sprintf(__('All Logs For \'%s\' Has Been Deleted.', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1440 |
} else {
|
1441 |
+
echo '<p style="color: red;">'.sprintf(__('An Error Has Occurred While Deleting All Logs For \'%s\'', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1442 |
}
|
1443 |
}
|
1444 |
break;
|
1449 |
$polla_aid = intval($_POST['polla_aid']);
|
1450 |
$poll_answers = $wpdb->get_row( $wpdb->prepare( "SELECT polla_votes, polla_answers FROM $wpdb->pollsa WHERE polla_aid = %d AND polla_qid = %d", $polla_aid, $pollq_id ) );
|
1451 |
$polla_votes = intval($poll_answers->polla_votes);
|
1452 |
+
$polla_answers = wp_kses_post( removeslashes( trim( $poll_answers->polla_answers ) ) );
|
1453 |
$delete_polla_answers = $wpdb->delete( $wpdb->pollsa, array( 'polla_aid' => $polla_aid, 'polla_qid' => $pollq_id ), array( '%d', '%d' ) );
|
1454 |
$delete_pollip = $wpdb->delete( $wpdb->pollsip, array( 'pollip_qid' => $pollq_id, 'pollip_aid' => $polla_aid ), array( '%d', '%d' ) );
|
1455 |
$update_pollq_totalvotes = $wpdb->query( "UPDATE $wpdb->pollsq SET pollq_totalvotes = (pollq_totalvotes - $polla_votes) WHERE pollq_id = $pollq_id" );
|
1480 |
)
|
1481 |
);
|
1482 |
if( $open_poll ) {
|
1483 |
+
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Opened', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1484 |
} else {
|
1485 |
+
echo '<p style="color: red;">'.sprintf(__('Error Opening Poll \'%s\'', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1486 |
}
|
1487 |
break;
|
1488 |
// Close Poll
|
1506 |
)
|
1507 |
);
|
1508 |
if( $close_poll ) {
|
1509 |
+
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Is Now Closed', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1510 |
} else {
|
1511 |
+
echo '<p style="color: red;">'.sprintf(__('Error Closing Poll \'%s\'', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1512 |
}
|
1513 |
break;
|
1514 |
// Delete Poll
|
1521 |
$delete_poll_ip = $wpdb->delete( $wpdb->pollsip, array( 'pollip_qid' => $pollq_id ), array( '%d' ) );
|
1522 |
$poll_option_lastestpoll = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'poll_latestpoll'");
|
1523 |
if(!$delete_poll_question) {
|
1524 |
+
echo '<p style="color: red;">'.sprintf(__('Error In Deleting Poll \'%s\' Question', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1525 |
}
|
1526 |
if(empty($text)) {
|
1527 |
+
echo '<p style="color: green;">'.sprintf(__('Poll \'%s\' Deleted Successfully', 'wp-polls'), wp_kses_post( removeslashes( $pollq_question ) ) ).'</p>';
|
1528 |
}
|
1529 |
// Update Lastest Poll ID To Poll Options
|
1530 |
$latest_pollid = polls_latest_id();
|
1671 |
$polls = $wpdb->get_results("SELECT pollq_id, pollq_question FROM $wpdb->pollsq ORDER BY pollq_id DESC");
|
1672 |
if($polls) {
|
1673 |
foreach($polls as $poll) {
|
1674 |
+
$pollq_question = wp_kses_post( removeslashes( $poll->pollq_question ) );
|
1675 |
$pollq_id = intval($poll->pollq_id);
|
1676 |
if($pollq_id == $poll_id) {
|
1677 |
echo "<option value=\"$pollq_id\" selected=\"selected\">$pollq_question</option>\n";
|
1697 |
register_widget('WP_Widget_Polls');
|
1698 |
}
|
1699 |
|
1700 |
+
if( ! function_exists( 'removeslashes' ) ) {
|
1701 |
+
function removeslashes( $string ) {
|
1702 |
+
$string = implode( '', explode( '\\', $string ) );
|
1703 |
+
return stripslashes( trim( $string ) );
|
1704 |
+
}
|
1705 |
+
}
|
1706 |
|
1707 |
### Function: Activate Plugin
|
1708 |
register_activation_hook( __FILE__, 'polls_activation' );
|