Version Description
- Added PollDaddy Ratings, you can now add ratings to your posts, pages and comments
- Bug Fix: Sub-menu now highlights the correct option
Download this release
Release Info
Developer | eoigal |
Plugin | Crowdsignal Dashboard – Polls, Surveys & more |
Version | 1.7.6 |
Comparing to | |
See all releases |
Code changes from version 1.7.5 to 1.7.6
- common.js +1 -1
- polldaddy-client.php +4 -0
- polldaddy.css +5 -76
- polldaddy.js +4 -129
- polldaddy.php +1341 -334
- readme.txt +10 -6
- style-editor.css +1 -20
common.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function $(id){return document.getElementById(id)}function pd_style(){this.name='';this.n_id=0;this.n_desc='';this.m_id=0;this.m_desc='';this.w_id=0;this.w_desc='';this.tag=''}function preload_pd_style(){if($('preload_value').value!='0'){url=window.location.href;fnd='';qs=window.location.search.substring(1);qv=qs.split("&");for(i=0;i<qv.length;i++){ft=qv[i].split("=");if(ft[0]=='preload'){fnd='&preload='+ft[1];url=url.replace(fnd,'')}}window.location=url+"&preload="
|
1 |
+
function $(id){return document.getElementById(id)} function pd_style(){this.name = '';this.n_id = 0;this.n_desc = '';this.m_id = 0;this.m_desc = '';this.w_id = 0;this.w_desc = '';this.tag = ''} function preload_pd_style(){if ($('preload_value').value != '0'){url = window.location.href;fnd = '';qs = window.location.search.substring(1);qv = qs.split("&");for (i = 0;i < qv.length;i++){ft = qv[i].split("=");if (ft[0] == 'preload'){fnd = '&preload=' + ft[1];url = url.replace(fnd,'')}}window.location = url + "&preload=" + $('preload_value').value}} function pd_bind(obj){if (obj.id == 'font_bold'){if (obj.checked){PDRTJS_1.font_bold = 'bold';}else{PDRTJS_1.font_bold = 'normal';}}else if (obj.id == 'font_italic'){if (obj.checked){PDRTJS_1.font_italic = 'italic';}else{PDRTJS_1.font_italic = 'normal';}}else if (obj.id == 'nero_style'){PDRTJS_1.star_color = obj.value;}else{eval('PDRTJS_1.' + obj.id + ' = "' + obj.value.replace('"','"') + '";');}PDRTJS_1.build();}function pd_change_type(type){var dd_label = $('editor_star_color_text');var size_label = $('editor_star_size_text');var obj_star = $('star_color');var obj_nero = $('nero_style');if (type == 1){PDRTJS_1.type = 'nero';PDRTJS_1.build();dd_label.innerHTML = adminRatingsL10n.nero_type;size_label.innerHTML = adminRatingsL10n.nero_size;obj_star.style.display = 'none';obj_nero.style.display = 'block';pd_bind(obj_nero);}else{PDRTJS_1.type = 'stars';PDRTJS_1.build();dd_label.innerHTML = adminRatingsL10n.star_colors;size_label.innerHTML = adminRatingsL10n.star_size;obj_star.style.display = 'block';obj_nero.style.display = 'none';pd_bind(obj_star);}} function show_options(id){if ($('pd_show_' + id).checked == true){$('span_' + id).style.display = 'inline-block';}else{$('span_' + id).style.display = 'none';}} function show_settings(){var div = $('poststuff');if (div.style.display == 'block'){div.style.display = 'none';}else{div.style.display = 'block';}}
|
polldaddy-client.php
CHANGED
@@ -844,6 +844,10 @@ class api_client {
|
|
844 |
}
|
845 |
return false;
|
846 |
}
|
|
|
|
|
|
|
|
|
847 |
}
|
848 |
|
849 |
function &polldaddy_activity( $act ) {
|
844 |
}
|
845 |
return false;
|
846 |
}
|
847 |
+
|
848 |
+
function get_xml(){
|
849 |
+
return 'REQUEST::' . $this->request_xml . "\n\nRESPONSE::" . $this->response_xml;
|
850 |
+
}
|
851 |
}
|
852 |
|
853 |
function &polldaddy_activity( $act ) {
|
polldaddy.css
CHANGED
@@ -1,76 +1,5 @@
|
|
1 |
-
html,body{height:auto !important;}
|
2 |
-
body.poll-preview-iframe{min-width:0;}
|
3 |
-
body.
|
4 |
-
|
5 |
-
|
6 |
-
body.poll-preview-iframe #wphead,
|
7 |
-
body.poll-preview-iframe #gears-info-box,
|
8 |
-
body.poll-preview-iframe #user_info,
|
9 |
-
body.poll-preview-iframe #dashmenu,
|
10 |
-
body.poll-preview-iframe #adminmenu,
|
11 |
-
body.poll-preview-iframe #sidemenu-bg,
|
12 |
-
body.poll-preview-iframe #footer,
|
13 |
-
body.poll-preview-iframe #feedbacklink,
|
14 |
-
body.poll-preview-iframe #screen-meta,
|
15 |
-
body.poll-preview-iframe #manage-polls h2#preview-header{display:none;}
|
16 |
-
body.poll-preview-iframe-editor #manage-polls h2#preview-header{display:block;}
|
17 |
-
body.poll-preview-iframe h2{padding-top:0;}
|
18 |
-
body.poll-preview-iframe{margin:0 !important;padding:0 !important;}
|
19 |
-
body.poll-preview-iframe .wrap{max-width:100%;}
|
20 |
-
body.poll-preview-iframe #wpwrap{min-height:0;}
|
21 |
-
body.poll-preview-iframe div#wpcontent{margin:0;padding:0;}
|
22 |
-
body.poll-preview-iframe div#wpbody{margin:0;padding:2em 3em;text-align:center;}
|
23 |
-
body.poll-preview-iframe div#wpbody-content{margin:0;padding:0;border:none;}
|
24 |
-
body.poll-preview-iframe div#manage-polls.wrap{text-align:left;}
|
25 |
-
body.poll-preview-iframe .pds-box{margin-left:auto;margin-right:auto;}
|
26 |
-
table td.post-title strong{display:block;}
|
27 |
-
table.poll-results .column-vote{min-width:50%;padding:3px 5px 3px 3px;margin:0;}
|
28 |
-
table.poll-results div.result-holder{position:relative;}
|
29 |
-
table.poll-results span.result-bar{display:block;padding:5px 0 4px 0;margin:0;height:100%;border:1px solid #EDB918;background-color:#FBD55E;}
|
30 |
-
table.poll-results span.result-total{position:absolute;left:.75em;top:6px;}
|
31 |
-
table.poll-results span.result-percent{position:absolute;right:.75em;top:6px;}
|
32 |
-
table.poll-others{margin-top:1.5em;}
|
33 |
-
table.poll-others .column-vote{min-width:50%;}
|
34 |
-
ul#answers,ul.poll-options{list-style:none;padding:0;}
|
35 |
-
ul#answers li{position:relative;}
|
36 |
-
ul#answers li div{border:1px solid #ccc;padding:2px 3px;margin:0 20px;}
|
37 |
-
ul#answers li span.handle{position:absolute;left:0;top:0;width:18px;height:100%;background-color:#E4F2FD;color:#70A6C4;display:none;cursor:move;text-align:center;line-height:1.8em;}
|
38 |
-
ul#answers li:hover span.handle{display:block;}
|
39 |
-
ul#answers li a.delete{display:block;position:absolute;top:0;right:0;width:18px;height:100%;text-align:center;line-height:1.8em;}
|
40 |
-
ul#answers li a.delete:hover{color:white;background-color:#f00;}
|
41 |
-
ul#answers input{padding:0;width:100%;border:none;}
|
42 |
-
ul#answer-options{list-style:none;padding:0;margin-left:20px;}
|
43 |
-
ul#answer-options li{display:inline;margin-right:1em;white-space:nowrap;}
|
44 |
-
p.submit input{padding:6px;}
|
45 |
-
p#add-answer-holder{display:none;text-align:right;}
|
46 |
-
.inner-sidebar{clear:right;float:right;position:relative;width:220px;margin-top:10px;}
|
47 |
-
#poststuff #post-body.has-sidebar,.has-sidebar{clear:left;float:left;margin-right:-240px;width:100%;}
|
48 |
-
.has-sidebar .has-sidebar-content,
|
49 |
-
.has-right-sidebar #post-body-content{margin-right:245px;}
|
50 |
-
#post-body-content #titlediv{margin:10px 0;}
|
51 |
-
.postbox{min-width:220px;}
|
52 |
-
tr.polldaddy-shortcode-row{background-color:#FFFEEB;}
|
53 |
-
tr.polldaddy-shortcode-row h4{padding:0;margin:0.3em 0;clear:both;}
|
54 |
-
tr.polldaddy-shortcode-row pre{float:left;background-color:#fff;padding:.2em;margin:0 0 .5em;border:1px solid #ccc;}
|
55 |
-
.polldaddy-show-design-options{text-align:left;width:8em;display:block;font-size:1em;padding:1em 2em;text-decoration:none;}
|
56 |
-
#design{text-align:center;}
|
57 |
-
#design h3{text-align:left;}
|
58 |
-
#design_standard{display:block;padding:0px 0px 0px 20px;}
|
59 |
-
#design_standard a{width:1em;font-size:4em;text-decoration:none;}
|
60 |
-
#design_custom {display:none;}
|
61 |
-
.pollStyle{width:100%;border-collapse:collapse;}
|
62 |
-
.pollStyle .cb{height:40px;width:30px;padding:0px 0px 2px 0px;}
|
63 |
-
.pollStyle .selector{width:250px;}
|
64 |
-
.pollStyle .customSelect{vertical-align:top;text-align:left;margin:0px;}
|
65 |
-
.pollStyle TH{text-align:left;}
|
66 |
-
.st_selector{border-collapse:collapse;}
|
67 |
-
.st_selector .img{width:150px;padding:0px;margin:0px;height:200px;}
|
68 |
-
.st_selector .dir_left{padding:0px 10px 0px 0px;width:75px;}
|
69 |
-
.st_selector .dir_right{padding:0px 0px 0px 20px;width:75px;}
|
70 |
-
.st_selector .title{text-align:center;height:20px;font-weight:bold;}
|
71 |
-
.st_selector .counter{text-align:center;width:150px;padding:10px 0px 0px 0px;}
|
72 |
-
#st_image{width:150px;padding:0px;margin:0px;height:200px;}
|
73 |
-
#st_sizes{width:150px;text-align:center;font-size:12px;}
|
74 |
-
#st_sizes a{width:150px;text-align:center;font-size:12px;}
|
75 |
-
.st_image_loader{width:150px;padding:0px;margin:0px;background:url(http://i.polldaddy.com/polls/st-loader.gif) no-repeat center center;}
|
76 |
-
#st_description{padding:6px 0px;font-size:10px;width:300px;text-align:center;}
|
1 |
+
html,body{height:auto !important;} body.poll-preview-iframe{min-width:0;} body.poll-preview-iframe #sidemenu, body.poll-preview-iframe #submenu, body.poll-preview-iframe #wpcombar, body.poll-preview-iframe #wphead, body.poll-preview-iframe #gears-info-box, body.poll-preview-iframe #user_info, body.poll-preview-iframe #dashmenu, body.poll-preview-iframe #adminmenu, body.poll-preview-iframe #sidemenu-bg, body.poll-preview-iframe #footer, body.poll-preview-iframe #feedbacklink, body.poll-preview-iframe #screen-meta, body.poll-preview-iframe #manage-polls h2#preview-header{display:none;} body.poll-preview-iframe-editor #manage-polls h2#preview-header{display:block;} body.poll-preview-iframe h2{padding-top:0;} body.poll-preview-iframe{margin:0 !important;padding:0 !important;} body.poll-preview-iframe .wrap{max-width:100%;} body.poll-preview-iframe #wpwrap{min-height:0;} body.poll-preview-iframe div#wpcontent{margin:0;padding:0;} body.poll-preview-iframe div#wpbody{margin:0;padding:2em 3em;text-align:center;}
|
2 |
+
body.poll-preview-iframe div#wpbody-content{margin:0;padding:0;border:none;} body.poll-preview-iframe div#manage-polls.wrap{text-align:left;} body.poll-preview-iframe .pds-box{margin-left:auto;margin-right:auto;} table td.post-title strong{display:block;} table.poll-results .column-vote{min-width:50%;padding:3px 5px 3px 3px;margin:0;} table.poll-results div.result-holder{position:relative;} table.poll-results span.result-bar{display:block;padding:5px 0 4px 0;margin:0;height:100%;border:1px solid #EDB918;background-color:#FBD55E;} table.poll-results span.result-total{position:absolute;left:.75em;top:6px;} table.poll-results span.result-percent{position:absolute;right:.75em;top:6px;} table.poll-others{margin-top:1.5em;} table.poll-others .column-vote{min-width:50%;} ul#answers,ul.poll-options{list-style:none;padding:0;} ul#answers li{position:relative;} ul#answers li div{border:1px solid #ccc;padding:2px 3px;margin:0 20px;}
|
3 |
+
ul#answers li span.handle{position:absolute;left:0;top:0;width:18px;height:100%;background-color:#E4F2FD;color:#70A6C4;display:none;cursor:move;text-align:center;line-height:1.8em;} ul#answers li:hover span.handle{display:block;} ul#answers li a.delete{display:block;position:absolute;top:0;right:0;width:18px;height:100%;text-align:center;line-height:1.8em;} ul#answers li a.delete:hover{color:white;background-color:#f00;} ul#answers input{padding:0;width:100%;border:none;} ul#answer-options{list-style:none;padding:0;margin-left:20px;} ul#answer-options li{display:inline;margin-right:1em;white-space:nowrap;} p.submit input{padding:6px;} p#add-answer-holder{display:none;text-align:right;} .inner-sidebar-ratings{clear:right;float:right;position:relative;width:281px;} #poststuff #post-body.has-sidebar,.has-sidebar{clear:left;float:left;margin-right:-240px;width:100%;} .has-sidebar .has-sidebar-content{margin-right:245px;} #post-body-content #titlediv{margin:10px 0;}
|
4 |
+
tr.polldaddy-shortcode-row{background-color:#FFFEEB;} tr.polldaddy-shortcode-row h4{padding:0;margin:0.3em 0;clear:both;} tr.polldaddy-shortcode-row pre{float:left;background-color:#fff;padding:.2em;margin:0 0 .5em;border:1px solid #ccc;} .polldaddy-show-design-options{text-align:left;width:8em;display:block;font-size:1em;padding:1em 2em;text-decoration:none;} #design{text-align:center;} #design h3{text-align:left;} #design_standard{display:block;padding:0px 0px 0px 20px;} #design_standard a{width:1em;font-size:4em;text-decoration:none;} #design_custom {display:none;} .pollStyle{width:100%;border-collapse:collapse;} .pollStyle .cb{height:40px;width:30px;padding:0px 0px 2px 0px;} .pollStyle .selector{width:250px;} .pollStyle .customSelect{vertical-align:top;text-align:left;margin:0px;} .pollStyle TH{text-align:left;} .st_selector{border-collapse:collapse;} .st_selector .img{width:150px;padding:0px;margin:0px;height:200px;} .st_selector .dir_left{padding:0px 10px 0px 0px;width:75px;}
|
5 |
+
.st_selector .dir_right{padding:0px 0px 0px 20px;width:75px;} .st_selector .title{text-align:center;height:20px;font-weight:bold;} .st_selector .counter{text-align:center;width:150px;padding:10px 0px 0px 0px;} #st_image{width:150px;padding:0px;margin:0px;height:200px;} #st_sizes{width:150px;text-align:center;font-size:12px;} #st_sizes a{width:150px;text-align:center;font-size:12px;} .st_image_loader{width:150px;padding:0px;margin:0px;background:url(http://i.polldaddy.com/polls/st-loader.gif) no-repeat center center;} #st_description{padding:6px 0px;font-size:10px;width:300px;text-align:center;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
polldaddy.js
CHANGED
@@ -1,129 +1,4 @@
|
|
1 |
-
jQuery(function($){
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
$('a.delete-poll').click( function() {
|
7 |
-
return confirm( 'Are you sure you want to delete "' + $(this).parents( 'td' ).find( 'strong' ).text() + '"?' );
|
8 |
-
} );
|
9 |
-
|
10 |
-
$('span.view a.thickbox').attr( 'href', function() {
|
11 |
-
return $(this).attr( 'href' ) + '&iframe&TB_iframe=true';
|
12 |
-
} );
|
13 |
-
|
14 |
-
var delAnswerPrep = function( context ) {
|
15 |
-
$('a.delete-answer', context || null ).click( function() {
|
16 |
-
if ( confirm( 'Are you sure you want to delete this answer?' ) ) {
|
17 |
-
$(this).parents( 'li' ).remove();
|
18 |
-
$('#choices option:last-child').remove();
|
19 |
-
}
|
20 |
-
return false;
|
21 |
-
} );
|
22 |
-
};
|
23 |
-
delAnswerPrep();
|
24 |
-
|
25 |
-
$('#answers').sortable( {
|
26 |
-
axis: 'y',
|
27 |
-
containment: 'parent',
|
28 |
-
handle: '.handle',
|
29 |
-
tolerance: 'pointer'
|
30 |
-
} );
|
31 |
-
|
32 |
-
$('#add-answer-holder').show().find( 'button').click( function() {
|
33 |
-
var aa = ( 1 + $('#answers li').size() ).toString();
|
34 |
-
delAnswerPrep( $('#answers').append( '<li><span class="handle">↕</span><div><input type="text" name="answer[new' + aa + ']" size="30" tabindex="2" value="" autocomplete="off" /></div><a title="delete this answer" class="delete-answer delete" href="#">×</a></li>' ).find( 'li:last' ) );
|
35 |
-
$('#choices').append('<option value="'+aa+'">'+aa+'</option>');
|
36 |
-
return false;
|
37 |
-
} );
|
38 |
-
|
39 |
-
var win = window.dialogArguments || opener || parent || top;
|
40 |
-
$('.polldaddy-send-to-editor').click( function() {
|
41 |
-
var pollID = $(this).siblings('.polldaddy-poll-id').val();
|
42 |
-
if ( !pollID )
|
43 |
-
pollID = $('.polldaddy-poll-id:first').val();
|
44 |
-
win.send_to_editor( '[polldaddy poll=' + parseInt( pollID ).toString() + ']' );
|
45 |
-
} );
|
46 |
-
|
47 |
-
$('.polldaddy-show-shortcode').toggle( function() {
|
48 |
-
$(this).parents('tr:first').next('tr').fadeIn();
|
49 |
-
$(this).parents('tr:first').next('tr').show();
|
50 |
-
return false;
|
51 |
-
}, function() {
|
52 |
-
$(this).parents('tr:first').next('tr').fadeOut();
|
53 |
-
$(this).parents('tr:first').next('tr').hide();
|
54 |
-
return false;
|
55 |
-
} );
|
56 |
-
|
57 |
-
var hiddenStyleID = $(':input[name=styleID]');
|
58 |
-
var customStyle = $(':input[name=customSelect]');
|
59 |
-
var customStyleVal = parseInt( customStyle.val() );
|
60 |
-
|
61 |
-
customStyle.change(function() {
|
62 |
-
var customStyleVal = parseInt( customStyle.val() );
|
63 |
-
hiddenStyleID.val( customStyleVal.toString() );
|
64 |
-
});
|
65 |
-
|
66 |
-
if ( customStyleVal > 0 ) {
|
67 |
-
$('#design_standard').hide();
|
68 |
-
$('#design_custom').show();
|
69 |
-
$('.polldaddy-show-design-options').html('Standard Styles');
|
70 |
-
hiddenStyleID.val( customStyleVal.toString() );
|
71 |
-
|
72 |
-
$('.polldaddy-show-design-options').toggle( function() {
|
73 |
-
$('#design_custom').hide();
|
74 |
-
$('#design_standard').fadeIn();
|
75 |
-
$('.polldaddy-show-design-options').html('Custom Styles');
|
76 |
-
hiddenStyleID.val( 'x' );
|
77 |
-
return false;
|
78 |
-
}, function() {
|
79 |
-
$('#design_standard').hide();
|
80 |
-
$('#design_custom').fadeIn();
|
81 |
-
$('.polldaddy-show-design-options').html('Standard Styles');
|
82 |
-
var customStyle = $(':input[name=customSelect]');
|
83 |
-
var customStyleVal = parseInt( customStyle.val() );
|
84 |
-
if ( customStyleVal > 0 ){
|
85 |
-
hiddenStyleID.val( customStyleVal.toString() );
|
86 |
-
}
|
87 |
-
else{
|
88 |
-
hiddenStyleID.val( 'x' );
|
89 |
-
}
|
90 |
-
return false;
|
91 |
-
} );
|
92 |
-
}
|
93 |
-
else{
|
94 |
-
$('#design_custom').hide();
|
95 |
-
$('#design_standard').show();
|
96 |
-
|
97 |
-
$('.polldaddy-show-design-options').toggle( function() {
|
98 |
-
$('#design_standard').hide();
|
99 |
-
$('#design_custom').fadeIn();
|
100 |
-
$('.polldaddy-show-design-options').html('Standard Styles');
|
101 |
-
var customStyle = $(':input[name=customSelect]');
|
102 |
-
var customStyleVal = parseInt( customStyle.val() );
|
103 |
-
if ( customStyleVal > 0 ){
|
104 |
-
hiddenStyleID.val( customStyleVal.toString() );
|
105 |
-
}
|
106 |
-
else{
|
107 |
-
hiddenStyleID.val( 'x' );
|
108 |
-
}
|
109 |
-
return false;
|
110 |
-
}, function() {
|
111 |
-
$('#design_custom').hide();
|
112 |
-
$('#design_standard').fadeIn();
|
113 |
-
$('.polldaddy-show-design-options').html('Custom Styles');
|
114 |
-
hiddenStyleID.val( 'x' );
|
115 |
-
return false;
|
116 |
-
} );
|
117 |
-
}
|
118 |
-
|
119 |
-
$("#multipleChoice").click(function(){
|
120 |
-
if ($("#multipleChoice").is(":checked"))
|
121 |
-
{
|
122 |
-
$("#numberChoices").show("fast");
|
123 |
-
}
|
124 |
-
else
|
125 |
-
{
|
126 |
-
$("#numberChoices").hide("fast");
|
127 |
-
}
|
128 |
-
});
|
129 |
-
});
|
1 |
+
jQuery(function($){ $('.hide-if-js').hide(); $('.empty-if-js').empty(); $('.hide-if-no-js').removeClass( 'hide-if-no-js' ); $('a.delete-poll').click( function() { return confirm( 'Are you sure you want to delete "' + $(this).parents( 'td' ).find( 'strong' ).text() + '"?' ); } ); $('span.view a.thickbox').attr( 'href', function() { return $(this).attr( 'href' ) + '&iframe&TB_iframe=true'; } ); var delAnswerPrep = function( context ) { $('a.delete-answer', context || null ).click( function() { if ( confirm( 'Are you sure you want to delete this answer?' ) ) { $(this).parents( 'li' ).remove(); $('#choices option:last-child').remove(); } return false; } ); }; delAnswerPrep(); $('#answers').sortable( { axis: 'y', containment: 'parent', handle: '.handle', tolerance: 'pointer' } ); $('#add-answer-holder').show().find( 'button').click( function() { var aa = ( 1 + $('#answers li').size() ).toString();
|
2 |
+
delAnswerPrep( $('#answers').append( '<li><span class="handle">↕</span><div><input type="text" name="answer[new' + aa + ']" size="30" tabindex="2" value="" autocomplete="off" /></div><a title="delete this answer" class="delete-answer delete" href="#">×</a></li>' ).find( 'li:last' ) ); $('#choices').append('<option value="'+aa+'">'+aa+'</option>'); return false; } ); var win = window.dialogArguments || opener || parent || top; $('.polldaddy-send-to-editor').click( function() { var pollID = $(this).siblings('.polldaddy-poll-id').val(); if ( !pollID ) pollID = $('.polldaddy-poll-id:first').val(); win.send_to_editor( '[polldaddy poll=' + parseInt( pollID ).toString() + ']' ); } ); $('.polldaddy-show-shortcode').toggle( function() { $(this).parents('tr:first').next('tr').fadeIn(); $(this).parents('tr:first').next('tr').show(); return false; }, function() { $(this).parents('tr:first').next('tr').fadeOut(); $(this).parents('tr:first').next('tr').hide(); return false; } );
|
3 |
+
var hiddenStyleID = $(':input[name=styleID]'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); customStyle.change(function() { var customStyleVal = parseInt( customStyle.val() ); hiddenStyleID.val( customStyleVal.toString() ); }); if ( customStyleVal > 0 ) { $('#design_standard').hide(); $('#design_custom').show(); $('.polldaddy-show-design-options').html('Standard Styles'); hiddenStyleID.val( customStyleVal.toString() ); $('.polldaddy-show-design-options').toggle( function() { $('#design_custom').hide(); $('#design_standard').fadeIn(); $('.polldaddy-show-design-options').html('Custom Styles'); hiddenStyleID.val( 'x' ); return false; }, function() { $('#design_standard').hide(); $('#design_custom').fadeIn(); $('.polldaddy-show-design-options').html('Standard Styles'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); if ( customStyleVal > 0 ){ hiddenStyleID.val( customStyleVal.toString() ); } else{
|
4 |
+
hiddenStyleID.val( 'x' ); } return false; } ); } else{ $('#design_custom').hide(); $('#design_standard').show(); $('.polldaddy-show-design-options').toggle( function() { $('#design_standard').hide(); $('#design_custom').fadeIn(); $('.polldaddy-show-design-options').html('Standard Styles'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); if ( customStyleVal > 0 ){ hiddenStyleID.val( customStyleVal.toString() ); } else{ hiddenStyleID.val( 'x' ); } return false; }, function() { $('#design_custom').hide(); $('#design_standard').fadeIn(); $('.polldaddy-show-design-options').html('Custom Styles'); hiddenStyleID.val( 'x' ); return false; } ); } $("#multipleChoice").click(function(){ if ($("#multipleChoice").is(":checked")) { $("#numberChoices").show("fast"); } else { $("#numberChoices").hide("fast"); } }); });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
polldaddy.php
CHANGED
@@ -5,7 +5,7 @@ Plugin Name: PollDaddy Polls
|
|
5 |
Description: Create and manage PollDaddy polls in WordPress
|
6 |
Author: Automattic, Inc.
|
7 |
Author URL: http://automattic.com/
|
8 |
-
Version: 1.7.
|
9 |
*/
|
10 |
|
11 |
// You can hardcode your PollDaddy PartnerGUID (API Key) here
|
@@ -24,7 +24,7 @@ class WP_PollDaddy {
|
|
24 |
var $base_url = false;
|
25 |
var $use_ssl = 0;
|
26 |
var $scheme = 'https';
|
27 |
-
var $version = '1.7.
|
28 |
|
29 |
var $polldaddy_clients = array();
|
30 |
|
@@ -64,16 +64,26 @@ class WP_PollDaddy {
|
|
64 |
if ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] )
|
65 |
add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "You need to <a href=\"%s\">input your PollDaddy.com account details</a>.", "edit.php?page=polls" ) . "</p></div>";' ) );
|
66 |
return false;
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
70 |
$hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
|
71 |
else
|
72 |
$hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
|
|
|
73 |
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
74 |
-
|
75 |
-
|
76 |
-
add_submenu_page( '
|
|
|
|
|
77 |
add_submenu_page( 'polls', __( 'Add New Poll' ), __( 'Add New' ), 'edit_posts', 'polls&action=create-poll', array( &$this, 'management_page' ) );
|
78 |
add_submenu_page( 'polls', __( 'Custom Styles' ), __( 'Custom Styles' ), 'edit_posts', 'polls&action=list-styles', array( &$this, 'management_page' ) );
|
79 |
|
@@ -244,7 +254,7 @@ class WP_PollDaddy {
|
|
244 |
<tbody>
|
245 |
<tr class="form-field form-required">
|
246 |
<th valign="top" scope="row">
|
247 |
-
<label for="polldaddy-email"
|
248 |
</th>
|
249 |
<td>
|
250 |
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" value="<?php if ( isset( $_POST['polldaddy_email'] ) ) echo attribute_escape( $_POST['polldaddy_email'] ); ?>" />
|
@@ -252,7 +262,7 @@ class WP_PollDaddy {
|
|
252 |
</tr>
|
253 |
<tr class="form-field form-required">
|
254 |
<th valign="top" scope="row">
|
255 |
-
<label for="polldaddy-password"
|
256 |
</th>
|
257 |
<td>
|
258 |
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
@@ -265,11 +275,11 @@ class WP_PollDaddy {
|
|
265 |
?>
|
266 |
<tr class="form-field form-required">
|
267 |
<th valign="top" scope="row">
|
268 |
-
<label for="polldaddy-use-ssl"
|
269 |
</th>
|
270 |
<td>
|
271 |
<input type="checkbox" name="polldaddy_use_ssl" id="polldaddy-use-ssl" value="1" <?php echo $checked ?> style="width: auto"/>
|
272 |
-
<label for="polldaddy-use-ssl"
|
273 |
<input type="hidden" name="polldaddy_use_ssl_checkbox" value="1" />
|
274 |
</td>
|
275 |
</tr>
|
@@ -293,7 +303,7 @@ class WP_PollDaddy {
|
|
293 |
}
|
294 |
|
295 |
function management_page_load() {
|
296 |
-
global $current_user;
|
297 |
|
298 |
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
299 |
$polldaddy->reset();
|
@@ -301,8 +311,8 @@ class WP_PollDaddy {
|
|
301 |
if ( !defined( 'WP_POLLDADDY__USERCODE' ) )
|
302 |
define( 'WP_POLLDADDY__USERCODE', $polldaddy->get_usercode( $current_user->ID ) );
|
303 |
|
304 |
-
wp_reset_vars( array( 'action', 'poll', 'style' ) );
|
305 |
-
global $action, $poll, $style;
|
306 |
|
307 |
if ( !WP_POLLDADDY__USERCODE )
|
308 |
$action = 'signup';
|
@@ -312,19 +322,40 @@ class WP_PollDaddy {
|
|
312 |
wp_enqueue_script( 'polls', "{$this->base_url}polldaddy.js", array( 'jquery', 'jquery-ui-sortable' ), $this->version );
|
313 |
wp_enqueue_script( 'polls-common', "{$this->base_url}common.js", array(), $this->version );
|
314 |
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
|
329 |
wp_enqueue_script( 'admin-forms' );
|
330 |
add_thickbox();
|
@@ -371,382 +402,386 @@ class WP_PollDaddy {
|
|
371 |
|
372 |
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
373 |
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
|
|
379 |
|
380 |
-
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
|
404 |
-
|
405 |
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
|
|
|
|
420 |
}
|
421 |
-
|
|
|
|
|
422 |
}
|
423 |
|
424 |
-
$
|
425 |
-
$
|
426 |
-
|
|
|
|
|
|
|
427 |
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
if ( empty( $poll ) )
|
433 |
-
return;
|
434 |
|
435 |
-
|
436 |
-
check_admin_referer( 'action-poll_bulk' );
|
437 |
-
else
|
438 |
-
check_admin_referer( "open-poll_$poll" );
|
439 |
|
440 |
-
|
|
|
|
|
441 |
|
442 |
-
|
443 |
-
|
444 |
-
|
|
|
445 |
|
446 |
-
|
447 |
-
|
448 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
}
|
450 |
|
451 |
-
|
452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
$polldaddy->reset();
|
454 |
-
|
455 |
-
|
|
|
|
|
|
|
456 |
}
|
457 |
-
$polldaddy->userCode = $userCode;
|
458 |
-
}
|
459 |
|
460 |
-
|
461 |
-
|
462 |
-
|
|
|
|
|
|
|
|
|
|
|
463 |
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
case 'close' :
|
468 |
-
if ( empty( $poll ) )
|
469 |
-
return;
|
470 |
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
|
|
475 |
|
476 |
-
|
477 |
|
478 |
-
|
479 |
$polldaddy->reset();
|
|
|
480 |
$poll_object = $polldaddy->get_poll( $poll );
|
|
|
481 |
|
482 |
if ( !$this->can_edit( $poll_object ) ) {
|
483 |
-
$this->errors->add( 'permission', __( 'You are not allowed to
|
484 |
return false;
|
485 |
}
|
486 |
|
487 |
// Send Poll Author credentials
|
|
|
488 |
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
489 |
$polldaddy->reset();
|
490 |
-
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
491 |
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
492 |
}
|
|
|
493 |
$polldaddy->userCode = $userCode;
|
494 |
}
|
495 |
|
496 |
-
|
497 |
-
|
498 |
-
}
|
499 |
-
|
500 |
-
$query_args['message'] = 'closed';
|
501 |
-
$query_args['closed'] = count( (array) $poll );
|
502 |
-
break;
|
503 |
-
case 'edit-poll' : // TODO: use polldaddy_poll
|
504 |
-
if ( !$is_POST || !$poll = (int) $poll )
|
505 |
-
return;
|
506 |
-
|
507 |
-
check_admin_referer( "edit-poll_$poll" );
|
508 |
|
509 |
-
|
510 |
-
|
511 |
|
512 |
-
|
513 |
-
|
|
|
|
|
514 |
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
// Send Poll Author credentials
|
521 |
-
|
522 |
-
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
523 |
-
$polldaddy->reset();
|
524 |
-
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
525 |
-
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
526 |
}
|
527 |
-
$this->parse_errors( $polldaddy );
|
528 |
-
$polldaddy->userCode = $userCode;
|
529 |
-
}
|
530 |
|
531 |
-
|
532 |
-
|
|
|
533 |
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
foreach ( $poll_data as $key => $value )
|
539 |
-
if ( '_' === $key[0] )
|
540 |
-
unset( $poll_data[$key] );
|
541 |
-
|
542 |
-
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
543 |
-
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
544 |
-
$poll_data[$option] = 'yes';
|
545 |
-
else
|
546 |
-
$poll_data[$option] = 'no';
|
547 |
-
}
|
548 |
|
549 |
-
|
550 |
-
|
551 |
-
$poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
552 |
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
$this->errors->add( 'answer', __( 'Invalid answers' ) );
|
560 |
-
|
561 |
-
$answers = array();
|
562 |
-
foreach ( $_POST['answer'] as $answer_id => $answer ) {
|
563 |
-
if ( !$answer = trim( stripslashes( $answer ) ) )
|
564 |
-
continue;
|
565 |
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
$answers[] = polldaddy_poll_answer( $args );
|
572 |
-
}
|
573 |
-
|
574 |
-
if ( 2 > count( $answers ) )
|
575 |
-
$this->errors->add( 'answer', __( 'You must include at least 2 answers' ) );
|
576 |
|
577 |
-
|
578 |
-
|
579 |
|
580 |
-
|
581 |
-
|
582 |
-
$poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
|
583 |
-
|
584 |
-
if ( isset ( $_POST['styleID'] ) ){
|
585 |
-
if ( $_POST['styleID'] == 'x' ){
|
586 |
-
$this->errors->add( 'UpdatePoll', __( 'Please choose a poll style' ) );
|
587 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
}
|
589 |
-
|
590 |
-
|
591 |
-
$poll_data['choices'] = (int) $_POST['choices'];
|
592 |
|
593 |
-
|
594 |
|
595 |
-
|
596 |
|
597 |
-
|
598 |
|
599 |
-
|
600 |
-
|
601 |
|
602 |
-
|
603 |
-
|
604 |
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
|
613 |
-
|
614 |
|
615 |
-
|
616 |
-
|
617 |
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
|
623 |
-
|
624 |
|
625 |
-
|
626 |
-
|
627 |
|
628 |
-
|
629 |
-
|
630 |
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
|
|
644 |
}
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
$this->parse_errors( $polldaddy );
|
651 |
|
652 |
-
|
653 |
-
|
654 |
|
655 |
-
|
656 |
-
|
657 |
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
|
673 |
-
|
674 |
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
|
689 |
-
|
690 |
-
|
691 |
|
692 |
-
|
693 |
|
694 |
-
|
695 |
-
|
696 |
|
697 |
-
|
698 |
-
|
699 |
|
700 |
-
|
701 |
|
702 |
-
|
703 |
|
704 |
-
|
705 |
-
|
706 |
|
707 |
-
|
708 |
-
|
709 |
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
|
720 |
-
|
721 |
-
|
722 |
|
723 |
-
|
724 |
|
725 |
-
|
726 |
-
|
727 |
|
728 |
-
|
729 |
-
|
730 |
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
|
737 |
-
|
738 |
-
|
739 |
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
|
|
|
|
|
|
747 |
return;
|
748 |
-
|
749 |
-
|
750 |
wp_redirect( add_query_arg( $query_args, wp_get_referer() ) );
|
751 |
exit;
|
752 |
}
|
@@ -862,15 +897,17 @@ class WP_PollDaddy {
|
|
862 |
}
|
863 |
|
864 |
function management_page() {
|
865 |
-
global $action, $poll, $style;
|
866 |
$poll = (int) $poll;
|
867 |
$style = (int) $style;
|
868 |
-
|
|
|
869 |
?>
|
870 |
|
871 |
<div class="wrap" id="manage-polls">
|
872 |
|
873 |
<?php
|
|
|
874 |
switch ( $action ) :
|
875 |
case 'signup' :
|
876 |
case 'account' :
|
@@ -952,6 +989,20 @@ class WP_PollDaddy {
|
|
952 |
<?php
|
953 |
$this->polls_table( isset( $_GET['view'] ) && 'user' == $_GET['view'] ? 'user' : 'blog' );
|
954 |
endswitch;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
955 |
?>
|
956 |
|
957 |
</div>
|
@@ -1078,7 +1129,7 @@ class WP_PollDaddy {
|
|
1078 |
<tr class="polldaddy-shortcode-row" style="display: none;">
|
1079 |
<td colspan="4">
|
1080 |
<h4><?php _e( 'Shortcode' ); ?></h4>
|
1081 |
-
<pre>[polldaddy poll=<?php echo (int) $poll_id; ?>]</pre>
|
1082 |
|
1083 |
<h4><?php _e( 'JavaScript' ); ?></h4>
|
1084 |
<pre><script type="text/javascript" language="javascript"
|
@@ -1212,7 +1263,7 @@ class WP_PollDaddy {
|
|
1212 |
<?php endforeach; ?>
|
1213 |
|
1214 |
</ul>
|
1215 |
-
<p
|
1216 |
</div>
|
1217 |
</div>
|
1218 |
</div>
|
@@ -1489,7 +1540,7 @@ class WP_PollDaddy {
|
|
1489 |
<div style="display:none;">
|
1490 |
<?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
|
1491 |
<input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style($('customSelect').value);" <?php echo $disabled; ?>></input>
|
1492 |
-
<label onclick="javascript:pd_change_style($('customSelect').value);"
|
1493 |
</div>
|
1494 |
</th>
|
1495 |
</tr>
|
@@ -1502,18 +1553,18 @@ class WP_PollDaddy {
|
|
1502 |
<td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
|
1503 |
<select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
|
1504 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
1505 |
-
<option value="x"<?php echo $selected;
|
1506 |
<?php foreach ( $styles->style as $style ) :
|
1507 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
1508 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
|
1509 |
<?php endforeach;?>
|
1510 |
</select>
|
1511 |
-
<div id="styleIDErr" class="formErr" style="display:none;"
|
1512 |
</tr>
|
1513 |
<tr>
|
1514 |
<td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
|
1515 |
<p><?php echo $extra ?></p>
|
1516 |
-
<p
|
1517 |
</td>
|
1518 |
</tr>
|
1519 |
</table>
|
@@ -1536,7 +1587,7 @@ class WP_PollDaddy {
|
|
1536 |
<input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
|
1537 |
</th>
|
1538 |
<th>
|
1539 |
-
<label for="skin" onclick="javascript:pd_build_styles( 0 );"
|
1540 |
</th>
|
1541 |
<th/>
|
1542 |
<th class="cb">
|
@@ -1544,7 +1595,7 @@ class WP_PollDaddy {
|
|
1544 |
<input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style($('customSelect').value);" <?php echo $disabled; ?>></input>
|
1545 |
</th>
|
1546 |
<th>
|
1547 |
-
<label onclick="javascript:pd_change_style($('customSelect').value);"
|
1548 |
</th>
|
1549 |
</tr>
|
1550 |
</thead>
|
@@ -1598,18 +1649,18 @@ class WP_PollDaddy {
|
|
1598 |
<td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
|
1599 |
<select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
|
1600 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
1601 |
-
<option value="x"<?php echo $selected;
|
1602 |
-
<?php if( $show_custom) : foreach ( $styles->style as $style ) :
|
1603 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
1604 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
|
1605 |
<?php endforeach; endif;?>
|
1606 |
</select>
|
1607 |
-
<div id="styleIDErr" class="formErr" style="display:none;"
|
1608 |
</tr>
|
1609 |
<tr>
|
1610 |
<td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
|
1611 |
<p><?php echo $extra ?></p>
|
1612 |
-
<p
|
1613 |
</td>
|
1614 |
</tr>
|
1615 |
</table>
|
@@ -1746,7 +1797,7 @@ class WP_PollDaddy {
|
|
1746 |
$class = '';
|
1747 |
$styles_exist = false;
|
1748 |
|
1749 |
-
foreach ( $styles as $style ) :
|
1750 |
if( (int) $style->_type == 1 ):
|
1751 |
$styles_exist = true;
|
1752 |
break;
|
@@ -1771,8 +1822,8 @@ class WP_PollDaddy {
|
|
1771 |
<thead>
|
1772 |
<tr>
|
1773 |
<th id="cb" class="manage-column column-cb check-column" scope="col" /><input type="checkbox" /></th>
|
1774 |
-
<th id="title" class="manage-column column-title" scope="col"
|
1775 |
-
<th id="date" class="manage-column column-date" scope="col"
|
1776 |
</tr>
|
1777 |
</thead>
|
1778 |
<tbody>
|
@@ -1844,9 +1895,8 @@ class WP_PollDaddy {
|
|
1844 |
|
1845 |
$style->css = trim( urldecode( $style->css ) );
|
1846 |
|
1847 |
-
if ( $start = stripos( $style->css, '<data>' ) )
|
1848 |
$style->css = substr( $style->css, $start );
|
1849 |
-
}
|
1850 |
|
1851 |
$style->css = addslashes( $style->css );
|
1852 |
|
@@ -1858,9 +1908,7 @@ class WP_PollDaddy {
|
|
1858 |
$preload_style_id = (int) $_REQUEST['preload'];
|
1859 |
|
1860 |
if ( $preload_style_id > 1000 || $preload_style_id < 100 )
|
1861 |
-
{
|
1862 |
$preload_style_id = 0;
|
1863 |
-
}
|
1864 |
|
1865 |
if ( $preload_style_id > 0 ) {
|
1866 |
$polldaddy->reset();
|
@@ -1870,9 +1918,8 @@ class WP_PollDaddy {
|
|
1870 |
|
1871 |
$preload_style->css = trim( urldecode( $preload_style->css ) );
|
1872 |
|
1873 |
-
if ( $start = stripos( $preload_style->css, '<data>' ) )
|
1874 |
$preload_style->css = substr( $preload_style->css, $start );
|
1875 |
-
}
|
1876 |
|
1877 |
$style->css = addslashes( $preload_style->css );
|
1878 |
}
|
@@ -2740,6 +2787,859 @@ enter a numeric value in pixels.
|
|
2740 |
|
2741 |
<?php
|
2742 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2743 |
|
2744 |
function signup() {
|
2745 |
return $this->api_key_page();
|
@@ -2765,6 +3665,8 @@ function polldaddy_loader() {
|
|
2765 |
}
|
2766 |
|
2767 |
add_action( 'init', 'polldaddy_loader' );
|
|
|
|
|
2768 |
|
2769 |
function polldaddy_shortcode($atts, $content=null) {
|
2770 |
extract(shortcode_atts(array(
|
@@ -2778,4 +3680,109 @@ function polldaddy_shortcode($atts, $content=null) {
|
|
2778 |
return "<script type='text/javascript' language='javascript' charset='utf-8' src='http://s3.polldaddy.com/p/$poll.js$cb'></script><noscript> <a href='http://answers.polldaddy.com/poll/$poll/'>View Poll</a></noscript>";
|
2779 |
}
|
2780 |
|
2781 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Description: Create and manage PollDaddy polls in WordPress
|
6 |
Author: Automattic, Inc.
|
7 |
Author URL: http://automattic.com/
|
8 |
+
Version: 1.7.6
|
9 |
*/
|
10 |
|
11 |
// You can hardcode your PollDaddy PartnerGUID (API Key) here
|
24 |
var $base_url = false;
|
25 |
var $use_ssl = 0;
|
26 |
var $scheme = 'https';
|
27 |
+
var $version = '1.7.6';
|
28 |
|
29 |
var $polldaddy_clients = array();
|
30 |
|
64 |
if ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] )
|
65 |
add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "You need to <a href=\"%s\">input your PollDaddy.com account details</a>.", "edit.php?page=polls" ) . "</p></div>";' ) );
|
66 |
return false;
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
70 |
+
$hook = add_object_page( __( 'Ratings' ), __( 'Ratings' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
|
71 |
+
else
|
72 |
+
$hook = add_management_page( __( 'Ratings' ), __( 'Ratings' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
|
73 |
+
|
74 |
+
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
75 |
|
76 |
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
77 |
$hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
|
78 |
else
|
79 |
$hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
|
80 |
+
|
81 |
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
82 |
+
|
83 |
+
add_submenu_page( 'ratings', __( 'Ratings – Settings' ), __( 'Settings' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
|
84 |
+
add_submenu_page( 'ratings', __( 'Ratings – Reports' ), __( 'Reports' ), 'edit_posts', 'ratings&action=reports', array( &$this, 'management_page' ) );
|
85 |
+
|
86 |
+
add_submenu_page( 'polls', __( 'Polls' ), __( 'Edit' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
|
87 |
add_submenu_page( 'polls', __( 'Add New Poll' ), __( 'Add New' ), 'edit_posts', 'polls&action=create-poll', array( &$this, 'management_page' ) );
|
88 |
add_submenu_page( 'polls', __( 'Custom Styles' ), __( 'Custom Styles' ), 'edit_posts', 'polls&action=list-styles', array( &$this, 'management_page' ) );
|
89 |
|
254 |
<tbody>
|
255 |
<tr class="form-field form-required">
|
256 |
<th valign="top" scope="row">
|
257 |
+
<label for="polldaddy-email"><?php _e( 'PollDaddy Email Address' ); ?></label>
|
258 |
</th>
|
259 |
<td>
|
260 |
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" value="<?php if ( isset( $_POST['polldaddy_email'] ) ) echo attribute_escape( $_POST['polldaddy_email'] ); ?>" />
|
262 |
</tr>
|
263 |
<tr class="form-field form-required">
|
264 |
<th valign="top" scope="row">
|
265 |
+
<label for="polldaddy-password"><?php _e( 'PollDaddy Password' ); ?></label>
|
266 |
</th>
|
267 |
<td>
|
268 |
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
275 |
?>
|
276 |
<tr class="form-field form-required">
|
277 |
<th valign="top" scope="row">
|
278 |
+
<label for="polldaddy-use-ssl"><?php _e( 'Use SSL to Log in' ); ?></label>
|
279 |
</th>
|
280 |
<td>
|
281 |
<input type="checkbox" name="polldaddy_use_ssl" id="polldaddy-use-ssl" value="1" <?php echo $checked ?> style="width: auto"/>
|
282 |
+
<label for="polldaddy-use-ssl"><?php _e( 'This ensures a secure login to your PollDaddy account. Only uncheck if you are having problems logging in.' ); ?></label>
|
283 |
<input type="hidden" name="polldaddy_use_ssl_checkbox" value="1" />
|
284 |
</td>
|
285 |
</tr>
|
303 |
}
|
304 |
|
305 |
function management_page_load() {
|
306 |
+
global $current_user, $plugin_page;
|
307 |
|
308 |
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
309 |
$polldaddy->reset();
|
311 |
if ( !defined( 'WP_POLLDADDY__USERCODE' ) )
|
312 |
define( 'WP_POLLDADDY__USERCODE', $polldaddy->get_usercode( $current_user->ID ) );
|
313 |
|
314 |
+
wp_reset_vars( array( 'page', 'action', 'poll', 'style', 'rating' ) );
|
315 |
+
global $page, $action, $poll, $style, $rating;
|
316 |
|
317 |
if ( !WP_POLLDADDY__USERCODE )
|
318 |
$action = 'signup';
|
322 |
wp_enqueue_script( 'polls', "{$this->base_url}polldaddy.js", array( 'jquery', 'jquery-ui-sortable' ), $this->version );
|
323 |
wp_enqueue_script( 'polls-common', "{$this->base_url}common.js", array(), $this->version );
|
324 |
|
325 |
+
if( $page == 'polls' ) {
|
326 |
+
switch ( $action ) :
|
327 |
+
case 'edit' :
|
328 |
+
case 'edit-poll' :
|
329 |
+
case 'create-poll' :
|
330 |
+
wp_enqueue_script( 'polls-style', "http://i.polldaddy.com/js/poll-style-picker.js", array(), $this->version );
|
331 |
+
|
332 |
+
if ( $action == 'create-poll' )
|
333 |
+
$plugin_page = 'polls&action=create-poll';
|
334 |
+
|
335 |
+
break;
|
336 |
+
case 'edit-style' :
|
337 |
+
case 'create-style' :
|
338 |
+
wp_enqueue_script( 'polls-style', "http://i.polldaddy.com/js/style-editor.js", array(), $this->version );
|
339 |
+
wp_enqueue_script( 'polls-style-color', "http://i.polldaddy.com/js/jscolor.js", array(), $this->version );
|
340 |
+
wp_enqueue_style( 'polls', "{$this->base_url}style-editor.css", array(), $this->version );
|
341 |
+
break;
|
342 |
+
case 'list-styles' :
|
343 |
+
$plugin_page = 'polls&action=list-styles';
|
344 |
+
break;
|
345 |
+
endswitch;
|
346 |
+
} elseif( $page == 'ratings' ) {
|
347 |
+
switch ( $action ) :
|
348 |
+
case 'reports' :
|
349 |
+
$plugin_page = 'ratings&action=reports';
|
350 |
+
break;
|
351 |
+
default :
|
352 |
+
wp_enqueue_script( 'rating-text-color', "http://i.polldaddy.com/js/jscolor.js", array(), $this->version );
|
353 |
+
wp_enqueue_script( 'ratings', 'http://i.polldaddy.com/ratings/rating.js', array(), $this->version );
|
354 |
+
wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
|
355 |
+
'star_colors' => __( 'Star Colors' ), 'star_size' => __( 'Star Size' ),
|
356 |
+
'nero_type' => __( 'Nero Type' ), 'nero_size' => __( 'Nero Size' ), ) );
|
357 |
+
endswitch;
|
358 |
+
}
|
359 |
|
360 |
wp_enqueue_script( 'admin-forms' );
|
361 |
add_thickbox();
|
402 |
|
403 |
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
404 |
|
405 |
+
if( $page == 'polls' ) {
|
406 |
+
switch ( $action ) :
|
407 |
+
case 'signup' : // sign up for first time
|
408 |
+
case 'account' : // reauthenticate
|
409 |
+
if ( !$is_POST )
|
410 |
+
return;
|
411 |
|
412 |
+
check_admin_referer( 'polldaddy-account' );
|
413 |
|
414 |
+
if ( $new_args = $this->management_page_load_signup() )
|
415 |
+
$query_args = array_merge( $query_args, $new_args );
|
416 |
+
if ( $this->errors->get_error_codes() )
|
417 |
+
return false;
|
418 |
|
419 |
+
wp_reset_vars( array( 'action' ) );
|
420 |
+
if ( !empty( $_GET['reaction'] ) )
|
421 |
+
$query_args['action'] = $_GET['reaction'];
|
422 |
+
elseif ( !empty( $_GET['action'] ) && 'signup' != $_GET['action'] )
|
423 |
+
$query_args['action'] = $_GET['action'];
|
424 |
+
else
|
425 |
+
$query_args['action'] = false;
|
426 |
+
break;
|
427 |
+
case 'delete' :
|
428 |
+
if ( empty( $poll ) )
|
429 |
+
return;
|
430 |
|
431 |
+
if ( is_array( $poll ) )
|
432 |
+
check_admin_referer( 'delete-poll_bulk' );
|
433 |
+
else
|
434 |
+
check_admin_referer( "delete-poll_$poll" );
|
435 |
|
436 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
437 |
|
438 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
439 |
+
$polldaddy->reset();
|
440 |
+
$poll_object = $polldaddy->get_poll( $poll );
|
441 |
|
442 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
443 |
+
$this->errors->add( 'permission', __( 'You are not allowed to delete this poll.' ) );
|
444 |
+
return false;
|
445 |
+
}
|
446 |
|
447 |
+
// Send Poll Author credentials
|
448 |
+
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
449 |
+
$polldaddy->reset();
|
450 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
451 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
452 |
+
}
|
453 |
+
$polldaddy->userCode = $userCode;
|
454 |
}
|
455 |
+
|
456 |
+
$polldaddy->reset();
|
457 |
+
$polldaddy->delete_poll( $poll_id );
|
458 |
}
|
459 |
|
460 |
+
$query_args['message'] = 'deleted';
|
461 |
+
$query_args['deleted'] = count( (array) $poll );
|
462 |
+
break;
|
463 |
+
case 'open' :
|
464 |
+
if ( empty( $poll ) )
|
465 |
+
return;
|
466 |
|
467 |
+
if ( is_array( $poll ) )
|
468 |
+
check_admin_referer( 'action-poll_bulk' );
|
469 |
+
else
|
470 |
+
check_admin_referer( "open-poll_$poll" );
|
|
|
|
|
471 |
|
472 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
|
|
|
|
|
|
473 |
|
474 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
475 |
+
$polldaddy->reset();
|
476 |
+
$poll_object = $polldaddy->get_poll( $poll );
|
477 |
|
478 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
479 |
+
$this->errors->add( 'permission', __( 'You are not allowed to delete this poll.' ) );
|
480 |
+
return false;
|
481 |
+
}
|
482 |
|
483 |
+
// Send Poll Author credentials
|
484 |
+
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
485 |
+
$polldaddy->reset();
|
486 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
487 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
488 |
+
}
|
489 |
+
$polldaddy->userCode = $userCode;
|
490 |
+
}
|
491 |
+
|
492 |
+
$polldaddy->reset();
|
493 |
+
$polldaddy->open_poll( $poll_id );
|
494 |
}
|
495 |
|
496 |
+
$query_args['message'] = 'opened';
|
497 |
+
$query_args['opened'] = count( (array) $poll );
|
498 |
+
break;
|
499 |
+
case 'close' :
|
500 |
+
if ( empty( $poll ) )
|
501 |
+
return;
|
502 |
+
|
503 |
+
if ( is_array( $poll ) )
|
504 |
+
check_admin_referer( 'action-poll_bulk' );
|
505 |
+
else
|
506 |
+
check_admin_referer( "close-poll_$poll" );
|
507 |
+
|
508 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
509 |
+
|
510 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
511 |
$polldaddy->reset();
|
512 |
+
$poll_object = $polldaddy->get_poll( $poll );
|
513 |
+
|
514 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
515 |
+
$this->errors->add( 'permission', __( 'You are not allowed to delete this poll.' ) );
|
516 |
+
return false;
|
517 |
}
|
|
|
|
|
518 |
|
519 |
+
// Send Poll Author credentials
|
520 |
+
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
521 |
+
$polldaddy->reset();
|
522 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
523 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
524 |
+
}
|
525 |
+
$polldaddy->userCode = $userCode;
|
526 |
+
}
|
527 |
|
528 |
+
$polldaddy->reset();
|
529 |
+
$polldaddy->close_poll( $poll_id );
|
530 |
+
}
|
|
|
|
|
|
|
531 |
|
532 |
+
$query_args['message'] = 'closed';
|
533 |
+
$query_args['closed'] = count( (array) $poll );
|
534 |
+
break;
|
535 |
+
case 'edit-poll' : // TODO: use polldaddy_poll
|
536 |
+
if ( !$is_POST || !$poll = (int) $poll )
|
537 |
+
return;
|
538 |
|
539 |
+
check_admin_referer( "edit-poll_$poll" );
|
540 |
|
541 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
542 |
$polldaddy->reset();
|
543 |
+
|
544 |
$poll_object = $polldaddy->get_poll( $poll );
|
545 |
+
$this->parse_errors( $polldaddy );
|
546 |
|
547 |
if ( !$this->can_edit( $poll_object ) ) {
|
548 |
+
$this->errors->add( 'permission', __( 'You are not allowed to edit this poll.' ) );
|
549 |
return false;
|
550 |
}
|
551 |
|
552 |
// Send Poll Author credentials
|
553 |
+
|
554 |
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
555 |
$polldaddy->reset();
|
556 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
557 |
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
558 |
}
|
559 |
+
$this->parse_errors( $polldaddy );
|
560 |
$polldaddy->userCode = $userCode;
|
561 |
}
|
562 |
|
563 |
+
if ( !$poll_object )
|
564 |
+
$this->errors->add( 'GetPoll', __( 'Poll not found' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
|
566 |
+
if ( $this->errors->get_error_codes() )
|
567 |
+
return false;
|
568 |
|
569 |
+
$poll_data = get_object_vars( $poll_object );
|
570 |
+
foreach ( $poll_data as $key => $value )
|
571 |
+
if ( '_' === $key[0] )
|
572 |
+
unset( $poll_data[$key] );
|
573 |
|
574 |
+
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
575 |
+
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
576 |
+
$poll_data[$option] = 'yes';
|
577 |
+
else
|
578 |
+
$poll_data[$option] = 'no';
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
}
|
|
|
|
|
|
|
580 |
|
581 |
+
$blocks = array( 'off', 'cookie', 'cookieip' );
|
582 |
+
if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
|
583 |
+
$poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
584 |
|
585 |
+
$results = array( 'show', 'percent', 'hide' );
|
586 |
+
if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
|
587 |
+
$poll_data['resultsType'] = $_POST['resultsType'];
|
588 |
+
$poll_data['question'] = stripslashes( $_POST['question'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
|
590 |
+
if ( empty( $_POST['answer'] ) || !is_array( $_POST['answer'] ) )
|
591 |
+
$this->errors->add( 'answer', __( 'Invalid answers' ) );
|
|
|
592 |
|
593 |
+
$answers = array();
|
594 |
+
foreach ( $_POST['answer'] as $answer_id => $answer ) {
|
595 |
+
if ( !$answer = trim( stripslashes( $answer ) ) )
|
596 |
+
continue;
|
597 |
+
|
598 |
+
$args['text'] = wp_kses( $answer, $allowedtags );
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
|
600 |
+
if ( is_numeric( $answer_id ) )
|
601 |
+
$answers[] = polldaddy_poll_answer( $args, $answer_id );
|
602 |
+
else
|
603 |
+
$answers[] = polldaddy_poll_answer( $args );
|
604 |
+
}
|
|
|
|
|
|
|
|
|
|
|
605 |
|
606 |
+
if ( 2 > count( $answers ) )
|
607 |
+
$this->errors->add( 'answer', __( 'You must include at least 2 answers' ) );
|
608 |
|
609 |
+
if ( $this->errors->get_error_codes() )
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
return false;
|
611 |
+
|
612 |
+
$poll_data['answers'] = $answers;
|
613 |
+
|
614 |
+
$poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
|
615 |
+
|
616 |
+
if ( isset ( $_POST['styleID'] ) ){
|
617 |
+
if ( $_POST['styleID'] == 'x' ){
|
618 |
+
$this->errors->add( 'UpdatePoll', __( 'Please choose a poll style' ) );
|
619 |
+
return false;
|
620 |
+
}
|
621 |
}
|
622 |
+
$poll_data['styleID'] = (int) $_POST['styleID'];
|
623 |
+
$poll_data['choices'] = (int) $_POST['choices'];
|
|
|
624 |
|
625 |
+
$polldaddy->reset();
|
626 |
|
627 |
+
$update_response = $polldaddy->update_poll( $poll, $poll_data );
|
628 |
|
629 |
+
$this->parse_errors( $polldaddy );
|
630 |
|
631 |
+
if ( !$update_response )
|
632 |
+
$this->errors->add( 'UpdatePoll', __( 'Poll could not be updated' ) );
|
633 |
|
634 |
+
if ( $this->errors->get_error_codes() )
|
635 |
+
return false;
|
636 |
|
637 |
+
$query_args['message'] = 'updated';
|
638 |
+
if ( isset($_POST['iframe']) )
|
639 |
+
$query_args['iframe'] = '';
|
640 |
+
break;
|
641 |
+
case 'create-poll' :
|
642 |
+
if ( !$is_POST )
|
643 |
+
return;
|
644 |
|
645 |
+
check_admin_referer( 'create-poll' );
|
646 |
|
647 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
648 |
+
$polldaddy->reset();
|
649 |
|
650 |
+
$answers = array();
|
651 |
+
foreach ( $_POST['answer'] as $answer ){
|
652 |
+
if ( !$answer = trim( stripslashes( $answer ) ) )
|
653 |
+
continue;
|
654 |
|
655 |
+
$args['text'] = wp_kses( $answer, $allowedtags );
|
656 |
|
657 |
+
$answers[] = polldaddy_poll_answer( $args );
|
658 |
+
}
|
659 |
|
660 |
+
if ( !$answers )
|
661 |
+
return false;
|
662 |
|
663 |
+
$poll_data = _polldaddy_poll_defaults();
|
664 |
+
foreach ( $poll_data as $key => $value )
|
665 |
+
if ( isset($_POST[$key]) )
|
666 |
+
$poll_data[$key] = stripslashes( $_POST[$key] );
|
667 |
|
668 |
+
$poll_data['answers'] = $answers;
|
669 |
+
|
670 |
+
$poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
|
671 |
+
|
672 |
+
if ( isset ( $_POST['styleID'] ) ){
|
673 |
+
if ( $_POST['styleID'] == 'x' ){
|
674 |
+
$this->errors->add( 'UpdatePoll', __( 'Please choose a poll style' ) );
|
675 |
+
return false;
|
676 |
+
}
|
677 |
}
|
678 |
+
$poll_data['styleID'] = (int) $_POST['styleID'];
|
679 |
+
$poll_data['choices'] = (int) $_POST['choices'];
|
680 |
+
|
681 |
+
$poll = $polldaddy->create_poll( $poll_data );
|
682 |
+
$this->parse_errors( $polldaddy );
|
|
|
683 |
|
684 |
+
if ( !$poll || empty( $poll->_id ) )
|
685 |
+
$this->errors->add( 'CreatePoll', __( 'Poll could not be created' ) );
|
686 |
|
687 |
+
if ( $this->errors->get_error_codes() )
|
688 |
+
return false;
|
689 |
|
690 |
+
$query_args['message'] = 'created';
|
691 |
+
$query_args['action'] = 'edit-poll';
|
692 |
+
$query_args['poll'] = $poll->_id;
|
693 |
+
if ( isset($_POST['iframe']) )
|
694 |
+
$query_args['iframe'] = '';
|
695 |
+
break;
|
696 |
+
case 'delete-style' :
|
697 |
+
if ( empty( $style ) )
|
698 |
+
return;
|
699 |
|
700 |
+
if ( is_array( $style ) )
|
701 |
+
check_admin_referer( 'action-style_bulk' );
|
702 |
+
else
|
703 |
+
check_admin_referer( "delete-style_$style" );
|
704 |
|
705 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
706 |
|
707 |
+
foreach ( (array) $_REQUEST['style'] as $style_id ) {
|
708 |
+
$polldaddy->reset();
|
709 |
+
$polldaddy->delete_style( $style_id );
|
710 |
+
}
|
711 |
|
712 |
+
$query_args['message'] = 'deleted-style';
|
713 |
+
$query_args['deleted'] = count( (array) $style );
|
714 |
+
break;
|
715 |
+
case 'edit-style' :
|
716 |
+
if ( !$is_POST || !$style = (int) $style )
|
717 |
+
return;
|
718 |
+
|
719 |
+
check_admin_referer( "edit-style$style" );
|
720 |
|
721 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
722 |
+
$polldaddy->reset();
|
723 |
|
724 |
+
$style_data = _polldaddy_style_defaults();
|
725 |
|
726 |
+
if ( isset($_POST['style-title'] ) )
|
727 |
+
$style_data['title'] = stripslashes( trim ( (string) $_POST['style-title'] ) );
|
728 |
|
729 |
+
if ( isset($_POST['CSSXML'] ) )
|
730 |
+
$style_data['css'] = urlencode( stripslashes( trim ( (string) $_POST['CSSXML'] ) ) );
|
731 |
|
732 |
+
$update_response = $polldaddy->update_style( $style, $style_data );
|
733 |
|
734 |
+
$this->parse_errors( $polldaddy );
|
735 |
|
736 |
+
if ( !$update_response )
|
737 |
+
$this->errors->add( 'UpdateStyle', __( 'Style could not be updated' ) );
|
738 |
|
739 |
+
if ( $this->errors->get_error_codes() )
|
740 |
+
return false;
|
741 |
|
742 |
+
$query_args['message'] = 'updated-style';
|
743 |
+
if ( isset($_POST['iframe']) )
|
744 |
+
$query_args['iframe'] = '';
|
745 |
+
break;
|
746 |
+
case 'create-style' :
|
747 |
+
if ( !$is_POST )
|
748 |
+
return;
|
749 |
+
|
750 |
+
check_admin_referer( 'create-style' );
|
751 |
|
752 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
753 |
+
$polldaddy->reset();
|
754 |
|
755 |
+
$style_data = _polldaddy_style_defaults();
|
756 |
|
757 |
+
if ( isset($_POST['style-title'] ) )
|
758 |
+
$style_data['title'] = stripslashes( strip_tags( trim ( (string) $_POST['style-title'] ) ) );
|
759 |
|
760 |
+
if ( isset($_POST['CSSXML'] ) )
|
761 |
+
$style_data['css'] = urlencode( stripslashes( trim ( (string) $_POST['CSSXML'] ) ) );
|
762 |
|
763 |
+
$style = $polldaddy->create_style( $style_data );
|
764 |
+
$this->parse_errors( $polldaddy );
|
765 |
+
|
766 |
+
if ( !$style || empty( $style->_id ) )
|
767 |
+
$this->errors->add( 'CreateStyle', __( 'Style could not be created' ) );
|
768 |
|
769 |
+
if ( $this->errors->get_error_codes() )
|
770 |
+
return false;
|
771 |
|
772 |
+
$query_args['message'] = 'created-style';
|
773 |
+
$query_args['action'] = 'edit-style';
|
774 |
+
$query_args['style'] = $style->_id;
|
775 |
+
if ( isset($_POST['iframe']) )
|
776 |
+
$query_args['iframe'] = '';
|
777 |
+
break;
|
778 |
+
default :
|
779 |
+
return;
|
780 |
+
endswitch;
|
781 |
+
} elseif( $page == 'ratings' ) {
|
782 |
return;
|
783 |
+
}
|
784 |
+
|
785 |
wp_redirect( add_query_arg( $query_args, wp_get_referer() ) );
|
786 |
exit;
|
787 |
}
|
897 |
}
|
898 |
|
899 |
function management_page() {
|
900 |
+
global $page, $action, $poll, $style, $rating;
|
901 |
$poll = (int) $poll;
|
902 |
$style = (int) $style;
|
903 |
+
$rating = wp_specialchars( $rating );
|
904 |
+
|
905 |
?>
|
906 |
|
907 |
<div class="wrap" id="manage-polls">
|
908 |
|
909 |
<?php
|
910 |
+
if( $page == 'polls' ) {
|
911 |
switch ( $action ) :
|
912 |
case 'signup' :
|
913 |
case 'account' :
|
989 |
<?php
|
990 |
$this->polls_table( isset( $_GET['view'] ) && 'user' == $_GET['view'] ? 'user' : 'blog' );
|
991 |
endswitch;
|
992 |
+
} elseif( $page == 'ratings' ) {
|
993 |
+
switch ( $action ) :
|
994 |
+
case 'change-report' :
|
995 |
+
case 'reports' :
|
996 |
+
$this->rating_reports();
|
997 |
+
break;
|
998 |
+
case 'update-rating' :
|
999 |
+
$this->update_rating();
|
1000 |
+
$this->rating_settings( true );
|
1001 |
+
break;
|
1002 |
+
default :
|
1003 |
+
$this->rating_settings();
|
1004 |
+
endswitch;
|
1005 |
+
}
|
1006 |
?>
|
1007 |
|
1008 |
</div>
|
1129 |
<tr class="polldaddy-shortcode-row" style="display: none;">
|
1130 |
<td colspan="4">
|
1131 |
<h4><?php _e( 'Shortcode' ); ?></h4>
|
1132 |
+
<pre>[polldaddy poll=<?php echo (int) $poll_id; ?>]</pre>
|
1133 |
|
1134 |
<h4><?php _e( 'JavaScript' ); ?></h4>
|
1135 |
<pre><script type="text/javascript" language="javascript"
|
1263 |
<?php endforeach; ?>
|
1264 |
|
1265 |
</ul>
|
1266 |
+
<p><?php _e( 'Note: Blocking by cookie and IP address can be problematic for some voters.'); ?></p>
|
1267 |
</div>
|
1268 |
</div>
|
1269 |
</div>
|
1540 |
<div style="display:none;">
|
1541 |
<?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
|
1542 |
<input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style($('customSelect').value);" <?php echo $disabled; ?>></input>
|
1543 |
+
<label onclick="javascript:pd_change_style($('customSelect').value);"><?php _e( 'Custom Style' ); ?></label>
|
1544 |
</div>
|
1545 |
</th>
|
1546 |
</tr>
|
1553 |
<td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
|
1554 |
<select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
|
1555 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
1556 |
+
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style...' ); ?></option>
|
1557 |
<?php foreach ( $styles->style as $style ) :
|
1558 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
1559 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
|
1560 |
<?php endforeach;?>
|
1561 |
</select>
|
1562 |
+
<div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.' ); ?></div></td>
|
1563 |
</tr>
|
1564 |
<tr>
|
1565 |
<td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
|
1566 |
<p><?php echo $extra ?></p>
|
1567 |
+
<p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
|
1568 |
</td>
|
1569 |
</tr>
|
1570 |
</table>
|
1587 |
<input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
|
1588 |
</th>
|
1589 |
<th>
|
1590 |
+
<label for="skin" onclick="javascript:pd_build_styles( 0 );"><?php _e( 'PollDaddy Style' ); ?></label>
|
1591 |
</th>
|
1592 |
<th/>
|
1593 |
<th class="cb">
|
1595 |
<input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style($('customSelect').value);" <?php echo $disabled; ?>></input>
|
1596 |
</th>
|
1597 |
<th>
|
1598 |
+
<label onclick="javascript:pd_change_style($('customSelect').value);"><?php _e( 'Custom Style' ); ?></label>
|
1599 |
</th>
|
1600 |
</tr>
|
1601 |
</thead>
|
1649 |
<td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
|
1650 |
<select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
|
1651 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
1652 |
+
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style...'); ?></option>
|
1653 |
+
<?php if( $show_custom) : foreach ( (array)$styles->style as $style ) :
|
1654 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
1655 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
|
1656 |
<?php endforeach; endif;?>
|
1657 |
</select>
|
1658 |
+
<div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.'); ?></div></td>
|
1659 |
</tr>
|
1660 |
<tr>
|
1661 |
<td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
|
1662 |
<p><?php echo $extra ?></p>
|
1663 |
+
<p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
|
1664 |
</td>
|
1665 |
</tr>
|
1666 |
</table>
|
1797 |
$class = '';
|
1798 |
$styles_exist = false;
|
1799 |
|
1800 |
+
foreach ( (array)$styles as $style ) :
|
1801 |
if( (int) $style->_type == 1 ):
|
1802 |
$styles_exist = true;
|
1803 |
break;
|
1822 |
<thead>
|
1823 |
<tr>
|
1824 |
<th id="cb" class="manage-column column-cb check-column" scope="col" /><input type="checkbox" /></th>
|
1825 |
+
<th id="title" class="manage-column column-title" scope="col"><?php _e( 'Style' ); ?></th>
|
1826 |
+
<th id="date" class="manage-column column-date" scope="col"><?php _e( 'Last Modified' ); ?></th>
|
1827 |
</tr>
|
1828 |
</thead>
|
1829 |
<tbody>
|
1895 |
|
1896 |
$style->css = trim( urldecode( $style->css ) );
|
1897 |
|
1898 |
+
if ( $start = stripos( $style->css, '<data>' ) )
|
1899 |
$style->css = substr( $style->css, $start );
|
|
|
1900 |
|
1901 |
$style->css = addslashes( $style->css );
|
1902 |
|
1908 |
$preload_style_id = (int) $_REQUEST['preload'];
|
1909 |
|
1910 |
if ( $preload_style_id > 1000 || $preload_style_id < 100 )
|
|
|
1911 |
$preload_style_id = 0;
|
|
|
1912 |
|
1913 |
if ( $preload_style_id > 0 ) {
|
1914 |
$polldaddy->reset();
|
1918 |
|
1919 |
$preload_style->css = trim( urldecode( $preload_style->css ) );
|
1920 |
|
1921 |
+
if ( $start = stripos( $preload_style->css, '<data>' ) )
|
1922 |
$preload_style->css = substr( $preload_style->css, $start );
|
|
|
1923 |
|
1924 |
$style->css = addslashes( $preload_style->css );
|
1925 |
}
|
2787 |
|
2788 |
<?php
|
2789 |
}
|
2790 |
+
|
2791 |
+
function rating_settings( $rating_updated = false ){
|
2792 |
+
global $rating;
|
2793 |
+
$show_pages = 0;
|
2794 |
+
$show_comments = 0;
|
2795 |
+
$pos_posts = 0;
|
2796 |
+
$pos_pages = 0;
|
2797 |
+
$pos_comments = 0;
|
2798 |
+
$show_settings = $rating_updated;
|
2799 |
+
$error = false;
|
2800 |
+
|
2801 |
+
$settings_style = 'display: none;';
|
2802 |
+
if( $show_settings )
|
2803 |
+
$settings_style = 'display: block;';
|
2804 |
+
|
2805 |
+
if ( isset( $_POST[ 'pd_rating_action_type' ] ) ){
|
2806 |
+
|
2807 |
+
switch ( $_POST[ 'pd_rating_action_type' ] ) :
|
2808 |
+
|
2809 |
+
case 'posts' :
|
2810 |
+
if ( isset( $_POST[ 'pd_show_posts' ] ) && (int) $_POST[ 'pd_show_posts' ] == 1 )
|
2811 |
+
$show_posts = get_option( 'pd-rating-posts-id' );
|
2812 |
+
|
2813 |
+
update_option( 'pd-rating-posts', $show_posts );
|
2814 |
+
|
2815 |
+
if ( isset( $_POST[ 'posts_pos' ] ) && (int) $_POST[ 'posts_pos' ] == 1 )
|
2816 |
+
$pos_posts = 1;
|
2817 |
+
|
2818 |
+
update_option( 'pd-rating-posts-pos', $pos_posts );
|
2819 |
+
$rating_updated = true;
|
2820 |
+
break;
|
2821 |
+
|
2822 |
+
case 'pages';
|
2823 |
+
if ( isset( $_POST[ 'pd_show_pages' ] ) && (int) $_POST[ 'pd_show_pages' ] == 1 )
|
2824 |
+
$show_pages = get_option( 'pd-rating-pages-id' );
|
2825 |
+
|
2826 |
+
update_option( 'pd-rating-pages', $show_pages );
|
2827 |
+
|
2828 |
+
if ( isset( $_POST[ 'pages_pos' ] ) && (int) $_POST[ 'pages_pos' ] == 1 )
|
2829 |
+
$pos_pages = 1;
|
2830 |
+
|
2831 |
+
update_option( 'pd-rating-pages-pos', $pos_pages );
|
2832 |
+
$rating_updated = true;
|
2833 |
+
break;
|
2834 |
+
|
2835 |
+
case 'comments':
|
2836 |
+
if ( isset( $_POST[ 'pd_show_comments' ] ) && (int) $_POST[ 'pd_show_comments' ] == 1 )
|
2837 |
+
$show_comments = get_option( 'pd-rating-comments-id' );
|
2838 |
+
|
2839 |
+
update_option( 'pd-rating-comments', $show_comments );
|
2840 |
+
if ( isset( $_POST[ 'comments_pos' ] ) && (int) $_POST[ 'comments_pos' ] == 1 )
|
2841 |
+
$pos_comments = 1;
|
2842 |
+
|
2843 |
+
update_option( 'pd-rating-comments-pos', $pos_comments );
|
2844 |
+
|
2845 |
+
$rating_updated = true;
|
2846 |
+
break;
|
2847 |
+
endswitch;
|
2848 |
+
}
|
2849 |
+
|
2850 |
+
$show_posts = (int) get_option( 'pd-rating-posts' );
|
2851 |
+
$show_pages = (int) get_option( 'pd-rating-pages' );
|
2852 |
+
$show_comments = (int) get_option( 'pd-rating-comments' );
|
2853 |
+
|
2854 |
+
$pos_posts = (int) get_option( 'pd-rating-posts-pos' );
|
2855 |
+
$pos_pages = (int) get_option( 'pd-rating-pages-pos' );
|
2856 |
+
$pos_comments = (int) get_option( 'pd-rating-comments-pos' );
|
2857 |
+
|
2858 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
2859 |
+
$report_type = 'posts';
|
2860 |
+
$updated = false;
|
2861 |
+
|
2862 |
+
if ( isset( $rating ) ) {
|
2863 |
+
switch ( $rating ) :
|
2864 |
+
case 'pages':
|
2865 |
+
$report_type = 'pages';
|
2866 |
+
$rating_id = get_option( 'pd-rating-pages-id' );
|
2867 |
+
break;
|
2868 |
+
|
2869 |
+
case 'comments':
|
2870 |
+
$report_type = 'comments';
|
2871 |
+
$rating_id = get_option( 'pd-rating-comments-id' );
|
2872 |
+
break;
|
2873 |
+
|
2874 |
+
case 'posts':
|
2875 |
+
$report_type = 'posts';
|
2876 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
2877 |
+
break;
|
2878 |
+
endswitch;
|
2879 |
+
}
|
2880 |
+
|
2881 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
2882 |
+
$polldaddy->reset();
|
2883 |
+
$response = $polldaddy->get_rating( $rating_id );
|
2884 |
+
if ( is_object( $response ) && (int) $response->_id == 0 ) {
|
2885 |
+
$polldaddy->reset();
|
2886 |
+
$new_type = 0;
|
2887 |
+
if ( $report_type == 'comments' )
|
2888 |
+
$new_type = 1;
|
2889 |
+
|
2890 |
+
$response = $polldaddy->create_rating( 'WPCOM ' . $report_type, $new_type );
|
2891 |
+
|
2892 |
+
if( $response == false ) {
|
2893 |
+
echo '<div class="error"><p>'.sprintf(__('Sorry! There was an error creating your rating widget. Please contact <a href="%1$s" %2$s>PollDaddy support</a> to fix this.'), 'http://polldaddy.com/feedback/', 'target="_blank"') . '</p></div>';
|
2894 |
+
$error = true;
|
2895 |
+
} else {
|
2896 |
+
$rating_id = (int) $response->_id;
|
2897 |
+
update_option ( 'pd-rating-' . $report_type . '-id', $rating_id );
|
2898 |
+
update_option ( 'pd-rating-' . $report_type, 0 );
|
2899 |
+
|
2900 |
+
switch ( $report_type ) :
|
2901 |
+
case 'posts':
|
2902 |
+
$show_posts = 0;
|
2903 |
+
break;
|
2904 |
+
case 'pages':
|
2905 |
+
$show_pages = 0;
|
2906 |
+
break;
|
2907 |
+
case 'comments':
|
2908 |
+
$show_comments = 0;
|
2909 |
+
break;
|
2910 |
+
endswitch;
|
2911 |
+
}
|
2912 |
+
}
|
2913 |
+
|
2914 |
+
$settings_text = $response->settings;
|
2915 |
+
$settings = json_decode( $settings_text );
|
2916 |
+
|
2917 |
+
$rating_type = 0;
|
2918 |
+
|
2919 |
+
if( $settings->type == 'stars' )
|
2920 |
+
$rating_type = 0;
|
2921 |
+
else
|
2922 |
+
$rating_type = 1;
|
2923 |
+
|
2924 |
+
?>
|
2925 |
+
<div class="wrap">
|
2926 |
+
<h2><?php _e('Rating Settings'); ?></h2>
|
2927 |
+
<?php
|
2928 |
+
if ( $rating_updated )
|
2929 |
+
echo( '<div class="updated"><p>'.__('Rating updated').'</p></div>' );
|
2930 |
+
|
2931 |
+
if ( !$error ){
|
2932 |
+
?>
|
2933 |
+
<div id="side-sortables">
|
2934 |
+
<div id="categorydiv">
|
2935 |
+
<ul id="category-tabs">
|
2936 |
+
<?php
|
2937 |
+
$this_class = '';
|
2938 |
+
$posts_link = clean_url( add_query_arg( array( 'rating' => 'posts', 'message' => false ) ) );
|
2939 |
+
$pages_link = clean_url( add_query_arg( array( 'rating' => 'pages', 'message' => false ) ) );
|
2940 |
+
$comments_link = clean_url( add_query_arg( array( 'rating' => 'comments', 'message' => false ) ) );
|
2941 |
+
if ( $report_type == 'posts' )
|
2942 |
+
$this_class = ' class="tabs"';
|
2943 |
+
?>
|
2944 |
+
<li <?php echo( $this_class ); ?>><a tabindex="3" href="<?php echo $posts_link; ?>"><?php _e('Posts');?></a></li>
|
2945 |
+
<?php
|
2946 |
+
$this_class = '';
|
2947 |
+
if ( $report_type == 'pages' )
|
2948 |
+
$this_class = ' class="tabs"';
|
2949 |
+
?>
|
2950 |
+
<li <?php echo( $this_class ); ?>><a tabindex="3" href="<?php echo $pages_link; ?>"><?php _e('Pages');?></a></li>
|
2951 |
+
<?php
|
2952 |
+
$this_class = '';
|
2953 |
+
if ( $report_type == 'comments' )
|
2954 |
+
$this_class = ' class="tabs"';
|
2955 |
+
?>
|
2956 |
+
<li <?php echo( $this_class ); ?>><a href="<?php echo $comments_link; ?>"><?php _e('Comments');?></a></li>
|
2957 |
+
</ul>
|
2958 |
+
<div class="tabs-panel" id="categories-all" style="background: #FFFFFF;height: auto; overflow: visible;">
|
2959 |
+
<form action="" method="post">
|
2960 |
+
<input type="hidden" name="pd_rating_action_type" value="<?php echo ( $report_type ); ?>" />
|
2961 |
+
<table class="form-table" style="width: normal;">
|
2962 |
+
<tbody>
|
2963 |
+
<?php
|
2964 |
+
if ( $report_type == 'posts' ){
|
2965 |
+
?>
|
2966 |
+
<tr valign="top">
|
2967 |
+
<td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
|
2968 |
+
<label for="pd_show_posts">
|
2969 |
+
<input type="checkbox" name="pd_show_posts" id="pd_show_posts" <?php if( $show_posts > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for blog posts');?>
|
2970 |
+
</label>
|
2971 |
+
|
2972 |
+
<span id="span_posts">
|
2973 |
+
<select name="posts_pos">
|
2974 |
+
<?php
|
2975 |
+
$select = array( __('Above each blog post') => '0', __('Below each blog post') => '1' );
|
2976 |
+
foreach( $select as $option => $value ) :
|
2977 |
+
$selected = '';
|
2978 |
+
if ( $value == $pos_posts )
|
2979 |
+
$selected = ' selected="selected"';
|
2980 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
|
2981 |
+
endforeach;
|
2982 |
+
?>
|
2983 |
+
</select>
|
2984 |
+
</span>
|
2985 |
+
</td>
|
2986 |
+
</tr>
|
2987 |
+
<?php
|
2988 |
+
}
|
2989 |
+
if ( $report_type == 'pages' ){
|
2990 |
+
?>
|
2991 |
+
<tr valign="top">
|
2992 |
+
<td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
|
2993 |
+
<label for="pd_show_pages">
|
2994 |
+
<input type="checkbox" name="pd_show_pages" id="pd_show_pages" <?php if( $show_pages > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for pages');?>
|
2995 |
+
</label>
|
2996 |
+
|
2997 |
+
<span id="span_pages">
|
2998 |
+
<select name="pages_pos">
|
2999 |
+
<?php
|
3000 |
+
$select = array( __('Above each page') => '0', __('Below each page') => '1' );
|
3001 |
+
foreach( $select as $option => $value ) :
|
3002 |
+
$selected = '';
|
3003 |
+
if ( $value == $pos_pages )
|
3004 |
+
$selected = ' selected="selected"';
|
3005 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
|
3006 |
+
endforeach;
|
3007 |
+
?>
|
3008 |
+
</select>
|
3009 |
+
</span>
|
3010 |
+
</td>
|
3011 |
+
</tr>
|
3012 |
+
<?php
|
3013 |
+
}
|
3014 |
+
if ( $report_type == 'comments' ){
|
3015 |
+
?>
|
3016 |
+
<tr valign="top">
|
3017 |
+
<td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
|
3018 |
+
<label for="pd_show_comments">
|
3019 |
+
<input type="checkbox" name="pd_show_comments" id="pd_show_comments" <?php if( $show_comments > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for comments');?>
|
3020 |
+
</label>
|
3021 |
+
|
3022 |
+
<span id="span_comments">
|
3023 |
+
<select name="comments_pos">
|
3024 |
+
<?php
|
3025 |
+
$select = array( __('Above each comment') => '0', __('Below each comment') => '1' );
|
3026 |
+
foreach( $select as $option => $value ) :
|
3027 |
+
$selected = '';
|
3028 |
+
if ( $value == $pos_comments )
|
3029 |
+
$selected = ' selected="selected"';
|
3030 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
|
3031 |
+
endforeach;
|
3032 |
+
?>
|
3033 |
+
</select>
|
3034 |
+
</span>
|
3035 |
+
</td>
|
3036 |
+
</tr>
|
3037 |
+
<?php } ?>
|
3038 |
+
</tbody>
|
3039 |
+
</table>
|
3040 |
+
<p class="submit">
|
3041 |
+
<input class="button-primary" type="submit" value="<?php esc_attr_e('Save Changes');?>" name="Submit" />
|
3042 |
+
</p>
|
3043 |
+
<?php
|
3044 |
+
if ( $report_type == 'posts' && $show_posts > 0 )
|
3045 |
+
$show_settings = true;
|
3046 |
+
if ( $report_type == 'pages' && $show_pages > 0 )
|
3047 |
+
$show_settings = true;
|
3048 |
+
if ( $report_type == 'comments' && $show_comments > 0 )
|
3049 |
+
$show_settings = true;
|
3050 |
+
if ( $show_settings == true )
|
3051 |
+
echo ( '<a href="javascript:" onclick="show_settings();">'.__('Advanced Settings').'</a>' );
|
3052 |
+
?>
|
3053 |
+
</form>
|
3054 |
+
</div>
|
3055 |
+
</div>
|
3056 |
+
</div>
|
3057 |
+
|
3058 |
+
<?php if ( $show_settings == true ){ ?>
|
3059 |
+
<br/>
|
3060 |
+
<form method="post" action="">
|
3061 |
+
<div id="poststuff" style="<?php echo( $settings_style ); ?>">
|
3062 |
+
<div class="has-sidebar has-right-sidebar">
|
3063 |
+
<div class="inner-sidebar-ratings">
|
3064 |
+
<div class="postbox" id="submitdiv">
|
3065 |
+
<h3><?php _e('Save');?></h3>
|
3066 |
+
<div class="inside">
|
3067 |
+
<div id="major-publishing-actions">
|
3068 |
+
<input type="hidden" name="type" value="<?php echo( $report_type ); ?>" />
|
3069 |
+
<input type="hidden" name="rating_id" value="<?php echo( $rating_id ); ?>" />
|
3070 |
+
<input type="hidden" name="action" value="update-rating" />
|
3071 |
+
<p id="publishing-action">
|
3072 |
+
<input type="submit" value="<?php _e('Save Changes');?>" class="button-primary"/>
|
3073 |
+
</p>
|
3074 |
+
<br class="clear"/>
|
3075 |
+
</div>
|
3076 |
+
</div>
|
3077 |
+
</div>
|
3078 |
+
<div class="postbox">
|
3079 |
+
<h3><?php _e('Preview');?></h3>
|
3080 |
+
<div class="inside">
|
3081 |
+
<p><?php _e('This is a demo of what your rating widget will look like'); ?>.</p>
|
3082 |
+
<p>
|
3083 |
+
<div id="pd_rating_holder_1"></div>
|
3084 |
+
</p>
|
3085 |
+
</div>
|
3086 |
+
</div>
|
3087 |
+
<div class="postbox">
|
3088 |
+
<h3><?php _e('Customize Labels');?></h3>
|
3089 |
+
<div class="inside">
|
3090 |
+
<table>
|
3091 |
+
<tr>
|
3092 |
+
<td width="100" height="30"><?php _e('votes');?></td>
|
3093 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_votes" id="text_votes" value="<?php echo( wp_specialchars( $settings->text_votes ) ); ?>" maxlength="20" />
|
3094 |
+
</tr>
|
3095 |
+
<tr>
|
3096 |
+
<td height="30"><?php _e('rate this');?></td>
|
3097 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_rate_this" id="text_rate_this" value="<?php echo( wp_specialchars( $settings->text_rate_this ) ); ?>" maxlength="20" />
|
3098 |
+
</tr>
|
3099 |
+
<tr>
|
3100 |
+
<td height="30"><?php printf(__( '%d star' ), 1);?></td>
|
3101 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_1_star" id="text_1_star" value="<?php echo( wp_specialchars( $settings->text_1_star ) ); ?>" maxlength="20" />
|
3102 |
+
</tr>
|
3103 |
+
<tr>
|
3104 |
+
<td height="30"><?php printf(__( '%d stars' ), 2);?></td>
|
3105 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_2_star" id="text_2_star" value="<?php echo( wp_specialchars( $settings->text_2_star ) ); ?>" maxlength="20" />
|
3106 |
+
</tr>
|
3107 |
+
<tr>
|
3108 |
+
<td height="30"><?php printf(__( '%d stars' ), 3);?></td>
|
3109 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_3_star" id="text_3_star" value="<?php echo( wp_specialchars( $settings->text_3_star ) ); ?>" maxlength="20" />
|
3110 |
+
</tr>
|
3111 |
+
<tr>
|
3112 |
+
<td height="30"><?php printf(__( '%d stars' ), 4);?></td>
|
3113 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_4_star" id="text_4_star" value="<?php echo( wp_specialchars( $settings->text_4_star ) ); ?>" maxlength="20" />
|
3114 |
+
</tr>
|
3115 |
+
<tr>
|
3116 |
+
<td height="30"><?php printf(__( '%d stars' ), 5);?></td>
|
3117 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_5_star" id="text_5_star" value="<?php echo( wp_specialchars( $settings->text_5_star ) ); ?>" maxlength="20" />
|
3118 |
+
</tr>
|
3119 |
+
<tr>
|
3120 |
+
<td height="30"><?php _e('Thank You');?></td>
|
3121 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_thank_you" id="text_thank_you" value="<?php echo( wp_specialchars( $settings->text_thank_you ) ); ?>" maxlength="20" />
|
3122 |
+
</tr>
|
3123 |
+
<tr>
|
3124 |
+
<td height="30"><?php _e('Rate Up');?></td>
|
3125 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_rate_up" id="text_rate_up" value="<?php echo( wp_specialchars( $settings->text_rate_up ) ); ?>" maxlength="20" />
|
3126 |
+
</tr>
|
3127 |
+
<tr>
|
3128 |
+
<td height="30"><?php _e('Rate Down');?></td>
|
3129 |
+
<td><input onblur="pd_bind(this);" type="text" name="text_rate_down" id="text_rate_down" value="<?php echo( wp_specialchars( $settings->text_rate_down ) ); ?>" maxlength="20" />
|
3130 |
+
</tr>
|
3131 |
+
</table>
|
3132 |
+
</div>
|
3133 |
+
</div>
|
3134 |
+
|
3135 |
+
</div>
|
3136 |
+
<div id="post-body-content" class="has-sidebar-content">
|
3137 |
+
|
3138 |
+
<div class="postbox">
|
3139 |
+
<h3><?php _e('Rating Type');?></h3>
|
3140 |
+
<div class="inside">
|
3141 |
+
<p><?php _e('Here you can choose how you want your rating to display. The 5 star rating is the most commonly used. The Nero rating is useful for keeping it simple.'); ?></p>
|
3142 |
+
<ul>
|
3143 |
+
<li style="display: inline;margin-right: 10px;">
|
3144 |
+
<label for="stars">
|
3145 |
+
<?php
|
3146 |
+
$checked = '';
|
3147 |
+
if ( $settings->type == 'stars' )
|
3148 |
+
$checked = ' checked="checked"';
|
3149 |
+
?>
|
3150 |
+
<input type="radio" onchange="pd_change_type( 0 );" <?php echo ( $checked ); ?> value="stars" id="stars" name="rating_type" />
|
3151 |
+
<?php printf(__( '%d Star Rating' ), 5);?>
|
3152 |
+
</label>
|
3153 |
+
</li>
|
3154 |
+
<li style="display: inline;">
|
3155 |
+
<label>
|
3156 |
+
<?php
|
3157 |
+
$checked = '';
|
3158 |
+
if ( $settings->type == 'nero' )
|
3159 |
+
$checked = ' checked="checked"';
|
3160 |
+
?>
|
3161 |
+
<input type="radio" onchange="pd_change_type( 1 );" <?php echo( $checked ); ?> value="nero" id="nero" name="rating_type" />
|
3162 |
+
<?php _e('Nero Rating');?>
|
3163 |
+
</label>
|
3164 |
+
</li>
|
3165 |
+
</ul>
|
3166 |
+
</div>
|
3167 |
+
</div>
|
3168 |
+
<div class="postbox">
|
3169 |
+
<h3><?php _e('Rating Style');?></h3>
|
3170 |
+
<div class="inside">
|
3171 |
+
<table>
|
3172 |
+
<tr>
|
3173 |
+
<td height="30" width="100" id="editor_star_size_text"><?php _e('Star Size');?></td>
|
3174 |
+
<td>
|
3175 |
+
<select name="size" id="size" onchange="pd_bind(this);">
|
3176 |
+
<?php
|
3177 |
+
$select = array( __('Small')." (16px)" => "sml", __('Medium')." (20px)" => "med", __('Large')." (24px)" => "lrg" );
|
3178 |
+
|
3179 |
+
foreach ( $select as $option => $value ) :
|
3180 |
+
$selected = '';
|
3181 |
+
if ( $settings->size == $value )
|
3182 |
+
$selected = ' selected="selected"';
|
3183 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
|
3184 |
+
endforeach;
|
3185 |
+
|
3186 |
+
?>
|
3187 |
+
</select>
|
3188 |
+
</td>
|
3189 |
+
</tr>
|
3190 |
+
<tr>
|
3191 |
+
<td height="30" id="editor_star_color_text"><?php echo 'bubu'; _e('Star Color');?></td>
|
3192 |
+
<td>
|
3193 |
+
<select name="star_color" id="star_color" onchange="pd_bind(this);" style="display: none;">
|
3194 |
+
<?php
|
3195 |
+
$select = array( __('Yellow') => "yellow", __('Red') => "red", __('Blue') => "blue", __('Green') => "green", __('Grey') => "grey" );
|
3196 |
+
foreach ( $select as $option => $value ) :
|
3197 |
+
$selected = '';
|
3198 |
+
if ( $settings->star_color == $value )
|
3199 |
+
$selected = ' selected="selected"';
|
3200 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
|
3201 |
+
endforeach;
|
3202 |
+
?>
|
3203 |
+
</select>
|
3204 |
+
<select name="nero_style" id="nero_style" onchange="pd_bind(this);" style="display: none;">
|
3205 |
+
<?php
|
3206 |
+
$select = array( __('Hand') => "hand" );
|
3207 |
+
foreach ( $select as $option => $value ) :
|
3208 |
+
$selected = '';
|
3209 |
+
if ( $settings->star_color == $value )
|
3210 |
+
$selected = ' selected="selected"';
|
3211 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
|
3212 |
+
endforeach;
|
3213 |
+
?>
|
3214 |
+
</select>
|
3215 |
+
|
3216 |
+
</td>
|
3217 |
+
</tr>
|
3218 |
+
<tr>
|
3219 |
+
<td height="30"><?php _e('Custom Image');?></td>
|
3220 |
+
<td><input type="text" onblur="pd_bind(this);" name="custom_star" id="custom_star" value="<?php echo( clean_url( $settings->custom_star ) ); ?>" maxlength="200" />
|
3221 |
+
</tr>
|
3222 |
+
</table>
|
3223 |
+
</div>
|
3224 |
+
</div>
|
3225 |
+
<div class="postbox">
|
3226 |
+
<h3><?php _e('Text Layout & Font');?></h3>
|
3227 |
+
<div class="inside">
|
3228 |
+
<table>
|
3229 |
+
<tr>
|
3230 |
+
<td width="100" height="30"><?php _e('Align');?></td>
|
3231 |
+
<td>
|
3232 |
+
<select id="font_align" onchange="pd_bind(this);" name="font_align">
|
3233 |
+
<?php
|
3234 |
+
$select = array( __('Left') => "left", __('Center') => "center", __('Right') => "right" );
|
3235 |
+
foreach( $select as $option => $value ):
|
3236 |
+
$selected = '';
|
3237 |
+
if ( $settings->font_align == $value )
|
3238 |
+
$selected = ' selected="selected"';
|
3239 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>');
|
3240 |
+
endforeach;
|
3241 |
+
?>
|
3242 |
+
</select>
|
3243 |
+
</td>
|
3244 |
+
</tr>
|
3245 |
+
<tr>
|
3246 |
+
<td height="30"><?php _e('Position');?></td>
|
3247 |
+
<td>
|
3248 |
+
<select name="font_position" onchange="pd_bind(this);" id="font_position">
|
3249 |
+
<?php
|
3250 |
+
$select = array( __('Top') => "top", __('Right') => "right", __('Bottom') => "bottom" );
|
3251 |
+
foreach( $select as $option => $value ) :
|
3252 |
+
$selected = '';
|
3253 |
+
if ( $settings->font_position == $value )
|
3254 |
+
$selected = ' selected="selected"';
|
3255 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>');
|
3256 |
+
endforeach;
|
3257 |
+
?>
|
3258 |
+
</select>
|
3259 |
+
</td>
|
3260 |
+
</tr>
|
3261 |
+
<tr>
|
3262 |
+
<td height="30"><?php _e('Font');?></td>
|
3263 |
+
<td>
|
3264 |
+
<select name="font_family" id="font_family" onchange="pd_bind(this);">
|
3265 |
+
<?php
|
3266 |
+
$select = array( "Inherit" => "", "Arial" => "arial", "Comic Sans MS" => "comic sans ms", "Courier" => "courier", "Georgia" => "georgia", "Lucida Grande" => "lucida grande", "Tahoma" => "tahoma", "Times" => "times", "Trebuchet MS" => "trebuchet ms", "Verdana" => "verdana" );
|
3267 |
+
|
3268 |
+
foreach( $select as $option => $value ) :
|
3269 |
+
$selected = '';
|
3270 |
+
if ( $settings->font_family == $value )
|
3271 |
+
$selected = ' selected="selected"';
|
3272 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
|
3273 |
+
endforeach;
|
3274 |
+
?>
|
3275 |
+
</select>
|
3276 |
+
</td>
|
3277 |
+
</tr>
|
3278 |
+
<tr>
|
3279 |
+
<td height="30"><?php _e('Color');?></td>
|
3280 |
+
<td><input type="text" onblur="pd_bind(this);" class="elmColor jscolor-picker" name="font_color" id="font_color" value="<?php echo( wp_specialchars( $settings->font_color ) ); ?>" maxlength="11" autocomplete="off"/>
|
3281 |
+
</td>
|
3282 |
+
</tr>
|
3283 |
+
<tr>
|
3284 |
+
<td><?php _e('Size');?></td>
|
3285 |
+
<td>
|
3286 |
+
<select name="font_size" id="font_size" onchange="pd_bind(this);">
|
3287 |
+
<?php
|
3288 |
+
$select = array( __('Inherit') => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
|
3289 |
+
|
3290 |
+
foreach ( $select as $option => $value ) :
|
3291 |
+
$selected = '';
|
3292 |
+
if ( $settings->font_size == $value )
|
3293 |
+
$selected = ' selected="selected"';
|
3294 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
|
3295 |
+
endforeach;
|
3296 |
+
?>
|
3297 |
+
</select>
|
3298 |
+
</td>
|
3299 |
+
</tr>
|
3300 |
+
<tr>
|
3301 |
+
<td height="30"><?php _e('Line Height');?></td>
|
3302 |
+
<td>
|
3303 |
+
<select name="font_line_height" id="font_line_height" onchange="pd_bind(this);">
|
3304 |
+
<?php
|
3305 |
+
$select = array( __('Inherit') => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
|
3306 |
+
|
3307 |
+
foreach ( $select as $option => $value ) :
|
3308 |
+
$selected = '';
|
3309 |
+
if ( $settings->font_line_height == $value )
|
3310 |
+
$selected = ' selected="selected"';
|
3311 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
|
3312 |
+
endforeach;
|
3313 |
+
?>
|
3314 |
+
</select>
|
3315 |
+
</td>
|
3316 |
+
</tr>
|
3317 |
+
<tr>
|
3318 |
+
<td height="30"><?php _e('Bold');?></td>
|
3319 |
+
<td><?php
|
3320 |
+
$checked = '';
|
3321 |
+
if ( $settings->font_bold == 'bold' )
|
3322 |
+
$checked = ' checked="checked"';
|
3323 |
+
?><input type="checkbox" name="font_bold" onclick="pd_bind(this);" id="font_bold" value="bold" <?php echo( $checked ); ?> /></td>
|
3324 |
+
</tr>
|
3325 |
+
<tr>
|
3326 |
+
<td height="30"><?php _e('Italic');?></td>
|
3327 |
+
<?php
|
3328 |
+
$checked = '';
|
3329 |
+
if( $settings->font_italic == 'italic' )
|
3330 |
+
$checked = ' checked="checked"';
|
3331 |
+
?>
|
3332 |
+
<td><input type="checkbox" name="font_italic" onclick="pd_bind(this);" id="font_italic" value="italic" <?php echo( $checked ); ?>/></td>
|
3333 |
+
</tr>
|
3334 |
+
</table>
|
3335 |
+
</div>
|
3336 |
+
</div>
|
3337 |
+
</div>
|
3338 |
+
</div>
|
3339 |
+
</form>
|
3340 |
+
<script type="text/javascript">
|
3341 |
+
PDRTJS_settings = <?php echo ( $settings_text ); ?>;
|
3342 |
+
PDRTJS_settings.id = "1";
|
3343 |
+
PDRTJS_settings.unique_id = "xxx";
|
3344 |
+
PDRTJS_settings.title = "";
|
3345 |
+
PDRTJS_settings.override = "<?php echo( $rating_id ); ?>";
|
3346 |
+
PDRTJS_settings.permalink = "";
|
3347 |
+
PDRTJS_1 = new PDRTJS_RATING( PDRTJS_settings );
|
3348 |
+
pd_change_type( <?php echo ( $rating_type ) ?> );
|
3349 |
+
</script>
|
3350 |
+
<?php } ?>
|
3351 |
+
</div>
|
3352 |
+
<?php } // from if !error ?>
|
3353 |
+
</div>
|
3354 |
+
|
3355 |
+
<?php
|
3356 |
+
}
|
3357 |
+
|
3358 |
+
function update_rating(){
|
3359 |
+
$rating_type = 0;
|
3360 |
+
$rating_id = 0;
|
3361 |
+
|
3362 |
+
if( isset( $_REQUEST['rating_id'] ) )
|
3363 |
+
$rating_id = (int) $_REQUEST['rating_id'];
|
3364 |
+
|
3365 |
+
if( $_REQUEST['rating_type'] == 'stars' ) {
|
3366 |
+
$set->type = 'stars';
|
3367 |
+
$rating_type = 0;
|
3368 |
+
$set->star_color = attribute_escape( $_REQUEST['star_color'] );
|
3369 |
+
} else {
|
3370 |
+
$set->type = 'nero';
|
3371 |
+
$rating_type = 1;
|
3372 |
+
$set->star_color = attribute_escape( $_REQUEST['nero_style'] );
|
3373 |
+
}
|
3374 |
+
|
3375 |
+
$set->size = wp_specialchars( $_REQUEST['size'], 1 );
|
3376 |
+
$set->custom_star = wp_specialchars( clean_url( $_REQUEST['custom_star'] ) , 1 );
|
3377 |
+
$set->font_align = wp_specialchars( $_REQUEST['font_align'], 1 );
|
3378 |
+
$set->font_position = wp_specialchars( $_REQUEST['font_position'], 1 );
|
3379 |
+
$set->font_family = wp_specialchars( $_REQUEST['font_family'], 1);
|
3380 |
+
$set->font_size = wp_specialchars( $_REQUEST['font_size'], 1 );
|
3381 |
+
$set->font_line_height = wp_specialchars( $_REQUEST['font_line_height'], 1 );
|
3382 |
+
|
3383 |
+
if ( $_REQUEST['font_bold'] == 'bold' )
|
3384 |
+
$set->font_bold = 'bold';
|
3385 |
+
else
|
3386 |
+
$set->font_bold = 'normal';
|
3387 |
+
|
3388 |
+
if ( $_REQUEST['font_italic'] == 'italic' )
|
3389 |
+
$set->font_italic = 'italic';
|
3390 |
+
else
|
3391 |
+
$set->font_italic = 'normal';
|
3392 |
+
|
3393 |
+
$set->text_votes = wp_specialchars( $_REQUEST['text_votes'], 1 );
|
3394 |
+
$set->text_rate_this = wp_specialchars( $_REQUEST['text_rate_this'], 1 );
|
3395 |
+
$set->text_1_star = wp_specialchars( $_REQUEST['text_1_star'], 1 );
|
3396 |
+
$set->text_2_star = wp_specialchars( $_REQUEST['text_2_star'], 1 );
|
3397 |
+
$set->text_3_star = wp_specialchars( $_REQUEST['text_3_star'], 1 );
|
3398 |
+
$set->text_4_star = wp_specialchars( $_REQUEST['text_4_star'], 1 );
|
3399 |
+
$set->text_5_star = wp_specialchars( $_REQUEST['text_5_star'], 1 );
|
3400 |
+
$set->text_thank_you = wp_specialchars( $_REQUEST['text_thank_you'], 1 );
|
3401 |
+
$set->text_rate_up = wp_specialchars( $_REQUEST['text_rate_up'], 1 );
|
3402 |
+
$set->text_rate_down = wp_specialchars( $_REQUEST['text_rate_down'], 1 );
|
3403 |
+
$set->font_color = wp_specialchars( $_REQUEST['font_color'], 1 );
|
3404 |
+
|
3405 |
+
$settings_text = json_encode( $set );
|
3406 |
+
|
3407 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
3408 |
+
$polldaddy->reset();
|
3409 |
+
$response = $polldaddy->update_rating( $rating_id, $settings_text, $rating_type );
|
3410 |
+
}
|
3411 |
+
function rating_reports() {
|
3412 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
3413 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
3414 |
+
|
3415 |
+
$report_type = 'posts';
|
3416 |
+
$period = '7';
|
3417 |
+
$show_rating = 0;
|
3418 |
+
|
3419 |
+
if ( isset( $_REQUEST['rating'] ) ){
|
3420 |
+
switch ( $_REQUEST['rating'] ) :
|
3421 |
+
case 'pages':
|
3422 |
+
$report_type = 'pages';
|
3423 |
+
$rating_id = (int) get_option( 'pd-rating-pages-id' );
|
3424 |
+
break;
|
3425 |
+
|
3426 |
+
case 'comments':
|
3427 |
+
$report_type = 'comments';
|
3428 |
+
$rating_id = get_option( 'pd-rating-comments-id' );
|
3429 |
+
break;
|
3430 |
+
|
3431 |
+
case 'posts':
|
3432 |
+
$report_type = 'posts';
|
3433 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
3434 |
+
break;
|
3435 |
+
endswitch;
|
3436 |
+
}
|
3437 |
+
|
3438 |
+
if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] ){
|
3439 |
+
switch ( $_REQUEST['filter'] ) :
|
3440 |
+
case '1':
|
3441 |
+
$period = '1';
|
3442 |
+
break;
|
3443 |
+
|
3444 |
+
case '7':
|
3445 |
+
$period = '7';
|
3446 |
+
break;
|
3447 |
+
|
3448 |
+
case '31':
|
3449 |
+
$period = '31';
|
3450 |
+
break;
|
3451 |
+
|
3452 |
+
case '90':
|
3453 |
+
$period = '90';
|
3454 |
+
break;
|
3455 |
+
|
3456 |
+
case '365':
|
3457 |
+
$period = '365';
|
3458 |
+
break;
|
3459 |
+
|
3460 |
+
case 'all':
|
3461 |
+
$period = 'all';
|
3462 |
+
break;
|
3463 |
+
endswitch;
|
3464 |
+
}
|
3465 |
+
|
3466 |
+
$page_size = 15;
|
3467 |
+
$current_page = 1;
|
3468 |
+
|
3469 |
+
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'change-report' ){
|
3470 |
+
$current_page = 1;
|
3471 |
+
} else {
|
3472 |
+
if ( isset( $_REQUEST['paged'] ) ) {
|
3473 |
+
$current_page = (int) $_REQUEST['paged'];
|
3474 |
+
if ( $current_page == 0 )
|
3475 |
+
$current_page = 1;
|
3476 |
+
}
|
3477 |
+
}
|
3478 |
+
|
3479 |
+
$start = ( $current_page * $page_size ) - $page_size;
|
3480 |
+
$end = $page_size;
|
3481 |
+
|
3482 |
+
$response = $polldaddy->get_rating_results( $rating_id, $period, $start, $end );
|
3483 |
+
|
3484 |
+
$ratings = $response->rating;
|
3485 |
+
|
3486 |
+
$total = (int) $response->_total;
|
3487 |
+
|
3488 |
+
$total_pages = ceil( $total / $page_size );
|
3489 |
+
|
3490 |
+
$page_links = paginate_links( array(
|
3491 |
+
'base' => add_query_arg( array ('paged' => '%#%', 'rating' => $report_type, 'filter' => $period ) ),
|
3492 |
+
'format' => '',
|
3493 |
+
'prev_text' => __('«'),
|
3494 |
+
'next_text' => __('»'),
|
3495 |
+
'total' => $total_pages,
|
3496 |
+
'current' => $current_page
|
3497 |
+
));
|
3498 |
+
?>
|
3499 |
+
<div class="wrap">
|
3500 |
+
<h2><?php _e('Rating Reports');?> <span style="font-size: 16px;">(<?php echo ( $report_type ); ?>)</span></h2>
|
3501 |
+
<div class="clear"></div>
|
3502 |
+
<form method="post" action="">
|
3503 |
+
<div class="tablenav">
|
3504 |
+
<div class="alignleft">
|
3505 |
+
<select name="rating">
|
3506 |
+
<?php
|
3507 |
+
$select = array( __('Posts') => "posts", __('Pages') => "pages", __('Comments') => "comments" );
|
3508 |
+
|
3509 |
+
foreach ( $select as $option => $value ) :
|
3510 |
+
$selected = '';
|
3511 |
+
if ( $value == $report_type )
|
3512 |
+
$selected = ' selected="selected"';
|
3513 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
|
3514 |
+
endforeach;
|
3515 |
+
?>
|
3516 |
+
</select>
|
3517 |
+
<input type="hidden" name="action" value="change-report" />
|
3518 |
+
<input class="button-secondary action" type="submit" value="<?php esc_attr_e('View Report');?>" />
|
3519 |
+
|
3520 |
+
<select name="filter">
|
3521 |
+
<?php
|
3522 |
+
$select = array( __('Last 24 hours') => "1", __('Last 7 days') => "7", __('Last 31 days') => "31", __('Last 3 months') => "90", __('Last 12 months') => "365", __('All time') => "all" );
|
3523 |
+
foreach ( $select as $option => $value ) :
|
3524 |
+
$selected = '';
|
3525 |
+
if ( $value == $period )
|
3526 |
+
$selected = ' selected="selected"';
|
3527 |
+
echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
|
3528 |
+
endforeach;
|
3529 |
+
?>
|
3530 |
+
</select>
|
3531 |
+
<input class="button-secondary action" type="submit" value="<?php _e('Filter Report');?>" />
|
3532 |
+
</div>
|
3533 |
+
<div class="alignright">
|
3534 |
+
<div class="tablenav-pages">
|
3535 |
+
<?php echo( $page_links ); ?>
|
3536 |
+
</div>
|
3537 |
+
</div>
|
3538 |
+
</div>
|
3539 |
+
</form>
|
3540 |
+
|
3541 |
+
<table class="widefat">
|
3542 |
+
<?php
|
3543 |
+
if ( count( $ratings ) == 0 ) {
|
3544 |
+
?>
|
3545 |
+
<tbody>
|
3546 |
+
<tr>
|
3547 |
+
<td colspan="4"><?php printf(__('No ratings have been collected for your %s yet.'), $report_type); ?></td>
|
3548 |
+
</tr>
|
3549 |
+
</tbody>
|
3550 |
+
<?php
|
3551 |
+
}
|
3552 |
+
else{
|
3553 |
+
?>
|
3554 |
+
<thead>
|
3555 |
+
<tr>
|
3556 |
+
<th><?php _e('Start Date');?></th>
|
3557 |
+
<th><?php _e('Title');?></th>
|
3558 |
+
<th><?php _e('Votes');?></th>
|
3559 |
+
<th style="width: 120px;"><?php _e('Average Rating');?></th>
|
3560 |
+
</tr>
|
3561 |
+
</thead>
|
3562 |
+
<?php
|
3563 |
+
echo ( '<tbody>' );
|
3564 |
+
$alt_counter = 0;
|
3565 |
+
$alt = '';
|
3566 |
+
|
3567 |
+
foreach ( $ratings as $rating ) :
|
3568 |
+
$alt_counter++;
|
3569 |
+
|
3570 |
+
if ( ( $alt_counter % 2 ) == 0 )
|
3571 |
+
$alt = ' class="alternate"';
|
3572 |
+
else
|
3573 |
+
$alt = '';
|
3574 |
+
?>
|
3575 |
+
<tr <?php echo( $alt ); ?>>
|
3576 |
+
<td>
|
3577 |
+
<?php echo( str_replace( '-', '/', substr( wp_specialchars( $rating->date ), 0, 10 ) ) ); ?><br/>
|
3578 |
+
<?php echo( wp_specialchars( $rating->uid ) ); ?>
|
3579 |
+
</td>
|
3580 |
+
<td>
|
3581 |
+
<?php echo( wp_specialchars( $rating->title ) ); ?>
|
3582 |
+
<br/>
|
3583 |
+
<a href="<?php echo( clean_url( $rating->permalink ) ); ?>" target="_blank"><?php echo( clean_url( $rating->permalink ) ); ?></a>
|
3584 |
+
</td>
|
3585 |
+
<td style="padding-top: 10px; font-weight: bold;"><?php echo( number_format( $rating->_votes ) ); ?></td>
|
3586 |
+
<td style="padding-top: 10px;">
|
3587 |
+
<?php
|
3588 |
+
if ( $rating->_type == 0 ){
|
3589 |
+
$avg_rating = $this->round( $rating->average_rating, 0.5 );
|
3590 |
+
|
3591 |
+
echo ( '<div>' );
|
3592 |
+
$image_pos = '';
|
3593 |
+
|
3594 |
+
for ( $c = 1; $c <= 5; $c++ ){
|
3595 |
+
if ( $avg_rating > 0 ){
|
3596 |
+
if ( $avg_rating < $c ){
|
3597 |
+
$image_pos = 'bottom left';
|
3598 |
+
}
|
3599 |
+
if ( $avg_rating == ( $c - 1 + 0.5 ) ){
|
3600 |
+
$image_pos = 'center left';
|
3601 |
+
}
|
3602 |
+
}
|
3603 |
+
echo ('<div style="width: 20px; height: 20px; background: url(http://i.polldaddy.com/ratings/images/star-yellow-med.png) ' . $image_pos . '; float: left;"></div>' );
|
3604 |
+
}
|
3605 |
+
echo ( '<br class="clear" /></div>' );
|
3606 |
+
}
|
3607 |
+
else{
|
3608 |
+
echo ( '<div>' );
|
3609 |
+
echo ( '<div style="margin: 0px 0px 0px 20px; background: transparent url(http://i.polldaddy.com/images/rate-graph-up.png); width: 20px; height: 20px; float: left;"></div>' );
|
3610 |
+
echo ( '<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;">' . number_format ( $rating->total1 ) . '</div>' );
|
3611 |
+
echo ( '<div style="margin: 0px; background: transparent url(http://i.polldaddy.com/images/rate-graph-dn.png); width: 20px; height: 20px; float: left;"></div>' );
|
3612 |
+
echo ( '<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;">' . number_format( $rating->total2 ) . '</div>' );
|
3613 |
+
echo ( '<br class="clear" /></div>' );
|
3614 |
+
|
3615 |
+
}
|
3616 |
+
?>
|
3617 |
+
</td>
|
3618 |
+
</tr>
|
3619 |
+
|
3620 |
+
<?php
|
3621 |
+
endforeach;
|
3622 |
+
echo ( '</tbody>' );
|
3623 |
+
}
|
3624 |
+
|
3625 |
+
?>
|
3626 |
+
</table>
|
3627 |
+
<div class="tablenav">
|
3628 |
+
<div class="alignright">
|
3629 |
+
<div class="tablenav-pages">
|
3630 |
+
<?php echo( $page_links ); ?>
|
3631 |
+
</div>
|
3632 |
+
</div>
|
3633 |
+
</div>
|
3634 |
+
</div>
|
3635 |
+
<p></p>
|
3636 |
+
<?php
|
3637 |
+
}
|
3638 |
+
|
3639 |
+
function round($number, $increments) {
|
3640 |
+
$increments = 1 / $increments;
|
3641 |
+
return ( round ( $number * $increments ) / $increments );
|
3642 |
+
}
|
3643 |
|
3644 |
function signup() {
|
3645 |
return $this->api_key_page();
|
3665 |
}
|
3666 |
|
3667 |
add_action( 'init', 'polldaddy_loader' );
|
3668 |
+
add_filter( 'the_content', 'polldaddy_show_rating', 1 );
|
3669 |
+
add_filter( 'comment_text', 'polldaddy_show_rating_comments', 50 );
|
3670 |
|
3671 |
function polldaddy_shortcode($atts, $content=null) {
|
3672 |
extract(shortcode_atts(array(
|
3680 |
return "<script type='text/javascript' language='javascript' charset='utf-8' src='http://s3.polldaddy.com/p/$poll.js$cb'></script><noscript> <a href='http://answers.polldaddy.com/poll/$poll/'>View Poll</a></noscript>";
|
3681 |
}
|
3682 |
|
3683 |
+
function polldaddy_show_rating_comments( $content ){
|
3684 |
+
if ( !is_feed() ) {
|
3685 |
+
global $comment;
|
3686 |
+
global $post;
|
3687 |
+
|
3688 |
+
if ( $comment->comment_ID > 0 ) {
|
3689 |
+
$unique_id = '';
|
3690 |
+
$title = '';
|
3691 |
+
$permalink = '';
|
3692 |
+
$html = '';
|
3693 |
+
$rating_pos = 0;
|
3694 |
+
|
3695 |
+
if ( (int) get_option( 'pd-rating-comments' ) > 0 ) {
|
3696 |
+
$rating_id = (int) get_option( 'pd-rating-comments' );
|
3697 |
+
$unique_id = 'wp-comment-' . $comment->comment_ID;
|
3698 |
+
$rating_pos = (int) get_option( 'pd-rating-comments-pos' );
|
3699 |
+
$title = mb_substr( $comment->comment_content, 0, 195 ) . '...';
|
3700 |
+
$permalink = get_permalink( $post->ID ) . '#comment-' . $comment->comment_ID;
|
3701 |
+
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, '_comm_' . $comment->comment_ID );
|
3702 |
+
|
3703 |
+
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
3704 |
+
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
3705 |
+
}
|
3706 |
+
|
3707 |
+
if ( $rating_pos == 0 )
|
3708 |
+
$content = $html . $content;
|
3709 |
+
else
|
3710 |
+
$content .= $html;
|
3711 |
+
}
|
3712 |
+
}
|
3713 |
+
return $content;
|
3714 |
+
}
|
3715 |
+
|
3716 |
+
function polldaddy_show_rating( $content ) {
|
3717 |
+
if ( !is_feed() && !is_attachment() ) {
|
3718 |
+
if ( is_single() || is_page() ) {
|
3719 |
+
global $post;
|
3720 |
+
|
3721 |
+
if ( $post->ID > 0 ) {
|
3722 |
+
$unique_id = '';
|
3723 |
+
$title = '';
|
3724 |
+
$permalink = '';
|
3725 |
+
$html = '';
|
3726 |
+
$rating_id = 0;
|
3727 |
+
$rating_pos = 0;
|
3728 |
+
$item_id = '';
|
3729 |
+
|
3730 |
+
if ( is_page() ) {
|
3731 |
+
if ( (int) get_option( 'pd-rating-pages' ) > 0 ) {
|
3732 |
+
$rating_id = (int) get_option( 'pd-rating-pages' );
|
3733 |
+
$unique_id = 'wp-page-' . $post->ID;
|
3734 |
+
$rating_pos = (int) get_option( 'pd-rating-pages-pos' );
|
3735 |
+
$item_id = '_page_' . $post->ID;
|
3736 |
+
}
|
3737 |
+
} else {
|
3738 |
+
if ( (int) get_option( 'pd-rating-posts' ) > 0 ) {
|
3739 |
+
$rating_id = (int) get_option( 'pd-rating-posts' );
|
3740 |
+
$unique_id = 'wp-post-' . $post->ID;
|
3741 |
+
$rating_pos = (int) get_option( 'pd-rating-posts-pos' );
|
3742 |
+
$item_id = '_post_' . $post->ID;
|
3743 |
+
}
|
3744 |
+
}
|
3745 |
+
|
3746 |
+
if ( $rating_id > 0 ) {
|
3747 |
+
$title = $post->post_title;
|
3748 |
+
$permalink = get_permalink( $post->ID );
|
3749 |
+
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id );
|
3750 |
+
|
3751 |
+
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
3752 |
+
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
3753 |
+
}
|
3754 |
+
|
3755 |
+
if ( $rating_pos == 0 )
|
3756 |
+
$content = $html . $content;
|
3757 |
+
else
|
3758 |
+
$content .= $html;
|
3759 |
+
}
|
3760 |
+
}
|
3761 |
+
}
|
3762 |
+
return $content;
|
3763 |
+
}
|
3764 |
+
|
3765 |
+
function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
|
3766 |
+
|
3767 |
+
$html = '<p><div class="pd-rating" id="pd_rating_holder_' . $rating_id . $item_id . '"></div></p>
|
3768 |
+
<script type="text/javascript">
|
3769 |
+
PDRTJS_settings_' . (int)$rating_id . $item_id . ' = {
|
3770 |
+
"id" : "' . (int)$rating_id . '",
|
3771 |
+
"unique_id" : "' . urlencode( $unique_id ) . '",
|
3772 |
+
"title" : "' . urlencode( $title ) . '",' . "\n";
|
3773 |
+
|
3774 |
+
if ( $item_id != '' )
|
3775 |
+
$html .= ( ' "item_id" : "' . $item_id . '",' . "\n" );
|
3776 |
+
|
3777 |
+
$html .= ' "permalink" : "' . urlencode( clean_url( $permalink ) ) . '"';
|
3778 |
+
$html .= "\n }\n";
|
3779 |
+
$html .= '</script>';
|
3780 |
+
|
3781 |
+
return $html;
|
3782 |
+
}
|
3783 |
+
|
3784 |
+
function polldaddy_add_rating_js() {
|
3785 |
+
wp_print_scripts( 'polldaddy-rating-js' );
|
3786 |
+
}
|
3787 |
+
|
3788 |
+
add_shortcode('polldaddy', 'polldaddy_shortcode');
|
readme.txt
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
=== PollDaddy Polls ===
|
2 |
-
Contributors: mdawaffe, eoigal
|
3 |
-
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys
|
4 |
Requires at least: 2.6
|
5 |
-
Tested up to: 2.9
|
6 |
-
Stable tag: 1.7.
|
7 |
|
8 |
-
Create and manage PollDaddy polls from within WordPress.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
The PollDaddy Polls plugin allows you to create and manage polls from within your WordPress dashboard. You can create polls, choose from 20 different styles for your polls and view all results for your polls as they come in. All PollDaddy polls are fully customizable, you can set a close date for your poll, create multiple choice polls, choose whether to display the results or keep them private. You can even embed the polls you create on other websites. You can collect unlimited votes and create unlimited polls.
|
13 |
|
14 |
== Installation ==
|
15 |
|
@@ -32,6 +32,10 @@ Yes. You'll be able to edit the polls they create from your blog. (You won't be
|
|
32 |
Nope. The permissions are the same as for posts. So Editors and Administrators can edit anyone's polls for that blog. Authors can only edit their own.
|
33 |
|
34 |
== Change Log ==
|
|
|
|
|
|
|
|
|
35 |
= 1.7.5 =
|
36 |
* Bug Fix: Added fix for php warning when custom styles array empty
|
37 |
* Bug Fix: Added fix for cookie&ip option not getting set due to API change
|
1 |
=== PollDaddy Polls ===
|
2 |
+
Contributors: mdawaffe, eoigal
|
3 |
+
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rating, ratings
|
4 |
Requires at least: 2.6
|
5 |
+
Tested up to: 2.9.1
|
6 |
+
Stable tag: 1.7.6
|
7 |
|
8 |
+
Create and manage PollDaddy polls and ratings from within WordPress.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
The PollDaddy Polls plugin allows you to create and manage polls and ratings from within your WordPress dashboard. You can create polls, choose from 20 different styles for your polls, and view all results for your polls as they come in. All PollDaddy polls are fully customizable, you can set a close date for your poll, create multiple choice polls, choose whether to display the results or keep them private. You can also create your own custom style for your poll. You can even embed the polls you create on other websites. You can collect unlimited votes and create unlimited polls. The new ratings menu allows you to embed ratings into your posts, pages or comments.
|
13 |
|
14 |
== Installation ==
|
15 |
|
32 |
Nope. The permissions are the same as for posts. So Editors and Administrators can edit anyone's polls for that blog. Authors can only edit their own.
|
33 |
|
34 |
== Change Log ==
|
35 |
+
= 1.7.6 =
|
36 |
+
* Added PollDaddy Ratings, you can now add ratings to your posts, pages and comments
|
37 |
+
* Bug Fix: Sub-menu now highlights the correct option
|
38 |
+
|
39 |
= 1.7.5 =
|
40 |
* Bug Fix: Added fix for php warning when custom styles array empty
|
41 |
* Bug Fix: Added fix for cookie&ip option not getting set due to API change
|
style-editor.css
CHANGED
@@ -1,20 +1 @@
|
|
1 |
-
.CSSE_main{width:374px;border-collapse:collapse;padding:0px;margin:0px 6px;}
|
2 |
-
.CSSE_main_l{width:79px;border:0px;padding:11px 0px 0px 0px;text-align:right;}
|
3 |
-
.CSSE_main_l a{line-height:2;text-decoration:none;font-size:11px;text-align:right;padding-right:5px;}
|
4 |
-
.CSSE_main_r{width:295px;height:280px;padding:0px;margin:0px;border-color:#DFDFDF;border-style:solid;border-width:1px;padding:0.5em 0.9em;}
|
5 |
-
.CSSE_main_l .off{height:23px;width:79px;margin:0px 0px 3px 0px;}
|
6 |
-
.CSSE_main_l .on{-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:0;-moz-border-radius-topleft:3px;-moz-border-radius-topright:0;border-style:solid none solid solid;border-color:#DFDFDF;border-width:1px 0 1px 1px;margin-right:-1px;background-color:#F1F1F1;font-color:#333333;font-weight:bold;text-decoration:none;text-shadow:0 1px 0 #FFFFFF;border-style:solid none solid solid;}
|
7 |
-
.CSSE_main_l .Aoff,.CSSE_main_l .Aon{list-style-image:none;list-style-position:outside;list-style-type:none;margin:8px 5px 5px 0px;padding:0;white-space:nowrap;}
|
8 |
-
.CSSE_main_l .Aon{color:#333333;-moz-background-clip:border;-moz-background-inline-policy:continuous;-moz-background-origin:padding;background:transparent none repeat scroll 0 0;border:medium none;}
|
9 |
-
.CSSE_sub{width:295px;border-collapse:collapse;border:0;}
|
10 |
-
.CSSE_sub .top{height:11px;}
|
11 |
-
.CSSE_sub .btm{height:11px;}
|
12 |
-
.CSSE_edit{border-collapse:collapse;width:100%;margin:0px 0px 0px 25px;min-height:160px;}
|
13 |
-
.CSSE_edit TD{font-size:11px;color:#666;height:36px;}
|
14 |
-
.pds-clear{clear:both;display:block;}
|
15 |
-
.pds-answer-group{display:block;padding:5px 0px;}
|
16 |
-
.pds-answer-input{display:block;float:left;width:25px;}
|
17 |
-
.pds-answer{position:relative;cursor:pointer;display:block;float:left;}
|
18 |
-
.pds-answer-other{display:block;}
|
19 |
-
.pds-answer-group{display:block;}
|
20 |
-
.pds-link{display:block;float:left;}
|
1 |
+
.CSSE_main{width:374px;border-collapse:collapse;padding:0px;margin:0px 6px;} .CSSE_main_l{width:79px;border:0px;padding:11px 0px 0px 0px;text-align:right;} .CSSE_main_l a{line-height:2;text-decoration:none;font-size:11px;text-align:right;padding-right:5px;} .CSSE_main_r{width:295px;height:280px;padding:0px;margin:0px;border-color:#DFDFDF;border-style:solid;border-width:1px;padding:0.5em 0.9em;} .CSSE_main_l .off{height:23px;width:79px;margin:0px 0px 3px 0px;} .CSSE_main_l .on{-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:0;-moz-border-radius-topleft:3px;-moz-border-radius-topright:0;border-style:solid none solid solid;border-color:#DFDFDF;border-width:1px 0 1px 1px;margin-right:-1px;background-color:#F1F1F1;font-color:#333333;font-weight:bold;text-decoration:none;text-shadow:0 1px 0 #FFFFFF;border-style:solid none solid solid;} .CSSE_main_l .Aoff,.CSSE_main_l .Aon{list-style-image:none;list-style-position:outside;list-style-type:none;margin:8px 5px 5px 0px;padding:0;white-space:nowrap;}.CSSE_main_l .Aon{color:#333333;-moz-background-clip:border;-moz-background-inline-policy:continuous;-moz-background-origin:padding;background:transparent none repeat scroll 0 0;border:medium none;} .CSSE_sub{width:295px;border-collapse:collapse;border:0;} .CSSE_sub .top{height:11px;} .CSSE_sub .btm{height:11px;} .CSSE_edit{border-collapse:collapse;width:100%;margin:0px 0px 0px 25px;min-height:160px;} .CSSE_edit TD{font-size:11px;color:#666;height:36px;} .pds-clear{clear:both;display:block;} .pds-answer-group{display:block;padding:5px 0px;} .pds-answer-input{display:block;float:left;width:25px;} .pds-answer{position:relative;cursor:pointer;display:block;float:left;} .pds-answer-other{display:block;} .pds-answer-group{display:block;} .pds-link{display:block;float:left;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|