Crowdsignal Dashboard – Polls, Surveys & more - Version 2.0.4

Version Description

  • Fixed bugs with using new ajax.php in PHP 4
  • Fixed issue with conflicts with other plugins using ajax.php
  • Fixed bug in poll question media upload
  • Fixed bug in adding answers, if you clicked button multiple times, multiple answers were added with same name.
Download this release

Release Info

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

Code changes from version 2.0.3 to 2.0.4

Files changed (5) hide show
  1. ajax.php +8 -3
  2. polldaddy-org.php +7 -4
  3. polldaddy.js +7 -0
  4. polldaddy.php +30 -26
  5. readme.txt +7 -1
ajax.php CHANGED
@@ -3,7 +3,12 @@
3
  add_action( 'wp_ajax_myajax-submit', 'myajax_submit' );
4
 
5
  class Polldaddy_Ajax {
6
- public function __construct() {
 
 
 
 
 
7
  // Catch AJAX
8
  add_action( 'wp_ajax_polls_upload_image', array( &$this, 'ajax_upload_image' ) );
9
  add_action( 'wp_ajax_polls_add_answer', array( &$this, 'ajax_add_answer' ) );
@@ -16,7 +21,7 @@ class Polldaddy_Ajax {
16
  }
17
  }
18
 
19
- public function ajax_upload_image() {
20
  require_once dirname( __FILE__ ) . '/polldaddy-client.php';
21
 
22
  check_admin_referer( 'send-media' );
@@ -43,7 +48,7 @@ class Polldaddy_Ajax {
43
  die();
44
  }
45
 
46
- public function ajax_add_answer() {
47
  check_admin_referer( 'add-answer' );
48
 
49
  $a = 0;
3
  add_action( 'wp_ajax_myajax-submit', 'myajax_submit' );
4
 
5
  class Polldaddy_Ajax {
6
+
7
+ function Polldaddy_Ajax() {
8
+ $this->__construct();
9
+ }
10
+
11
+ function __construct() {
12
  // Catch AJAX
13
  add_action( 'wp_ajax_polls_upload_image', array( &$this, 'ajax_upload_image' ) );
14
  add_action( 'wp_ajax_polls_add_answer', array( &$this, 'ajax_add_answer' ) );
21
  }
22
  }
23
 
24
+ function ajax_upload_image() {
25
  require_once dirname( __FILE__ ) . '/polldaddy-client.php';
26
 
27
  check_admin_referer( 'send-media' );
48
  die();
49
  }
50
 
51
+ function ajax_add_answer() {
52
  check_admin_referer( 'add-answer' );
53
 
54
  $a = 0;
polldaddy-org.php CHANGED
@@ -11,7 +11,7 @@ class WPORG_PollDaddy extends WP_PollDaddy {
11
 
12
  function __construct() {
13
  parent::__construct();
14
- $this->version = '2.0.2';
15
  $this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
16
  $this->polldaddy_client_class = 'WPORG_PollDaddy_Client';
17
  $this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
@@ -378,9 +378,12 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
378
  function polldaddy_shortcode_handler_set_data() {
379
  $resource = wp_remote_get( 'http://polldaddy.com/xml/keywords.xml' );
380
  $body = wp_remote_retrieve_body( $resource );
381
- $keywords_xml = simplexml_load_string( $body );
382
  $keywords = array();
383
-
 
 
 
384
  if ( $keywords_xml !== false ) {
385
  $keywords['generated'] = time();
386
 
@@ -525,7 +528,7 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
525
 
526
  if( $align == 'left')
527
  $margins = 'margin:0px 10px 0px 0px;';
528
- else if ( $margin == 'right' )
529
  $margins = 'margin: 0px 0px 0px 10px';
530
  else
531
  $margins = null;
11
 
12
  function __construct() {
13
  parent::__construct();
14
+ $this->version = '2.0.4';
15
  $this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
16
  $this->polldaddy_client_class = 'WPORG_PollDaddy_Client';
17
  $this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
378
  function polldaddy_shortcode_handler_set_data() {
379
  $resource = wp_remote_get( 'http://polldaddy.com/xml/keywords.xml' );
380
  $body = wp_remote_retrieve_body( $resource );
381
+ $keywords_xml = false;
382
  $keywords = array();
383
+
384
+ if( function_exists( 'simplexml_load_string' ) )
385
+ $keywords_xml = simplexml_load_string( $body );
386
+
387
  if ( $keywords_xml !== false ) {
388
  $keywords['generated'] = time();
389
 
528
 
529
  if( $align == 'left')
530
  $margins = 'margin:0px 10px 0px 0px;';
531
+ elseif ( $align == 'right' )
532
  $margins = 'margin: 0px 0px 0px 10px';
533
  else
534
  $margins = null;
polldaddy.js CHANGED
@@ -65,11 +65,17 @@ jQuery(function ($) {
65
  handle: '.handle',
66
  tolerance: 'pointer'
67
  });
 
68
 
69
  function add_answer( aa, src ) {
70
  return false;
71
  }
72
  $('#add-answer-holder').show().find('button').click(function () {
 
 
 
 
 
73
  var aa = (1 + get_number_answers()).toString();
74
  var src = $( this ).closest( 'p' ).attr( 'class' );
75
 
@@ -78,6 +84,7 @@ jQuery(function ($) {
78
  $( 'form[name=add-answer] input[name=action]' ).val( 'polls_add_answer' );
79
 
80
  $( 'form[name=add-answer]' ).ajaxSubmit( function( response ) {
 
81
  delAnswerPrep( $( '#answers' ).append( response ).find( 'li:last' ) );
82
  $('#choices').append('<option value="' + (aa-1) + '">' + (aa-1) + '</option>');
83
  init();
65
  handle: '.handle',
66
  tolerance: 'pointer'
67
  });
68
+ var loading = false;
69
 
70
  function add_answer( aa, src ) {
71
  return false;
72
  }
73
  $('#add-answer-holder').show().find('button').click(function () {
74
+ if ( loading )
75
+ return false;
76
+
77
+ loading = true;
78
+
79
  var aa = (1 + get_number_answers()).toString();
80
  var src = $( this ).closest( 'p' ).attr( 'class' );
81
 
84
  $( 'form[name=add-answer] input[name=action]' ).val( 'polls_add_answer' );
85
 
86
  $( 'form[name=add-answer]' ).ajaxSubmit( function( response ) {
87
+ loading = false;
88
  delAnswerPrep( $( '#answers' ).append( response ).find( 'li:last' ) );
89
  $('#choices').append('<option value="' + (aa-1) + '">' + (aa-1) + '</option>');
90
  init();
polldaddy.php CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://wordpress.org/extend/plugins/polldaddy/
6
  Description: Create and manage Polldaddy polls and ratings in WordPress
7
  Author: Automattic, Inc.
8
  Author URL: http://automattic.com/
9
- Version: 2.0.3
10
  */
11
 
12
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
@@ -27,14 +27,14 @@ class WP_PollDaddy {
27
  var $rating_user_code;
28
 
29
  function WP_PollDaddy() {
30
- $this ->__construct();
31
  }
32
 
33
  function __construct() {
34
  global $current_user;
35
  $this->errors = new WP_Error;
36
  $this->scheme = 'https';
37
- $this->version = '2.0.3';
38
  $this->multiple_accounts = true;
39
  $this->polldaddy_client_class = 'api_client';
40
  $this->polldaddy_clients = array();
@@ -714,9 +714,12 @@ class WP_PollDaddy {
714
  if ( isset( $media[999999999] ) )
715
  $poll_data['mediaCode'] = esc_html( $media[999999999] );
716
 
 
 
 
717
  if( isset( $GLOBALS['blog_id'] ) )
718
  $poll_data['parentID'] = (int) $GLOBALS['blog_id'];
719
-
720
  $polldaddy->reset();
721
 
722
  $update_response = $polldaddy->update_poll( $poll, $poll_data );
@@ -1182,7 +1185,7 @@ class WP_PollDaddy {
1182
  <h2 id="poll-list-header"><?php _e( 'Polldaddy Polls', 'polldaddy' ); ?></h2>
1183
  <?php
1184
  } else { ?>
1185
- <h2 id="poll-list-header"><?php printf( __( 'Preview Poll <a href="%s" class="button add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1186
  <?php
1187
  }
1188
  endif;
@@ -1205,7 +1208,7 @@ class WP_PollDaddy {
1205
  case 'edit-poll' :
1206
  ?>
1207
 
1208
- <h2 id="poll-list-header"><?php printf( __( 'Edit Poll <a href="%s" class="button add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1209
 
1210
  <?php
1211
 
@@ -1414,14 +1417,15 @@ class WP_PollDaddy {
1414
  <abbr title="<?php echo date( __( 'Y/m/d g:i:s A', 'polldaddy' ), $poll_time ); ?>"> <?php _e( 'created', 'polldaddy' ); ?> <?php echo date( __( 'M d, Y', 'polldaddy' ), $poll_time ); ?></abbr>
1415
 
1416
  <div class="row-actions">
1417
- <span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a></span><span> | </span> <?php } else { ?>
 
1418
  <strong><?php echo esc_html( $poll->___content ); ?></strong>
1419
  <div class="row-actions">
1420
 
1421
  <?php } ?>
1422
-
1423
  <?php if ( !isset( $_GET['iframe'] ) ):?>
1424
- <span class="shortcode"><a href="javascript:void(0);" class="polldaddy-show-shortcode"><?php _e( 'Embed &amp; Link', 'polldaddy' ); ?></a></span>
1425
  <?php else: ?>
1426
  <input type="hidden" class="polldaddy-poll-id" value="<?php echo $poll_id; ?>" />
1427
  <span><a href="javascript:void(0);" class="polldaddy-send-to-editor"><?php _e( 'Embed in Post', 'polldaddy' ); ?></a></span>
@@ -1431,7 +1435,7 @@ class WP_PollDaddy {
1431
  <?php
1432
  if ( $poll_closed == 2 ) {
1433
  if ( $open_link ) { ?>
1434
- <span> | </span><span class="open"><a class="open-poll" href="<?php echo $open_link; ?>"><?php _e( 'Open', 'polldaddy' ); ?></a></span>
1435
  <?php } } else {
1436
  if ( $close_link ) { ?>
1437
  <span> | </span><span class="close"><a class="close-poll" href="<?php echo $close_link; ?>"><?php _e( 'Close', 'polldaddy' ); ?></a></span>
@@ -1442,11 +1446,12 @@ class WP_PollDaddy {
1442
  <span> | </span><span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a></span>
1443
  <?php endif;
1444
  if ( $delete_link ) { ?>
1445
- <span> | </span><span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
1446
- <?php }
1447
  if ( $poll->_responses > 0 ):?>
1448
- <span> | </span><span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results', 'polldaddy' ); ?></a></span>
1449
- <?php endif; ?>
 
1450
  <?php $this->poll_table_add_option( $poll_id ); ?>
1451
  </div>
1452
  </td>
@@ -1477,7 +1482,7 @@ class WP_PollDaddy {
1477
 
1478
 
1479
  <h4 style="padding-top:10px;color:#666;font-weight:normal;"><?php _e( 'JavaScript', 'polldaddy' ); ?></h4>
1480
- <pre class="hardbreak" style="max-width:542px;text-wrap:word-wrap;margin-bottom:20px;">&lt;script type="text/javascript" language="javascript"
1481
  src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/script&gt;
1482
  &lt;noscript&gt;
1483
  &lt;a href="http://polldaddy.com/poll/<?php echo (int) $poll_id; ?>/"&gt;<?php echo trim( strip_tags( $poll->___content ) ); ?>&lt;/a&gt;&lt;br/&gt;
@@ -1902,7 +1907,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
1902
  </td>
1903
  <td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
1904
  <ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
1905
- <?php if ( $mediaType[$answer_id] == 2 ) { ?>
1906
  <li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="http://i0.poll.fm/images/icon-report-ip-analysis.png" alt="Video Embed"></li>
1907
  <?php } else { ?>
1908
  <li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><?php echo isset($media[$answer_id])?urldecode($media[$answer_id]->img_small):''; ?></li>
@@ -4858,18 +4863,17 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
4858
  return true;
4859
 
4860
  //check to see if poll owner is a member of this blog
4861
- if ( function_exists( 'get_users' ) ) {
4862
- $user = get_users( array( 'include' => $poll->_owner ) );
4863
-
4864
- if ( empty( $user ) )
4865
- return false;
4866
- }
4867
 
4868
  return (bool) current_user_can( 'edit_others_posts' );
4869
  }
4870
  }
4871
 
4872
- require 'rating.php';
4873
- require 'ajax.php';
4874
- require 'popups.php';
4875
- require 'polldaddy-org.php';
6
  Description: Create and manage Polldaddy polls and ratings in WordPress
7
  Author: Automattic, Inc.
8
  Author URL: http://automattic.com/
9
+ Version: 2.0.4
10
  */
11
 
12
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
27
  var $rating_user_code;
28
 
29
  function WP_PollDaddy() {
30
+ $this->__construct();
31
  }
32
 
33
  function __construct() {
34
  global $current_user;
35
  $this->errors = new WP_Error;
36
  $this->scheme = 'https';
37
+ $this->version = '2.0.4';
38
  $this->multiple_accounts = true;
39
  $this->polldaddy_client_class = 'api_client';
40
  $this->polldaddy_clients = array();
714
  if ( isset( $media[999999999] ) )
715
  $poll_data['mediaCode'] = esc_html( $media[999999999] );
716
 
717
+ if ( isset( $mediaType[999999999] ) )
718
+ $poll_data['mediaType'] = intval( $mediaType[999999999] );
719
+
720
  if( isset( $GLOBALS['blog_id'] ) )
721
  $poll_data['parentID'] = (int) $GLOBALS['blog_id'];
722
+
723
  $polldaddy->reset();
724
 
725
  $update_response = $polldaddy->update_poll( $poll, $poll_data );
1185
  <h2 id="poll-list-header"><?php _e( 'Polldaddy Polls', 'polldaddy' ); ?></h2>
1186
  <?php
1187
  } else { ?>
1188
+ <h2 id="poll-list-header"><?php printf( __( 'Preview Poll <a href="%s" class="button add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1189
  <?php
1190
  }
1191
  endif;
1208
  case 'edit-poll' :
1209
  ?>
1210
 
1211
+ <h2 id="poll-list-header"><?php printf( __( 'Edit Poll <a href="%s" class="button add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1212
 
1213
  <?php
1214
 
1417
  <abbr title="<?php echo date( __( 'Y/m/d g:i:s A', 'polldaddy' ), $poll_time ); ?>"> <?php _e( 'created', 'polldaddy' ); ?> <?php echo date( __( 'M d, Y', 'polldaddy' ), $poll_time ); ?></abbr>
1418
 
1419
  <div class="row-actions">
1420
+ <span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a></span><span> | </span>
1421
+ <?php } else { ?>
1422
  <strong><?php echo esc_html( $poll->___content ); ?></strong>
1423
  <div class="row-actions">
1424
 
1425
  <?php } ?>
1426
+
1427
  <?php if ( !isset( $_GET['iframe'] ) ):?>
1428
+ <span class="shortcode"><a href="javascript:void(0);" class="polldaddy-show-shortcode"><?php _e( 'Embed &amp; Link', 'polldaddy' ); ?></a></span>
1429
  <?php else: ?>
1430
  <input type="hidden" class="polldaddy-poll-id" value="<?php echo $poll_id; ?>" />
1431
  <span><a href="javascript:void(0);" class="polldaddy-send-to-editor"><?php _e( 'Embed in Post', 'polldaddy' ); ?></a></span>
1435
  <?php
1436
  if ( $poll_closed == 2 ) {
1437
  if ( $open_link ) { ?>
1438
+ <span> | </span><span class="open"><a class="open-poll" href="<?php echo $open_link; ?>"><?php _e( 'Open', 'polldaddy' ); ?></a></span>
1439
  <?php } } else {
1440
  if ( $close_link ) { ?>
1441
  <span> | </span><span class="close"><a class="close-poll" href="<?php echo $close_link; ?>"><?php _e( 'Close', 'polldaddy' ); ?></a></span>
1446
  <span> | </span><span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a></span>
1447
  <?php endif;
1448
  if ( $delete_link ) { ?>
1449
+ <span> | </span><span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
1450
+ <?php }
1451
  if ( $poll->_responses > 0 ):?>
1452
+ <span> | </span><span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results', 'polldaddy' ); ?></a></span>
1453
+ <?php endif; ?>
1454
+
1455
  <?php $this->poll_table_add_option( $poll_id ); ?>
1456
  </div>
1457
  </td>
1482
 
1483
 
1484
  <h4 style="padding-top:10px;color:#666;font-weight:normal;"><?php _e( 'JavaScript', 'polldaddy' ); ?></h4>
1485
+ <pre class="hardbreak" style="max-width:542px;text-wrap:word-wrap;margin-bottom:20px;">&lt;script type="text/javascript" language="javascript"
1486
  src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/script&gt;
1487
  &lt;noscript&gt;
1488
  &lt;a href="http://polldaddy.com/poll/<?php echo (int) $poll_id; ?>/"&gt;<?php echo trim( strip_tags( $poll->___content ) ); ?>&lt;/a&gt;&lt;br/&gt;
1907
  </td>
1908
  <td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
1909
  <ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
1910
+ <?php if ( isset( $mediaType[$answer_id] ) && $mediaType[$answer_id] == 2 ) { ?>
1911
  <li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="http://i0.poll.fm/images/icon-report-ip-analysis.png" alt="Video Embed"></li>
1912
  <?php } else { ?>
1913
  <li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><?php echo isset($media[$answer_id])?urldecode($media[$answer_id]->img_small):''; ?></li>
4863
  return true;
4864
 
4865
  //check to see if poll owner is a member of this blog
4866
+ if ( function_exists( 'get_users' ) ) {
4867
+ $user = get_users( array( 'include' => $poll->_owner ) );
4868
+ if ( empty( $user ) )
4869
+ return false;
4870
+ }
 
4871
 
4872
  return (bool) current_user_can( 'edit_others_posts' );
4873
  }
4874
  }
4875
 
4876
+ require dirname( __FILE__ ).'/rating.php';
4877
+ require dirname( __FILE__ ).'/ajax.php';
4878
+ require dirname( __FILE__ ).'/popups.php';
4879
+ require dirname( __FILE__ ).'/polldaddy-org.php';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: eoigal, alternatekev, mdawaffe
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 3.1.3
6
- Stable tag: 2.0.3
7
 
8
  Create and manage Polldaddy polls and ratings from within WordPress.
9
 
@@ -67,6 +67,12 @@ More info here - http://codex.wordpress.org/Theme_Development#Plugin_API_Hooks
67
  You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
68
 
69
  == Change Log ==
 
 
 
 
 
 
70
  = 2.0.3 =
71
  * Fixed side nav gray theme icon bug introduced by usage of sprite image
72
 
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 3.1.3
6
+ Stable tag: 2.0.4
7
 
8
  Create and manage Polldaddy polls and ratings from within WordPress.
9
 
67
  You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
68
 
69
  == Change Log ==
70
+ = 2.0.4 =
71
+ * Fixed bugs with using new ajax.php in PHP 4
72
+ * Fixed issue with conflicts with other plugins using ajax.php
73
+ * Fixed bug in poll question media upload
74
+ * Fixed bug in adding answers, if you clicked button multiple times, multiple answers were added with same name.
75
+
76
  = 2.0.3 =
77
  * Fixed side nav gray theme icon bug introduced by usage of sprite image
78