Crowdsignal Dashboard – Polls, Surveys & more - Version 0.9

Version Description

  • Compatiblity with WordPress 2.7
  • Bug Fix: Potential charset issues
Download this release

Release Info

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

Code changes from version 0.8 to 0.9

Files changed (5) hide show
  1. polldaddy.css +7 -5
  2. polldaddy.gif +0 -0
  3. polldaddy.php +92 -67
  4. polldaddy.png +0 -0
  5. readme.txt +6 -2
polldaddy.css CHANGED
@@ -1,7 +1,9 @@
1
  html, body {
2
  height: auto !important;
3
  }
4
-
 
 
5
  body.poll-preview-iframe #sidemenu,
6
  body.poll-preview-iframe #submenu,
7
  body.poll-preview-iframe #wpcombar,
@@ -21,10 +23,6 @@ body.poll-preview-iframe-editor #manage-polls h2#preview-header {
21
  display: block;
22
  }
23
 
24
- h2#poll-list-header {
25
- margin-bottom: 1.2em;
26
- }
27
-
28
  body.poll-preview-iframe {
29
  margin: 0 !important;
30
  padding: 0 !important;
@@ -221,6 +219,10 @@ p#add-answer-holder {
221
  margin: 10px 0;
222
  }
223
 
 
 
 
 
224
  tr.polldaddy-shortcode-row {
225
  background-color: #FFFEEB;
226
  }
1
  html, body {
2
  height: auto !important;
3
  }
4
+ body.poll-preview-iframe {
5
+ min-width: 0;
6
+ }
7
  body.poll-preview-iframe #sidemenu,
8
  body.poll-preview-iframe #submenu,
9
  body.poll-preview-iframe #wpcombar,
23
  display: block;
24
  }
25
 
 
 
 
 
26
  body.poll-preview-iframe {
27
  margin: 0 !important;
28
  padding: 0 !important;
219
  margin: 10px 0;
220
  }
221
 
222
+ .postbox {
223
+ min-width: 220px;
224
+ }
225
+
226
  tr.polldaddy-shortcode-row {
227
  background-color: #FFFEEB;
228
  }
polldaddy.gif DELETED
Binary file
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: 0.8
9
  */
10
 
11
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
@@ -40,7 +40,10 @@ class WP_PollDaddy {
40
  }
41
 
42
  if ( !WP_POLLDADDY__PARTNERGUID ) {
43
- $hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ) );
 
 
 
44
  add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
45
  if ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] )
46
  add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "You need to <a href=\"%s\">input your PollDaddy.com account details</a>.", "edit.php?page=polls" ) . "</p></div>";' ) );
@@ -54,9 +57,17 @@ class WP_PollDaddy {
54
  false
55
  );
56
  }
57
- $hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
 
 
 
 
58
  add_action( "load-$hook", array( &$this, 'management_page_load' ) );
59
 
 
 
 
 
60
  add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
61
  }
62
 
@@ -83,7 +94,7 @@ class WP_PollDaddy {
83
  'uEmail' => $polldaddy_email,
84
  'uPass' => $polldaddy_password
85
  );
86
- if ( function_exists( 'wp_remote_post' ) ) {
87
  $polldaddy_api_key = wp_remote_post( 'http://api.polldaddy.com/key/new.aspx', array(
88
  'body' => $details
89
  ) );
@@ -226,7 +237,7 @@ class WP_PollDaddy {
226
 
227
  function media_buttons() {
228
  $title = __( 'Add Poll' );
229
- echo "<a href='admin.php?page=polls&amp;iframe&amp;TB_iframe=true' id='add_poll' class='thickbox' title='$title'><img src='{$this->base_url}polldaddy.gif' alt='$title' /></a>";
230
  }
231
 
232
  function management_page_load() {
@@ -242,7 +253,7 @@ class WP_PollDaddy {
242
  wp_enqueue_script( 'admin-forms' );
243
  add_thickbox();
244
 
245
- wp_enqueue_style( 'polls', "{$this->base_url}polldaddy.css", array(), $this->version );
246
  add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
247
 
248
  add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
@@ -626,9 +637,9 @@ class WP_PollDaddy {
626
 
627
  ?>
628
 
629
- <ul class="view-switch">
630
- <li<?php if ( 'blog' == $view ) echo ' class="current"'; ?>><a href="<?php echo clean_url( add_query_arg( 'view', false ) ); ?>"><?php _e( "All Blog's Polls" ); ?></a></li>
631
- <li<?php if ( 'user' == $view ) echo ' class="current"'; ?>><a href="<?php echo clean_url( add_query_arg( 'view', 'user' ) ); ?>"><?php _e( "All My Polls" ); ?></a></li>
632
  </ul>
633
  <form method="post" action="">
634
  <div class="tablenav">
@@ -768,47 +779,73 @@ class WP_PollDaddy {
768
  <div id="poststuff"><div id="post-body" class="has-sidebar">
769
 
770
  <div class="inner-sidebar" id="side-info-column">
771
- <h3><?php _e( 'Poll results' ); ?></h3>
772
- <div class="inside">
773
- <ul class="poll-options">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
 
775
  <?php
776
- foreach ( array( 'show' => __( 'Show results to voters' ), 'percent' => __( 'Only show percentages' ), 'hide' => __( 'Hide all results' ) ) as $value => $label ) :
777
- if ( $is_POST )
778
- $checked = $value === $_POST['resultsType'] ? ' checked="checked"' : '';
779
- else
780
- $checked = $value === $poll->resultsType ? ' checked="checked"' : '';
781
  ?>
782
 
783
- <li>
784
  <label for="resultsType-<?php echo $value; ?>"><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="resultsType" id="resultsType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
785
- </li>
786
 
787
- <?php endforeach; ?>
788
 
789
- </ul>
 
790
  </div>
791
 
792
- <h3><?php _e( 'Block repeat voters' ); ?></h3>
793
- <div class="inside">
794
- <ul class="poll-options">
 
795
 
796
  <?php
797
- foreach ( array( 'off' => __( "Don't block repeat voters" ), 'cookie' => __( 'Block by cookie (recommended)' ), 'cookieIP' => __( 'Block by cookie and by IP address' ) ) as $value => $label ) :
798
- if ( $is_POST )
799
- $checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : '';
800
- else
801
- $checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : '';
802
  ?>
803
 
804
- <li>
805
- <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>
806
- </li>
807
 
808
- <?php endforeach; ?>
809
 
810
- </ul>
811
- <p>Note: Blocking by cookie and IP address can be problematic for some voters.</p>
 
812
  </div>
813
  </div>
814
 
@@ -816,16 +853,15 @@ class WP_PollDaddy {
816
  <div id="post-body-content" class="has-sidebar-content">
817
 
818
  <div id="titlediv">
819
- <h3><label for="title"><?php _e( 'Question' ); ?></label></h3>
820
  <div id="titlewrap">
821
  <input type="text" autocomplete="off" id="title" value="<?php echo $question; ?>" tabindex="1" size="30" name="question" />
822
  </div>
823
  </div>
824
 
825
- <div id="answersdiv">
826
  <h3><?php _e( 'Answers' ); ?></h3>
827
 
828
- <div id="answerswrap">
829
  <ul id="answers">
830
  <?php
831
  $a = 0;
@@ -892,21 +928,22 @@ class WP_PollDaddy {
892
  </div>
893
  </div>
894
 
895
- <div id="design">
896
 
897
  <?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID ); ?>
898
 
899
  <h3><?php _e( 'Design' ); ?></h3>
900
 
901
- <div class="hide-if-no-js">
902
- <a class="alignleft" href="#previous">&#171;</a>
903
- <a class="alignright" href="#next">&#187;</a>
904
- <img src="http://polldaddy.com/Images/polls/<?php echo $style_ID; ?>.gif" />
905
- <img class="hide-if-js" src="http://polldaddy.com/Images/polls/<?php echo 1 + $style_ID; ?>.gif" />
906
- </div>
 
907
 
908
- <p class="hide-if-js" id="no-js-styleID">
909
- <select name="styleID">
910
 
911
  <?php
912
  $options = array(
@@ -933,28 +970,16 @@ class WP_PollDaddy {
933
  foreach ( $options as $styleID => $label ) :
934
  $selected = $styleID == $style_ID ? ' selected="selected"' : '';
935
  ?>
936
- <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
937
- <?php endforeach; ?>
938
 
939
- </select>
940
- </p>
 
941
  </div>
942
 
943
- <p class="submit">
944
- <?php wp_nonce_field( $poll_id ? "edit-poll_$poll_id" : 'create-poll' ); ?>
945
- <input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?>" />
946
- <input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?>" />
947
- <input type="submit" class="button button-highlighted" value="<?php echo attribute_escape( __( 'Save Poll' ) ); ?>" />
948
-
949
- <?php if ( isset( $_GET['iframe'] ) && $poll_id ) : ?>
950
-
951
- <input type="button" class="button polldaddy-send-to-editor" value="<?php echo attribute_escape( __( 'Send to Editor' ) ); ?>" />
952
-
953
- <?php endif; ?>
954
-
955
- </p>
956
-
957
- </div></div></div>
958
  </form>
959
  <br class="clear" />
960
 
@@ -1070,7 +1095,7 @@ function polldaddy_shortcode($atts, $content=null) {
1070
 
1071
  $poll = (int) $poll;
1072
 
1073
- return "<script type='text/javascript' language='javascript' src='http://s3.polldaddy.com/p/$poll.js'></script><noscript> <a href='http://answers.polldaddy.com/poll/$poll/'>View Poll</a></noscript>";
1074
  }
1075
 
1076
  add_shortcode('polldaddy', 'polldaddy_shortcode');
5
  Description: Create and manage PollDaddy polls in WordPress
6
  Author: Automattic, Inc.
7
  Author URL: http://automattic.com/
8
+ Version: 0.9
9
  */
10
 
11
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
40
  }
41
 
42
  if ( !WP_POLLDADDY__PARTNERGUID ) {
43
+ if ( function_exists( 'add_object_page' ) ) // WP 2.7+
44
+ $hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ), '/wp-content/admin-plugins/polldaddy/polldaddy.png' );
45
+ else
46
+ $hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ) );
47
  add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
48
  if ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] )
49
  add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "You need to <a href=\"%s\">input your PollDaddy.com account details</a>.", "edit.php?page=polls" ) . "</p></div>";' ) );
57
  false
58
  );
59
  }
60
+
61
+ if ( function_exists( 'add_object_page' ) ) // WP 2.7+
62
+ $hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ), '/wp-content/admin-plugins/polldaddy/polldaddy.png' );
63
+ else
64
+ $hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
65
  add_action( "load-$hook", array( &$this, 'management_page_load' ) );
66
 
67
+ // Hack-a-lack-a
68
+ add_submenu_page( 'polls', __( 'Edit Polls' ), __( 'Edit' ), 'edit_posts', 'polls' ); //, array( &$this, 'management_page' ) );
69
+ add_submenu_page( 'polls', __( 'Add New Poll' ), __( 'Add New' ), 'edit_posts', 'polls&action=create-poll', array( &$this, 'management_page' ) );
70
+
71
  add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
72
  }
73
 
94
  'uEmail' => $polldaddy_email,
95
  'uPass' => $polldaddy_password
96
  );
97
+ if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
98
  $polldaddy_api_key = wp_remote_post( 'http://api.polldaddy.com/key/new.aspx', array(
99
  'body' => $details
100
  ) );
237
 
238
  function media_buttons() {
239
  $title = __( 'Add Poll' );
240
+ echo "<a href='admin.php?page=polls&amp;iframe&amp;TB_iframe=true' id='add_poll' class='thickbox' title='$title'><img src='{$this->base_url}polldaddy.png' alt='$title' /></a>";
241
  }
242
 
243
  function management_page_load() {
253
  wp_enqueue_script( 'admin-forms' );
254
  add_thickbox();
255
 
256
+ wp_enqueue_style( 'polls', "{$this->base_url}polldaddy.css", array( 'global', 'wp-admin' ), $this->version );
257
  add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
258
 
259
  add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
637
 
638
  ?>
639
 
640
+ <ul class="subsubsub">
641
+ <li><a href="<?php echo clean_url( add_query_arg( array( 'view' => false, 'paged' => false ) ) ); ?>"<?php if ( 'blog' == $view ) echo ' class="current"'; ?>><?php _e( "All Blog's Polls" ); ?></a> | </li>
642
+ <li><a href="<?php echo clean_url( add_query_arg( array( 'view' => 'user', 'paged' => false ) ) ); ?>"<?php if ( 'user' == $view ) echo ' class="current"'; ?>><?php _e( "All My Polls" ); ?></a></li>
643
  </ul>
644
  <form method="post" action="">
645
  <div class="tablenav">
779
  <div id="poststuff"><div id="post-body" class="has-sidebar">
780
 
781
  <div class="inner-sidebar" id="side-info-column">
782
+ <div id="submitdiv" class="postbox">
783
+ <h3><?php _e( 'Publish' ); ?></h3>
784
+ <div class="inside">
785
+ <div id="major-publishing-actions">
786
+ <p id="publishing-action">
787
+ <?php wp_nonce_field( $poll_id ? "edit-poll_$poll_id" : 'create-poll' ); ?>
788
+ <input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?>" />
789
+ <input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?>" />
790
+ <input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Save Poll' ) ); ?>" />
791
+
792
+ <?php if ( isset( $_GET['iframe'] ) && $poll_id ) : ?>
793
+
794
+ <input type="button" class="button polldaddy-send-to-editor" value="<?php echo attribute_escape( __( 'Send to Editor' ) ); ?>" />
795
+
796
+ <?php endif; ?>
797
+
798
+ </p>
799
+ <br class="clear" />
800
+ </div>
801
+ </div>
802
+ </div>
803
+
804
+ <div class="postbox">
805
+ <h3><?php _e( 'Poll results' ); ?></h3>
806
+ <div class="inside">
807
+ <ul class="poll-options">
808
 
809
  <?php
810
+ foreach ( array( 'show' => __( 'Show results to voters' ), 'percent' => __( 'Only show percentages' ), 'hide' => __( 'Hide all results' ) ) as $value => $label ) :
811
+ if ( $is_POST )
812
+ $checked = $value === $_POST['resultsType'] ? ' checked="checked"' : '';
813
+ else
814
+ $checked = $value === $poll->resultsType ? ' checked="checked"' : '';
815
  ?>
816
 
817
+ <li>
818
  <label for="resultsType-<?php echo $value; ?>"><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="resultsType" id="resultsType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
819
+ </li>
820
 
821
+ <?php endforeach; ?>
822
 
823
+ </ul>
824
+ </div>
825
  </div>
826
 
827
+ <div class="postbox">
828
+ <h3><?php _e( 'Block repeat voters' ); ?></h3>
829
+ <div class="inside">
830
+ <ul class="poll-options">
831
 
832
  <?php
833
+ foreach ( array( 'off' => __( "Don't block repeat voters" ), 'cookie' => __( 'Block by cookie (recommended)' ), 'cookieIP' => __( 'Block by cookie and by IP address' ) ) as $value => $label ) :
834
+ if ( $is_POST )
835
+ $checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : '';
836
+ else
837
+ $checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : '';
838
  ?>
839
 
840
+ <li>
841
+ <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>
842
+ </li>
843
 
844
+ <?php endforeach; ?>
845
 
846
+ </ul>
847
+ <p>Note: Blocking by cookie and IP address can be problematic for some voters.</p>
848
+ </div>
849
  </div>
850
  </div>
851
 
853
  <div id="post-body-content" class="has-sidebar-content">
854
 
855
  <div id="titlediv">
 
856
  <div id="titlewrap">
857
  <input type="text" autocomplete="off" id="title" value="<?php echo $question; ?>" tabindex="1" size="30" name="question" />
858
  </div>
859
  </div>
860
 
861
+ <div id="answersdiv" class="postbox">
862
  <h3><?php _e( 'Answers' ); ?></h3>
863
 
864
+ <div id="answerswrap" class="inside">
865
  <ul id="answers">
866
  <?php
867
  $a = 0;
928
  </div>
929
  </div>
930
 
931
+ <div id="design" class="postbox">
932
 
933
  <?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID ); ?>
934
 
935
  <h3><?php _e( 'Design' ); ?></h3>
936
 
937
+ <div class="inside">
938
+ <div class="hide-if-no-js">
939
+ <a class="alignleft" href="#previous">&#171;</a>
940
+ <a class="alignright" href="#next">&#187;</a>
941
+ <img src="http://polldaddy.com/Images/polls/<?php echo $style_ID; ?>.gif" />
942
+ <img class="hide-if-js" src="http://polldaddy.com/Images/polls/<?php echo 1 + $style_ID; ?>.gif" />
943
+ </div>
944
 
945
+ <p class="hide-if-js" id="no-js-styleID">
946
+ <select name="styleID">
947
 
948
  <?php
949
  $options = array(
970
  foreach ( $options as $styleID => $label ) :
971
  $selected = $styleID == $style_ID ? ' selected="selected"' : '';
972
  ?>
973
+ <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
974
+ <?php endforeach; ?>
975
 
976
+ </select>
977
+ </p>
978
+ </div>
979
  </div>
980
 
981
+ </div>
982
+ </div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
983
  </form>
984
  <br class="clear" />
985
 
1095
 
1096
  $poll = (int) $poll;
1097
 
1098
+ return "<script type='text/javascript' language='javascript' charset='utf-8' src='http://s3.polldaddy.com/p/$poll.js'></script><noscript> <a href='http://answers.polldaddy.com/poll/$poll/'>View Poll</a></noscript>";
1099
  }
1100
 
1101
  add_shortcode('polldaddy', 'polldaddy_shortcode');
polldaddy.png ADDED
Binary file
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mdawaffe
3
  Tags: poll, polls, polldaddy, WordPress.com
4
  Requires at least: 2.6
5
- Tested up to: 2.6.3
6
- Stable tag: 0.8
7
 
8
  Create and manage PollDaddy polls from within WordPress.
9
 
@@ -31,6 +31,10 @@ Nope. The permissions are the same as for posts. So Editors and Administrators
31
 
32
  == Change Log ==
33
 
 
 
 
 
34
  = 0.8 =
35
  * Bug fix: prevent some PHP define errors
36
  * Bug fix: send content-length header when using wp_remote_post()
2
  Contributors: mdawaffe
3
  Tags: poll, polls, polldaddy, WordPress.com
4
  Requires at least: 2.6
5
+ Tested up to: 2.7.1
6
+ Stable tag: 0.9
7
 
8
  Create and manage PollDaddy polls from within WordPress.
9
 
31
 
32
  == Change Log ==
33
 
34
+ = 0.9 =
35
+ * Compatiblity with WordPress 2.7
36
+ * Bug Fix: Potential charset issues
37
+
38
  = 0.8 =
39
  * Bug fix: prevent some PHP define errors
40
  * Bug fix: send content-length header when using wp_remote_post()