Crowdsignal Dashboard – Polls, Surveys & more - Version 1.7.7

Version Description

  • Added a block repeat vote expiration setting to allow users to set how long to block out repeat voters from repeat voting
  • Bug Fix: Fixed notices thrown by ratings when first loaded, empty response from API.
Download this release

Release Info

Developer eoigal
Plugin Icon 128x128 Crowdsignal Dashboard – Polls, Surveys & more
Version 1.7.7
Comparing to
See all releases

Code changes from version 1.7.6 to 1.7.7

Files changed (6) hide show
  1. polldaddy-client.php +2 -1
  2. polldaddy-xml.php +3 -2
  3. polldaddy.css +1 -1
  4. polldaddy.js +1 -4
  5. polldaddy.php +74 -27
  6. readme.txt +7 -3
polldaddy-client.php CHANGED
@@ -1074,7 +1074,7 @@ function &polldaddy_poll( $args = null, $id = null, $_require_data = true ) {
1074
  $args[$bool] = $defaults[$bool];
1075
  }
1076
 
1077
- foreach ( array( 'styleID', 'packID', 'folderID', 'languageID', 'choices' ) as $int )
1078
  if ( !is_numeric( $args[$int] ) )
1079
  $args[$bool] = $defaults[$int];
1080
 
@@ -1113,6 +1113,7 @@ function _polldaddy_poll_defaults() {
1113
  'otherAnswer' => 'no',
1114
  'resultsType' => 'show',
1115
  'blockRepeatVotersType' => 'cookie',
 
1116
  'comments' => 'allow',
1117
  'makePublic' => 'yes',
1118
  'closePoll' => 'no',
1074
  $args[$bool] = $defaults[$bool];
1075
  }
1076
 
1077
+ foreach ( array( 'styleID', 'packID', 'folderID', 'languageID', 'choices', 'blockExpiration' ) as $int )
1078
  if ( !is_numeric( $args[$int] ) )
1079
  $args[$bool] = $defaults[$int];
1080
 
1113
  'otherAnswer' => 'no',
1114
  'resultsType' => 'show',
1115
  'blockRepeatVotersType' => 'cookie',
1116
+ 'blockExpiration' => 0,
1117
  'comments' => 'allow',
1118
  'makePublic' => 'yes',
1119
  'closePoll' => 'no',
polldaddy-xml.php CHANGED
@@ -300,7 +300,8 @@ class PollDaddy_Poll extends PollDaddy_XML_Object {
300
  var $randomiseAnswers;
301
  var $otherAnswer;
302
  var $resultsType;
303
- var $blockRepeatVotersType;
 
304
  var $comments;
305
  var $makePublic;
306
  var $closePoll;
@@ -710,7 +711,7 @@ class PollDaddy_XML_Parser {
710
 
711
  $new = $this->polldaddy_objects[$tag];
712
  $new_object =& new $new( $this->object_stack[$this->object_pos]['args'], $this->object_stack[$this->object_pos]['atts'] );
713
-
714
  if ( is_numeric( $this->object_stack[$this->object_pos]['parent'] ) ) {
715
  $this->object_pos = $this->object_stack[$this->object_pos]['parent'];
716
  if ( $this->object_stack[$this->object_pos]['args_tag_pos'] ) {
300
  var $randomiseAnswers;
301
  var $otherAnswer;
302
  var $resultsType;
303
+ var $blockRepeatVotersType;
304
+ var $blockExpiration;
305
  var $comments;
306
  var $makePublic;
307
  var $closePoll;
711
 
712
  $new = $this->polldaddy_objects[$tag];
713
  $new_object =& new $new( $this->object_stack[$this->object_pos]['args'], $this->object_stack[$this->object_pos]['atts'] );
714
+
715
  if ( is_numeric( $this->object_stack[$this->object_pos]['parent'] ) ) {
716
  $this->object_pos = $this->object_stack[$this->object_pos]['parent'];
717
  if ( $this->object_stack[$this->object_pos]['args_tag_pos'] ) {
polldaddy.css CHANGED
@@ -2,4 +2,4 @@ html,body{height:auto !important;} body.poll-preview-iframe{min-width:0;} body.p
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;}
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:152px;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:9px;width:300px;text-align:center;}
polldaddy.js CHANGED
@@ -1,4 +1 @@
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">&#x2195;</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="#">&times;</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"); } }); });
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();delAnswerPrep( $('#answers').append( '<li><span class="handle">&#x2195;</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="#">&times;</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; } );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{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"); } });$( '.block-repeat' ).click( function(){var repeat = jQuery( this ).val();if( repeat == 'off' ){$( '#cookieip_expiration_label' ).hide();$( '#cookieip_expiration' ).hide();}else{$( '#cookieip_expiration_label' ).show();$( '#cookieip_expiration' ).show();} } ); });
 
 
 
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.6
9
  */
10
 
11
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
@@ -15,7 +15,7 @@ if ( !defined( 'WP_POLLDADDY__CLASS' ) )
15
  define( 'WP_POLLDADDY__CLASS', 'WP_PollDaddy' );
16
 
17
  if ( !defined( 'WP_POLLDADDY__POLLDADDY_CLIENT_PATH' ) )
18
- define( 'WP_POLLDADDY__POLLDADDY_CLIENT_PATH', dirname( __FILE__ ) . '/polldaddy-client.php' );
19
 
20
  // TODO: when user changes PollDaddy password, userCode changes
21
  class WP_PollDaddy {
@@ -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.6';
28
 
29
  var $polldaddy_clients = array();
30
 
@@ -345,6 +345,7 @@ class WP_PollDaddy {
345
  endswitch;
346
  } elseif( $page == 'ratings' ) {
347
  switch ( $action ) :
 
348
  case 'reports' :
349
  $plugin_page = 'ratings&amp;action=reports';
350
  break;
@@ -621,6 +622,14 @@ class WP_PollDaddy {
621
  }
622
  $poll_data['styleID'] = (int) $_POST['styleID'];
623
  $poll_data['choices'] = (int) $_POST['choices'];
 
 
 
 
 
 
 
 
624
 
625
  $polldaddy->reset();
626
 
@@ -676,7 +685,15 @@ class WP_PollDaddy {
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 );
@@ -1257,12 +1274,24 @@ class WP_PollDaddy {
1257
  ?>
1258
 
1259
  <li>
1260
- <label for="blockRepeatVotersType-<?php echo $value; ?>"><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1261
  </li>
1262
 
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>
@@ -2881,15 +2910,23 @@ enter a numeric value in pixels.
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 {
@@ -2907,19 +2944,23 @@ enter a numeric value in pixels.
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">
@@ -3358,18 +3399,21 @@ enter a numeric value in pixels.
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 );
@@ -3380,12 +3424,12 @@ enter a numeric value in pixels.
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';
@@ -3481,11 +3525,14 @@ enter a numeric value in pixels.
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 ) ),
5
  Description: Create and manage PollDaddy polls in WordPress
6
  Author: Automattic, Inc.
7
  Author URL: http://automattic.com/
8
+ Version: 1.7.7
9
  */
10
 
11
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
15
  define( 'WP_POLLDADDY__CLASS', 'WP_PollDaddy' );
16
 
17
  if ( !defined( 'WP_POLLDADDY__POLLDADDY_CLIENT_PATH' ) )
18
+ define( 'WP_POLLDADDY__POLLDADDY_CLIENT_PATH', dirname( __FILE__ ) . '/polldaddy-client.php' );
19
 
20
  // TODO: when user changes PollDaddy password, userCode changes
21
  class WP_PollDaddy {
24
  var $base_url = false;
25
  var $use_ssl = 0;
26
  var $scheme = 'https';
27
+ var $version = '1.7.7';
28
 
29
  var $polldaddy_clients = array();
30
 
345
  endswitch;
346
  } elseif( $page == 'ratings' ) {
347
  switch ( $action ) :
348
+ case 'change-report' :
349
  case 'reports' :
350
  $plugin_page = 'ratings&amp;action=reports';
351
  break;
622
  }
623
  $poll_data['styleID'] = (int) $_POST['styleID'];
624
  $poll_data['choices'] = (int) $_POST['choices'];
625
+
626
+ if ( $poll_data['blockRepeatVotersType'] == 'cookie' ){
627
+ if( isset( $_POST['cookieip_expiration'] ) )
628
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
629
+ } elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ){
630
+ if( isset( $_POST['cookieip_expiration'] ) )
631
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
632
+ }
633
 
634
  $polldaddy->reset();
635
 
685
  }
686
  }
687
  $poll_data['styleID'] = (int) $_POST['styleID'];
688
+ $poll_data['choices'] = (int) $_POST['choices'];
689
+
690
+ if ( $poll_data['blockRepeatVotersType'] == 'cookie' ){
691
+ if( isset( $_POST['cookieip_expiration'] ) )
692
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
693
+ } elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ){
694
+ if( isset( $_POST['cookieip_expiration'] ) )
695
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
696
+ }
697
 
698
  $poll = $polldaddy->create_poll( $poll_data );
699
  $this->parse_errors( $polldaddy );
1274
  ?>
1275
 
1276
  <li>
1277
+ <label for="blockRepeatVotersType-<?php echo $value; ?>"><input class="block-repeat" type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1278
  </li>
1279
 
1280
  <?php endforeach; ?>
1281
 
1282
  </ul>
1283
+
1284
+ <span style="margin:6px 6px 8px;" id="cookieip_expiration_label"><label><?php _e( 'Expires: ' ); ?></label></span>
1285
+ <select id="cookieip_expiration" name="cookieip_expiration" style="width: auto;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?>">
1286
+ <option value="0" <?php echo (int) $poll->blockExpiration == 0 ? 'selected' : ''; ?>><?php _e( 'Never' ); ?></option>
1287
+ <option value="3600" <?php echo (int) $poll->blockExpiration == 3600 ? 'selected' : ''; ?>><?php printf( __('%d hour'), 1 ); ?></option>
1288
+ <option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected' : ''; ?>><?php printf( __('%d hours'), 3 ); ?></option>
1289
+ <option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected' : ''; ?>><?php printf( __('%d hours'), 6 ); ?></option>
1290
+ <option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected' : ''; ?>><?php printf( __('%d hours'), 12 ); ?></option>
1291
+ <option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected' : ''; ?>><?php printf( __('%d day'), 1 ); ?></option>
1292
+ <option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected' : ''; ?>><?php printf( __('%d week'), 1 ); ?></option>
1293
+ <option value="2419200" <?php echo (int) $poll->blockExpiration == 2419200 ? 'selected' : ''; ?>><?php printf( __('%d month'), 1 ); ?></option>
1294
+ </select>
1295
  <p><?php _e( 'Note: Blocking by cookie and IP address can be problematic for some voters.'); ?></p>
1296
  </div>
1297
  </div>
2910
  $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, WP_POLLDADDY__USERCODE );
2911
  $polldaddy->reset();
2912
  $response = $polldaddy->get_rating( $rating_id );
2913
+
2914
+ if ( empty( $response ) || (int) $response->_id == 0 ) {
2915
  $polldaddy->reset();
2916
  $new_type = 0;
2917
  if ( $report_type == 'comments' )
2918
  $new_type = 1;
2919
+
2920
+ $blog_name = get_option( 'blogname' );
2921
+
2922
+ if ( empty( $blog_name ) )
2923
+ $blog_name = 'WPORG Blog';
2924
+
2925
+ $blog_name .= ' - ' . $report_type;
2926
 
2927
+ $response = $polldaddy->create_rating( $blog_name , $new_type );
2928
 
2929
+ if( empty( $response ) ) {
2930
  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>';
2931
  $error = true;
2932
  } else {
2944
  case 'comments':
2945
  $show_comments = 0;
2946
  break;
2947
+ endswitch;
2948
  }
2949
+ $polldaddy->reset();
2950
+ $response = $polldaddy->get_rating( $rating_id );
2951
  }
2952
+
2953
+ if ( !empty( $response ) ) {
2954
+ $settings_text = $response->settings;
2955
+ $settings = json_decode( $settings_text );
2956
 
 
 
 
 
 
 
2957
  $rating_type = 0;
2958
+
2959
+ if( $settings->type == 'stars' )
2960
+ $rating_type = 0;
2961
+ else
2962
+ $rating_type = 1;
2963
+ }
2964
 
2965
  ?>
2966
  <div class="wrap">
3399
  function update_rating(){
3400
  $rating_type = 0;
3401
  $rating_id = 0;
3402
+ $set = null;
3403
 
3404
  if( isset( $_REQUEST['rating_id'] ) )
3405
  $rating_id = (int) $_REQUEST['rating_id'];
3406
 
3407
+ if( isset( $_REQUEST['rating_type'] ) && $_REQUEST['rating_type'] == 'stars' ) {
3408
  $set->type = 'stars';
3409
  $rating_type = 0;
3410
+ if( isset( $_REQUEST['star_color'] ) )
3411
+ $set->star_color = attribute_escape( $_REQUEST['star_color'] );
3412
  } else {
3413
  $set->type = 'nero';
3414
  $rating_type = 1;
3415
+ if( isset( $_REQUEST['nero_style'] ) )
3416
+ $set->star_color = attribute_escape( $_REQUEST['nero_style'] );
3417
  }
3418
 
3419
  $set->size = wp_specialchars( $_REQUEST['size'], 1 );
3424
  $set->font_size = wp_specialchars( $_REQUEST['font_size'], 1 );
3425
  $set->font_line_height = wp_specialchars( $_REQUEST['font_line_height'], 1 );
3426
 
3427
+ if ( isset( $_REQUEST['font_bold'] ) && $_REQUEST['font_bold'] == 'bold' )
3428
  $set->font_bold = 'bold';
3429
  else
3430
  $set->font_bold = 'normal';
3431
 
3432
+ if ( isset( $_REQUEST['font_italic'] ) && $_REQUEST['font_italic'] == 'italic' )
3433
  $set->font_italic = 'italic';
3434
  else
3435
  $set->font_italic = 'normal';
3525
 
3526
  $response = $polldaddy->get_rating_results( $rating_id, $period, $start, $end );
3527
 
3528
+ $total = $total_pages = 0;
3529
+ $ratings = null;
3530
+
3531
+ if( !empty($response) ){
3532
+ $ratings = $response->rating;
3533
+ $total = (int) $response->_total;
3534
+ $total_pages = ceil( $total / $page_size );
3535
+ }
3536
 
3537
  $page_links = paginate_links( array(
3538
  'base' => add_query_arg( array ('paged' => '%#%', 'rating' => $report_type, 'filter' => $period ) ),
readme.txt CHANGED
@@ -1,9 +1,9 @@
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
 
@@ -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.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
1
+ === PollDaddy Polls & Ratings ===
2
  Contributors: mdawaffe, eoigal
3
+ Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 2.9.1
6
+ Stable tag: 1.7.7
7
 
8
  Create and manage PollDaddy polls and ratings from within WordPress.
9
 
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.7 =
36
+ * Added a block repeat vote expiration setting to allow users to set how long to block out repeat voters from repeat voting
37
+ * Bug Fix: Fixed notices thrown by ratings when first loaded, empty response from API.
38
+
39
  = 1.7.6 =
40
  * Added PollDaddy Ratings, you can now add ratings to your posts, pages and comments
41
  * Bug Fix: Sub-menu now highlights the correct option