Version Description
- Added Close/Open poll to poll actions
- Added Custom Styles link to Edit poll, under Design. This link will be only present when the user has custom styles created on the PollDaddy.com site.
- Added option to make normal request every login
Download this release
Release Info
Developer | eoigal |
Plugin | Crowdsignal Dashboard – Polls, Surveys & more |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- polldaddy-client.php +45 -2
- polldaddy-xml.php +24 -1
- polldaddy.css +18 -1
- polldaddy.js +58 -5
- polldaddy.php +193 -57
- readme.txt +8 -1
polldaddy-client.php
CHANGED
@@ -324,6 +324,36 @@ class PollDaddy_Client {
|
|
324 |
return empty( $this->errors );
|
325 |
}
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
/**
|
328 |
* @see polldaddy_poll()
|
329 |
* @param array $args polldaddy_poll() args
|
@@ -487,9 +517,22 @@ class PollDaddy_Client {
|
|
487 |
return false;
|
488 |
}
|
489 |
|
490 |
-
|
491 |
-
|
|
|
|
|
492 |
function GetStyles() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
return false;
|
494 |
}
|
495 |
|
324 |
return empty( $this->errors );
|
325 |
}
|
326 |
|
327 |
+
/**
|
328 |
+
* @param int $id PollDaddy Poll ID
|
329 |
+
* @return bool success
|
330 |
+
*/
|
331 |
+
function OpenPoll( $id ) {
|
332 |
+
if ( !$id = (int) $id )
|
333 |
+
return false;
|
334 |
+
|
335 |
+
// $pos = $this->add_request( __FUNCTION__, new PollDaddy_Poll( null, compact( 'id' ) ) );
|
336 |
+
$pos = $this->add_request( 'OpenPoll', new PollDaddy_Poll( null, compact( 'id' ) ) );
|
337 |
+
$this->send_request();
|
338 |
+
|
339 |
+
return empty( $this->errors );
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* @param int $id PollDaddy Poll ID
|
344 |
+
* @return bool success
|
345 |
+
*/
|
346 |
+
function ClosePoll( $id ) {
|
347 |
+
if ( !$id = (int) $id )
|
348 |
+
return false;
|
349 |
+
|
350 |
+
// $pos = $this->add_request( __FUNCTION__, new PollDaddy_Poll( null, compact( 'id' ) ) );
|
351 |
+
$pos = $this->add_request( 'ClosePoll', new PollDaddy_Poll( null, compact( 'id' ) ) );
|
352 |
+
$this->send_request();
|
353 |
+
|
354 |
+
return empty( $this->errors );
|
355 |
+
}
|
356 |
+
|
357 |
/**
|
358 |
* @see polldaddy_poll()
|
359 |
* @param array $args polldaddy_poll() args
|
517 |
return false;
|
518 |
}
|
519 |
|
520 |
+
/* Styles */
|
521 |
+
/**
|
522 |
+
* @return array|false PollDaddy Styles or false on failure
|
523 |
+
*/
|
524 |
function GetStyles() {
|
525 |
+
$pos = $this->add_request( 'getstyles', null );
|
526 |
+
$this->send_request();
|
527 |
+
|
528 |
+
$demand = $this->response_part( $pos );
|
529 |
+
if ( isset( $demand->styles ) ) {
|
530 |
+
if ( isset( $demand->styles->style ) ) {
|
531 |
+
if ( !is_array( $demand->styles->style ) )
|
532 |
+
$demand->styles->style = array( $demand->styles->style );
|
533 |
+
}
|
534 |
+
return $demand->styles;
|
535 |
+
}
|
536 |
return false;
|
537 |
}
|
538 |
|
polldaddy-xml.php
CHANGED
@@ -192,6 +192,8 @@ class PollDaddy_Demand extends PollDaddy_XML_Object {
|
|
192 |
var $list;
|
193 |
var $search;
|
194 |
var $result;
|
|
|
|
|
195 |
}
|
196 |
|
197 |
class PollDaddy_Account extends PollDaddy_XML_Object {
|
@@ -247,6 +249,7 @@ class PollDaddy_Poll extends PollDaddy_XML_Object {
|
|
247 |
var $_responses;
|
248 |
var $_folderID;
|
249 |
var $_owner;
|
|
|
250 |
|
251 |
var $question;
|
252 |
var $multipleChoice;
|
@@ -302,6 +305,24 @@ class PollDaddy_Other_Answers extends PollDaddy_XML_Object {
|
|
302 |
var $otherAnswer;
|
303 |
}
|
304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
class PollDaddy_XML_Parser {
|
306 |
var $parser;
|
307 |
var $polldaddy_objects = array(
|
@@ -321,7 +342,9 @@ class PollDaddy_XML_Parser {
|
|
321 |
'http://api.polldaddy.com/pdapi.xsd:answers' => 'PollDaddy_Poll_Answers',
|
322 |
'http://api.polldaddy.com/pdapi.xsd:answer' => 'PollDaddy_Poll_Answer',
|
323 |
'http://api.polldaddy.com/pdapi.xsd:otherAnswers' => 'PollDaddy_Other_Answers',
|
324 |
-
'http://api.polldaddy.com/pdapi.xsd:result' => 'PollDaddy_Poll_Result'
|
|
|
|
|
325 |
);
|
326 |
|
327 |
var $object_stack = array();
|
192 |
var $list;
|
193 |
var $search;
|
194 |
var $result;
|
195 |
+
var $styles;
|
196 |
+
var $style;
|
197 |
}
|
198 |
|
199 |
class PollDaddy_Account extends PollDaddy_XML_Object {
|
249 |
var $_responses;
|
250 |
var $_folderID;
|
251 |
var $_owner;
|
252 |
+
var $_closed;
|
253 |
|
254 |
var $question;
|
255 |
var $multipleChoice;
|
305 |
var $otherAnswer;
|
306 |
}
|
307 |
|
308 |
+
class PollDaddy_Styles extends PollDaddy_XML_Object {
|
309 |
+
var $___name = 'styles';
|
310 |
+
|
311 |
+
var $style;
|
312 |
+
}
|
313 |
+
|
314 |
+
class PollDaddy_Style extends PollDaddy_XML_Object {
|
315 |
+
var $___cdata = array( 'title', 'css' );
|
316 |
+
var $___name = 'style';
|
317 |
+
|
318 |
+
var $_id;
|
319 |
+
var $_type;
|
320 |
+
|
321 |
+
var $title;
|
322 |
+
var $date;
|
323 |
+
var $css;
|
324 |
+
}
|
325 |
+
|
326 |
class PollDaddy_XML_Parser {
|
327 |
var $parser;
|
328 |
var $polldaddy_objects = array(
|
342 |
'http://api.polldaddy.com/pdapi.xsd:answers' => 'PollDaddy_Poll_Answers',
|
343 |
'http://api.polldaddy.com/pdapi.xsd:answer' => 'PollDaddy_Poll_Answer',
|
344 |
'http://api.polldaddy.com/pdapi.xsd:otherAnswers' => 'PollDaddy_Other_Answers',
|
345 |
+
'http://api.polldaddy.com/pdapi.xsd:result' => 'PollDaddy_Poll_Result',
|
346 |
+
'http://api.polldaddy.com/pdapi.xsd:styles' => 'PollDaddy_Styles',
|
347 |
+
'http://api.polldaddy.com/pdapi.xsd:style' => 'PollDaddy_Style'
|
348 |
);
|
349 |
|
350 |
var $object_stack = array();
|
polldaddy.css
CHANGED
@@ -194,7 +194,7 @@ p#add-answer-holder {
|
|
194 |
text-align: left;
|
195 |
}
|
196 |
|
197 |
-
#
|
198 |
width: 1em;
|
199 |
display: block;
|
200 |
font-size: 4em;
|
@@ -246,3 +246,20 @@ tr.polldaddy-shortcode-row pre {
|
|
246 |
margin: 0 0 .5em;
|
247 |
border: 1px solid #ccc;
|
248 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
text-align: left;
|
195 |
}
|
196 |
|
197 |
+
#design_standard a {
|
198 |
width: 1em;
|
199 |
display: block;
|
200 |
font-size: 4em;
|
246 |
margin: 0 0 .5em;
|
247 |
border: 1px solid #ccc;
|
248 |
}
|
249 |
+
|
250 |
+
.polldaddy-show-design-options{
|
251 |
+
text-align: left;
|
252 |
+
width: 8em;
|
253 |
+
display: block;
|
254 |
+
font-size: 1em;
|
255 |
+
padding: 1em 2em;
|
256 |
+
text-decoration: none;
|
257 |
+
}
|
258 |
+
|
259 |
+
.design_standard {
|
260 |
+
display: block;
|
261 |
+
}
|
262 |
+
|
263 |
+
.design_custom {
|
264 |
+
display: none;
|
265 |
+
}
|
polldaddy.js
CHANGED
@@ -49,17 +49,17 @@ jQuery(function($){
|
|
49 |
return false;
|
50 |
} );
|
51 |
|
52 |
-
var img1 = $('#
|
53 |
if ( !img1.size() ) {
|
54 |
return;
|
55 |
}
|
56 |
-
var img2 = $('#
|
57 |
var imgPath = 'http://polldaddy.com/images/';
|
58 |
|
59 |
var styleCount = $(':input[name=styleID] option').size();
|
60 |
var styles = $(':input[name=styleID]').remove();
|
61 |
var o = parseInt( styles.val() );
|
62 |
-
$('#
|
63 |
var hiddenStyleID = $('#hidden-styleID');
|
64 |
var spanStyleID = $('#span-styleID');
|
65 |
var styleIDName = $('#styleID-name');
|
@@ -73,6 +73,59 @@ jQuery(function($){
|
|
73 |
styleIDName.text( $(styles.find('option').get( ( i + o + styleCount ) % styleCount )).text() );
|
74 |
};
|
75 |
|
76 |
-
$('#
|
77 |
-
$('#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
});
|
49 |
return false;
|
50 |
} );
|
51 |
|
52 |
+
var img1 = $('#design_standard img:first');
|
53 |
if ( !img1.size() ) {
|
54 |
return;
|
55 |
}
|
56 |
+
var img2 = $('#design_standard img:last');
|
57 |
var imgPath = 'http://polldaddy.com/images/';
|
58 |
|
59 |
var styleCount = $(':input[name=styleID] option').size();
|
60 |
var styles = $(':input[name=styleID]').remove();
|
61 |
var o = parseInt( styles.val() );
|
62 |
+
$('#design_standard').append( '<input type="hidden" id="hidden-styleID" name="styleID" value="' + o.toString() + '" /><p><strong id="styleID-name">' + $(styles.find('option').get(o)).text() + '</strong><br /><span id="span-styleID">' + ( o + 1 ).toString() + '</span> of ' + styleCount + '</p>');
|
63 |
var hiddenStyleID = $('#hidden-styleID');
|
64 |
var spanStyleID = $('#span-styleID');
|
65 |
var styleIDName = $('#styleID-name');
|
73 |
styleIDName.text( $(styles.find('option').get( ( i + o + styleCount ) % styleCount )).text() );
|
74 |
};
|
75 |
|
76 |
+
$('#design_standard a.alignleft').click( function() { changePreview( -1 ); return false; } );
|
77 |
+
$('#design_standard a.alignright').click( function() { changePreview( 1 ); return false; } );
|
78 |
+
|
79 |
+
var customStyle = $(':input[name=styleID_custom]');
|
80 |
+
var customStyleVal = parseInt( customStyle.val() );
|
81 |
+
|
82 |
+
customStyle.change(function() {
|
83 |
+
var customStyleVal = parseInt( customStyle.val() );
|
84 |
+
hiddenStyleID.val( customStyleVal.toString() );
|
85 |
+
});
|
86 |
+
|
87 |
+
if ( customStyleVal > 0 ) {
|
88 |
+
$('#design_standard').hide();
|
89 |
+
$('#design_custom').show();
|
90 |
+
$('.polldaddy-show-design-options').html('Standard Styles');
|
91 |
+
hiddenStyleID.val( customStyleVal.toString() );
|
92 |
+
|
93 |
+
$('.polldaddy-show-design-options').toggle( function() {
|
94 |
+
$('#design_custom').hide();
|
95 |
+
$('#design_standard').fadeIn();
|
96 |
+
$('.polldaddy-show-design-options').html('Custom Styles');
|
97 |
+
var styleVal = parseInt( img1.attr( 'src' ).substr( imgPath.length ) );
|
98 |
+
hiddenStyleID.val( styleVal.toString() );
|
99 |
+
return false;
|
100 |
+
}, function() {
|
101 |
+
$('#design_standard').hide();
|
102 |
+
$('#design_custom').fadeIn();
|
103 |
+
$('.polldaddy-show-design-options').html('Standard Styles');
|
104 |
+
var customStyle = $(':input[name=styleID_custom]');
|
105 |
+
var customStyleVal = parseInt( customStyle.val() );
|
106 |
+
hiddenStyleID.val( customStyleVal.toString() );
|
107 |
+
return false;
|
108 |
+
} );
|
109 |
+
}
|
110 |
+
else{
|
111 |
+
$('#design_custom').hide();
|
112 |
+
$('#design_standard').show();
|
113 |
+
|
114 |
+
$('.polldaddy-show-design-options').toggle( function() {
|
115 |
+
$('#design_standard').hide();
|
116 |
+
$('#design_custom').fadeIn();
|
117 |
+
$('.polldaddy-show-design-options').html('Standard Styles');
|
118 |
+
var customStyle = $(':input[name=styleID_custom]');
|
119 |
+
var customStyleVal = parseInt( customStyle.val() );
|
120 |
+
hiddenStyleID.val( customStyleVal.toString() );
|
121 |
+
return false;
|
122 |
+
}, function() {
|
123 |
+
$('#design_custom').hide();
|
124 |
+
$('#design_standard').fadeIn();
|
125 |
+
$('.polldaddy-show-design-options').html('Custom Styles');
|
126 |
+
var styleVal = parseInt( img1.attr( 'src' ).substr( imgPath.length ) );
|
127 |
+
hiddenStyleID.val( styleVal.toString() );
|
128 |
+
return false;
|
129 |
+
} );
|
130 |
+
}
|
131 |
});
|
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.
|
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.
|
28 |
|
29 |
var $polldaddy_clients = array();
|
30 |
|
@@ -99,9 +99,9 @@ class WP_PollDaddy {
|
|
99 |
|
100 |
if ( !empty( $_POST['polldaddy_use_ssl_checkbox'] ) ) {
|
101 |
if ( $polldaddy_use_ssl = (int) $_POST['polldaddy_use_ssl'] ) {
|
102 |
-
$this->use_ssl =
|
103 |
} else {
|
104 |
-
$this->use_ssl = 1;
|
105 |
$this->scheme = 'http';
|
106 |
}
|
107 |
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
@@ -172,7 +172,7 @@ class WP_PollDaddy {
|
|
172 |
if ( 1 !== $this->use_ssl ) {
|
173 |
$this->errors->add( 'polldaddy_api_key', __( 'If your email address and password are correct, your host may not support secure logins.' ) );
|
174 |
$this->errors->add( 'polldaddy_api_key', __( 'In that case, you may be able to log in to PollDaddy by unchecking the "Use SSL to Log in" checkbox.' ) );
|
175 |
-
$this->use_ssl =
|
176 |
}
|
177 |
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
178 |
return false;
|
@@ -256,11 +256,9 @@ class WP_PollDaddy {
|
|
256 |
</td>
|
257 |
</tr>
|
258 |
<?php
|
259 |
-
|
260 |
-
if ( $this->use_ssl
|
261 |
-
$checked = '';
|
262 |
-
if ( $this->use_ssl == 2 )
|
263 |
-
$checked = 'checked="checked"';
|
264 |
?>
|
265 |
<tr class="form-field form-required">
|
266 |
<th valign="top" scope="row">
|
@@ -271,9 +269,7 @@ class WP_PollDaddy {
|
|
271 |
<label for="polldaddy-use-ssl">This ensures a secure login to your PollDaddy account. Only uncheck if you are having problems logging in.</label>
|
272 |
<input type="hidden" name="polldaddy_use_ssl_checkbox" value="1" />
|
273 |
</td>
|
274 |
-
</tr
|
275 |
-
}
|
276 |
-
?>
|
277 |
</tbody>
|
278 |
</table>
|
279 |
<p class="submit">
|
@@ -380,6 +376,78 @@ class WP_PollDaddy {
|
|
380 |
$query_args['message'] = 'deleted';
|
381 |
$query_args['deleted'] = count( (array) $poll );
|
382 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
case 'edit-poll' : // TODO: use polldaddy_poll
|
384 |
if ( !$is_POST || !$poll = (int) $poll )
|
385 |
return;
|
@@ -566,6 +634,20 @@ class WP_PollDaddy {
|
|
566 |
else
|
567 |
$message = sprintf( __ngettext( '%s Poll Deleted.', '%s Polls Deleted.', $deleted ), number_format_i18n( $deleted ) );
|
568 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
case 'updated' :
|
570 |
$message = __( 'Poll updated.' );
|
571 |
break;
|
@@ -626,7 +708,7 @@ class WP_PollDaddy {
|
|
626 |
); ?></h2>
|
627 |
|
628 |
<?php
|
629 |
-
echo do_shortcode( "[polldaddy poll=$poll]" );
|
630 |
break;
|
631 |
case 'results' :
|
632 |
?>
|
@@ -709,9 +791,11 @@ class WP_PollDaddy {
|
|
709 |
<select name="action">
|
710 |
<option selected="selected" value=""><?php _e( 'Actions' ); ?></option>
|
711 |
<option value="delete"><?php _e( 'Delete' ); ?></option>
|
|
|
|
|
712 |
</select>
|
713 |
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply' ); ?>" />
|
714 |
-
<?php wp_nonce_field( '
|
715 |
</div>
|
716 |
<div class="tablenav-pages"><?php echo $page_links; ?></div>
|
717 |
</div>
|
@@ -731,6 +815,8 @@ class WP_PollDaddy {
|
|
731 |
if ( $polls ) :
|
732 |
foreach ( $polls as $poll ) :
|
733 |
$poll_id = (int) $poll->_id;
|
|
|
|
|
734 |
|
735 |
if ( $this->can_edit( $poll ) )
|
736 |
$edit_link = clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll_id, 'message' => false ) ) );
|
@@ -740,6 +826,8 @@ class WP_PollDaddy {
|
|
740 |
$class = $class ? '' : ' class="alternate"';
|
741 |
$results_link = clean_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll_id, 'message' => false ) ) );
|
742 |
$delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'poll' => $poll_id, 'message' => false ) ), "delete-poll_$poll_id" ) );
|
|
|
|
|
743 |
$preview_link = clean_url( add_query_arg( array( 'action' => 'preview', 'poll' => $poll_id, 'message' => false ) ) ); //, 'iframe' => '', 'TB_iframe' => 'true' ) ) );
|
744 |
list($poll_time) = explode( '.', $poll->_created );
|
745 |
$poll_time = strtotime( $poll_time );
|
@@ -757,6 +845,11 @@ class WP_PollDaddy {
|
|
757 |
|
758 |
<span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results' ); ?></a> | </span>
|
759 |
<span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete' ); ?></a> | </span>
|
|
|
|
|
|
|
|
|
|
|
760 |
<?php if ( isset( $_GET['iframe'] ) ) : ?>
|
761 |
<span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview' ); ?></a> | </span>
|
762 |
<span class="editor">
|
@@ -994,51 +1087,92 @@ class WP_PollDaddy {
|
|
994 |
|
995 |
<div id="design" class="postbox">
|
996 |
|
997 |
-
<?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
998 |
|
999 |
<h3><?php _e( 'Design' ); ?></h3>
|
1000 |
|
1001 |
<div class="inside">
|
1002 |
-
<div
|
1003 |
-
<
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1007 |
</div>
|
1008 |
-
|
1009 |
-
<
|
1010 |
-
<
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
16 => 'Sunset',
|
1031 |
-
17 => 'Pink Butterflies',
|
1032 |
-
18 => 'Map'
|
1033 |
-
);
|
1034 |
-
foreach ( $options as $styleID => $label ) :
|
1035 |
-
$selected = $styleID == $style_ID ? ' selected="selected"' : '';
|
1036 |
-
?>
|
1037 |
-
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
|
1038 |
-
<?php endforeach; ?>
|
1039 |
-
|
1040 |
-
</select>
|
1041 |
-
</p>
|
1042 |
</div>
|
1043 |
</div>
|
1044 |
|
@@ -1156,11 +1290,13 @@ add_action( 'init', 'polldaddy_loader' );
|
|
1156 |
function polldaddy_shortcode($atts, $content=null) {
|
1157 |
extract(shortcode_atts(array(
|
1158 |
'poll' => 'empty',
|
|
|
1159 |
), $atts));
|
1160 |
|
1161 |
$poll = (int) $poll;
|
1162 |
-
|
1163 |
-
|
|
|
1164 |
}
|
1165 |
|
1166 |
add_shortcode('polldaddy', 'polldaddy_shortcode');
|
5 |
Description: Create and manage PollDaddy polls in WordPress
|
6 |
Author: Automattic, Inc.
|
7 |
Author URL: http://automattic.com/
|
8 |
+
Version: 1.3
|
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.3';
|
28 |
|
29 |
var $polldaddy_clients = array();
|
30 |
|
99 |
|
100 |
if ( !empty( $_POST['polldaddy_use_ssl_checkbox'] ) ) {
|
101 |
if ( $polldaddy_use_ssl = (int) $_POST['polldaddy_use_ssl'] ) {
|
102 |
+
$this->use_ssl = 0; //checked (by default)
|
103 |
} else {
|
104 |
+
$this->use_ssl = 1; //unchecked
|
105 |
$this->scheme = 'http';
|
106 |
}
|
107 |
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
172 |
if ( 1 !== $this->use_ssl ) {
|
173 |
$this->errors->add( 'polldaddy_api_key', __( 'If your email address and password are correct, your host may not support secure logins.' ) );
|
174 |
$this->errors->add( 'polldaddy_api_key', __( 'In that case, you may be able to log in to PollDaddy by unchecking the "Use SSL to Log in" checkbox.' ) );
|
175 |
+
$this->use_ssl = 0;
|
176 |
}
|
177 |
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
178 |
return false;
|
256 |
</td>
|
257 |
</tr>
|
258 |
<?php
|
259 |
+
$checked = '';
|
260 |
+
if ( $this->use_ssl == 0 )
|
261 |
+
$checked = 'checked="checked"';
|
|
|
|
|
262 |
?>
|
263 |
<tr class="form-field form-required">
|
264 |
<th valign="top" scope="row">
|
269 |
<label for="polldaddy-use-ssl">This ensures a secure login to your PollDaddy account. Only uncheck if you are having problems logging in.</label>
|
270 |
<input type="hidden" name="polldaddy_use_ssl_checkbox" value="1" />
|
271 |
</td>
|
272 |
+
</tr>
|
|
|
|
|
273 |
</tbody>
|
274 |
</table>
|
275 |
<p class="submit">
|
376 |
$query_args['message'] = 'deleted';
|
377 |
$query_args['deleted'] = count( (array) $poll );
|
378 |
break;
|
379 |
+
case 'open' :
|
380 |
+
if ( empty( $poll ) )
|
381 |
+
return;
|
382 |
+
|
383 |
+
if ( is_array( $poll ) )
|
384 |
+
check_admin_referer( 'action-poll_bulk' );
|
385 |
+
else
|
386 |
+
check_admin_referer( "open-poll_$poll" );
|
387 |
+
|
388 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
389 |
+
|
390 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
391 |
+
$polldaddy->reset();
|
392 |
+
$poll_object = $polldaddy->GetPoll( $poll );
|
393 |
+
|
394 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
395 |
+
$this->errors->add( 'permission', __( 'You are not allowed to delete this poll.' ) );
|
396 |
+
return false;
|
397 |
+
}
|
398 |
+
|
399 |
+
// Send Poll Author credentials
|
400 |
+
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
401 |
+
$polldaddy->reset();
|
402 |
+
if ( !$userCode = $polldaddy->GetUserCode( $poll_object->_owner ) ) {
|
403 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
404 |
+
}
|
405 |
+
$polldaddy->userCode = $userCode;
|
406 |
+
}
|
407 |
+
|
408 |
+
$polldaddy->reset();
|
409 |
+
$polldaddy->OpenPoll( $poll_id );
|
410 |
+
}
|
411 |
+
|
412 |
+
$query_args['message'] = 'opened';
|
413 |
+
$query_args['opened'] = count( (array) $poll );
|
414 |
+
break;
|
415 |
+
case 'close' :
|
416 |
+
if ( empty( $poll ) )
|
417 |
+
return;
|
418 |
+
|
419 |
+
if ( is_array( $poll ) )
|
420 |
+
check_admin_referer( 'action-poll_bulk' );
|
421 |
+
else
|
422 |
+
check_admin_referer( "close-poll_$poll" );
|
423 |
+
|
424 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
|
425 |
+
|
426 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
427 |
+
$polldaddy->reset();
|
428 |
+
$poll_object = $polldaddy->GetPoll( $poll );
|
429 |
+
|
430 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
431 |
+
$this->errors->add( 'permission', __( 'You are not allowed to delete this poll.' ) );
|
432 |
+
return false;
|
433 |
+
}
|
434 |
+
|
435 |
+
// Send Poll Author credentials
|
436 |
+
if ( !empty( $poll_object->_owner ) && $current_user->ID != $poll_object->_owner ) {
|
437 |
+
$polldaddy->reset();
|
438 |
+
if ( !$userCode = $polldaddy->GetUserCode( $poll_object->_owner ) ) {
|
439 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author' ) );
|
440 |
+
}
|
441 |
+
$polldaddy->userCode = $userCode;
|
442 |
+
}
|
443 |
+
|
444 |
+
$polldaddy->reset();
|
445 |
+
$polldaddy->ClosePoll( $poll_id );
|
446 |
+
}
|
447 |
+
|
448 |
+
$query_args['message'] = 'closed';
|
449 |
+
$query_args['closed'] = count( (array) $poll );
|
450 |
+
break;
|
451 |
case 'edit-poll' : // TODO: use polldaddy_poll
|
452 |
if ( !$is_POST || !$poll = (int) $poll )
|
453 |
return;
|
634 |
else
|
635 |
$message = sprintf( __ngettext( '%s Poll Deleted.', '%s Polls Deleted.', $deleted ), number_format_i18n( $deleted ) );
|
636 |
break;
|
637 |
+
case 'opened' :
|
638 |
+
$opened = (int) $_GET['opened'];
|
639 |
+
if ( 1 == $opened )
|
640 |
+
$message = __( 'Poll opened.' );
|
641 |
+
else
|
642 |
+
$message = sprintf( __ngettext( '%s Poll Opened.', '%s Polls Opened.', $opened ), number_format_i18n( $opened ) );
|
643 |
+
break;
|
644 |
+
case 'closed' :
|
645 |
+
$closed = (int) $_GET['closed'];
|
646 |
+
if ( 1 == $closed )
|
647 |
+
$message = __( 'Poll closed.' );
|
648 |
+
else
|
649 |
+
$message = sprintf( __ngettext( '%s Poll Closed.', '%s Polls Closed.', $closed ), number_format_i18n( $closed ) );
|
650 |
+
break;
|
651 |
case 'updated' :
|
652 |
$message = __( 'Poll updated.' );
|
653 |
break;
|
708 |
); ?></h2>
|
709 |
|
710 |
<?php
|
711 |
+
echo do_shortcode( "[polldaddy poll=$poll cb=1]" );
|
712 |
break;
|
713 |
case 'results' :
|
714 |
?>
|
791 |
<select name="action">
|
792 |
<option selected="selected" value=""><?php _e( 'Actions' ); ?></option>
|
793 |
<option value="delete"><?php _e( 'Delete' ); ?></option>
|
794 |
+
<option value="close"><?php _e( 'Close' ); ?></option>
|
795 |
+
<option value="open"><?php _e( 'Open' ); ?></option>
|
796 |
</select>
|
797 |
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply' ); ?>" />
|
798 |
+
<?php wp_nonce_field( 'action-poll_bulk' ); ?>
|
799 |
</div>
|
800 |
<div class="tablenav-pages"><?php echo $page_links; ?></div>
|
801 |
</div>
|
815 |
if ( $polls ) :
|
816 |
foreach ( $polls as $poll ) :
|
817 |
$poll_id = (int) $poll->_id;
|
818 |
+
|
819 |
+
$poll_closed = (int) $poll->_closed;
|
820 |
|
821 |
if ( $this->can_edit( $poll ) )
|
822 |
$edit_link = clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll_id, 'message' => false ) ) );
|
826 |
$class = $class ? '' : ' class="alternate"';
|
827 |
$results_link = clean_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll_id, 'message' => false ) ) );
|
828 |
$delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'poll' => $poll_id, 'message' => false ) ), "delete-poll_$poll_id" ) );
|
829 |
+
$open_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'open', 'poll' => $poll_id, 'message' => false ) ), "open-poll_$poll_id" ) );
|
830 |
+
$close_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'close', 'poll' => $poll_id, 'message' => false ) ), "close-poll_$poll_id" ) );
|
831 |
$preview_link = clean_url( add_query_arg( array( 'action' => 'preview', 'poll' => $poll_id, 'message' => false ) ) ); //, 'iframe' => '', 'TB_iframe' => 'true' ) ) );
|
832 |
list($poll_time) = explode( '.', $poll->_created );
|
833 |
$poll_time = strtotime( $poll_time );
|
845 |
|
846 |
<span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results' ); ?></a> | </span>
|
847 |
<span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete' ); ?></a> | </span>
|
848 |
+
<?php if ( $poll_closed == 2 ) : ?>
|
849 |
+
<span class="open"><a class="open-poll" href="<?php echo $open_link; ?>"><?php _e( 'Open' ); ?></a> | </span>
|
850 |
+
<?php else : ?>
|
851 |
+
<span class="close"><a class="close-poll" href="<?php echo $close_link; ?>"><?php _e( 'Close' ); ?></a> | </span>
|
852 |
+
<?php endif; ?>
|
853 |
<?php if ( isset( $_GET['iframe'] ) ) : ?>
|
854 |
<span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview' ); ?></a> | </span>
|
855 |
<span class="editor">
|
1087 |
|
1088 |
<div id="design" class="postbox">
|
1089 |
|
1090 |
+
<?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID );
|
1091 |
+
|
1092 |
+
$options = array(
|
1093 |
+
0 => 'Grey Plastic Standard',
|
1094 |
+
1 => 'White Plastic Standard',
|
1095 |
+
2 => 'Black Plastic Standard',
|
1096 |
+
3 => 'Simple Grey',
|
1097 |
+
4 => 'Simple White',
|
1098 |
+
5 => 'Simple Dark',
|
1099 |
+
6 => 'Thinking 1',
|
1100 |
+
7 => 'Thinking 2',
|
1101 |
+
8 => 'Manga',
|
1102 |
+
9 => 'Working 1',
|
1103 |
+
10 => 'Working 2',
|
1104 |
+
11 => 'SideBar Narrow (Dark)',
|
1105 |
+
12 => 'SideBar Narrow (Light)',
|
1106 |
+
13 => 'SideBar Narrow (Grey)',
|
1107 |
+
14 => 'Skulls',
|
1108 |
+
15 => 'Music',
|
1109 |
+
16 => 'Sunset',
|
1110 |
+
17 => 'Pink Butterflies',
|
1111 |
+
18 => 'Map'
|
1112 |
+
);
|
1113 |
+
|
1114 |
+
$polldaddy->reset();
|
1115 |
+
$styles = $polldaddy->GetStyles();
|
1116 |
+
|
1117 |
+
$show_custom = false;
|
1118 |
+
if( isset( $styles ) && count( $styles ) > 0 ){
|
1119 |
+
$show_custom = true;
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
if ( $style_ID > 18 ){
|
1123 |
+
$standard_style_ID = 0;
|
1124 |
+
$custom_style_ID = $style_ID;
|
1125 |
+
}
|
1126 |
+
else{
|
1127 |
+
$standard_style_ID = $style_ID;
|
1128 |
+
$custom_style_ID = 0;
|
1129 |
+
}
|
1130 |
+
?>
|
1131 |
|
1132 |
<h3><?php _e( 'Design' ); ?></h3>
|
1133 |
|
1134 |
<div class="inside">
|
1135 |
+
<div id="design_standard" >
|
1136 |
+
<div class="hide-if-no-js">
|
1137 |
+
<a class="alignleft" href="#previous">«</a>
|
1138 |
+
<a class="alignright" href="#next">»</a>
|
1139 |
+
<img src="http://polldaddy.com/images/<?php echo $standard_style_ID; ?>.gif" />
|
1140 |
+
<img class="hide-if-js" src="http://polldaddy.com/images/<?php echo 1 + $standard_style_ID; ?>.gif" />
|
1141 |
+
</div>
|
1142 |
+
|
1143 |
+
<p class="hide-if-js" id="no-js-styleID">
|
1144 |
+
<select name="styleID">
|
1145 |
+
|
1146 |
+
<?php foreach ( $options as $styleID => $label ) :
|
1147 |
+
$selected = $styleID == $standard_style_ID ? ' selected="selected"' : ''; ?>
|
1148 |
+
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
|
1149 |
+
<?php endforeach; ?>
|
1150 |
+
|
1151 |
+
</select>
|
1152 |
+
</p>
|
1153 |
</div>
|
1154 |
+
<?php if ( $show_custom ){ ?>
|
1155 |
+
<div id="design_custom">
|
1156 |
+
<p class="hide-if-no-js">
|
1157 |
+
You can select from the list of custom styles that you created on PollDaddy.com
|
1158 |
+
<br />
|
1159 |
+
<br />
|
1160 |
+
Select a custom style:
|
1161 |
+
<select name="styleID_custom">
|
1162 |
+
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
1163 |
+
<option value="0"<?php echo $selected; ?>></option>
|
1164 |
+
<?php foreach ( $styles->style as $style ) :
|
1165 |
+
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
1166 |
+
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
|
1167 |
+
<?php endforeach;?>
|
1168 |
+
|
1169 |
+
</select>
|
1170 |
+
</p>
|
1171 |
+
</div>
|
1172 |
+
<div id="design_options">
|
1173 |
+
<a href="#" class="polldaddy-show-design-options">Custom Styles</a>
|
1174 |
+
</div>
|
1175 |
+
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1176 |
</div>
|
1177 |
</div>
|
1178 |
|
1290 |
function polldaddy_shortcode($atts, $content=null) {
|
1291 |
extract(shortcode_atts(array(
|
1292 |
'poll' => 'empty',
|
1293 |
+
'cb' => '',
|
1294 |
), $atts));
|
1295 |
|
1296 |
$poll = (int) $poll;
|
1297 |
+
$cb = ( $cb == 1 ? '?cb=' . mktime() : '' );
|
1298 |
+
|
1299 |
+
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>";
|
1300 |
}
|
1301 |
|
1302 |
add_shortcode('polldaddy', 'polldaddy_shortcode');
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mdawaffe, eoigal
|
|
3 |
Tags: poll, polls, polldaddy, WordPress.com
|
4 |
Requires at least: 2.6
|
5 |
Tested up to: 2.7.1
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
Create and manage PollDaddy polls from within WordPress.
|
9 |
|
@@ -15,6 +15,8 @@ The PollDaddy plugin allows you to create and manage your [PollDaddy.com](http:/
|
|
15 |
|
16 |
Upload the plugin to your blog, Activate it, then enter your PollDaddy.com email address and password.
|
17 |
|
|
|
|
|
18 |
== Frequently Asked Questions ==
|
19 |
|
20 |
= I have multiple authors on my blog? What happens? =
|
@@ -31,6 +33,11 @@ Nope. The permissions are the same as for posts. So Editors and Administrators
|
|
31 |
|
32 |
== Change Log ==
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
= 1.2 =
|
35 |
Bug Fix: SSL request for PollDaddy API key sometimes failed due to host constraints, included option to make a normal http request in this case.
|
36 |
Bug Fix: Redirect after login now goes to list polls
|
3 |
Tags: poll, polls, polldaddy, WordPress.com
|
4 |
Requires at least: 2.6
|
5 |
Tested up to: 2.7.1
|
6 |
+
Stable tag: 1.3
|
7 |
|
8 |
Create and manage PollDaddy polls from within WordPress.
|
9 |
|
15 |
|
16 |
Upload the plugin to your blog, Activate it, then enter your PollDaddy.com email address and password.
|
17 |
|
18 |
+
More info here - http://support.polldaddy.com/installing-wordpress-org-plugin/
|
19 |
+
|
20 |
== Frequently Asked Questions ==
|
21 |
|
22 |
= I have multiple authors on my blog? What happens? =
|
33 |
|
34 |
== Change Log ==
|
35 |
|
36 |
+
= 1.3 =
|
37 |
+
* Added Close/Open poll to poll actions
|
38 |
+
* Added Custom Styles link to Edit poll, under Design. This link will be only present when the user has custom styles created on the PollDaddy.com site.
|
39 |
+
* Added option to make normal request every login
|
40 |
+
|
41 |
= 1.2 =
|
42 |
Bug Fix: SSL request for PollDaddy API key sometimes failed due to host constraints, included option to make a normal http request in this case.
|
43 |
Bug Fix: Redirect after login now goes to list polls
|