Crowdsignal Dashboard – Polls, Surveys & more - Version 1.7.3

Version Description

  • Added poll option to allow you to set limit on number of answers for multiple choice polls.
Download this release

Release Info

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

Code changes from version 1.7.2 to 1.7.3

Files changed (5) hide show
  1. polldaddy-client.php +2 -1
  2. polldaddy-xml.php +4 -3
  3. polldaddy.js +13 -0
  4. polldaddy.php +28 -3
  5. readme.txt +4 -1
polldaddy-client.php CHANGED
@@ -1070,7 +1070,7 @@ function &polldaddy_poll( $args = null, $id = null, $_require_data = true ) {
1070
  $args[$bool] = $defaults[$bool];
1071
  }
1072
 
1073
- foreach ( array( 'styleID', 'packID', 'folderID', 'languageID' ) as $int )
1074
  if ( !is_numeric( $args[$int] ) )
1075
  $args[$bool] = $defaults[$int];
1076
 
@@ -1122,6 +1122,7 @@ function _polldaddy_poll_defaults() {
1122
  'parentID' => (int) $GLOBALS['blog_id'],
1123
  'mediaCode' => '',
1124
  'mediaType' => 0,
 
1125
  'answers' => array()
1126
  );
1127
  }
1070
  $args[$bool] = $defaults[$bool];
1071
  }
1072
 
1073
+ foreach ( array( 'styleID', 'packID', 'folderID', 'languageID', 'choices' ) as $int )
1074
  if ( !is_numeric( $args[$int] ) )
1075
  $args[$bool] = $defaults[$int];
1076
 
1122
  'parentID' => (int) $GLOBALS['blog_id'],
1123
  'mediaCode' => '',
1124
  'mediaType' => 0,
1125
+ 'choices' => 0,
1126
  'answers' => array()
1127
  );
1128
  }
polldaddy-xml.php CHANGED
@@ -312,12 +312,13 @@ class PollDaddy_Poll extends PollDaddy_XML_Object {
312
  var $languageID;
313
  var $parentID;
314
  var $keyword;
315
- var $mediaType; // new
316
- var $mediaCode; // new
317
- var $answers;
318
  var $sharing;
319
  var $rank;
320
  var $url;
 
 
 
 
321
  }
322
 
323
  class PollDaddy_Poll_Result extends PollDaddy_XML_Object {
312
  var $languageID;
313
  var $parentID;
314
  var $keyword;
 
 
 
315
  var $sharing;
316
  var $rank;
317
  var $url;
318
+ var $choices;
319
+ var $mediaType; // new
320
+ var $mediaCode; // new
321
+ var $answers;
322
  }
323
 
324
  class PollDaddy_Poll_Result extends PollDaddy_XML_Object {
polldaddy.js CHANGED
@@ -14,6 +14,7 @@ jQuery(function($){
14
  $('a.delete-answer', context || null ).click( function() {
15
  if ( confirm( 'Are you sure you want to delete this answer?' ) ) {
16
  $(this).parents( 'li' ).remove();
 
17
  }
18
  return false;
19
  } );
@@ -30,6 +31,7 @@ jQuery(function($){
30
  $('#add-answer-holder').show().find( 'button').click( function() {
31
  var aa = ( 1 + $('#answers li').size() ).toString();
32
  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' ) );
 
33
  return false;
34
  } );
35
 
@@ -110,4 +112,15 @@ jQuery(function($){
110
  return false;
111
  } );
112
  }
 
 
 
 
 
 
 
 
 
 
 
113
  });
14
  $('a.delete-answer', context || null ).click( function() {
15
  if ( confirm( 'Are you sure you want to delete this answer?' ) ) {
16
  $(this).parents( 'li' ).remove();
17
+ $('#choices option:last-child').remove();
18
  }
19
  return false;
20
  } );
31
  $('#add-answer-holder').show().find( 'button').click( function() {
32
  var aa = ( 1 + $('#answers li').size() ).toString();
33
  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' ) );
34
+ $('#choices').append('<option value="'+aa+'">'+aa+'</option>');
35
  return false;
36
  } );
37
 
112
  return false;
113
  } );
114
  }
115
+
116
+ $("#multipleChoice").click(function(){
117
+ if ($("#multipleChoice").is(":checked"))
118
+ {
119
+ $("#numberChoices").show("fast");
120
+ }
121
+ else
122
+ {
123
+ $("#numberChoices").hide("fast");
124
+ }
125
+ });
126
  });
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.2
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.2';
28
 
29
  var $polldaddy_clients = array();
30
 
@@ -588,6 +588,7 @@ class WP_PollDaddy {
588
  }
589
  }
590
  $poll_data['styleID'] = (int) $_POST['styleID'];
 
591
 
592
  $polldaddy->reset();
593
 
@@ -642,7 +643,8 @@ class WP_PollDaddy {
642
  return false;
643
  }
644
  }
645
- $poll_data['styleID'] = $_POST['styleID'];
 
646
 
647
  $poll = $polldaddy->create_poll( $poll_data );
648
  $this->parse_errors( $polldaddy );
@@ -1288,6 +1290,29 @@ class WP_PollDaddy {
1288
  <?php endforeach; ?>
1289
 
1290
  </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1291
  </div>
1292
  </div>
1293
 
5
  Description: Create and manage PollDaddy polls in WordPress
6
  Author: Automattic, Inc.
7
  Author URL: http://automattic.com/
8
+ Version: 1.7.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.7.3';
28
 
29
  var $polldaddy_clients = array();
30
 
588
  }
589
  }
590
  $poll_data['styleID'] = (int) $_POST['styleID'];
591
+ $poll_data['choices'] = (int) $_POST['choices'];
592
 
593
  $polldaddy->reset();
594
 
643
  return false;
644
  }
645
  }
646
+ $poll_data['styleID'] = (int) $_POST['styleID'];
647
+ $poll_data['choices'] = (int) $_POST['choices'];
648
 
649
  $poll = $polldaddy->create_poll( $poll_data );
650
  $this->parse_errors( $polldaddy );
1290
  <?php endforeach; ?>
1291
 
1292
  </ul>
1293
+ <?php
1294
+ if ( $is_POST )
1295
+ $style = 'yes' === $_POST['multipleChoice'] ? 'display:block;' : 'display:none;';
1296
+ else
1297
+ $style = 'yes' === $poll->multipleChoice ? 'display:block;' : 'display:none;';
1298
+ ?>
1299
+ <div id="numberChoices" name="numberChoices" style="padding-left:15px;<?php echo $style; ?>">
1300
+ <p>Number of choices: <select name="choices" id="choices"><option value="0">No Limit</option>
1301
+ <?php
1302
+ if ( $is_POST )
1303
+ $choices = (int) $_POST['choices'];
1304
+ else
1305
+ $choices = (int) $poll->choices;
1306
+
1307
+ if( $a > 1 ) :
1308
+ for( $i=2; $i<=$a; $i++ ) :
1309
+ $selected = $i == $choices ? 'selected="true"' : '';
1310
+ echo "<option value='$i' $selected>$i</option>";
1311
+ endfor;
1312
+ endif; ?>
1313
+ </select>
1314
+ </p>
1315
+ </div>
1316
  </div>
1317
  </div>
1318
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mdawaffe, eoigal
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys
4
  Requires at least: 2.6
5
  Tested up to: 2.8.4
6
- Stable tag: 1.7.2
7
 
8
  Create and manage PollDaddy polls from within WordPress.
9
 
@@ -32,6 +32,9 @@ 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.2 =
36
  * Bug Fix: Added fix for open/close poll
37
 
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys
4
  Requires at least: 2.6
5
  Tested up to: 2.8.4
6
+ Stable tag: 1.7.3
7
 
8
  Create and manage PollDaddy polls 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.3 =
36
+ * Added poll option to allow you to set limit on number of answers for multiple choice polls.
37
+
38
  = 1.7.2 =
39
  * Bug Fix: Added fix for open/close poll
40