Crowdsignal Dashboard – Polls, Surveys & more - Version 2.0.10

Version Description

Create custom poll styles that support RTL text direction.

=

Download this release

Release Info

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

Code changes from version 2.0.9 to 2.0.10

Files changed (4) hide show
  1. polldaddy-org.php +113 -60
  2. polldaddy.js +20 -22
  3. polldaddy.php +100 -39
  4. readme.txt +16 -3
polldaddy-org.php CHANGED
@@ -2,8 +2,11 @@
2
 
3
  require_once dirname( __FILE__ ) . '/polldaddy-client.php';
4
 
 
 
5
  class WPORG_Polldaddy extends WP_Polldaddy {
6
  var $use_ssl;
 
7
 
8
  function WPORG_Polldaddy() {
9
  $this->__construct();
@@ -12,15 +15,22 @@ class WPORG_Polldaddy extends WP_Polldaddy {
12
  function __construct() {
13
  parent::__construct();
14
  $this->log( 'Created WPORG_Polldaddy Object: constructor' );
15
- $this->version = '2.0.9';
16
  $this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
17
  $this->polldaddy_client_class = 'WPORG_Polldaddy_Client';
18
  $this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
19
  $this->multiple_accounts = (bool) get_option( 'polldaddy_multiple_accounts' );
 
20
  $this->is_author = ( ( (bool) current_user_can('edit_others_posts')) or ( $this->multiple_accounts ) );
21
  return;
22
  }
23
 
 
 
 
 
 
 
24
  function set_api_user_code() {
25
  if ( empty( $this->rating_user_code ) ) {
26
  $this->rating_user_code = get_option( 'pd-rating-usercode' );
@@ -72,6 +82,7 @@ class WPORG_Polldaddy extends WP_Polldaddy {
72
 
73
  $polldaddy_sync_account = 0;
74
  $polldaddy_multiple_accounts = 0;
 
75
 
76
  if ( isset( $_POST['polldaddy-sync-account'] ) )
77
  $polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
@@ -86,9 +97,13 @@ class WPORG_Polldaddy extends WP_Polldaddy {
86
  if ( isset( $_POST['polldaddy-multiple-accounts'] ) )
87
  $polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
88
 
 
 
 
89
  $partner = array( 'role' => $polldaddy_multiple_accounts );
90
  $polldaddy->update_partner_account( $partner );
91
  update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
 
92
 
93
  $rating_title_filter = '';
94
  if ( isset( $_POST['polldaddy-ratings-title-filter'] ) )
@@ -280,6 +295,10 @@ class WPORG_Polldaddy extends WP_Polldaddy {
280
 
281
  function plugin_options_add() {
282
  if ( $this->is_admin ) {
 
 
 
 
283
  $checked = '';
284
  if ( $this->multiple_accounts )
285
  $checked = 'checked="checked"';
@@ -290,6 +309,18 @@ class WPORG_Polldaddy extends WP_Polldaddy {
290
  $rating_title_filter = 'wp_title';
291
 
292
  ?><tr class="form-field form-required">
 
 
 
 
 
 
 
 
 
 
 
 
293
  <th valign="top" scope="row">
294
  <label for="polldaddy-multiple-accounts">
295
  <?php _e( 'Multiple Polldaddy Accounts', 'polldaddy' ); ?>
@@ -431,13 +462,17 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
431
 
432
  function polldaddy_shortcode_handler( $atts, $content = null ) {
433
  global $post;
434
- global $content_width;
435
 
 
436
  $no_script = false;
437
 
 
 
 
438
  if ( is_feed() || defined( 'DOING_AJAX' ) )
439
  $no_script = true;
440
-
441
  extract( shortcode_atts( array(
442
  'survey' => null,
443
  'link_text' => 'View Survey',
@@ -460,7 +495,7 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
460
  'delay' => 100,
461
  'visit' => 'single'
462
  ), $atts ) );
463
-
464
  $survey = esc_attr( str_replace( "'", "", $survey ) );
465
  $link_text = esc_attr( $link_text );
466
 
@@ -468,14 +503,14 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
468
  $width = $content_width;
469
 
470
  if ( !$width )
471
- $width = '840px';
472
 
473
  if ( !$height )
474
- $height = '80%';
475
-
476
  if ( null != $survey ) {
477
-
478
- // This is the new survey embed
479
  if ( $type != null ) {
480
  //need to use esc_js and esc_attr as the values will be inserted into javascript while being enclosed in single quotes.
481
  $title = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $title ) ) );
@@ -486,41 +521,41 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
486
  $back_color = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $back_color ) ) );
487
  $align = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $align ) ) );
488
  $style = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $style ) ) );
489
-
490
- if ( $no_script ) {
491
- return "<a href='http://polldaddy.com/s/{$survey}'>{$title}</a>";
492
- } else {
493
- if ( $type == 'inline' ) {
494
  return <<<EOD
495
  <iframe src="{$survey}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" marginheight="0" marginwidth="0"><a href="{$survey}">{$link_text}</a></iframe>
496
  EOD;
497
- }
498
-
499
- $settings = json_encode( array(
500
- 'title' => $title,
501
- 'type' => $type,
502
- 'body' => $body,
503
- 'button' => $button,
504
- 'body' => $body,
505
- 'text_color' => $text_color,
506
- 'back_color' => $back_color,
507
- 'align' => $align,
508
- 'style' => $style,
509
- 'id' => $survey,
510
- 'height' => $height,
511
- 'width' => $width
512
- ) );
 
513
 
514
- return <<<EOD
515
  <script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
516
  <script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
517
- polldaddy.add( {$settings} );
518
  //--><!]]></script>
519
  <noscript><a href="http://polldaddy.com/s/{$survey}">{$title}</a></noscript>
520
  EOD;
521
- }
522
- } else {
523
-
524
  wp_register_script( 'polldaddy-survey-js', 'http://i0.poll.fm/s.js' );
525
  add_filter( 'wp_footer', 'polldaddy_add_survey_js' );
526
 
@@ -533,11 +568,11 @@ var PDF_openText = "{$link_text}";
533
  EOD;
534
  }
535
  }
536
-
537
  $poll = (int) $poll;
538
  $rating = (int) $rating;
539
  $cb = (int) $cb;
540
-
541
  if ( !$no_script && $rating > 0 ) {
542
  if ( null != $unique_id )
543
  $unique_id = esc_html( $unique_id );
@@ -548,36 +583,51 @@ EOD;
548
  $item_id = esc_html( $item_id );
549
  else
550
  $item_id = is_page() ? '_page_'.$post->ID : '_post_'.$post->ID;
551
-
552
  if ( null != $title )
553
  $title = esc_html( $title );
554
- else {
555
- $rating_title_filter = get_option( 'pd-rating-title-filter' );
556
-
557
- if ( $rating_title_filter === false )
558
- $title = apply_filters( 'wp_title', $post->post_title );
559
- elseif ( strlen( $rating_title_filter ) > 0 )
560
- $title = apply_filters( $rating_title_filter, $post->post_title );
561
- else
562
- $title = $post->post_title;
563
- }
564
-
565
  if ( null != $permalink )
566
  $permalink = clean_url( $permalink );
567
  else
568
  $permalink = get_permalink( $post->ID );
569
-
570
- wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
571
- add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
572
 
573
- return polldaddy_get_rating_code( $rating, $unique_id, $title, $permalink, $item_id );
574
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
  } elseif ( $poll > 0 ) {
576
 
577
  if ( $no_script )
578
  return '<a href="http://polldaddy.com/poll/' . $poll . '/">View This Poll</a>';
579
  else {
580
- if ( $type == 'slider' ) {
581
  $delay = (int) $delay;
582
 
583
  if( $visit !== 'single' && $visit !== 'multiple' )
@@ -590,7 +640,7 @@ EOD;
590
  'visit' => $visit,
591
  'id' => $poll
592
  ) );
593
-
594
  return <<<EOD
595
  <script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
596
  <script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
@@ -600,7 +650,7 @@ polldaddy.add( {$settings} );
600
  EOD;
601
  }
602
  else {
603
- $cb = ( $cb == 1 ? mktime() : false );
604
 
605
  if( isset( $align ) )
606
  $float = "float:" . $align .";";
@@ -614,7 +664,7 @@ EOD;
614
  else
615
  $margins = null;
616
 
617
- if ( $cb === false ) {
618
  $pd_poll_shortcodes = new pd_poll_shortcodes( $poll );
619
  wp_register_script( "polldaddy-poll-js-{$poll}", "http://static.polldaddy.com/p/{$poll}.js" );
620
  add_filter( 'wp_footer', array( &$pd_poll_shortcodes, 'polldaddy_add_poll_js' ) );
@@ -625,15 +675,18 @@ EOD;
625
  EOD;
626
  }
627
  else {
 
 
 
628
  return <<<EOD
629
  <a name="pd_a_{$poll}"></a><div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div><div id="PD_superContainer"></div>
630
- <script type="text/javascript" charset="UTF-8" src="http://static.polldaddy.com/p/{$poll}.js?cb={$cb}"></script><noscript><a href="http://polldaddy.com/poll/{$poll}/">View This Poll</a></noscript>
631
  EOD;
632
  }
633
  }
634
  }
635
  }
636
-
637
  return '<!-- no polldaddy output -->';
638
  }
639
 
2
 
3
  require_once dirname( __FILE__ ) . '/polldaddy-client.php';
4
 
5
+ $GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
6
+
7
  class WPORG_Polldaddy extends WP_Polldaddy {
8
  var $use_ssl;
9
+ var $inline;
10
 
11
  function WPORG_Polldaddy() {
12
  $this->__construct();
15
  function __construct() {
16
  parent::__construct();
17
  $this->log( 'Created WPORG_Polldaddy Object: constructor' );
18
+ $this->version = '2.0.10';
19
  $this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
20
  $this->polldaddy_client_class = 'WPORG_Polldaddy_Client';
21
  $this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
22
  $this->multiple_accounts = (bool) get_option( 'polldaddy_multiple_accounts' );
23
+ $this->inline = (bool) get_option( 'polldaddy_load_poll_inline' );
24
  $this->is_author = ( ( (bool) current_user_can('edit_others_posts')) or ( $this->multiple_accounts ) );
25
  return;
26
  }
27
 
28
+ function log( $message ) {
29
+ if ( defined( 'WP_DEBUG_LOG' ) )
30
+ $GLOBALS[ 'wp_log' ][ 'polldaddy' ][] = $message;
31
+ parent::log( $message );
32
+ }
33
+
34
  function set_api_user_code() {
35
  if ( empty( $this->rating_user_code ) ) {
36
  $this->rating_user_code = get_option( 'pd-rating-usercode' );
82
 
83
  $polldaddy_sync_account = 0;
84
  $polldaddy_multiple_accounts = 0;
85
+ $polldaddy_load_poll_inline = 0;
86
 
87
  if ( isset( $_POST['polldaddy-sync-account'] ) )
88
  $polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
97
  if ( isset( $_POST['polldaddy-multiple-accounts'] ) )
98
  $polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
99
 
100
+ if ( isset( $_POST['polldaddy-load-poll-inline'] ) )
101
+ $polldaddy_load_poll_inline = (int) $_POST['polldaddy-load-poll-inline'];
102
+
103
  $partner = array( 'role' => $polldaddy_multiple_accounts );
104
  $polldaddy->update_partner_account( $partner );
105
  update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
106
+ update_option( 'polldaddy_load_poll_inline', $polldaddy_load_poll_inline );
107
 
108
  $rating_title_filter = '';
109
  if ( isset( $_POST['polldaddy-ratings-title-filter'] ) )
295
 
296
  function plugin_options_add() {
297
  if ( $this->is_admin ) {
298
+ $inline = '';
299
+ if ( $this->inline )
300
+ $inline = 'checked="checked"';
301
+
302
  $checked = '';
303
  if ( $this->multiple_accounts )
304
  $checked = 'checked="checked"';
309
  $rating_title_filter = 'wp_title';
310
 
311
  ?><tr class="form-field form-required">
312
+ <th valign="top" scope="row">
313
+ <label for="polldaddy-load-poll-inline">
314
+ <?php _e( 'Load Shortcodes Inline', 'polldaddy' ); ?>
315
+ </label>
316
+ </th>
317
+ <td>
318
+ <input type="checkbox" name="polldaddy-load-poll-inline" id="polldaddy-load-poll-inline" value="1" <?php echo $inline ?> style="width: auto" />
319
+ <span class="description">
320
+ <label for="polldaddy-load-poll-inline"><?php _e( 'This will load the Polldaddy shortcodes inline rather than in the page footer.', 'polldaddy' ); ?></label>
321
+ </span>
322
+ </td>
323
+ </tr><tr class="form-field form-required">
324
  <th valign="top" scope="row">
325
  <label for="polldaddy-multiple-accounts">
326
  <?php _e( 'Multiple Polldaddy Accounts', 'polldaddy' ); ?>
462
 
463
  function polldaddy_shortcode_handler( $atts, $content = null ) {
464
  global $post;
465
+ global $content_width;
466
 
467
+ $inline = false;
468
  $no_script = false;
469
 
470
+ if ( get_option( 'polldaddy_load_poll_inline' ) )
471
+ $inline = true;
472
+
473
  if ( is_feed() || defined( 'DOING_AJAX' ) )
474
  $no_script = true;
475
+
476
  extract( shortcode_atts( array(
477
  'survey' => null,
478
  'link_text' => 'View Survey',
495
  'delay' => 100,
496
  'visit' => 'single'
497
  ), $atts ) );
498
+
499
  $survey = esc_attr( str_replace( "'", "", $survey ) );
500
  $link_text = esc_attr( $link_text );
501
 
503
  $width = $content_width;
504
 
505
  if ( !$width )
506
+ $width = '100%';
507
 
508
  if ( !$height )
509
+ $height = '600';
510
+
511
  if ( null != $survey ) {
512
+
513
+ // This is the new survey embed
514
  if ( $type != null ) {
515
  //need to use esc_js and esc_attr as the values will be inserted into javascript while being enclosed in single quotes.
516
  $title = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $title ) ) );
521
  $back_color = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $back_color ) ) );
522
  $align = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $align ) ) );
523
  $style = preg_replace( '/&amp;(\w*);/', '&$1;', esc_js( esc_attr( $style ) ) );
524
+
525
+ if ( $type == 'inline' ) {
526
+ if ( $inline )
527
+ return '<a href="'.$survey.'">'.$link_text.'</a>';
528
+ else
529
  return <<<EOD
530
  <iframe src="{$survey}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" marginheight="0" marginwidth="0"><a href="{$survey}">{$link_text}</a></iframe>
531
  EOD;
532
+ }
533
+
534
+ if ( $no_script || $inline )
535
+ return "<a href='http://polldaddy.com/s/{$survey}'>{$title}</a>";
536
+
537
+ $settings = json_encode( array(
538
+ 'title' => $title,
539
+ 'type' => $type,
540
+ 'body' => $body,
541
+ 'button' => $button,
542
+ 'body' => $body,
543
+ 'text_color' => $text_color,
544
+ 'back_color' => $back_color,
545
+ 'align' => $align,
546
+ 'style' => $style,
547
+ 'id' => $survey
548
+ ) );
549
 
550
+ return <<<EOD
551
  <script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
552
  <script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
553
+ polldaddy.add( {$settings} );
554
  //--><!]]></script>
555
  <noscript><a href="http://polldaddy.com/s/{$survey}">{$title}</a></noscript>
556
  EOD;
557
+ }
558
+ else {
 
559
  wp_register_script( 'polldaddy-survey-js', 'http://i0.poll.fm/s.js' );
560
  add_filter( 'wp_footer', 'polldaddy_add_survey_js' );
561
 
568
  EOD;
569
  }
570
  }
571
+
572
  $poll = (int) $poll;
573
  $rating = (int) $rating;
574
  $cb = (int) $cb;
575
+
576
  if ( !$no_script && $rating > 0 ) {
577
  if ( null != $unique_id )
578
  $unique_id = esc_html( $unique_id );
583
  $item_id = esc_html( $item_id );
584
  else
585
  $item_id = is_page() ? '_page_'.$post->ID : '_post_'.$post->ID;
586
+
587
  if ( null != $title )
588
  $title = esc_html( $title );
589
+ else
590
+ $title = apply_filters( 'wp_title', $post->post_title );
591
+
 
 
 
 
 
 
 
 
592
  if ( null != $permalink )
593
  $permalink = clean_url( $permalink );
594
  else
595
  $permalink = get_permalink( $post->ID );
 
 
 
596
 
597
+ $settings = json_encode( array(
598
+ 'id' => $rating,
599
+ 'unique_id' => $unique_id,
600
+ 'title' => rawurlencode( trim( $title ) ),
601
+ 'permalink' => esc_url_raw( $permalink ),
602
+ 'item_id' => $item_id
603
+ ) );
604
+
605
+ if ( $inline ) {
606
+ return <<<EOD
607
+ <div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
608
+ <script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
609
+ PDRTJS_settings_{$rating}{$item_id}={$settings};
610
+ //--><!]]></script>
611
+ <script type="text/javascript" charset="UTF-8" src="http://i.polldaddy.com/ratings/rating.js"></script>
612
+ EOD;
613
+ }
614
+ else {
615
+ wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
616
+ add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
617
+
618
+ return <<<EOD
619
+ <div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
620
+ <script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
621
+ PDRTJS_settings_{$rating}{$item_id}={$settings};
622
+ //--><!]]></script>
623
+ EOD;
624
+ }
625
  } elseif ( $poll > 0 ) {
626
 
627
  if ( $no_script )
628
  return '<a href="http://polldaddy.com/poll/' . $poll . '/">View This Poll</a>';
629
  else {
630
+ if ( $type == 'slider' && !$inline ) {
631
  $delay = (int) $delay;
632
 
633
  if( $visit !== 'single' && $visit !== 'multiple' )
640
  'visit' => $visit,
641
  'id' => $poll
642
  ) );
643
+
644
  return <<<EOD
645
  <script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
646
  <script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
650
  EOD;
651
  }
652
  else {
653
+ $cb = ( $cb == 1 ? '?cb='.mktime() : false );
654
 
655
  if( isset( $align ) )
656
  $float = "float:" . $align .";";
664
  else
665
  $margins = null;
666
 
667
+ if ( $cb === false && !$inline ) {
668
  $pd_poll_shortcodes = new pd_poll_shortcodes( $poll );
669
  wp_register_script( "polldaddy-poll-js-{$poll}", "http://static.polldaddy.com/p/{$poll}.js" );
670
  add_filter( 'wp_footer', array( &$pd_poll_shortcodes, 'polldaddy_add_poll_js' ) );
675
  EOD;
676
  }
677
  else {
678
+ if ( $inline )
679
+ $cb = '';
680
+
681
  return <<<EOD
682
  <a name="pd_a_{$poll}"></a><div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div><div id="PD_superContainer"></div>
683
+ <script type="text/javascript" charset="UTF-8" src="http://static.polldaddy.com/p/{$poll}.js{$cb}"></script><noscript><a href="http://polldaddy.com/poll/{$poll}/">View This Poll</a></noscript>
684
  EOD;
685
  }
686
  }
687
  }
688
  }
689
+
690
  return '<!-- no polldaddy output -->';
691
  }
692
 
polldaddy.js CHANGED
@@ -41,7 +41,7 @@ jQuery(function ($) {
41
  } );
42
 
43
  $('a.delete-rating').click(function () {
44
- return confirm( opts.delete_rating.replace("%s", $(this).parents('td').find('strong').text() ) );
45
  });
46
  $('a.delete-poll').click(function () {
47
  return confirm( opts.delete_poll.replace( "%s", "'" + $(this).parents('td').find('strong').text() + "'" ) );
@@ -65,31 +65,29 @@ jQuery(function ($) {
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
-
82
- $( 'form[name=add-answer] input[name=aa]' ).val( aa );
83
- $( 'form[name=add-answer] input[name=src]' ).val( src );
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();
91
- } );
92
-
93
  return false;
94
  });
95
  var win = window.dialogArguments || opener || parent || top;
@@ -243,4 +241,4 @@ jQuery(function ($) {
243
 
244
  return api;
245
  }
246
- });
41
  } );
42
 
43
  $('a.delete-rating').click(function () {
44
+ return confirm( opts.delete_rating.replace( "%s", "'" + $(this).parents('td').find('strong').text() + "'" ) );
45
  });
46
  $('a.delete-poll').click(function () {
47
  return confirm( opts.delete_poll.replace( "%s", "'" + $(this).parents('td').find('strong').text() + "'" ) );
65
  handle: '.handle',
66
  tolerance: 'pointer'
67
  });
 
68
 
69
  function add_answer( aa, src ) {
70
  return false;
71
  }
72
+
73
+ var busy = false;
74
  $('#add-answer-holder').show().find('button').click(function () {
75
+ if ( !busy ) {
76
+ busy = true;
77
+ var aa = (1 + get_number_answers()).toString();
78
+ var src = $( this ).closest( 'p' ).attr( 'class' );
79
+
80
+ $( 'form[name=add-answer] input[name=aa]' ).val( aa );
81
+ $( 'form[name=add-answer] input[name=src]' ).val( src );
82
+ $( 'form[name=add-answer] input[name=action]' ).val( 'polls_add_answer' );
83
+
84
+ $( 'form[name=add-answer]' ).ajaxSubmit( function( response ) {
85
+ delAnswerPrep( $( '#answers' ).append( response ).find( 'li:last' ) );
86
+ $('#choices').append('<option value="' + (aa-1) + '">' + (aa-1) + '</option>');
87
+ busy = false;
88
+ init();
89
+ } );
90
+ }
 
 
 
91
  return false;
92
  });
93
  var win = window.dialogArguments || opener || parent || top;
241
 
242
  return api;
243
  }
244
+ });
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.9
10
  */
11
 
12
  // You can hardcode your Polldaddy PartnerGUID (API Key) here
@@ -35,7 +35,7 @@ class WP_Polldaddy {
35
  $this->log( 'Created WP_Polldaddy Object: constructor' );
36
  $this->errors = new WP_Error;
37
  $this->scheme = 'https';
38
- $this->version = '2.0.8';
39
  $this->multiple_accounts = true;
40
  $this->polldaddy_client_class = 'api_client';
41
  $this->polldaddy_clients = array();
@@ -2593,7 +2593,11 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
2593
  }
2594
 
2595
  $style->css = trim( urldecode( $style->css ) );
2596
-
 
 
 
 
2597
  if ( $start = stripos( $style->css, '<data>' ) )
2598
  $style->css = substr( $style->css, $start );
2599
 
@@ -2660,7 +2664,18 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
2660
  <option value="117"><?php _e( 'Skull Light', 'polldaddy' ); ?></option>
2661
  <option value="157"><?php _e( 'Micro', 'polldaddy' ); ?></option>
2662
  </select>
2663
- <a tabindex="4" id="style-preload" href="javascript:preload_pd_style();" class="button"><?php echo esc_attr( __( 'Load Style', 'polldaddy' ) ); ?></a>
 
 
 
 
 
 
 
 
 
 
 
2664
  </div>
2665
  </td>
2666
  </tr>
@@ -2681,8 +2696,13 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
2681
  <option value="pds-textfield"><?php _e( 'Other Input', 'polldaddy' ); ?></option>
2682
  <option value="pds-vote-button"><?php _e( 'Vote Button', 'polldaddy' ); ?></option>
2683
  <option value="pds-link"><?php _e( 'Links', 'polldaddy' ); ?></option>
2684
- <option value="pds-answer-feedback"><?php _e( 'Result Background', 'polldaddy' ); ?></option>
2685
- <option value="pds-answer-feedback-bar"><?php _e( 'Result Bar', 'polldaddy' ); ?></option>
 
 
 
 
 
2686
  <option value="pds-totalvotes-inner"><?php _e( 'Total Votes', 'polldaddy' ); ?></option>
2687
  </select>
2688
 
@@ -2719,6 +2739,9 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
2719
  <div class="off" id="D_Height">
2720
  <a href="javascript:CSSE_changeView('Height');" id="A_Height" class="Aoff"><?php _e( 'Height', 'polldaddy' ); ?></a>
2721
  </div>
 
 
 
2722
  </td>
2723
  <td class="CSSE_main_r" valign="top">
2724
  <table class="CSSE_sub">
@@ -3304,6 +3327,20 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
3304
  </td>
3305
  </tr>
3306
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3307
  </td>
3308
  </tr>
3309
  <tr>
@@ -3387,41 +3424,61 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
3387
  <!-- End divAnswers -->
3388
  <!-- divResults -->
3389
  <div id="divResults">
3390
-
3391
- <div class="pds-answer-group" id="pds-answer-group4">
3392
- <label for="PDI_feedback1" class="pds-answer" id="pds-answer4"><span class="pds-answer-text"><?php _e( 'I use it in school!', 'polldaddy' ); ?></span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>46%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes"><?php printf( __( '(%d votes)', 'polldaddy' ), 620 ); ?></span></label>
3393
- <span class="pds-clear"></span>
3394
- <div id="pds-answer-feedback">
3395
- <div style="width:46%;" id="pds-answer-feedback-bar" class="pds-answer-feedback-bar"></div>
 
 
 
 
 
3396
  </div>
3397
- <span class="pds-clear"></span>
3398
  </div>
3399
-
3400
- <div class="pds-answer-group" id="pds-answer-group5">
3401
- <label for="PDI_feedback2" class="pds-answer" id="pds-answer5"><span class="pds-answer-text"><?php _e( 'I use it at home.', 'polldaddy' ); ?></span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>30%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes"><?php printf( __( '(%d votes)', 'polldaddy' ), 400 ); ?></span></label>
3402
- <span class="pds-clear"></span>
3403
- <div id="pds-answer-feedback2">
3404
- <div style="width:46%;" id="pds-answer-feedback-bar2" class="pds-answer-feedback-bar"></div>
 
 
 
 
 
3405
  </div>
3406
- <span class="pds-clear"></span>
3407
  </div>
3408
-
3409
- <div class="pds-answer-group" id="pds-answer-group6">
3410
- <label for="PDI_feedback3" class="pds-answer" id="pds-answer6"><span class="pds-answer-text"><?php _e( 'I use it every where I go, at work and home and anywhere else that I can!', 'polldaddy' ); ?></span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>16%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes"><?php printf( __( '(%d votes)', 'polldaddy' ), 220 ); ?></span></label>
3411
- <span class="pds-clear"></span>
3412
- <div id="pds-answer-feedback3">
3413
- <div style="width:16%;" id="pds-answer-feedback-bar3" class="pds-answer-feedback-bar"></div>
 
 
 
 
 
3414
  </div>
3415
- <span class="pds-clear"></span>
3416
  </div>
3417
-
3418
- <div class="pds-answer-group" id="pds-answer-group7">
3419
- <label for="PDI_feedback4" class="pds-answer" id="pds-answer7"><span class="pds-answer-text"><?php _e( 'Other', 'polldaddy' ); ?></span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>8%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes"><?php printf( __( '(%d votes)', 'polldaddy' ), 110 ); ?></span></label>
3420
- <span class="pds-clear"></span>
3421
- <div id="pds-answer-feedback4">
3422
- <div style="width:8%;" id="pds-answer-feedback-bar4" class="pds-answer-feedback-bar"></div>
 
 
 
 
 
3423
  </div>
3424
- <span class="pds-clear"></span>
3425
  </div>
3426
 
3427
  </div>
@@ -4510,6 +4567,13 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
4510
  <?php endforeach; ?>
4511
  </select>
4512
  <input class="button-secondary action" type="submit" value="<?php _e( 'Filter', 'polldaddy' );?>" />
 
 
 
 
 
 
 
4513
  </div>
4514
  <div class="alignright">
4515
  <div class="tablenav-pages">
@@ -4887,10 +4951,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/scr
4887
  return (bool) current_user_can( 'edit_others_posts' );
4888
  }
4889
 
4890
- function log( $message ) {
4891
- if ( defined( 'WP_DEBUG_LOG' ) )
4892
- $GLOBALS[ 'wp_log' ][ 'polldaddy' ][] = $message;
4893
- }
4894
  }
4895
 
4896
  require dirname( __FILE__ ).'/rating.php';
@@ -4898,4 +4959,4 @@ require dirname( __FILE__ ).'/ajax.php';
4898
  require dirname( __FILE__ ).'/popups.php';
4899
  require dirname( __FILE__ ).'/polldaddy-org.php';
4900
 
4901
- $GLOBALS[ 'wp_log_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.10
10
  */
11
 
12
  // You can hardcode your Polldaddy PartnerGUID (API Key) here
35
  $this->log( 'Created WP_Polldaddy Object: constructor' );
36
  $this->errors = new WP_Error;
37
  $this->scheme = 'https';
38
+ $this->version = '2.0.10';
39
  $this->multiple_accounts = true;
40
  $this->polldaddy_client_class = 'api_client';
41
  $this->polldaddy_clients = array();
2593
  }
2594
 
2595
  $style->css = trim( urldecode( $style->css ) );
2596
+
2597
+ $direction = 'ltr';
2598
+ if ( in_array( $style->_direction, array( 'ltr', 'rtl') ) )
2599
+ $direction = $style->_direction;
2600
+
2601
  if ( $start = stripos( $style->css, '<data>' ) )
2602
  $style->css = substr( $style->css, $start );
2603
 
2664
  <option value="117"><?php _e( 'Skull Light', 'polldaddy' ); ?></option>
2665
  <option value="157"><?php _e( 'Micro', 'polldaddy' ); ?></option>
2666
  </select>
2667
+ <a tabindex="4" id="style-preload" href="javascript:preload_pd_style();" class="button"><?php echo esc_attr( __( 'Load Style', 'polldaddy' ) ); ?></a>
2668
+ </div>
2669
+ </td>
2670
+ </tr>
2671
+ <tr>
2672
+ <td class="pd-editor-label">
2673
+ <label class="CSSE_title_label"><?php _e( 'Text Direction', 'polldaddy' ); ?></label>
2674
+ </td>
2675
+ <td>
2676
+ <div class="CSSE_rtl_ltr">
2677
+ <a tabindex="4" id="style-force-rtl" href="#" onclick="javascript:force_rtl();" class="button" style="<?php echo $direction == 'rtl' ? 'display:none;' : '' ;?>"><?php echo esc_attr( __( 'Force RTL', 'polldaddy' ) ); ?></a>
2678
+ <a tabindex="4" id="style-force-ltr" href="#" onclick="javascript:force_ltr();" class="button" style="<?php echo $direction == 'ltr' ? 'display:none;' : '' ;?>"><?php echo esc_attr( __( 'Force LTR', 'polldaddy' ) ); ?></a>
2679
  </div>
2680
  </td>
2681
  </tr>
2696
  <option value="pds-textfield"><?php _e( 'Other Input', 'polldaddy' ); ?></option>
2697
  <option value="pds-vote-button"><?php _e( 'Vote Button', 'polldaddy' ); ?></option>
2698
  <option value="pds-link"><?php _e( 'Links', 'polldaddy' ); ?></option>
2699
+ <option value="pds-feedback-group"><?php _e( 'Feedback Group', 'polldaddy' ); ?></option>
2700
+ <option value="pds-feedback-result"><?php _e( 'Results Group', 'polldaddy' ); ?></option>
2701
+ <option value="pds-feedback-per"><?php _e( 'Results Percent', 'polldaddy' ); ?></option>
2702
+ <option value="pds-feedback-votes"><?php _e( 'Results Votes', 'polldaddy' ); ?></option>
2703
+ <option value="pds-answer-text"><?php _e( 'Results Text', 'polldaddy' ); ?></option>
2704
+ <option value="pds-answer-feedback"><?php _e( 'Results Background', 'polldaddy' ); ?></option>
2705
+ <option value="pds-answer-feedback-bar"><?php _e( 'Results Bar', 'polldaddy' ); ?></option>
2706
  <option value="pds-totalvotes-inner"><?php _e( 'Total Votes', 'polldaddy' ); ?></option>
2707
  </select>
2708
 
2739
  <div class="off" id="D_Height">
2740
  <a href="javascript:CSSE_changeView('Height');" id="A_Height" class="Aoff"><?php _e( 'Height', 'polldaddy' ); ?></a>
2741
  </div>
2742
+ <div class="off" id="D_Position">
2743
+ <a href="javascript:CSSE_changeView('Position');" id="A_Position" class="Aoff"><?php _e( 'Position', 'polldaddy' ); ?></a>
2744
+ </div>
2745
  </td>
2746
  <td class="CSSE_main_r" valign="top">
2747
  <table class="CSSE_sub">
3327
  </td>
3328
  </tr>
3329
  </table>
3330
+
3331
+ <table class="CSSE_edit" id="editPosition" style="display:none;">
3332
+ <tr>
3333
+ <td width="85"><?php _e( 'Position', 'polldaddy' ); ?> (px):</td>
3334
+ <td>
3335
+ <select class="set-width" id="float" onchange="bind(this);">
3336
+ <option value="left">Left</option>
3337
+ <option value="right">Right</option>
3338
+ </select>
3339
+ <input type="hidden" id="position" />
3340
+ <input type="hidden" id="direction" />
3341
+ </td>
3342
+ </tr>
3343
+ </table>
3344
  </td>
3345
  </tr>
3346
  <tr>
3424
  <!-- End divAnswers -->
3425
  <!-- divResults -->
3426
  <div id="divResults">
3427
+
3428
+ <div class="pds-feedback-group" id="pds-feedback-group" >
3429
+ <label class="pds-feedback-label" id="pds-feedback-label">
3430
+ <span class="pds-answer-text" id="pds-answer-text"><?php _e( 'I use it in school!', 'polldaddy' ); ?></span>
3431
+ <span class="pds-feedback-result" id="pds-feedback-result">
3432
+ <span class="pds-feedback-per" id="pds-feedback-per">&nbsp;46%</span>&nbsp;<span class="pds-feedback-votes" id="pds-feedback-votes"> <?php printf( __( '(%d votes)', 'polldaddy' ), 620 ); ?></span>
3433
+ </span>
3434
+ </label>
3435
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3436
+ <div class="pds-answer-feedback" id="pds-answer-feedback">
3437
+ <div style="width:46%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar"></div>
3438
  </div>
3439
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3440
  </div>
3441
+
3442
+ <div class="pds-feedback-group" id="pds-feedback-group1">
3443
+ <label class="pds-feedback-label" id="pds-feedback-label1">
3444
+ <span class="pds-answer-text" id="pds-answer-text1"><?php _e( 'I use it at home.', 'polldaddy' ); ?></span>
3445
+ <span class="pds-feedback-result" id="pds-feedback-result1">
3446
+ <span class="pds-feedback-per" id="pds-feedback-per1">&nbsp;30%</span>&nbsp;<span class="pds-feedback-votes" id="pds-feedback-votes1"> <?php printf( __( '(%d votes)', 'polldaddy' ), 400 ); ?></span>
3447
+ </span>
3448
+ </label>
3449
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3450
+ <div class="pds-answer-feedback" id="pds-answer-feedback1">
3451
+ <div style="width:30%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar1"></div>
3452
  </div>
3453
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3454
  </div>
3455
+
3456
+ <div class="pds-feedback-group" id="pds-feedback-group2">
3457
+ <label class="pds-feedback-label" id="pds-feedback-label2">
3458
+ <span class="pds-answer-text" id="pds-answer-text2"><?php _e( 'I use it every where I go, at work and home and anywhere else that I can!', 'polldaddy' ); ?></span>
3459
+ <span class="pds-feedback-result" id="pds-feedback-result2">
3460
+ <span class="pds-feedback-per" id="pds-feedback-per2">&nbsp;16%</span>&nbsp;<span class="pds-feedback-votes" id="pds-feedback-votes2"> <?php printf( __( '(%d votes)', 'polldaddy' ), 220 ); ?></span>
3461
+ </span>
3462
+ </label>
3463
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3464
+ <div class="pds-answer-feedback" id="pds-answer-feedback2">
3465
+ <div style="width:16%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar2"></div>
3466
  </div>
3467
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3468
  </div>
3469
+
3470
+ <div class="pds-feedback-group" id="pds-feedback-group3">
3471
+ <label class="pds-feedback-label" id="pds-feedback-label3">
3472
+ <span class="pds-answer-text" id="pds-answer-text3"><?php _e( 'Other', 'polldaddy' ); ?></span>
3473
+ <span class="pds-feedback-result" id="pds-feedback-result3">
3474
+ <span class="pds-feedback-per" id="pds-feedback-per3">&nbsp;8%</span>&nbsp;<span class="pds-feedback-votes" id="pds-feedback-votes3"> <?php printf( __( '(%d votes)', 'polldaddy' ), 110 ); ?></span>
3475
+ </span>
3476
+ </label>
3477
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3478
+ <div class="pds-answer-feedback" id="pds-answer-feedback3">
3479
+ <div style="width:8%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar3"></div>
3480
  </div>
3481
+ <span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear">&nbsp;</span>
3482
  </div>
3483
 
3484
  </div>
4567
  <?php endforeach; ?>
4568
  </select>
4569
  <input class="button-secondary action" type="submit" value="<?php _e( 'Filter', 'polldaddy' );?>" />
4570
+ <?php if ( in_array( $period, array( 1, 7 ) ) ) : ?>
4571
+ <label><?php _e( '* The results are cached and are updated every hour' ); ?></label>
4572
+ <?php elseif ( $period == 31 ) : ?>
4573
+ <label><?php _e( '* The results are cached and are updated every day' ); ?></label>
4574
+ <?php else : ?>
4575
+ <label><?php _e( '* The results are cached and are updated every 3 days' ); ?></label>
4576
+ <?php endif; ?>
4577
  </div>
4578
  <div class="alignright">
4579
  <div class="tablenav-pages">
4951
  return (bool) current_user_can( 'edit_others_posts' );
4952
  }
4953
 
4954
+ function log( $message ) {}
 
 
 
4955
  }
4956
 
4957
  require dirname( __FILE__ ).'/rating.php';
4959
  require dirname( __FILE__ ).'/popups.php';
4960
  require dirname( __FILE__ ).'/polldaddy-org.php';
4961
 
4962
+ $GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: eoigal, alternatekev, mdawaffe, donncha, johnny5
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 3.2.1
6
- Stable tag: 2.0.9
7
 
8
  Create and manage Polldaddy polls and ratings from within WordPress.
9
 
@@ -67,12 +67,25 @@ More info here - http://codex.wordpress.org/Theme_Development#Plugin_API_Hooks
67
 
68
  You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
69
 
 
 
 
 
 
 
 
 
70
 
71
  == Upgrade Notice ==
72
- = 2.0.9 =
73
- Added support for slider popup polls and variable sized surveys. Added activity logging. Added Latvian translation.
 
74
 
75
  == Change Log ==
 
 
 
 
76
  = 2.0.9 =
77
  * Added support for slider popup polls and variable sized surveys
78
  * Added activity logging
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 3.2.1
6
+ Stable tag: 2.0.10
7
 
8
  Create and manage Polldaddy polls and ratings from within WordPress.
9
 
67
 
68
  You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
69
 
70
+ = When I try to use a rating on a page, I get a PHP warning about the post title. =
71
+
72
+ Your rating uses the filter 'wp_title' by default when retrieving the post title, you may need to remove this in the Polls & Ratings settings to allow ratings to work with your theme.
73
+
74
+ = Why is a poll loading in the footer of my main page? =
75
+
76
+ Your theme is getting the post content, without necessarily showing it. If the post has a poll, the poll javascript is loaded in the footer. To fix this, you need to enable the 'Load Shortcodes Inline' setting in the Polls & Ratings settings. This will load the poll shortcode inline and will only load the poll if the content of the post is actually displayed.
77
+
78
 
79
  == Upgrade Notice ==
80
+ = 2.0.10 =
81
+ Create custom poll styles that support RTL text direction.
82
+
83
 
84
  == Change Log ==
85
+ = 2.0.10 =
86
+ * Added option to custom style editor to set direction of text.
87
+ * Added option to allow shortcodes to load inline rather than in the footer. Some themes need this.
88
+
89
  = 2.0.9 =
90
  * Added support for slider popup polls and variable sized surveys
91
  * Added activity logging