Version Description
Bug Fix: SSL request for PollDaddy API key sometimes failed due to host constraints, included option to make a normal http request in this case. Bug Fix: Redirect after login now goes to list polls
Download this release
Release Info
| Developer | eoigal |
| Plugin | |
| Version | 1.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0 to 1.2
- polldaddy.css +8 -2
- polldaddy.js +8 -7
- polldaddy.php +74 -28
- readme.txt +12 -2
polldaddy.css
CHANGED
|
@@ -15,6 +15,7 @@ body.poll-preview-iframe #adminmenu,
|
|
| 15 |
body.poll-preview-iframe #sidemenu-bg,
|
| 16 |
body.poll-preview-iframe #footer,
|
| 17 |
body.poll-preview-iframe #feedbacklink,
|
|
|
|
| 18 |
body.poll-preview-iframe #manage-polls h2#preview-header {
|
| 19 |
display: none;
|
| 20 |
}
|
|
@@ -23,6 +24,10 @@ body.poll-preview-iframe-editor #manage-polls h2#preview-header {
|
|
| 23 |
display: block;
|
| 24 |
}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
body.poll-preview-iframe {
|
| 27 |
margin: 0 !important;
|
| 28 |
padding: 0 !important;
|
|
@@ -43,7 +48,7 @@ body.poll-preview-iframe div#wpcontent {
|
|
| 43 |
|
| 44 |
body.poll-preview-iframe div#wpbody {
|
| 45 |
margin: 0;
|
| 46 |
-
padding: 3em;
|
| 47 |
text-align: center;
|
| 48 |
}
|
| 49 |
|
|
@@ -211,7 +216,8 @@ p#add-answer-holder {
|
|
| 211 |
width: 100%;
|
| 212 |
}
|
| 213 |
|
| 214 |
-
.has-sidebar .has-sidebar-content
|
|
|
|
| 215 |
margin-right: 245px;
|
| 216 |
}
|
| 217 |
|
| 15 |
body.poll-preview-iframe #sidemenu-bg,
|
| 16 |
body.poll-preview-iframe #footer,
|
| 17 |
body.poll-preview-iframe #feedbacklink,
|
| 18 |
+
body.poll-preview-iframe #screen-meta,
|
| 19 |
body.poll-preview-iframe #manage-polls h2#preview-header {
|
| 20 |
display: none;
|
| 21 |
}
|
| 24 |
display: block;
|
| 25 |
}
|
| 26 |
|
| 27 |
+
body.poll-preview-iframe h2 {
|
| 28 |
+
padding-top: 0;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
body.poll-preview-iframe {
|
| 32 |
margin: 0 !important;
|
| 33 |
padding: 0 !important;
|
| 48 |
|
| 49 |
body.poll-preview-iframe div#wpbody {
|
| 50 |
margin: 0;
|
| 51 |
+
padding: 2em 3em;
|
| 52 |
text-align: center;
|
| 53 |
}
|
| 54 |
|
| 216 |
width: 100%;
|
| 217 |
}
|
| 218 |
|
| 219 |
+
.has-sidebar .has-sidebar-content,
|
| 220 |
+
.has-right-sidebar #post-body-content {
|
| 221 |
margin-right: 245px;
|
| 222 |
}
|
| 223 |
|
polldaddy.js
CHANGED
|
@@ -54,22 +54,23 @@ jQuery(function($){
|
|
| 54 |
return;
|
| 55 |
}
|
| 56 |
var img2 = $('#design img:last');
|
| 57 |
-
var imgPath = 'http://polldaddy.com/
|
| 58 |
|
|
|
|
| 59 |
var styles = $(':input[name=styleID]').remove();
|
| 60 |
var o = parseInt( styles.val() );
|
| 61 |
-
$('#design').append( '<input type="hidden" id="hidden-styleID" name="styleID" value="' + o.toString() + '" /><p><strong id="styleID-name">' + $(styles.find('option').get(o)).text() + '</strong><br /><span id="span-styleID">' + ( o + 1 ).toString() + '</span> of
|
| 62 |
var hiddenStyleID = $('#hidden-styleID');
|
| 63 |
var spanStyleID = $('#span-styleID');
|
| 64 |
var styleIDName = $('#styleID-name');
|
| 65 |
|
| 66 |
var changePreview = function( i ) {
|
| 67 |
var o = parseInt( img1.attr( 'src' ).substr( imgPath.length ) );
|
| 68 |
-
img1.attr( 'src', imgPath + ( ( i + o +
|
| 69 |
-
img2.attr( 'src', imgPath + ( ( 2 * i + o +
|
| 70 |
-
hiddenStyleID.val( ( ( i + o +
|
| 71 |
-
spanStyleID.text( ( ( i + o +
|
| 72 |
-
styleIDName.text( $(styles.find('option').get( ( i + o +
|
| 73 |
};
|
| 74 |
|
| 75 |
$('#design a.alignleft').click( function() { changePreview( -1 ); return false; } );
|
| 54 |
return;
|
| 55 |
}
|
| 56 |
var img2 = $('#design img:last');
|
| 57 |
+
var imgPath = 'http://polldaddy.com/images/';
|
| 58 |
|
| 59 |
+
var styleCount = $(':input[name=styleID] option').size();
|
| 60 |
var styles = $(':input[name=styleID]').remove();
|
| 61 |
var o = parseInt( styles.val() );
|
| 62 |
+
$('#design').append( '<input type="hidden" id="hidden-styleID" name="styleID" value="' + o.toString() + '" /><p><strong id="styleID-name">' + $(styles.find('option').get(o)).text() + '</strong><br /><span id="span-styleID">' + ( o + 1 ).toString() + '</span> of ' + styleCount + '</p>');
|
| 63 |
var hiddenStyleID = $('#hidden-styleID');
|
| 64 |
var spanStyleID = $('#span-styleID');
|
| 65 |
var styleIDName = $('#styleID-name');
|
| 66 |
|
| 67 |
var changePreview = function( i ) {
|
| 68 |
var o = parseInt( img1.attr( 'src' ).substr( imgPath.length ) );
|
| 69 |
+
img1.attr( 'src', imgPath + ( ( i + o + styleCount ) % styleCount ).toString() + '.gif' );
|
| 70 |
+
img2.attr( 'src', imgPath + ( ( 2 * i + o + styleCount ) % styleCount ).toString() + '.gif' );
|
| 71 |
+
hiddenStyleID.val( ( ( i + o + styleCount ) % styleCount ).toString() );
|
| 72 |
+
spanStyleID.text( ( ( i + o + styleCount ) % styleCount + 1 ).toString() );
|
| 73 |
+
styleIDName.text( $(styles.find('option').get( ( i + o + styleCount ) % styleCount )).text() );
|
| 74 |
};
|
| 75 |
|
| 76 |
$('#design a.alignleft').click( function() { changePreview( -1 ); return false; } );
|
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.
|
| 9 |
*/
|
| 10 |
|
| 11 |
// You can hardcode your PollDaddy PartnerGUID (API Key) here
|
|
@@ -22,7 +22,9 @@ class WP_PollDaddy {
|
|
| 22 |
var $errors;
|
| 23 |
var $polldaddy_client_class = 'PollDaddy_Client';
|
| 24 |
var $base_url = false;
|
| 25 |
-
var $
|
|
|
|
|
|
|
| 26 |
|
| 27 |
var $polldaddy_clients = array();
|
| 28 |
|
|
@@ -38,12 +40,10 @@ class WP_PollDaddy {
|
|
| 38 |
}
|
| 39 |
|
| 40 |
function admin_menu() {
|
| 41 |
-
global $current_user;
|
| 42 |
-
|
| 43 |
$this->errors = new WP_Error;
|
| 44 |
|
| 45 |
if ( !$this->base_url )
|
| 46 |
-
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
| 47 |
|
| 48 |
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) ) {
|
| 49 |
$guid = get_option( 'polldaddy_api_key' );
|
|
@@ -53,22 +53,19 @@ class WP_PollDaddy {
|
|
| 53 |
}
|
| 54 |
|
| 55 |
if ( !WP_POLLDADDY__PARTNERGUID ) {
|
|
|
|
|
|
|
| 56 |
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
| 57 |
$hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ), "{$this->base_url}polldaddy.png" );
|
| 58 |
else
|
| 59 |
$hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ) );
|
|
|
|
| 60 |
add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
|
| 61 |
if ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] )
|
| 62 |
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>";' ) );
|
| 63 |
return false;
|
| 64 |
}
|
| 65 |
|
| 66 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
| 67 |
-
$polldaddy->reset();
|
| 68 |
-
|
| 69 |
-
if ( !defined( 'WP_POLLDADDY__USERCODE' ) )
|
| 70 |
-
define( 'WP_POLLDADDY__USERCODE', $polldaddy->GetUserCode( $current_user->ID ) );
|
| 71 |
-
|
| 72 |
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
| 73 |
$hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
|
| 74 |
else
|
|
@@ -77,7 +74,7 @@ class WP_PollDaddy {
|
|
| 77 |
|
| 78 |
// Hack-a-lack-a
|
| 79 |
add_submenu_page( 'polls', __( 'Edit Polls' ), __( 'Edit' ), 'edit_posts', 'polls' ); //, array( &$this, 'management_page' ) );
|
| 80 |
-
add_submenu_page( 'polls', __( 'Add New Poll' ), __( 'Add New' ), 'edit_posts', 'polls&action=create-poll', array( &$this, 'management_page' ) );
|
| 81 |
|
| 82 |
add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
|
| 83 |
}
|
|
@@ -90,7 +87,7 @@ class WP_PollDaddy {
|
|
| 90 |
|
| 91 |
$polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
|
| 92 |
$polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
|
| 93 |
-
|
| 94 |
if ( !$polldaddy_email )
|
| 95 |
$this->errors->add( 'polldaddy_email', __( 'Email address required' ) );
|
| 96 |
|
|
@@ -100,20 +97,36 @@ class WP_PollDaddy {
|
|
| 100 |
if ( $this->errors->get_error_codes() )
|
| 101 |
return false;
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
$details = array(
|
| 104 |
'uName' => get_bloginfo( 'name' ),
|
| 105 |
'uEmail' => $polldaddy_email,
|
| 106 |
'uPass' => $polldaddy_password,
|
| 107 |
'partner_userid' => $GLOBALS['current_user']->ID
|
| 108 |
);
|
|
|
|
| 109 |
if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
|
| 110 |
-
$polldaddy_api_key = wp_remote_post( '
|
| 111 |
'body' => $details
|
| 112 |
) );
|
| 113 |
if ( is_wp_error( $polldaddy_api_key ) ) {
|
| 114 |
$this->errors = $polldaddy_api_key;
|
| 115 |
return false;
|
| 116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
$polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
|
| 118 |
} else {
|
| 119 |
$fp = fsockopen(
|
|
@@ -151,13 +164,20 @@ class WP_PollDaddy {
|
|
| 151 |
list($headers, $polldaddy_api_key) = explode( "\r\n\r\n", $response, 2 );
|
| 152 |
}
|
| 153 |
|
| 154 |
-
if (
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
return false;
|
| 157 |
}
|
| 158 |
|
| 159 |
-
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 160 |
-
|
| 161 |
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 162 |
$polldaddy->reset();
|
| 163 |
if ( !$polldaddy->GetUserCode( $GLOBALS['current_user']->ID ) ) {
|
|
@@ -165,8 +185,9 @@ class WP_PollDaddy {
|
|
| 165 |
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?' ) );
|
| 166 |
return false;
|
| 167 |
}
|
| 168 |
-
|
| 169 |
-
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
function parse_errors( &$polldaddy ) {
|
|
@@ -206,7 +227,7 @@ class WP_PollDaddy {
|
|
| 206 |
}
|
| 207 |
|
| 208 |
function api_key_page() {
|
| 209 |
-
|
| 210 |
?>
|
| 211 |
|
| 212 |
<div class="wrap">
|
|
@@ -223,7 +244,7 @@ class WP_PollDaddy {
|
|
| 223 |
<label for="polldaddy-email">PollDaddy Email Address</label>
|
| 224 |
</th>
|
| 225 |
<td>
|
| 226 |
-
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" />
|
| 227 |
</td>
|
| 228 |
</tr>
|
| 229 |
<tr class="form-field form-required">
|
|
@@ -234,6 +255,25 @@ class WP_PollDaddy {
|
|
| 234 |
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
| 235 |
</td>
|
| 236 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
</tbody>
|
| 238 |
</table>
|
| 239 |
<p class="submit">
|
|
@@ -254,6 +294,14 @@ class WP_PollDaddy {
|
|
| 254 |
}
|
| 255 |
|
| 256 |
function management_page_load() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
wp_reset_vars( array( 'action', 'poll' ) );
|
| 258 |
global $action, $poll;
|
| 259 |
|
|
@@ -297,8 +345,6 @@ class WP_PollDaddy {
|
|
| 297 |
$query_args['action'] = false;
|
| 298 |
break;
|
| 299 |
case 'delete' :
|
| 300 |
-
global $current_user;
|
| 301 |
-
|
| 302 |
if ( empty( $poll ) )
|
| 303 |
return;
|
| 304 |
|
|
@@ -410,7 +456,7 @@ class WP_PollDaddy {
|
|
| 410 |
return false;
|
| 411 |
|
| 412 |
$poll_data['answers'] = $answers;
|
| 413 |
-
$poll_data['styleID'] = $_POST['styleID'];
|
| 414 |
|
| 415 |
$polldaddy->reset();
|
| 416 |
|
|
@@ -794,7 +840,7 @@ class WP_PollDaddy {
|
|
| 794 |
?>
|
| 795 |
|
| 796 |
<form action="" method="post">
|
| 797 |
-
<div id="poststuff"><div id="post-body" class="has-sidebar">
|
| 798 |
|
| 799 |
<div class="inner-sidebar" id="side-info-column">
|
| 800 |
<div id="submitdiv" class="postbox">
|
|
@@ -956,8 +1002,8 @@ class WP_PollDaddy {
|
|
| 956 |
<div class="hide-if-no-js">
|
| 957 |
<a class="alignleft" href="#previous">«</a>
|
| 958 |
<a class="alignright" href="#next">»</a>
|
| 959 |
-
<img src="http://polldaddy.com/
|
| 960 |
-
<img class="hide-if-js" src="http://polldaddy.com/
|
| 961 |
</div>
|
| 962 |
|
| 963 |
<p class="hide-if-js" id="no-js-styleID">
|
| 5 |
Description: Create and manage PollDaddy polls in WordPress
|
| 6 |
Author: Automattic, Inc.
|
| 7 |
Author URL: http://automattic.com/
|
| 8 |
+
Version: 1.2
|
| 9 |
*/
|
| 10 |
|
| 11 |
// You can hardcode your PollDaddy PartnerGUID (API Key) here
|
| 22 |
var $errors;
|
| 23 |
var $polldaddy_client_class = 'PollDaddy_Client';
|
| 24 |
var $base_url = false;
|
| 25 |
+
var $use_ssl = 0;
|
| 26 |
+
var $scheme = 'https';
|
| 27 |
+
var $version = '1.2';
|
| 28 |
|
| 29 |
var $polldaddy_clients = array();
|
| 30 |
|
| 40 |
}
|
| 41 |
|
| 42 |
function admin_menu() {
|
|
|
|
|
|
|
| 43 |
$this->errors = new WP_Error;
|
| 44 |
|
| 45 |
if ( !$this->base_url )
|
| 46 |
+
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
| 47 |
|
| 48 |
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) ) {
|
| 49 |
$guid = get_option( 'polldaddy_api_key' );
|
| 53 |
}
|
| 54 |
|
| 55 |
if ( !WP_POLLDADDY__PARTNERGUID ) {
|
| 56 |
+
$this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
|
| 57 |
+
|
| 58 |
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
| 59 |
$hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ), "{$this->base_url}polldaddy.png" );
|
| 60 |
else
|
| 61 |
$hook = add_management_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ) );
|
| 62 |
+
|
| 63 |
add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
|
| 64 |
if ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] )
|
| 65 |
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>";' ) );
|
| 66 |
return false;
|
| 67 |
}
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
| 70 |
$hook = add_object_page( __( 'Polls' ), __( 'Polls' ), 'edit_posts', 'polls', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
|
| 71 |
else
|
| 74 |
|
| 75 |
// Hack-a-lack-a
|
| 76 |
add_submenu_page( 'polls', __( 'Edit Polls' ), __( 'Edit' ), 'edit_posts', 'polls' ); //, array( &$this, 'management_page' ) );
|
| 77 |
+
add_submenu_page( 'polls', __( 'Add New Poll' ), __( 'Add New' ), 'edit_posts', 'polls&action=create-poll', array( &$this, 'management_page' ) );
|
| 78 |
|
| 79 |
add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
|
| 80 |
}
|
| 87 |
|
| 88 |
$polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
|
| 89 |
$polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
|
| 90 |
+
|
| 91 |
if ( !$polldaddy_email )
|
| 92 |
$this->errors->add( 'polldaddy_email', __( 'Email address required' ) );
|
| 93 |
|
| 97 |
if ( $this->errors->get_error_codes() )
|
| 98 |
return false;
|
| 99 |
|
| 100 |
+
if ( !empty( $_POST['polldaddy_use_ssl_checkbox'] ) ) {
|
| 101 |
+
if ( $polldaddy_use_ssl = (int) $_POST['polldaddy_use_ssl'] ) {
|
| 102 |
+
$this->use_ssl = 2;
|
| 103 |
+
} else {
|
| 104 |
+
$this->use_ssl = 1;
|
| 105 |
+
$this->scheme = 'http';
|
| 106 |
+
}
|
| 107 |
+
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
$details = array(
|
| 111 |
'uName' => get_bloginfo( 'name' ),
|
| 112 |
'uEmail' => $polldaddy_email,
|
| 113 |
'uPass' => $polldaddy_password,
|
| 114 |
'partner_userid' => $GLOBALS['current_user']->ID
|
| 115 |
);
|
| 116 |
+
|
| 117 |
if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
|
| 118 |
+
$polldaddy_api_key = wp_remote_post( $this->scheme . '://api.polldaddy.com/key.php', array(
|
| 119 |
'body' => $details
|
| 120 |
) );
|
| 121 |
if ( is_wp_error( $polldaddy_api_key ) ) {
|
| 122 |
$this->errors = $polldaddy_api_key;
|
| 123 |
return false;
|
| 124 |
}
|
| 125 |
+
$response_code = wp_remote_retrieve_response_code( $polldaddy_api_key );
|
| 126 |
+
if ( 200 != $response_code ) {
|
| 127 |
+
$this->errors->add( 'http_code', __( 'Could not connect to PollDaddy API Key service' ) );
|
| 128 |
+
return false;
|
| 129 |
+
}
|
| 130 |
$polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
|
| 131 |
} else {
|
| 132 |
$fp = fsockopen(
|
| 164 |
list($headers, $polldaddy_api_key) = explode( "\r\n\r\n", $response, 2 );
|
| 165 |
}
|
| 166 |
|
| 167 |
+
if( isset( $polldaddy_api_key ) && strlen( $polldaddy_api_key ) > 0 ){
|
| 168 |
+
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 169 |
+
}
|
| 170 |
+
else{
|
| 171 |
+
$this->errors->add( 'polldaddy_api_key', __( 'Login to PollDaddy failed. Double check your email address and password.' ) );
|
| 172 |
+
if ( 1 !== $this->use_ssl ) {
|
| 173 |
+
$this->errors->add( 'polldaddy_api_key', __( 'If your email address and password are correct, your host may not support secure logins.' ) );
|
| 174 |
+
$this->errors->add( 'polldaddy_api_key', __( 'In that case, you may be able to log in to PollDaddy by unchecking the "Use SSL to Log in" checkbox.' ) );
|
| 175 |
+
$this->use_ssl = 2;
|
| 176 |
+
}
|
| 177 |
+
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
| 178 |
return false;
|
| 179 |
}
|
| 180 |
|
|
|
|
|
|
|
| 181 |
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 182 |
$polldaddy->reset();
|
| 183 |
if ( !$polldaddy->GetUserCode( $GLOBALS['current_user']->ID ) ) {
|
| 185 |
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?' ) );
|
| 186 |
return false;
|
| 187 |
}
|
| 188 |
+
|
| 189 |
+
wp_redirect( add_query_arg( array( 'page' => 'polls' ), wp_get_referer() ) );
|
| 190 |
+
exit;
|
| 191 |
}
|
| 192 |
|
| 193 |
function parse_errors( &$polldaddy ) {
|
| 227 |
}
|
| 228 |
|
| 229 |
function api_key_page() {
|
| 230 |
+
$this->print_errors();
|
| 231 |
?>
|
| 232 |
|
| 233 |
<div class="wrap">
|
| 244 |
<label for="polldaddy-email">PollDaddy Email Address</label>
|
| 245 |
</th>
|
| 246 |
<td>
|
| 247 |
+
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" value="<?php if ( isset( $_POST['polldaddy_email'] ) ) echo attribute_escape( $_POST['polldaddy_email'] ); ?>" />
|
| 248 |
</td>
|
| 249 |
</tr>
|
| 250 |
<tr class="form-field form-required">
|
| 255 |
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
| 256 |
</td>
|
| 257 |
</tr>
|
| 258 |
+
<?php
|
| 259 |
+
|
| 260 |
+
if ( $this->use_ssl > 0 ) {
|
| 261 |
+
$checked = '';
|
| 262 |
+
if ( $this->use_ssl == 2 )
|
| 263 |
+
$checked = 'checked="checked"';
|
| 264 |
+
?>
|
| 265 |
+
<tr class="form-field form-required">
|
| 266 |
+
<th valign="top" scope="row">
|
| 267 |
+
<label for="polldaddy-use-ssl">Use SSL to Log in</label>
|
| 268 |
+
</th>
|
| 269 |
+
<td>
|
| 270 |
+
<input type="checkbox" name="polldaddy_use_ssl" id="polldaddy-use-ssl" value="1" <?php echo $checked ?> style="width: auto"/>
|
| 271 |
+
<label for="polldaddy-use-ssl">This ensures a secure login to your PollDaddy account. Only uncheck if you are having problems logging in.</label>
|
| 272 |
+
<input type="hidden" name="polldaddy_use_ssl_checkbox" value="1" />
|
| 273 |
+
</td>
|
| 274 |
+
</tr><?php
|
| 275 |
+
}
|
| 276 |
+
?>
|
| 277 |
</tbody>
|
| 278 |
</table>
|
| 279 |
<p class="submit">
|
| 294 |
}
|
| 295 |
|
| 296 |
function management_page_load() {
|
| 297 |
+
global $current_user;
|
| 298 |
+
|
| 299 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
| 300 |
+
$polldaddy->reset();
|
| 301 |
+
|
| 302 |
+
if ( !defined( 'WP_POLLDADDY__USERCODE' ) )
|
| 303 |
+
define( 'WP_POLLDADDY__USERCODE', $polldaddy->GetUserCode( $current_user->ID ) );
|
| 304 |
+
|
| 305 |
wp_reset_vars( array( 'action', 'poll' ) );
|
| 306 |
global $action, $poll;
|
| 307 |
|
| 345 |
$query_args['action'] = false;
|
| 346 |
break;
|
| 347 |
case 'delete' :
|
|
|
|
|
|
|
| 348 |
if ( empty( $poll ) )
|
| 349 |
return;
|
| 350 |
|
| 456 |
return false;
|
| 457 |
|
| 458 |
$poll_data['answers'] = $answers;
|
| 459 |
+
$poll_data['styleID'] = (int) $_POST['styleID'];
|
| 460 |
|
| 461 |
$polldaddy->reset();
|
| 462 |
|
| 840 |
?>
|
| 841 |
|
| 842 |
<form action="" method="post">
|
| 843 |
+
<div id="poststuff"><div id="post-body" class="has-sidebar has-right-sidebar">
|
| 844 |
|
| 845 |
<div class="inner-sidebar" id="side-info-column">
|
| 846 |
<div id="submitdiv" class="postbox">
|
| 1002 |
<div class="hide-if-no-js">
|
| 1003 |
<a class="alignleft" href="#previous">«</a>
|
| 1004 |
<a class="alignright" href="#next">»</a>
|
| 1005 |
+
<img src="http://polldaddy.com/images/<?php echo $style_ID; ?>.gif" />
|
| 1006 |
+
<img class="hide-if-js" src="http://polldaddy.com/images/<?php echo 1 + $style_ID; ?>.gif" />
|
| 1007 |
</div>
|
| 1008 |
|
| 1009 |
<p class="hide-if-js" id="no-js-styleID">
|
readme.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
=== PollDaddy ===
|
| 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: 1.
|
| 7 |
|
| 8 |
Create and manage PollDaddy polls from within WordPress.
|
| 9 |
|
|
@@ -31,6 +31,16 @@ Nope. The permissions are the same as for posts. So Editors and Administrators
|
|
| 31 |
|
| 32 |
== Change Log ==
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
= 1.0 =
|
| 35 |
* New PollDaddy API
|
| 36 |
* Do not store UserCode, retrieve from API
|
| 1 |
=== PollDaddy ===
|
| 2 |
+
Contributors: mdawaffe, eoigal
|
| 3 |
Tags: poll, polls, polldaddy, WordPress.com
|
| 4 |
Requires at least: 2.6
|
| 5 |
Tested up to: 2.7.1
|
| 6 |
+
Stable tag: 1.2
|
| 7 |
|
| 8 |
Create and manage PollDaddy polls from within WordPress.
|
| 9 |
|
| 31 |
|
| 32 |
== Change Log ==
|
| 33 |
|
| 34 |
+
= 1.2 =
|
| 35 |
+
Bug Fix: SSL request for PollDaddy API key sometimes failed due to host constraints, included option to make a normal http request in this case.
|
| 36 |
+
Bug Fix: Redirect after login now goes to list polls
|
| 37 |
+
|
| 38 |
+
= 1.1 =
|
| 39 |
+
Bug Fix: Don't call PollDaddy API on every admin page load
|
| 40 |
+
Bug Fix: Correct Image locations
|
| 41 |
+
Bug Fix: CSS Tweaks for upcoming WordPress 2.8
|
| 42 |
+
Make Javascript image selector more robust
|
| 43 |
+
|
| 44 |
= 1.0 =
|
| 45 |
* New PollDaddy API
|
| 46 |
* Do not store UserCode, retrieve from API
|
