Version Description
N/A
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-Polls |
Version | 2.66 |
Comparing to | |
See all releases |
Code changes from version 2.65 to 2.66
- polls-js.dev.js +17 -21
- polls-js.js +6 -9
- readme.txt +7 -1
- tinymce/plugins/polls/plugin.js +6 -6
- tinymce/plugins/polls/plugin.min.js +1 -1
- wp-polls.php +17 -16
polls-js.dev.js
CHANGED
@@ -57,12 +57,11 @@ function poll_process() {
|
|
57 |
jQuery(document).ready(function($) {
|
58 |
poll_nonce = $('#poll_' + poll_id + '_nonce').val();
|
59 |
if(pollsL10n.show_fading) {
|
60 |
-
$('#polls-' + poll_id).fadeTo('def', 0
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
});
|
66 |
} else {
|
67 |
if(pollsL10n.show_loading) {
|
68 |
$('#polls-' + poll_id + '-loading').show();
|
@@ -80,12 +79,11 @@ function poll_result(current_poll_id) {
|
|
80 |
poll_id = current_poll_id;
|
81 |
poll_nonce = $('#poll_' + poll_id + '_nonce').val();
|
82 |
if(pollsL10n.show_fading) {
|
83 |
-
$('#polls-' + poll_id).fadeTo('def', 0
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
});
|
89 |
} else {
|
90 |
if(pollsL10n.show_loading) {
|
91 |
$('#polls-' + poll_id + '-loading').show();
|
@@ -106,12 +104,11 @@ function poll_booth(current_poll_id) {
|
|
106 |
poll_id = current_poll_id;
|
107 |
poll_nonce = $('#poll_' + poll_id + '_nonce').val();
|
108 |
if(pollsL10n.show_fading) {
|
109 |
-
$('#polls-' + poll_id).fadeTo('def', 0
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
});
|
115 |
} else {
|
116 |
if(pollsL10n.show_loading) {
|
117 |
$('#polls-' + poll_id + '-loading').show();
|
@@ -132,9 +129,8 @@ function poll_process_success(data) {
|
|
132 |
$('#polls-' + poll_id + '-loading').hide();
|
133 |
}
|
134 |
if(pollsL10n.show_fading) {
|
135 |
-
$('#polls-' + poll_id).fadeTo('def', 1
|
136 |
-
|
137 |
-
});
|
138 |
} else {
|
139 |
set_is_being_voted(false);
|
140 |
}
|
57 |
jQuery(document).ready(function($) {
|
58 |
poll_nonce = $('#poll_' + poll_id + '_nonce').val();
|
59 |
if(pollsL10n.show_fading) {
|
60 |
+
$('#polls-' + poll_id).fadeTo('def', 0);
|
61 |
+
if(pollsL10n.show_loading) {
|
62 |
+
$('#polls-' + poll_id + '-loading').show();
|
63 |
+
}
|
64 |
+
$.ajax({type: 'POST', xhrFields: {withCredentials: true}, url: pollsL10n.ajax_url, data: 'action=polls&view=process&poll_id=' + poll_id + '&poll_' + poll_id + '=' + poll_answer_id + '&poll_' + poll_id + '_nonce=' + poll_nonce, cache: false, success: poll_process_success});
|
|
|
65 |
} else {
|
66 |
if(pollsL10n.show_loading) {
|
67 |
$('#polls-' + poll_id + '-loading').show();
|
79 |
poll_id = current_poll_id;
|
80 |
poll_nonce = $('#poll_' + poll_id + '_nonce').val();
|
81 |
if(pollsL10n.show_fading) {
|
82 |
+
$('#polls-' + poll_id).fadeTo('def', 0);
|
83 |
+
if(pollsL10n.show_loading) {
|
84 |
+
$('#polls-' + poll_id + '-loading').show();
|
85 |
+
}
|
86 |
+
$.ajax({type: 'GET', url: pollsL10n.ajax_url, data: 'action=polls&view=result&poll_id=' + poll_id + '&poll_' + poll_id + '_nonce=' + poll_nonce, cache: false, success: poll_process_success});
|
|
|
87 |
} else {
|
88 |
if(pollsL10n.show_loading) {
|
89 |
$('#polls-' + poll_id + '-loading').show();
|
104 |
poll_id = current_poll_id;
|
105 |
poll_nonce = $('#poll_' + poll_id + '_nonce').val();
|
106 |
if(pollsL10n.show_fading) {
|
107 |
+
$('#polls-' + poll_id).fadeTo('def', 0);
|
108 |
+
if(pollsL10n.show_loading) {
|
109 |
+
$('#polls-' + poll_id + '-loading').show();
|
110 |
+
}
|
111 |
+
$.ajax({type: 'GET', url: pollsL10n.ajax_url, data: 'action=polls&view=booth&poll_id=' + poll_id + '&poll_' + poll_id + '_nonce=' + poll_nonce, cache: false, success: poll_process_success});
|
|
|
112 |
} else {
|
113 |
if(pollsL10n.show_loading) {
|
114 |
$('#polls-' + poll_id + '-loading').show();
|
129 |
$('#polls-' + poll_id + '-loading').hide();
|
130 |
}
|
131 |
if(pollsL10n.show_fading) {
|
132 |
+
$('#polls-' + poll_id).fadeTo('def', 1);
|
133 |
+
set_is_being_voted(false);
|
|
|
134 |
} else {
|
135 |
set_is_being_voted(false);
|
136 |
}
|
polls-js.js
CHANGED
@@ -1,10 +1,7 @@
|
|
1 |
var poll_id=0,poll_answer_id="",is_being_voted=!1;pollsL10n.show_loading=parseInt(pollsL10n.show_loading);pollsL10n.show_fading=parseInt(pollsL10n.show_fading);
|
2 |
-
function poll_vote(a){is_being_voted?alert(pollsL10n.text_wait):(set_is_being_voted(!0),poll_id=
|
3 |
-
poll_answer_id=parseInt(
|
4 |
-
function poll_process(){poll_nonce=
|
5 |
-
url:pollsL10n.ajax_url,data:"action=polls&view=
|
6 |
-
function
|
7 |
-
|
8 |
-
function poll_booth(a){is_being_voted?alert(pollsL10n.text_wait):(set_is_being_voted(!0),poll_id=a,poll_nonce=jQuery("#poll_"+poll_id+"_nonce").val(),pollsL10n.show_fading?jQuery("#polls-"+poll_id).fadeTo("def",0,function(){pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").show();jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"action=polls&view=booth&poll_id="+poll_id+"&poll_"+poll_id+"_nonce="+poll_nonce,cache:!1,success:poll_process_success})}):(pollsL10n.show_loading&&jQuery("#polls-"+
|
9 |
-
poll_id+"-loading").show(),jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"action=polls&view=booth&poll_id="+poll_id+"&poll_"+poll_id+"_nonce="+poll_nonce,cache:!1,success:poll_process_success})))}function poll_process_success(a){jQuery("#polls-"+poll_id).replaceWith(a);pollsL10n.show_loading&&jQuery("#polls-"+poll_id+"-loading").hide();pollsL10n.show_fading?jQuery("#polls-"+poll_id).fadeTo("def",1,function(){set_is_being_voted(!1)}):set_is_being_voted(!1)}
|
10 |
-
function set_is_being_voted(a){is_being_voted=a};
|
1 |
var poll_id=0,poll_answer_id="",is_being_voted=!1;pollsL10n.show_loading=parseInt(pollsL10n.show_loading);pollsL10n.show_fading=parseInt(pollsL10n.show_fading);
|
2 |
+
function poll_vote(b){jQuery(document).ready(function(a){is_being_voted?alert(pollsL10n.text_wait):(set_is_being_voted(!0),poll_id=b,poll_answer_id="",poll_multiple_ans_count=poll_multiple_ans=0,a("#poll_multiple_ans_"+poll_id).length&&(poll_multiple_ans=parseInt(a("#poll_multiple_ans_"+poll_id).val())),a("#polls_form_"+poll_id+" input:checkbox, #polls_form_"+poll_id+" input:radio, #polls_form_"+poll_id+" option").each(function(b){if(a(this).is(":checked")||a(this).is(":selected"))0<poll_multiple_ans?
|
3 |
+
(poll_answer_id=a(this).val()+","+poll_answer_id,poll_multiple_ans_count++):poll_answer_id=parseInt(a(this).val())}),0<poll_multiple_ans?0<poll_multiple_ans_count&&poll_multiple_ans_count<=poll_multiple_ans?(poll_answer_id=poll_answer_id.substring(0,poll_answer_id.length-1),poll_process()):0==poll_multiple_ans_count?(set_is_being_voted(!1),alert(pollsL10n.text_valid)):(set_is_being_voted(!1),alert(pollsL10n.text_multiple+" "+poll_multiple_ans)):0<poll_answer_id?poll_process():(set_is_being_voted(!1),
|
4 |
+
alert(pollsL10n.text_valid)))})}function poll_process(){jQuery(document).ready(function(b){poll_nonce=b("#poll_"+poll_id+"_nonce").val();pollsL10n.show_fading&&b("#polls-"+poll_id).fadeTo("def",0);pollsL10n.show_loading&&b("#polls-"+poll_id+"-loading").show();b.ajax({type:"POST",xhrFields:{withCredentials:!0},url:pollsL10n.ajax_url,data:"action=polls&view=process&poll_id="+poll_id+"&poll_"+poll_id+"="+poll_answer_id+"&poll_"+poll_id+"_nonce="+poll_nonce,cache:!1,success:poll_process_success})})}
|
5 |
+
function poll_result(b){jQuery(document).ready(function(a){is_being_voted?alert(pollsL10n.text_wait):(set_is_being_voted(!0),poll_id=b,poll_nonce=a("#poll_"+poll_id+"_nonce").val(),pollsL10n.show_fading&&a("#polls-"+poll_id).fadeTo("def",0),pollsL10n.show_loading&&a("#polls-"+poll_id+"-loading").show(),a.ajax({type:"GET",url:pollsL10n.ajax_url,data:"action=polls&view=result&poll_id="+poll_id+"&poll_"+poll_id+"_nonce="+poll_nonce,cache:!1,success:poll_process_success}))})}
|
6 |
+
function poll_booth(b){jQuery(document).ready(function(a){is_being_voted?alert(pollsL10n.text_wait):(set_is_being_voted(!0),poll_id=b,poll_nonce=a("#poll_"+poll_id+"_nonce").val(),pollsL10n.show_fading&&a("#polls-"+poll_id).fadeTo("def",0),pollsL10n.show_loading&&a("#polls-"+poll_id+"-loading").show(),a.ajax({type:"GET",url:pollsL10n.ajax_url,data:"action=polls&view=booth&poll_id="+poll_id+"&poll_"+poll_id+"_nonce="+poll_nonce,cache:!1,success:poll_process_success}))})}
|
7 |
+
function poll_process_success(b){jQuery(document).ready(function(a){a("#polls-"+poll_id).replaceWith(b);pollsL10n.show_loading&&a("#polls-"+poll_id+"-loading").hide();pollsL10n.show_fading&&a("#polls-"+poll_id).fadeTo("def",1);set_is_being_voted(!1)})}function set_is_being_voted(b){is_being_voted=b};
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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: 3.9
|
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 |
|
@@ -26,6 +26,12 @@ WP-Polls is extremely customizable via templates and css styles and there are to
|
|
26 |
|
27 |
== Changelog ==
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
= Version 2.65 =
|
30 |
* NEW: Use Dashicons
|
31 |
* NEW: Supports TinyMCE 4.0 For WordPress 3.9
|
4 |
Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 3.9
|
7 |
+
Stable tag: 2.66
|
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 |
|
26 |
|
27 |
== Changelog ==
|
28 |
|
29 |
+
= Version 2.66 =
|
30 |
+
* FIXED: Notices from polls_archive function. Props. @prettyboymp.
|
31 |
+
* FIXED: Ajax request in parallel with animation. Props @nodecode.
|
32 |
+
* FIXED: Editor button was outputting the wrong shortcode.
|
33 |
+
* FIXED: ReferenceError: pollsEdL10n is not defined if TinyMCE 4.0 is loaded outside the Add/Edit Posts/Pages.
|
34 |
+
|
35 |
= Version 2.65 =
|
36 |
* NEW: Use Dashicons
|
37 |
* NEW: Supports TinyMCE 4.0 For WordPress 3.9
|
tinymce/plugins/polls/plugin.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
(function() {
|
2 |
-
tinymce.PluginManager.add('polls', function(editor
|
3 |
editor.addCommand('WP-Polls-Insert_Poll', function() {
|
4 |
-
var poll_id = jQuery.trim(prompt(
|
5 |
while(isNaN(poll_id)) {
|
6 |
-
poll_id = jQuery.trim(prompt(
|
7 |
}
|
8 |
if (poll_id >= -1 && poll_id != null && poll_id != "") {
|
9 |
-
editor.insertContent('[poll="' + poll_id + '"]');
|
10 |
}
|
11 |
});
|
12 |
editor.addButton('polls', {
|
13 |
text: false,
|
14 |
-
tooltip:
|
15 |
icon: 'polls dashicons-before dashicons-chart-bar',
|
16 |
onclick: function() {
|
17 |
-
tinyMCE.activeEditor.execCommand(
|
18 |
}
|
19 |
});
|
20 |
});
|
1 |
(function() {
|
2 |
+
tinymce.PluginManager.add('polls', function(editor) {
|
3 |
editor.addCommand('WP-Polls-Insert_Poll', function() {
|
4 |
+
var poll_id = jQuery.trim(prompt(tinymce.translate('Enter Poll ID')));
|
5 |
while(isNaN(poll_id)) {
|
6 |
+
poll_id = jQuery.trim(prompt(tinymce.translate('Error: Poll ID must be numeric') + "\n\n" + tinymce.translate('Please enter Poll ID again')));
|
7 |
}
|
8 |
if (poll_id >= -1 && poll_id != null && poll_id != "") {
|
9 |
+
editor.insertContent('[poll id="' + poll_id + '"]');
|
10 |
}
|
11 |
});
|
12 |
editor.addButton('polls', {
|
13 |
text: false,
|
14 |
+
tooltip: tinymce.translate('Insert Poll'),
|
15 |
icon: 'polls dashicons-before dashicons-chart-bar',
|
16 |
onclick: function() {
|
17 |
+
tinyMCE.activeEditor.execCommand('WP-Polls-Insert_Poll')
|
18 |
}
|
19 |
});
|
20 |
});
|
tinymce/plugins/polls/plugin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(){tinymce.PluginManager.add("polls",function(b
|
1 |
+
(function(){tinymce.PluginManager.add("polls",function(b){b.addCommand("WP-Polls-Insert_Poll",function(){for(var a=jQuery.trim(prompt(tinymce.translate("Enter Poll ID")));isNaN(a);)a=jQuery.trim(prompt(tinymce.translate("Error: Poll ID must be numeric")+"\n\n"+tinymce.translate("Please enter Poll ID again")));-1<=a&&null!=a&&""!=a&&b.insertContent('[poll id="'+a+'"]')});b.addButton("polls",{text:!1,tooltip:tinymce.translate("Insert Poll"),icon:"polls dashicons-before dashicons-chart-bar",onclick:function(){tinyMCE.activeEditor.execCommand("WP-Polls-Insert_Poll")}})})})();
|
wp-polls.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP-Polls
|
4 |
Plugin URI: http://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: http://lesterchan.net
|
9 |
Text Domain: wp-polls
|
@@ -255,20 +255,13 @@ add_action('admin_footer-page.php', 'poll_footer_admin');
|
|
255 |
function poll_footer_admin() {
|
256 |
?>
|
257 |
<script type="text/javascript">
|
258 |
-
|
259 |
-
|
260 |
-
, error_poll_id_numeric: "<?php echo esc_js(__('Error: Poll ID must be numeric', 'wp-polls')); ?>"
|
261 |
-
, enter_poll_id_again: "<?php echo esc_js(__('Please enter Poll ID again', 'wp-polls')); ?>"
|
262 |
-
, poll: "<?php echo esc_js(__('Poll', 'wp-polls')); ?>"
|
263 |
-
, insert_poll: "<?php echo esc_js(__('Insert Poll', 'wp-polls')) ; ?>"
|
264 |
-
};
|
265 |
-
QTags.addButton('ed_wp_polls', pollsEdL10n.poll, function() {
|
266 |
-
var poll_id = jQuery.trim(prompt(pollsEdL10n.enter_poll_id));
|
267 |
while(isNaN(poll_id)) {
|
268 |
-
poll_id = jQuery.trim(prompt(
|
269 |
}
|
270 |
if (poll_id >= -1 && poll_id != null && poll_id != "") {
|
271 |
-
QTags.insertContent('[poll="' + poll_id + '"]');
|
272 |
}
|
273 |
});
|
274 |
</script>
|
@@ -282,8 +275,9 @@ function poll_tinymce_addbuttons() {
|
|
282 |
return;
|
283 |
}
|
284 |
if(get_user_option('rich_editing') == 'true') {
|
285 |
-
add_filter(
|
286 |
add_filter('mce_buttons', 'poll_tinymce_registerbutton');
|
|
|
287 |
}
|
288 |
}
|
289 |
function poll_tinymce_registerbutton($buttons) {
|
@@ -298,6 +292,13 @@ function poll_tinymce_addplugin($plugin_array) {
|
|
298 |
}
|
299 |
return $plugin_array;
|
300 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
|
302 |
|
303 |
### Function: Check Who Is Allow To Vote
|
@@ -859,10 +860,10 @@ function polls_archive() {
|
|
859 |
global $wpdb, $in_pollsarchive;
|
860 |
// Polls Variables
|
861 |
$in_pollsarchive = true;
|
862 |
-
$page = intval($_GET['poll_page']);
|
863 |
$polls_questions = array();
|
864 |
$polls_answers = array();
|
865 |
-
$
|
866 |
$polls_perpage = intval(get_option('poll_archive_perpage'));
|
867 |
$poll_questions_ids = '0';
|
868 |
$poll_voted = false;
|
@@ -1016,7 +1017,7 @@ function polls_archive() {
|
|
1016 |
}
|
1017 |
}
|
1018 |
// Let User See What Options They Voted
|
1019 |
-
if(in_array($polls_answer['aid'], check_voted_multiple($polls_question['id'], $polls_ips[$polls_question['id']]))) {
|
1020 |
// Results Body Variables
|
1021 |
$template_answer = stripslashes(get_option('poll_template_resultbody2'));
|
1022 |
$template_answer = str_replace("%POLL_ID%", $polls_question['id'], $template_answer);
|
3 |
Plugin Name: WP-Polls
|
4 |
Plugin URI: http://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.66
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
Text Domain: wp-polls
|
255 |
function poll_footer_admin() {
|
256 |
?>
|
257 |
<script type="text/javascript">
|
258 |
+
QTags.addButton('ed_wp_polls', '<?php echo esc_js(__('Poll', 'wp-polls')); ?>', function() {
|
259 |
+
var poll_id = jQuery.trim(prompt('<?php echo esc_js(__('Enter Poll ID', 'wp-polls')); ?>'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
while(isNaN(poll_id)) {
|
261 |
+
poll_id = jQuery.trim(prompt("<?php echo esc_js(__('Error: Poll ID must be numeric', 'wp-polls')); ?>\n\n<?php echo esc_js(__('Please enter Poll ID again', 'wp-polls')); ?>"));
|
262 |
}
|
263 |
if (poll_id >= -1 && poll_id != null && poll_id != "") {
|
264 |
+
QTags.insertContent('[poll id="' + poll_id + '"]');
|
265 |
}
|
266 |
});
|
267 |
</script>
|
275 |
return;
|
276 |
}
|
277 |
if(get_user_option('rich_editing') == 'true') {
|
278 |
+
add_filter('mce_external_plugins', 'poll_tinymce_addplugin');
|
279 |
add_filter('mce_buttons', 'poll_tinymce_registerbutton');
|
280 |
+
add_filter('wp_mce_translation', 'poll_tinymce_translation');
|
281 |
}
|
282 |
}
|
283 |
function poll_tinymce_registerbutton($buttons) {
|
292 |
}
|
293 |
return $plugin_array;
|
294 |
}
|
295 |
+
function poll_tinymce_translation($mce_translation) {
|
296 |
+
$mce_translation['Enter Poll ID'] = esc_js(__('Enter Poll ID', 'wp-polls'));
|
297 |
+
$mce_translation['Error: Poll ID must be numeric'] = esc_js(__('Error: Poll ID must be numeric', 'wp-polls'));
|
298 |
+
$mce_translation['Please enter Poll ID again'] = esc_js(__('Please enter Poll ID again', 'wp-polls'));
|
299 |
+
$mce_translation['Insert Poll'] = esc_js(__('Insert Poll', 'wp-polls'));
|
300 |
+
return $mce_translation;
|
301 |
+
}
|
302 |
|
303 |
|
304 |
### Function: Check Who Is Allow To Vote
|
860 |
global $wpdb, $in_pollsarchive;
|
861 |
// Polls Variables
|
862 |
$in_pollsarchive = true;
|
863 |
+
$page = isset($_GET['poll_page']) ? intval($_GET['poll_page']) : 0;
|
864 |
$polls_questions = array();
|
865 |
$polls_answers = array();
|
866 |
+
$polls_ips = array();
|
867 |
$polls_perpage = intval(get_option('poll_archive_perpage'));
|
868 |
$poll_questions_ids = '0';
|
869 |
$poll_voted = false;
|
1017 |
}
|
1018 |
}
|
1019 |
// Let User See What Options They Voted
|
1020 |
+
if(isset($polls_ips[$polls_question['id']]) && in_array($polls_answer['aid'], check_voted_multiple($polls_question['id'], $polls_ips[$polls_question['id']]))) {
|
1021 |
// Results Body Variables
|
1022 |
$template_answer = stripslashes(get_option('poll_template_resultbody2'));
|
1023 |
$template_answer = str_replace("%POLL_ID%", $polls_question['id'], $template_answer);
|