Version Description
- Minor fix for remaining legacy class constructor with PHP 7.
- Fixed some minor PHP notices when accessing nonexistent array values.
- Fixed deprecated usage of
mktime().
Download this release
Release Info
| Developer | jakeom |
| Plugin | |
| Version | 2.0.35 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.34 to 2.0.35
- polldaddy-client.php +1 -1
- polldaddy-org.php +1186 -1183
- polldaddy.php +5232 -5232
- readme.txt +7 -2
polldaddy-client.php
CHANGED
|
@@ -16,7 +16,7 @@ class api_client {
|
|
| 16 |
var $responses = array();
|
| 17 |
var $errors = array();
|
| 18 |
|
| 19 |
-
function
|
| 20 |
$this->partnerGUID = $partnerGUID;
|
| 21 |
$this->userCode = $userCode;
|
| 22 |
}
|
| 16 |
var $responses = array();
|
| 17 |
var $errors = array();
|
| 18 |
|
| 19 |
+
function __construct( $partnerGUID = '', $userCode = null ) {
|
| 20 |
$this->partnerGUID = $partnerGUID;
|
| 21 |
$this->userCode = $userCode;
|
| 22 |
}
|
polldaddy-org.php
CHANGED
|
@@ -1,1183 +1,1186 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
if ( function_exists( 'get_option' ) == false )
|
| 4 |
-
die( "Cheatin' eh?" );
|
| 5 |
-
|
| 6 |
-
require_once dirname( __FILE__ ) . '/polldaddy-client.php';
|
| 7 |
-
|
| 8 |
-
$GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
|
| 9 |
-
|
| 10 |
-
class WPORG_Polldaddy extends WP_Polldaddy {
|
| 11 |
-
var $use_ssl;
|
| 12 |
-
var $inline;
|
| 13 |
-
|
| 14 |
-
function __construct() {
|
| 15 |
-
parent::__construct();
|
| 16 |
-
$this->log( 'Created WPORG_Polldaddy Object: constructor' );
|
| 17 |
-
$this->version = '2.0.22';
|
| 18 |
-
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
| 19 |
-
$this->polldaddy_client_class = 'WPORG_Polldaddy_Client';
|
| 20 |
-
$this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
|
| 21 |
-
$this->multiple_accounts = (bool) get_option( 'polldaddy_multiple_accounts' );
|
| 22 |
-
$this->inline = (bool) get_option( 'polldaddy_load_poll_inline' );
|
| 23 |
-
$this->is_author = ( ( (bool) current_user_can('edit_others_posts')) or ( $this->multiple_accounts ) );
|
| 24 |
-
return;
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
function log( $message ) {
|
| 28 |
-
if ( defined( 'WP_DEBUG_LOG' ) )
|
| 29 |
-
$GLOBALS[ 'wp_log' ][ 'polldaddy' ][] = $message;
|
| 30 |
-
parent::log( $message );
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
function set_api_user_code() {
|
| 34 |
-
if ( empty( $this->rating_user_code ) ) {
|
| 35 |
-
$this->rating_user_code = get_option( 'pd-rating-usercode' );
|
| 36 |
-
|
| 37 |
-
if ( empty( $this->rating_user_code ) ) {
|
| 38 |
-
$this->log( 'set_api_user_code: retrieve usercode from Polldaddy' );
|
| 39 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
| 40 |
-
$polldaddy->reset();
|
| 41 |
-
|
| 42 |
-
if ( $this->multiple_accounts ) {
|
| 43 |
-
//need to retrieve initial admin user code to use as ratings user code
|
| 44 |
-
$polldaddy->update_partner_account( array( 'role' => 0 ) );
|
| 45 |
-
update_option( 'polldaddy_multiple_accounts', 0 );
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
$this->rating_user_code = $polldaddy->get_usercode( $this->id );
|
| 49 |
-
if ( !empty( $this->rating_user_code ) )
|
| 50 |
-
update_option( 'pd-rating-usercode', $this->rating_user_code );
|
| 51 |
-
|
| 52 |
-
if ( $this->multiple_accounts ) {
|
| 53 |
-
$polldaddy->update_partner_account( array( 'role' => 1 ) );
|
| 54 |
-
update_option( 'polldaddy_multiple_accounts', 1 );
|
| 55 |
-
}
|
| 56 |
-
}
|
| 57 |
-
}
|
| 58 |
-
parent::set_api_user_code();
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
function admin_title( $admin_title ) {
|
| 62 |
-
global $page;
|
| 63 |
-
|
| 64 |
-
if ( $page == 'ratings' )
|
| 65 |
-
return (stripos( $admin_title, $page ) === false ? __( "Ratings", "polldaddy" ) : '' ).$admin_title;
|
| 66 |
-
elseif ( $page == 'polls' )
|
| 67 |
-
return (stripos( $admin_title, $page ) === false ? __( "Polls", "polldaddy" ) : '' ).$admin_title;
|
| 68 |
-
|
| 69 |
-
return $admin_title;
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
function admin_menu() {
|
| 73 |
-
parent::admin_menu();
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
function management_page_load() {
|
| 77 |
-
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
| 78 |
-
|
| 79 |
-
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 80 |
-
wp_reset_vars( array( 'action', 'page' ) );
|
| 81 |
-
global $action, $page;
|
| 82 |
-
|
| 83 |
-
$this->set_api_user_code();
|
| 84 |
-
|
| 85 |
-
if ( $page == 'polls' ) {
|
| 86 |
-
switch ( $action ) {
|
| 87 |
-
case 'update-options' :
|
| 88 |
-
if ( !$is_POST )
|
| 89 |
-
return;
|
| 90 |
-
|
| 91 |
-
if ( $this->is_admin ) {
|
| 92 |
-
check_admin_referer( 'polldaddy-account' );
|
| 93 |
-
|
| 94 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 95 |
-
$polldaddy->reset();
|
| 96 |
-
|
| 97 |
-
$polldaddy_sync_account = 0;
|
| 98 |
-
$polldaddy_multiple_accounts = 0;
|
| 99 |
-
$polldaddy_load_poll_inline = 0;
|
| 100 |
-
|
| 101 |
-
if ( isset( $_POST['polldaddy-sync-account'] ) )
|
| 102 |
-
$polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
|
| 103 |
-
|
| 104 |
-
if ( $polldaddy_sync_account > 0 ) {
|
| 105 |
-
$this->log( 'management_page_load: sync usercode' );
|
| 106 |
-
$this->rating_user_code = '';
|
| 107 |
-
update_option( 'pd-rating-usercode', '' );
|
| 108 |
-
$this->set_api_user_code();
|
| 109 |
-
}
|
| 110 |
-
|
| 111 |
-
if ( isset( $_POST['polldaddy-multiple-accounts'] ) )
|
| 112 |
-
$polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
|
| 113 |
-
|
| 114 |
-
if ( isset( $_POST['polldaddy-load-poll-inline'] ) )
|
| 115 |
-
$polldaddy_load_poll_inline = (int) $_POST['polldaddy-load-poll-inline'];
|
| 116 |
-
|
| 117 |
-
$partner = array( 'role' => $polldaddy_multiple_accounts );
|
| 118 |
-
$polldaddy->update_partner_account( $partner );
|
| 119 |
-
update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
|
| 120 |
-
update_option( 'polldaddy_load_poll_inline', $polldaddy_load_poll_inline );
|
| 121 |
-
|
| 122 |
-
$rating_title_filter = '';
|
| 123 |
-
if ( isset( $_POST['polldaddy-ratings-title-filter'] ) )
|
| 124 |
-
$rating_title_filter = sanitize_text_field( $_POST['polldaddy-ratings-title-filter'] );
|
| 125 |
-
|
| 126 |
-
update_option( 'pd-rating-title-filter', $rating_title_filter );
|
| 127 |
-
}
|
| 128 |
-
break;
|
| 129 |
-
} //end switch
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
global $parent_file, $submenu_file, $typenow;
|
| 133 |
-
|
| 134 |
-
//need to set this to make sure that menus behave properly
|
| 135 |
-
if ( in_array( $action, array( 'options', 'update-rating' ) ) ) {
|
| 136 |
-
$parent_file = 'options-general.php';
|
| 137 |
-
$submenu_file = $page.'&action=options';
|
| 138 |
-
} else {
|
| 139 |
-
add_filter( 'admin_title', array( &$this, 'admin_title' ) );
|
| 140 |
-
$submenu_file = $page;
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
parent::management_page_load();
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
function api_key_page_load() {
|
| 147 |
-
if ( 'post' != strtolower( $_SERVER['REQUEST_METHOD'] ) || empty( $_POST['action'] ) || 'account' != $_POST['action'] )
|
| 148 |
-
return false;
|
| 149 |
-
|
| 150 |
-
check_admin_referer( 'polldaddy-account' );
|
| 151 |
-
|
| 152 |
-
$polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
|
| 153 |
-
$polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
|
| 154 |
-
|
| 155 |
-
$this->log( 'api_key_page_load: get Polldaddy API key for account - '.$polldaddy_email );
|
| 156 |
-
|
| 157 |
-
if ( !$polldaddy_email )
|
| 158 |
-
$this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
|
| 159 |
-
|
| 160 |
-
if ( !$polldaddy_password )
|
| 161 |
-
$this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
|
| 162 |
-
|
| 163 |
-
if ( $this->errors->get_error_codes() )
|
| 164 |
-
return false;
|
| 165 |
-
|
| 166 |
-
if ( !empty( $_POST['polldaddy_use_ssl_checkbox'] ) ) {
|
| 167 |
-
if ( $polldaddy_use_ssl = (int) $_POST['polldaddy_use_ssl'] ) {
|
| 168 |
-
$this->use_ssl = 0; //checked (by default)
|
| 169 |
-
} else {
|
| 170 |
-
$this->use_ssl = 1; //unchecked
|
| 171 |
-
$this->scheme = 'http';
|
| 172 |
-
}
|
| 173 |
-
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
$details = array(
|
| 177 |
-
'uName' => get_bloginfo( 'name' ),
|
| 178 |
-
'uEmail' => $polldaddy_email,
|
| 179 |
-
'uPass' => $polldaddy_password,
|
| 180 |
-
'partner_userid' => $this->id
|
| 181 |
-
);
|
| 182 |
-
|
| 183 |
-
if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
|
| 184 |
-
$polldaddy_api_key = wp_remote_post( $this->scheme . '://api.polldaddy.com/key.php', array(
|
| 185 |
-
'body' => $details
|
| 186 |
-
) );
|
| 187 |
-
if ( is_wp_error( $polldaddy_api_key ) ) {
|
| 188 |
-
$this->errors = $polldaddy_api_key;
|
| 189 |
-
return false;
|
| 190 |
-
}
|
| 191 |
-
$response_code = wp_remote_retrieve_response_code( $polldaddy_api_key );
|
| 192 |
-
if ( 200 != $response_code ) {
|
| 193 |
-
$this->log( 'management_page_load: could not connect to Polldaddy API key service' );
|
| 194 |
-
$this->errors->add( 'http_code', __( 'Could not connect to Polldaddy API Key service', 'polldaddy' ) );
|
| 195 |
-
return false;
|
| 196 |
-
}
|
| 197 |
-
$polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
|
| 198 |
-
} else {
|
| 199 |
-
$fp = fsockopen(
|
| 200 |
-
'api.polldaddy.com',
|
| 201 |
-
80,
|
| 202 |
-
$err_num,
|
| 203 |
-
$err_str,
|
| 204 |
-
3
|
| 205 |
-
);
|
| 206 |
-
|
| 207 |
-
if ( !$fp ) {
|
| 208 |
-
$this->log( 'management_page_load: could not connect to Polldaddy API key service' );
|
| 209 |
-
$this->errors->add( 'connect', __( "Can't connect to Polldaddy.com", 'polldaddy' ) );
|
| 210 |
-
return false;
|
| 211 |
-
}
|
| 212 |
-
|
| 213 |
-
if ( function_exists( 'stream_set_timeout' ) )
|
| 214 |
-
stream_set_timeout( $fp, 3 );
|
| 215 |
-
|
| 216 |
-
global $wp_version;
|
| 217 |
-
|
| 218 |
-
$request_body = http_build_query( $details, null, '&' );
|
| 219 |
-
|
| 220 |
-
$request = "POST /key.php HTTP/1.0\r\n";
|
| 221 |
-
$request .= "Host: api.polldaddy.com\r\n";
|
| 222 |
-
$request .= "User-agent: WordPress/$wp_version\r\n";
|
| 223 |
-
$request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
|
| 224 |
-
$request .= 'Content-Length: ' . strlen( $request_body ) . "\r\n";
|
| 225 |
-
|
| 226 |
-
fwrite( $fp, "$request\r\n$request_body" );
|
| 227 |
-
|
| 228 |
-
$response = '';
|
| 229 |
-
while ( !feof( $fp ) )
|
| 230 |
-
$response .= fread( $fp, 4096 );
|
| 231 |
-
fclose( $fp );
|
| 232 |
-
list($headers, $polldaddy_api_key) = explode( "\r\n\r\n", $response, 2 );
|
| 233 |
-
}
|
| 234 |
-
|
| 235 |
-
if ( isset( $polldaddy_api_key ) && strlen( $polldaddy_api_key ) > 0 ) {
|
| 236 |
-
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 237 |
-
} else {
|
| 238 |
-
$this->log( 'management_page_load: login to Polldaddy failed' );
|
| 239 |
-
$this->errors->add( 'polldaddy_api_key', __( 'Login to Polldaddy failed. Double check your email address and password.', 'polldaddy' ) );
|
| 240 |
-
if ( 1 !== $this->use_ssl ) {
|
| 241 |
-
$this->errors->add( 'polldaddy_api_key', __( 'If your email address and password are correct, your host may not support secure logins.', 'polldaddy' ) );
|
| 242 |
-
$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.', 'polldaddy' ) );
|
| 243 |
-
$this->use_ssl = 0;
|
| 244 |
-
}
|
| 245 |
-
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
| 246 |
-
return false;
|
| 247 |
-
}
|
| 248 |
-
|
| 249 |
-
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 250 |
-
$polldaddy->reset();
|
| 251 |
-
if ( !$polldaddy->get_usercode( $this->id ) ) {
|
| 252 |
-
$this->parse_errors( $polldaddy );
|
| 253 |
-
$this->log( 'management_page_load: get usercode from Polldaddy failed' );
|
| 254 |
-
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?', 'polldaddy' ) );
|
| 255 |
-
return false;
|
| 256 |
-
}
|
| 257 |
-
|
| 258 |
-
wp_redirect( add_query_arg( array( 'page' => 'polls' ), wp_get_referer() ) );
|
| 259 |
-
return true;
|
| 260 |
-
}
|
| 261 |
-
|
| 262 |
-
function api_key_page() {
|
| 263 |
-
$this->print_errors();
|
| 264 |
-
?>
|
| 265 |
-
|
| 266 |
-
<div class="wrap">
|
| 267 |
-
|
| 268 |
-
<h2><?php _e( 'Polldaddy Account', 'polldaddy' ); ?></h2>
|
| 269 |
-
|
| 270 |
-
<p><?php printf( __( 'Before you can use the Polldaddy plugin, you need to enter your <a href="%s">Polldaddy.com</a> account details.', 'polldaddy' ), 'http://polldaddy.com/' ); ?></p>
|
| 271 |
-
|
| 272 |
-
<form action="" method="post">
|
| 273 |
-
<table class="form-table">
|
| 274 |
-
<tbody>
|
| 275 |
-
<tr class="form-field form-required">
|
| 276 |
-
<th valign="top" scope="row">
|
| 277 |
-
<label for="polldaddy-email"><?php _e( 'Polldaddy Email Address', 'polldaddy' ); ?></label>
|
| 278 |
-
</th>
|
| 279 |
-
<td>
|
| 280 |
-
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" value="<?php if ( isset( $_POST['polldaddy_email'] ) ) echo esc_attr( $_POST['polldaddy_email'] ); ?>" />
|
| 281 |
-
</td>
|
| 282 |
-
</tr>
|
| 283 |
-
<tr class="form-field form-required">
|
| 284 |
-
<th valign="top" scope="row">
|
| 285 |
-
<label for="polldaddy-password"><?php _e( 'Polldaddy Password', 'polldaddy' ); ?></label>
|
| 286 |
-
</th>
|
| 287 |
-
<td>
|
| 288 |
-
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
| 289 |
-
</td>
|
| 290 |
-
</tr>
|
| 291 |
-
<?php
|
| 292 |
-
$checked = '';
|
| 293 |
-
if ( $this->use_ssl == 0 )
|
| 294 |
-
$checked = 'checked="checked"';
|
| 295 |
-
?>
|
| 296 |
-
<tr class="form-field form-required">
|
| 297 |
-
<th valign="top" scope="row">
|
| 298 |
-
<label for="polldaddy-use-ssl"><?php _e( 'Use SSL to Log in', 'polldaddy' ); ?></label>
|
| 299 |
-
</th>
|
| 300 |
-
<td>
|
| 301 |
-
<input type="checkbox" name="polldaddy_use_ssl" id="polldaddy-use-ssl" value="1" <?php echo $checked ?> style="width: auto"/>
|
| 302 |
-
<label for="polldaddy-use-ssl"><?php _e( 'This ensures a secure login to your Polldaddy account. Only uncheck if you are having problems logging in.', 'polldaddy' ); ?></label>
|
| 303 |
-
<input type="hidden" name="polldaddy_use_ssl_checkbox" value="1" />
|
| 304 |
-
</td>
|
| 305 |
-
</tr>
|
| 306 |
-
</tbody>
|
| 307 |
-
</table>
|
| 308 |
-
<p class="submit">
|
| 309 |
-
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 310 |
-
<input type="hidden" name="action" value="account" />
|
| 311 |
-
<input type="hidden" name="account" value="import" />
|
| 312 |
-
<input class="button-secondary" type="submit" value="<?php echo esc_attr( __( 'Submit', 'polldaddy' ) ); ?>" />
|
| 313 |
-
</p>
|
| 314 |
-
</form>
|
| 315 |
-
</div>
|
| 316 |
-
|
| 317 |
-
<?php
|
| 318 |
-
}
|
| 319 |
-
|
| 320 |
-
function plugin_options_add() {
|
| 321 |
-
if ( $this->is_admin ) {
|
| 322 |
-
$inline = '';
|
| 323 |
-
if ( $this->inline )
|
| 324 |
-
$inline = 'checked="checked"';
|
| 325 |
-
|
| 326 |
-
$checked = '';
|
| 327 |
-
if ( $this->multiple_accounts )
|
| 328 |
-
$checked = 'checked="checked"';
|
| 329 |
-
|
| 330 |
-
$rating_title_filter = get_option( 'pd-rating-title-filter' );
|
| 331 |
-
|
| 332 |
-
if ( $rating_title_filter === false )
|
| 333 |
-
$rating_title_filter = 'wp_title';
|
| 334 |
-
|
| 335 |
-
?><tr class="form-field form-required">
|
| 336 |
-
<th valign="top" scope="row">
|
| 337 |
-
<label for="polldaddy-load-poll-inline">
|
| 338 |
-
<?php _e( 'Load Shortcodes Inline', 'polldaddy' ); ?>
|
| 339 |
-
</label>
|
| 340 |
-
</th>
|
| 341 |
-
<td>
|
| 342 |
-
<input type="checkbox" name="polldaddy-load-poll-inline" id="polldaddy-load-poll-inline" value="1" <?php echo $inline ?> style="width: auto" />
|
| 343 |
-
<span class="description">
|
| 344 |
-
<label for="polldaddy-load-poll-inline"><?php _e( 'This will load the Polldaddy shortcodes inline rather than in the page footer.', 'polldaddy' ); ?></label>
|
| 345 |
-
</span>
|
| 346 |
-
</td>
|
| 347 |
-
</tr><tr class="form-field form-required">
|
| 348 |
-
<th valign="top" scope="row">
|
| 349 |
-
<label for="polldaddy-multiple-accounts">
|
| 350 |
-
<?php _e( 'Multiple Polldaddy Accounts', 'polldaddy' ); ?>
|
| 351 |
-
</label>
|
| 352 |
-
</th>
|
| 353 |
-
<td>
|
| 354 |
-
<input type="checkbox" name="polldaddy-multiple-accounts" id="polldaddy-multiple-accounts" value="1" <?php echo $checked ?> style="width: auto" />
|
| 355 |
-
<span class="description">
|
| 356 |
-
<label for="polldaddy-multiple-accounts"><?php _e( 'This setting will allow each blog user to import a Polldaddy account.', 'polldaddy' ); ?></label>
|
| 357 |
-
</span>
|
| 358 |
-
</td>
|
| 359 |
-
</tr>
|
| 360 |
-
<tr class="form-field form-required">
|
| 361 |
-
<th valign="top" scope="row">
|
| 362 |
-
<label for="polldaddy-sync-account">
|
| 363 |
-
<?php _e( 'Sync Ratings Account', 'polldaddy' ); ?>
|
| 364 |
-
</label>
|
| 365 |
-
</th>
|
| 366 |
-
<td>
|
| 367 |
-
<input type="checkbox" name="polldaddy-sync-account" id="polldaddy-sync-account" value="1" style="width: auto" />
|
| 368 |
-
<span class="description">
|
| 369 |
-
<label for="polldaddy-sync-account"><?php _e( 'This will synchronize your ratings Polldaddy account.', 'polldaddy' ); ?></label>
|
| 370 |
-
</span>
|
| 371 |
-
</td>
|
| 372 |
-
</tr>
|
| 373 |
-
<tr class="form-field form-required">
|
| 374 |
-
<th valign="top" scope="row">
|
| 375 |
-
<label for="polldaddy-ratings-title-filter">
|
| 376 |
-
<?php _e( 'Ratings Title Filter', 'polldaddy' ); ?>
|
| 377 |
-
</label>
|
| 378 |
-
</th>
|
| 379 |
-
<td>
|
| 380 |
-
<input type="text" name="polldaddy-ratings-title-filter" id="polldaddy-ratings-title-filter" value="<?php echo esc_attr( $rating_title_filter ); ?>" style="width: auto" />
|
| 381 |
-
<span class="description">
|
| 382 |
-
<label for="polldaddy-ratings-title-filter"><?php _e( 'This setting allows you to specify a filter to use with your ratings title.', 'polldaddy' ); ?></label>
|
| 383 |
-
</span>
|
| 384 |
-
</td>
|
| 385 |
-
</tr><?php }
|
| 386 |
-
return parent::plugin_options_add();
|
| 387 |
-
}
|
| 388 |
-
}
|
| 389 |
-
|
| 390 |
-
class WPORG_Polldaddy_Client extends api_client {
|
| 391 |
-
/**
|
| 392 |
-
*
|
| 393 |
-
*
|
| 394 |
-
* @return string|false Polldaddy partner account or false on failure
|
| 395 |
-
*/
|
| 396 |
-
function get_partner_account() {
|
| 397 |
-
$pos = $this->add_request( 'getpartneraccount' );
|
| 398 |
-
$this->send_request();
|
| 399 |
-
$r = $this->response_part( $pos );
|
| 400 |
-
if ( isset( $r->partner ) && !is_null( $r->partner->_role ) )
|
| 401 |
-
return $r->partner;
|
| 402 |
-
return false;
|
| 403 |
-
}
|
| 404 |
-
|
| 405 |
-
/**
|
| 406 |
-
*
|
| 407 |
-
*
|
| 408 |
-
* @see polldaddy_partner()
|
| 409 |
-
* @param array $args polldaddy_partner() args
|
| 410 |
-
* @return string|false Polldaddy partner account or false on failure
|
| 411 |
-
*/
|
| 412 |
-
function update_partner_account( $args ) {
|
| 413 |
-
if ( !$partner = polldaddy_partner( $args ) )
|
| 414 |
-
return false;
|
| 415 |
-
|
| 416 |
-
$pos = $this->add_request( 'updatepartneraccount', $partner );
|
| 417 |
-
$this->send_request();
|
| 418 |
-
$r = $this->response_part( $pos );
|
| 419 |
-
if ( isset( $r->partner ) && !is_null( $r->partner->_role ) )
|
| 420 |
-
return $r->partner;
|
| 421 |
-
return false;
|
| 422 |
-
}
|
| 423 |
-
}
|
| 424 |
-
|
| 425 |
-
function &polldaddy_partner( $args = null ) {
|
| 426 |
-
$false = false;
|
| 427 |
-
if ( is_a( $args, 'Polldaddy_Partner' ) )
|
| 428 |
-
return $args;
|
| 429 |
-
|
| 430 |
-
$defaults = _polldaddy_partner_defaults();
|
| 431 |
-
|
| 432 |
-
$args = wp_parse_args( $args, $defaults );
|
| 433 |
-
|
| 434 |
-
foreach ( array( 'name' ) as $required )
|
| 435 |
-
if ( !is_string( $args[$required] ) || !$args[$required] )
|
| 436 |
-
return $false;
|
| 437 |
-
|
| 438 |
-
$obj = new Polldaddy_Partner( $args, $args );
|
| 439 |
-
|
| 440 |
-
return $obj;
|
| 441 |
-
}
|
| 442 |
-
|
| 443 |
-
function _polldaddy_partner_defaults() {
|
| 444 |
-
return array(
|
| 445 |
-
'name' => get_bloginfo( 'name' ),
|
| 446 |
-
'role' => 0
|
| 447 |
-
);
|
| 448 |
-
}
|
| 449 |
-
|
| 450 |
-
if ( !function_exists( 'wp_strip_all_tags' ) ) {
|
| 451 |
-
function wp_strip_all_tags($string, $remove_breaks = false) {
|
| 452 |
-
$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
|
| 453 |
-
$string = strip_tags($string);
|
| 454 |
-
|
| 455 |
-
if ( $remove_breaks )
|
| 456 |
-
$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
|
| 457 |
-
|
| 458 |
-
return trim($string);
|
| 459 |
-
}
|
| 460 |
-
}
|
| 461 |
-
|
| 462 |
-
define( 'WP_POLLDADDY__CLASS', 'WPORG_Polldaddy' );
|
| 463 |
-
define( 'WP_POLLDADDY__POLLDADDY_CLIENT_PATH', dirname( __FILE__ ) . '/polldaddy-client.php' );
|
| 464 |
-
|
| 465 |
-
function polldaddy_loader() {
|
| 466 |
-
global $polldaddy_object;
|
| 467 |
-
$polldaddy_class = WP_POLLDADDY__CLASS;
|
| 468 |
-
$polldaddy_object = new $polldaddy_class;
|
| 469 |
-
load_plugin_textdomain( 'polldaddy', '', 'polldaddy/locale' );
|
| 470 |
-
add_action( 'admin_menu', array( &$polldaddy_object, 'admin_menu' ) );
|
| 471 |
-
}
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
| 475 |
-
function polldaddy_shortcode_handler() {}
|
| 476 |
-
}
|
| 477 |
-
|
| 478 |
-
if ( !class_exists( 'PolldaddyShortcode' ) ) {
|
| 479 |
-
/**
|
| 480 |
-
* Class wrapper for polldaddy shortcodes
|
| 481 |
-
*/
|
| 482 |
-
class PolldaddyShortcode {
|
| 483 |
-
|
| 484 |
-
static $add_script = false;
|
| 485 |
-
static $scripts = false;
|
| 486 |
-
|
| 487 |
-
/**
|
| 488 |
-
* Add all the actions & resgister the shortcode
|
| 489 |
-
*/
|
| 490 |
-
function __construct() {
|
| 491 |
-
if ( defined( 'GLOBAL_TAGS' ) == false )
|
| 492 |
-
add_shortcode( 'polldaddy', array( $this, 'polldaddy_shortcode' ) );
|
| 493 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'check_infinite' ) );
|
| 494 |
-
add_action( 'infinite_scroll_render', array( $this, 'polldaddy_shortcode_infinite' ), 11 );
|
| 495 |
-
}
|
| 496 |
-
|
| 497 |
-
private function get_async_code( array $settings, $survey_link ) {
|
| 498 |
-
$embed_src = 'http://i0.poll.fm/survey.js';
|
| 499 |
-
$embed_src_ssl = 'https://polldaddy.com/survey.js';
|
| 500 |
-
|
| 501 |
-
$include = <<<CONTAINER
|
| 502 |
-
( function( d, c, j ) {
|
| 503 |
-
if ( !d.getElementById( j ) ) {
|
| 504 |
-
var pd = d.createElement( c ), s;
|
| 505 |
-
pd.id = j;
|
| 506 |
-
pd.src = ( 'https:' == d.location.protocol ) ? '{$embed_src_ssl}' : '{$embed_src}';
|
| 507 |
-
s = d.getElementsByTagName( c )[0];
|
| 508 |
-
s.parentNode.insertBefore( pd, s );
|
| 509 |
-
}
|
| 510 |
-
}( document, 'script', 'pd-embed' ) );
|
| 511 |
-
CONTAINER;
|
| 512 |
-
|
| 513 |
-
// Compress it a bit
|
| 514 |
-
$include = $this->compress_it( $include );
|
| 515 |
-
|
| 516 |
-
$placeholder = '<div class="pd-embed" data-settings="'.esc_attr( json_encode( $settings ) ).'"></div>';
|
| 517 |
-
if ( $type === 'button' )
|
| 518 |
-
$placeholder = '<a class="pd-embed" href="'.esc_attr( $survey_link ).'" data-settings="'.esc_attr( json_encode( $settings ) ).'">'.esc_html( $settings['title'] ).'</a>';
|
| 519 |
-
|
| 520 |
-
$js_include = $placeholder."\n";
|
| 521 |
-
$js_include .= '<script type="text/javascript"><!--//--><![CDATA[//><!--'."\n";
|
| 522 |
-
$js_include .= $include."\n";
|
| 523 |
-
$js_include .= "//--><!]]></script>\n";
|
| 524 |
-
|
| 525 |
-
if ( $type !== 'button' )
|
| 526 |
-
$js_include .= '<noscript>'.$survey_link."</noscript>\n";
|
| 527 |
-
|
| 528 |
-
return $js_include;
|
| 529 |
-
}
|
| 530 |
-
|
| 531 |
-
private function compress_it( $js ) {
|
| 532 |
-
$js = str_replace( array( "\n", "\t", "\r" ), '', $js );
|
| 533 |
-
$js = preg_replace( '/\s*([,:\?\{;\-=\(\)])\s*/', '$1', $js );
|
| 534 |
-
return $js;
|
| 535 |
-
}
|
| 536 |
-
|
| 537 |
-
/**
|
| 538 |
-
* Shortcode for polldadddy
|
| 539 |
-
* [polldaddy poll|survey|rating="123456"]
|
| 540 |
-
*
|
| 541 |
-
* */
|
| 542 |
-
function polldaddy_shortcode( $atts ) {
|
| 543 |
-
global $post;
|
| 544 |
-
global $content_width;
|
| 545 |
-
|
| 546 |
-
extract( shortcode_atts( array(
|
| 547 |
-
'survey' => null,
|
| 548 |
-
'link_text' => 'Take Our Survey',
|
| 549 |
-
'poll' => 'empty',
|
| 550 |
-
'rating' => 'empty',
|
| 551 |
-
'unique_id' => null,
|
| 552 |
-
'item_id' => null,
|
| 553 |
-
'title' => null,
|
| 554 |
-
'permalink' => null,
|
| 555 |
-
'cb' => 0,
|
| 556 |
-
'type' => 'button',
|
| 557 |
-
'body' => '',
|
| 558 |
-
'button' => '',
|
| 559 |
-
'text_color' => '000000',
|
| 560 |
-
'back_color' => 'FFFFFF',
|
| 561 |
-
'align' => '',
|
| 562 |
-
'style' => '',
|
| 563 |
-
'width' => $content_width,
|
| 564 |
-
'height' => floor( $content_width * 3 / 4 ),
|
| 565 |
-
'delay' => 100,
|
| 566 |
-
'visit' => 'single',
|
| 567 |
-
'domain' => '',
|
| 568 |
-
'id' => ''
|
| 569 |
-
), $atts, 'polldaddy' ) );
|
| 570 |
-
|
| 571 |
-
if ( ! is_array( $atts ) ) {
|
| 572 |
-
return '<!-- Polldaddy shortcode passed invalid attributes -->';
|
| 573 |
-
}
|
| 574 |
-
|
| 575 |
-
$inline = !in_the_loop();
|
| 576 |
-
$no_script = false;
|
| 577 |
-
$infinite_scroll = false;
|
| 578 |
-
|
| 579 |
-
if ( is_home() && current_theme_supports( 'infinite-scroll' ) )
|
| 580 |
-
$infinite_scroll = true;
|
| 581 |
-
|
| 582 |
-
if ( defined( 'PADPRESS_LOADED' ) )
|
| 583 |
-
$inline = true;
|
| 584 |
-
|
| 585 |
-
if ( function_exists( 'get_option' ) && get_option( 'polldaddy_load_poll_inline' ) )
|
| 586 |
-
$inline = true;
|
| 587 |
-
|
| 588 |
-
if ( is_feed() || ( defined( 'DOING_AJAX' ) && !$infinite_scroll ) )
|
| 589 |
-
$no_script = false;
|
| 590 |
-
|
| 591 |
-
self::$add_script = $infinite_scroll;
|
| 592 |
-
|
| 593 |
-
if ( intval( $rating ) > 0 && !$no_script ) { //rating embed
|
| 594 |
-
|
| 595 |
-
if ( empty( $unique_id ) )
|
| 596 |
-
$unique_id = is_page() ? 'wp-page-'.$post->ID : 'wp-post-'.$post->ID;
|
| 597 |
-
|
| 598 |
-
if ( empty( $item_id ) )
|
| 599 |
-
$item_id = is_page() ? '_page_'.$post->ID : '_post_'.$post->ID;
|
| 600 |
-
|
| 601 |
-
if ( empty( $title ) )
|
| 602 |
-
$title = apply_filters( 'the_title', $post->post_title );
|
| 603 |
-
|
| 604 |
-
if ( empty( $permalink ) )
|
| 605 |
-
$permalink = get_permalink( $post->ID );
|
| 606 |
-
|
| 607 |
-
$rating = intval( $rating );
|
| 608 |
-
$unique_id = preg_replace( '/[^\-_a-z0-9]/i', '', wp_strip_all_tags( $unique_id ) );
|
| 609 |
-
$item_id = wp_strip_all_tags( $item_id );
|
| 610 |
-
$item_id = preg_replace( '/[^_a-z0-9]/i', '', $item_id );
|
| 611 |
-
|
| 612 |
-
$settings = json_encode( array(
|
| 613 |
-
'id' => $rating,
|
| 614 |
-
'unique_id' => $unique_id,
|
| 615 |
-
'title' => rawurlencode( trim( $title ) ),
|
| 616 |
-
'permalink' => esc_url( $permalink ),
|
| 617 |
-
'item_id' => $item_id
|
| 618 |
-
) );
|
| 619 |
-
|
| 620 |
-
$item_id = esc_js( $item_id );
|
| 621 |
-
if ( is_ssl() )
|
| 622 |
-
$rating_js_file = "https://polldaddy.com/js/rating/rating.js";
|
| 623 |
-
else
|
| 624 |
-
$rating_js_file = "http://i0.poll.fm/js/rating/rating.js";
|
| 625 |
-
|
| 626 |
-
if ( $inline ) {
|
| 627 |
-
return <<<SCRIPT
|
| 628 |
-
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
| 629 |
-
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
| 630 |
-
PDRTJS_settings_{$rating}{$item_id}={$settings};
|
| 631 |
-
//--><!]]></script>
|
| 632 |
-
<script type="text/javascript" charset="UTF-8" src="{$rating_js_file}"></script>
|
| 633 |
-
SCRIPT;
|
| 634 |
-
} else {
|
| 635 |
-
if ( self::$scripts === false )
|
| 636 |
-
self::$scripts = array();
|
| 637 |
-
|
| 638 |
-
$data = array( 'id' => $rating, 'item_id' => $item_id, 'settings' => $settings );
|
| 639 |
-
|
| 640 |
-
self::$scripts['rating'][] = $data;
|
| 641 |
-
|
| 642 |
-
add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
|
| 643 |
-
|
| 644 |
-
$data = esc_attr( json_encode( $data ) );
|
| 645 |
-
|
| 646 |
-
if ( $infinite_scroll )
|
| 647 |
-
return <<<CONTAINER
|
| 648 |
-
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}" data-settings="{$data}"></div>
|
| 649 |
-
CONTAINER;
|
| 650 |
-
else
|
| 651 |
-
return <<<CONTAINER
|
| 652 |
-
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
| 653 |
-
CONTAINER;
|
| 654 |
-
}
|
| 655 |
-
} elseif ( intval( $poll ) > 0 ) { //poll embed
|
| 656 |
-
|
| 657 |
-
$poll = intval( $poll );
|
| 658 |
-
$poll_url = sprintf( 'http://polldaddy.com/poll/%d', $poll );
|
| 659 |
-
$poll_js = sprintf( '%s.polldaddy.com/p/%d.js', '//static', $poll );
|
| 660 |
-
$poll_link = sprintf( '<a href="%s">Take Our Poll</a>', $poll_url );
|
| 661 |
-
|
| 662 |
-
if ( $no_script ) {
|
| 663 |
-
return $poll_link;
|
| 664 |
-
} else {
|
| 665 |
-
if ( $type == 'slider' && !$inline ) {
|
| 666 |
-
|
| 667 |
-
if( !in_array( $visit, array( 'single', 'multiple' ) ) )
|
| 668 |
-
$visit = 'single';
|
| 669 |
-
|
| 670 |
-
$settings = array(
|
| 671 |
-
'type' => 'slider',
|
| 672 |
-
'embed' => 'poll',
|
| 673 |
-
'delay' => intval( $delay ),
|
| 674 |
-
'visit' => $visit,
|
| 675 |
-
'id' => intval( $poll )
|
| 676 |
-
);
|
| 677 |
-
|
| 678 |
-
return $this->get_async_code( $settings, $poll_link );
|
| 679 |
-
} else {
|
| 680 |
-
$cb = ( $cb == 1 ? '?cb='.
|
| 681 |
-
$margins = '';
|
| 682 |
-
$float = '';
|
| 683 |
-
|
| 684 |
-
if ( in_array( $align, array( 'right', 'left' ) ) ) {
|
| 685 |
-
$float = sprintf( 'float: %s;', $align );
|
| 686 |
-
|
| 687 |
-
if ( $align == 'left')
|
| 688 |
-
$margins = 'margin: 0px 10px 0px 0px;';
|
| 689 |
-
elseif ( $align == 'right' )
|
| 690 |
-
$margins = 'margin: 0px 0px 0px 10px';
|
| 691 |
-
}
|
| 692 |
-
|
| 693 |
-
// Force the normal style embed on single posts/pages otherwise it's not rendered on infinite scroll themed blogs ('infinite_scroll_render' isn't fired)
|
| 694 |
-
if ( is_singular() )
|
| 695 |
-
$inline = true;
|
| 696 |
-
|
| 697 |
-
if ( $cb === false && !$inline ) {
|
| 698 |
-
if ( self::$scripts === false )
|
| 699 |
-
self::$scripts = array();
|
| 700 |
-
|
| 701 |
-
$data = array( 'url' => $poll_js );
|
| 702 |
-
|
| 703 |
-
self::$scripts['poll'][] = $data;
|
| 704 |
-
|
| 705 |
-
add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
|
| 706 |
-
|
| 707 |
-
$data = esc_attr( json_encode( $data ) );
|
| 708 |
-
|
| 709 |
-
$script_url = esc_url_raw( plugins_url( 'js/polldaddy-shortcode.js', __FILE__ ) );
|
| 710 |
-
|
| 711 |
-
$str = <<<CONTAINER
|
| 712 |
-
<a name="pd_a_{$poll}"></a>
|
| 713 |
-
<div class="PDS_Poll" id="PDI_container{$poll}" data-settings="{$data}" style="display:inline-block;{$float}{$margins}"></div>
|
| 714 |
-
<div id="PD_superContainer"></div>
|
| 715 |
-
<noscript>{$poll_link}</noscript>
|
| 716 |
-
CONTAINER;
|
| 717 |
-
|
| 718 |
-
$loader = <<<SCRIPT
|
| 719 |
-
( function( d, c, j ) {
|
| 720 |
-
if ( !d.getElementById( j ) ) {
|
| 721 |
-
var pd = d.createElement( c ), s;
|
| 722 |
-
pd.id = j;
|
| 723 |
-
pd.src = '{$script_url}';
|
| 724 |
-
s = d.getElementsByTagName( c )[0];
|
| 725 |
-
s.parentNode.insertBefore( pd, s );
|
| 726 |
-
}
|
| 727 |
-
else if ( typeof jQuery !== 'undefined' )
|
| 728 |
-
jQuery( d.body ).trigger( 'pd-script-load' );
|
| 729 |
-
}( document, 'script', 'pd-polldaddy-loader' ) );
|
| 730 |
-
SCRIPT;
|
| 731 |
-
|
| 732 |
-
$loader = $this->compress_it( $loader );
|
| 733 |
-
$loader = "<script type='text/javascript'>\n".$loader."\n</script>";
|
| 734 |
-
|
| 735 |
-
return $str.$loader;
|
| 736 |
-
} else {
|
| 737 |
-
if ( $inline )
|
| 738 |
-
$cb = '';
|
| 739 |
-
|
| 740 |
-
return <<<CONTAINER
|
| 741 |
-
<a name="pd_a_{$poll}"></a>
|
| 742 |
-
<div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div>
|
| 743 |
-
<div id="PD_superContainer"></div>
|
| 744 |
-
<script type="text/javascript" charset="UTF-8" src="{$poll_js}{$cb}"></script>
|
| 745 |
-
<noscript>{$poll_link}</noscript>
|
| 746 |
-
CONTAINER;
|
| 747 |
-
}
|
| 748 |
-
}
|
| 749 |
-
}
|
| 750 |
-
} elseif ( !empty( $survey ) ) { //survey embed
|
| 751 |
-
|
| 752 |
-
if ( in_array( $type, array( 'iframe', 'button', 'banner', 'slider' ) ) ) {
|
| 753 |
-
|
| 754 |
-
if ( empty( $title ) ) {
|
| 755 |
-
$title = __( 'Take Our Survey!', 'polldaddy' );
|
| 756 |
-
if( !empty( $link_text ) )
|
| 757 |
-
$title = $link_text;
|
| 758 |
-
}
|
| 759 |
-
|
| 760 |
-
if ( $type == 'banner' || $type == 'slider' )
|
| 761 |
-
$inline = false;
|
| 762 |
-
|
| 763 |
-
$survey = preg_replace( '/[^a-f0-9]/i', '', $survey );
|
| 764 |
-
$survey_url = esc_url( "http://polldaddy.com/s/{$survey}" );
|
| 765 |
-
$survey_link = sprintf( '<a href="%s">%s</a>', $survey_url, esc_html( $title ) );
|
| 766 |
-
|
| 767 |
-
if ( $no_script || $inline || $infinite_scroll )
|
| 768 |
-
return $survey_link;
|
| 769 |
-
|
| 770 |
-
if ( $type == 'iframe' ) {
|
| 771 |
-
if ( $height != 'auto' ) {
|
| 772 |
-
if ( isset( $content_width ) && is_numeric( $width ) && $width > $content_width )
|
| 773 |
-
$width = $content_width;
|
| 774 |
-
|
| 775 |
-
if ( !$width )
|
| 776 |
-
$width = '100%';
|
| 777 |
-
else
|
| 778 |
-
$width = (int) $width;
|
| 779 |
-
|
| 780 |
-
if ( !$height )
|
| 781 |
-
$height = '600';
|
| 782 |
-
else
|
| 783 |
-
$height = (int) $height;
|
| 784 |
-
|
| 785 |
-
return <<<CONTAINER
|
| 786 |
-
<iframe src="{$survey_url}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" allowtransparency="true" marginheight="0" marginwidth="0">{$survey_link}</iframe>
|
| 787 |
-
CONTAINER;
|
| 788 |
-
} elseif ( !empty( $domain ) && !empty( $id ) ) {
|
| 789 |
-
|
| 790 |
-
$domain = preg_replace( '/[^a-z0-9\-]/i', '', $domain );
|
| 791 |
-
$id = preg_replace( '/[\/\?&\{\}]/', '', $id );
|
| 792 |
-
|
| 793 |
-
$auto_src = esc_url( "http://{$domain}.polldaddy.com/s/{$id}" );
|
| 794 |
-
$auto_src = parse_url( $auto_src );
|
| 795 |
-
|
| 796 |
-
if ( !is_array( $auto_src ) || count( $auto_src ) == 0 )
|
| 797 |
-
return '<!-- no polldaddy output -->';
|
| 798 |
-
|
| 799 |
-
if ( !isset( $auto_src['host'] ) || !isset( $auto_src['path'] ) )
|
| 800 |
-
return '<!-- no polldaddy output -->';
|
| 801 |
-
|
| 802 |
-
$domain = $auto_src['host'].'/s/';
|
| 803 |
-
$id = str_ireplace( '/s/', '', $auto_src['path'] );
|
| 804 |
-
|
| 805 |
-
$settings = array(
|
| 806 |
-
'type' => $type,
|
| 807 |
-
'auto' => true,
|
| 808 |
-
'domain' => $domain,
|
| 809 |
-
'id' => $id
|
| 810 |
-
);
|
| 811 |
-
}
|
| 812 |
-
} else {
|
| 813 |
-
$text_color = preg_replace( '/[^a-f0-9]/i', '', $text_color );
|
| 814 |
-
$back_color = preg_replace( '/[^a-f0-9]/i', '', $back_color );
|
| 815 |
-
|
| 816 |
-
if ( !in_array( $align, array( 'right', 'left', 'top-left', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-right' ) ) )
|
| 817 |
-
$align = '';
|
| 818 |
-
|
| 819 |
-
if ( !in_array( $style, array( 'inline', 'side', 'corner', 'rounded', 'square' ) ) )
|
| 820 |
-
$style = '';
|
| 821 |
-
|
| 822 |
-
$title = wp_strip_all_tags( $title );
|
| 823 |
-
$body = wp_strip_all_tags( $body );
|
| 824 |
-
$button = wp_strip_all_tags( $button );
|
| 825 |
-
|
| 826 |
-
$settings = array_filter( array(
|
| 827 |
-
'title' => $title,
|
| 828 |
-
'type' => $type,
|
| 829 |
-
'body' => $body,
|
| 830 |
-
'button' => $button,
|
| 831 |
-
'text_color' => $text_color,
|
| 832 |
-
'back_color' => $back_color,
|
| 833 |
-
'align' => $align,
|
| 834 |
-
'style' => $style,
|
| 835 |
-
'id' => $survey
|
| 836 |
-
) );
|
| 837 |
-
}
|
| 838 |
-
|
| 839 |
-
if ( empty( $settings ) )
|
| 840 |
-
return '<!-- no polldaddy output -->';
|
| 841 |
-
|
| 842 |
-
return $this->get_async_code( $settings, $survey_link );
|
| 843 |
-
}
|
| 844 |
-
} else {
|
| 845 |
-
return '<!-- no polldaddy output -->';
|
| 846 |
-
}
|
| 847 |
-
}
|
| 848 |
-
|
| 849 |
-
function generate_scripts() {
|
| 850 |
-
$script = '';
|
| 851 |
-
|
| 852 |
-
if ( is_array( self::$scripts ) ) {
|
| 853 |
-
if ( is_ssl() )
|
| 854 |
-
$rating_js_file = "https://polldaddy.com/js/rating/rating.js";
|
| 855 |
-
else
|
| 856 |
-
$rating_js_file = "http://i0.poll.fm/js/rating/rating.js";
|
| 857 |
-
|
| 858 |
-
if ( isset( self::$scripts['rating'] ) ) {
|
| 859 |
-
$script = "<script type='text/javascript' charset='UTF-8' id='polldaddyRatings'><!--//--><![CDATA[//><!--\n";
|
| 860 |
-
foreach( self::$scripts['rating'] as $rating ) {
|
| 861 |
-
$script .= "PDRTJS_settings_{$rating['id']}{$rating['item_id']}={$rating['settings']}; if ( typeof PDRTJS_RATING !== 'undefined' ){if ( typeof PDRTJS_{$rating['id']}{$rating['item_id']} == 'undefined' ){PDRTJS_{$rating['id']}{$rating['item_id']} = new PDRTJS_RATING( PDRTJS_settings_{$rating['id']}{$rating['item_id']} );}}";
|
| 862 |
-
}
|
| 863 |
-
$script .= "\n//--><!]]></script><script type='text/javascript' charset='UTF-8' src='{$rating_js_file}'></script>";
|
| 864 |
-
|
| 865 |
-
}
|
| 866 |
-
|
| 867 |
-
if ( isset( self::$scripts['poll'] ) ) {
|
| 868 |
-
foreach( self::$scripts['poll'] as $poll ) {
|
| 869 |
-
$script .= "<script type='text/javascript' charset='UTF-8' src='{$poll['url']}'></script>";
|
| 870 |
-
}
|
| 871 |
-
}
|
| 872 |
-
}
|
| 873 |
-
|
| 874 |
-
self::$scripts = false;
|
| 875 |
-
echo $script;
|
| 876 |
-
}
|
| 877 |
-
|
| 878 |
-
/**
|
| 879 |
-
* If the theme uses infinite scroll, include jquery at the start
|
| 880 |
-
*/
|
| 881 |
-
function check_infinite() {
|
| 882 |
-
if ( current_theme_supports( 'infinite-scroll' ) && class_exists( 'The_Neverending_Home_Page' ) && The_Neverending_Home_Page::archive_supports_infinity() )
|
| 883 |
-
wp_enqueue_script( 'jquery' );
|
| 884 |
-
}
|
| 885 |
-
|
| 886 |
-
/**
|
| 887 |
-
* Dynamically load the .js, if needed
|
| 888 |
-
*
|
| 889 |
-
* This hooks in late (priority 11) to infinite_scroll_render to determine
|
| 890 |
-
* a posteriori if a shortcode has been called.
|
| 891 |
-
*/
|
| 892 |
-
function polldaddy_shortcode_infinite() {
|
| 893 |
-
// only try to load if a shortcode has been called and theme supports infinite scroll
|
| 894 |
-
if( self::$add_script ) {
|
| 895 |
-
$script_url = esc_url_raw( plugins_url( 'js/polldaddy-shortcode.js', __FILE__ ) );
|
| 896 |
-
|
| 897 |
-
// if the script hasn't been loaded, load it
|
| 898 |
-
// if the script loads successfully, fire an 'pd-script-load' event
|
| 899 |
-
echo <<<SCRIPT
|
| 900 |
-
<script type='text/javascript'>
|
| 901 |
-
//<![CDATA[
|
| 902 |
-
( function( d, c, j ) {
|
| 903 |
-
if ( !d.getElementById( j ) ) {
|
| 904 |
-
var pd = d.createElement( c ), s;
|
| 905 |
-
pd.id = j;
|
| 906 |
-
pd.src = '{$script_url}';
|
| 907 |
-
s = d.getElementsByTagName( c )[0];
|
| 908 |
-
s.parentNode.insertBefore( pd, s );
|
| 909 |
-
}
|
| 910 |
-
else if ( typeof jQuery !== 'undefined' )
|
| 911 |
-
jQuery( d.body ).trigger( 'pd-script-load' );
|
| 912 |
-
}( document, 'script', 'pd-polldaddy-loader' ) );
|
| 913 |
-
//]]>
|
| 914 |
-
</script>
|
| 915 |
-
SCRIPT;
|
| 916 |
-
|
| 917 |
-
}
|
| 918 |
-
}
|
| 919 |
-
}
|
| 920 |
-
|
| 921 |
-
// kick it all off
|
| 922 |
-
new PolldaddyShortcode();
|
| 923 |
-
|
| 924 |
-
if ( !function_exists( 'polldaddy_link' ) ) {
|
| 925 |
-
// http://polldaddy.com/poll/1562975/?view=results&msg=voted
|
| 926 |
-
function polldaddy_link( $content ) {
|
| 927 |
-
if ( false === strpos( $content, "polldaddy.com/" ) )
|
| 928 |
-
return $content;
|
| 929 |
-
$textarr = wp_html_split( $content );
|
| 930 |
-
unset( $content );
|
| 931 |
-
foreach( $textarr as &$element ) {
|
| 932 |
-
if ( '' === $element || '<' === $element{0} )
|
| 933 |
-
continue;
|
| 934 |
-
$element = preg_replace( '!(?:\n|\A)http://polldaddy.com/poll/([0-9]+?)/(.+)?(?:\n|\Z)!i', "\n<script type='text/javascript' charset='utf-8' src='//static.polldaddy.com/p/$1.js'></script><noscript> <a href='http://polldaddy.com/poll/$1/'>View Poll</a></noscript>\n", $element );
|
| 935 |
-
}
|
| 936 |
-
return join( $textarr );
|
| 937 |
-
}
|
| 938 |
-
|
| 939 |
-
// higher priority because we need it before auto-link and autop get to it
|
| 940 |
-
add_filter( 'the_content', 'polldaddy_link', 1 );
|
| 941 |
-
add_filter( 'the_content_rss', 'polldaddy_link', 1 );
|
| 942 |
-
}
|
| 943 |
-
|
| 944 |
-
}
|
| 945 |
-
|
| 946 |
-
add_action( 'init', 'polldaddy_loader' );
|
| 947 |
-
add_filter( 'widget_text', 'do_shortcode' );
|
| 948 |
-
|
| 949 |
-
/**
|
| 950 |
-
* Polldaddy Top Rated Widget
|
| 951 |
-
*
|
| 952 |
-
* **/
|
| 953 |
-
if ( class_exists( 'WP_Widget' ) ) {
|
| 954 |
-
class PD_Top_Rated extends WP_Widget {
|
| 955 |
-
|
| 956 |
-
function __construct() {
|
| 957 |
-
|
| 958 |
-
$widget_ops = array( 'classname' => 'top_rated', 'description' => __( 'A list of your top rated posts, pages or comments.', 'polldaddy' ) );
|
| 959 |
-
parent::__construct( 'PD_Top_Rated', 'Top Rated', $widget_ops );
|
| 960 |
-
}
|
| 961 |
-
|
| 962 |
-
function PD_Top_Rated() {
|
| 963 |
-
$this->__construct();
|
| 964 |
-
}
|
| 965 |
-
|
| 966 |
-
function widget($args, $instance) {
|
| 967 |
-
|
| 968 |
-
extract($args, EXTR_SKIP);
|
| 969 |
-
|
| 970 |
-
$title = empty( $instance['title'] ) ? __( 'Top Rated', 'polldaddy' ) : apply_filters( 'widget_title', $instance['title'] );
|
| 971 |
-
$posts_rating_id = (int) get_option( 'pd-rating-posts-id' );
|
| 972 |
-
$pages_rating_id = (int) get_option( 'pd-rating-pages-id' );
|
| 973 |
-
$comments_rating_id = (int) get_option( 'pd-rating-comments-id' );
|
| 974 |
-
$rating_seq = $instance['show_posts'] . $instance['show_pages'] . $instance['show_comments'];
|
| 975 |
-
|
| 976 |
-
$filter = '';
|
| 977 |
-
if ( $instance['show_posts'] == 1 && $instance['filter_by_category'] == 1 ) {
|
| 978 |
-
if ( is_single() ) { //get all posts in current category
|
| 979 |
-
global $post;
|
| 980 |
-
if( !empty( $post ) )
|
| 981 |
-
$current_category = get_the_category( $post->ID );
|
| 982 |
-
}
|
| 983 |
-
|
| 984 |
-
if ( is_category() ) { //get all posts in category archive page
|
| 985 |
-
global $posts;
|
| 986 |
-
if( !empty( $posts ) )
|
| 987 |
-
$current_category = get_the_category( $posts[0]->ID );
|
| 988 |
-
}
|
| 989 |
-
|
| 990 |
-
if ( is_array( $current_category ) && (int) $current_category[0]->cat_ID > 0 ) {
|
| 991 |
-
$args = array( 'category' => $current_category[0]->cat_ID );
|
| 992 |
-
$post_ids = '';
|
| 993 |
-
foreach( get_posts( $args ) as $p )
|
| 994 |
-
$post_ids .= $p->ID . ',';
|
| 995 |
-
$post_ids = substr( $post_ids, 0, -1 );
|
| 996 |
-
}
|
| 997 |
-
|
| 998 |
-
if ( !empty( $post_ids ) ) //set variable
|
| 999 |
-
$filter = 'PDRTJS_TOP.filters = [' . $post_ids . '];';
|
| 1000 |
-
}
|
| 1001 |
-
|
| 1002 |
-
$show = "PDRTJS_TOP.get_top( 'posts', '0' );";
|
| 1003 |
-
$widget_class = 'posts';
|
| 1004 |
-
if ( $instance['show_pages'] == 1 ) {
|
| 1005 |
-
$show = "PDRTJS_TOP.get_top( 'pages', '0' );";
|
| 1006 |
-
$widget_class = 'pages';
|
| 1007 |
-
} elseif ( $instance['show_comments'] == 1 ) {
|
| 1008 |
-
$show = "PDRTJS_TOP.get_top( 'comments', '0' );";
|
| 1009 |
-
$widget_class = 'comments';
|
| 1010 |
-
}
|
| 1011 |
-
|
| 1012 |
-
echo '</script>';
|
| 1013 |
-
|
| 1014 |
-
if ( is_ssl() )
|
| 1015 |
-
$rating_js_file = "https://polldaddy.com/js/rating/rating-top.js";
|
| 1016 |
-
else
|
| 1017 |
-
$rating_js_file = "http://i0.poll.fm/js/rating/rating-top.js";
|
| 1018 |
-
$widget = <<<EOD
|
| 1019 |
-
{$before_title}{$title}{$after_title}
|
| 1020 |
-
<div id="pd_top_rated_holder" class="pd_top_rated_holder_{$widget_class}"></div>
|
| 1021 |
-
<script language="javascript" charset="UTF-8" src="{$rating_js_file}"></script>
|
| 1022 |
-
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
| 1023 |
-
PDRTJS_TOP = new PDRTJS_RATING_TOP( {$posts_rating_id}, {$pages_rating_id}, {$comments_rating_id}, '{$rating_seq}', {$instance['item_count']} );{$filter}{$show}
|
| 1024 |
-
//--><!]]></script>
|
| 1025 |
-
EOD;
|
| 1026 |
-
echo $before_widget;
|
| 1027 |
-
echo $widget;
|
| 1028 |
-
echo $after_widget;
|
| 1029 |
-
}
|
| 1030 |
-
|
| 1031 |
-
function update( $new_instance, $old_instance ) {
|
| 1032 |
-
|
| 1033 |
-
$instance = $old_instance;
|
| 1034 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 1035 |
-
$instance['show_posts'] = (int) $new_instance['show_posts'];
|
| 1036 |
-
$instance['show_pages'] = (int) $new_instance['show_pages'];
|
| 1037 |
-
$instance['show_comments'] = (int) $new_instance['show_comments'];
|
| 1038 |
-
$instance['filter_by_category'] = (int) $new_instance['filter_by_category'];
|
| 1039 |
-
$instance['item_count'] = (int) $new_instance['item_count'];
|
| 1040 |
-
return $instance;
|
| 1041 |
-
}
|
| 1042 |
-
|
| 1043 |
-
function form( $instance ) {
|
| 1044 |
-
|
| 1045 |
-
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'show_posts' => '1', 'show_pages' => '1', 'show_comments' => '1', 'item_count' => '5', 'filter_by_category' => '', ) );
|
| 1046 |
-
$title = strip_tags( $instance['title'] );
|
| 1047 |
-
$show_posts = (int) $instance['show_posts'];
|
| 1048 |
-
$show_pages = (int) $instance['show_pages'];
|
| 1049 |
-
$show_comments = (int) $instance['show_comments'];
|
| 1050 |
-
$filter_by_category = (int) $instance['filter_by_category'];
|
| 1051 |
-
$item_count = (int) $instance['item_count'];
|
| 1052 |
-
?>
|
| 1053 |
-
<p>
|
| 1054 |
-
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title', 'polldaddy' ); ?>: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
|
| 1055 |
-
<p>
|
| 1056 |
-
<label for="<?php echo $this->get_field_id( 'show_posts' ); ?>">
|
| 1057 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'show_posts' ); ?>" name="<?php echo $this->get_field_name( 'show_posts' ); ?>" value="1" <?php echo $show_posts == 1 ? 'checked="checked"' : ''; ?> />
|
| 1058 |
-
<?php _e( 'Show for posts', 'polldaddy' ); ?>
|
| 1059 |
-
</label>
|
| 1060 |
-
</p>
|
| 1061 |
-
<p>
|
| 1062 |
-
<label for="<?php echo $this->get_field_id( 'show_pages' ); ?>">
|
| 1063 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'show_pages' ); ?>" name="<?php echo $this->get_field_name( 'show_pages' ); ?>" value="1" <?php echo $show_pages == 1 ? 'checked="checked"' : ''; ?> />
|
| 1064 |
-
<?php _e( 'Show for pages', 'polldaddy' ); ?>
|
| 1065 |
-
</label>
|
| 1066 |
-
</p>
|
| 1067 |
-
<p>
|
| 1068 |
-
<label for="<?php echo $this->get_field_id( 'show_comments' ); ?>">
|
| 1069 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'show_comments' ); ?>" name="<?php echo $this->get_field_name( 'show_comments' ); ?>" value="1" <?php echo $show_comments == 1 ? 'checked="checked"' : ''; ?> />
|
| 1070 |
-
<?php _e( 'Show for comments', 'polldaddy' ); ?>
|
| 1071 |
-
</label>
|
| 1072 |
-
</p>
|
| 1073 |
-
<p>
|
| 1074 |
-
<label for="<?php echo $this->get_field_id( 'filter_by_category' ); ?>">
|
| 1075 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'filter_by_category' ); ?>" name="<?php echo $this->get_field_name( 'filter_by_category' ); ?>" value="1" <?php echo $filter_by_category == 1 ? 'checked="checked"':''; ?>/>
|
| 1076 |
-
<?php _e('Filter by category'); ?>
|
| 1077 |
-
</label>
|
| 1078 |
-
</p>
|
| 1079 |
-
<p>
|
| 1080 |
-
<label for="rss-items-<?php echo $number; ?>"><?php _e( 'How many items would you like to display?', 'polldaddy' ); ?>
|
| 1081 |
-
<select id="<?php echo $this->get_field_id( 'item_count' ); ?>" name="<?php echo $this->get_field_name( 'item_count' ); ?>">
|
| 1082 |
-
<?php
|
| 1083 |
-
for ( $i = 1; $i <= 20; ++$i )
|
| 1084 |
-
echo "<option value='$i' " . ( $item_count == $i ? "selected='selected'" : '' ) . ">$i</option>";
|
| 1085 |
-
?>
|
| 1086 |
-
</select>
|
| 1087 |
-
</label>
|
| 1088 |
-
</p>
|
| 1089 |
-
<?php
|
| 1090 |
-
}
|
| 1091 |
-
}
|
| 1092 |
-
add_action('widgets_init', create_function('', 'return register_widget("PD_Top_Rated");'));
|
| 1093 |
-
}
|
| 1094 |
-
|
| 1095 |
-
function polldaddy_login_warning() {
|
| 1096 |
-
global $cache_enabled, $hook_suffix;
|
| 1097 |
-
$page = isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : '';
|
| 1098 |
-
if ( ( $hook_suffix == 'plugins.php' || $page == 'polls' ) && false == get_option( 'polldaddy_api_key' ) && function_exists( "admin_url" ) )
|
| 1099 |
-
echo '<div class="updated"><p><strong>' . sprintf( __( 'Warning! The Polldaddy plugin must be linked to your Polldaddy.com account. Please visit the <a href="%s">plugin settings page</a> to login.', 'polldaddy' ), admin_url( 'options-general.php?page=polls&action=options' ) ) . '</strong></p></div>';
|
| 1100 |
-
}
|
| 1101 |
-
add_action( 'admin_notices', 'polldaddy_login_warning' );
|
| 1102 |
-
|
| 1103 |
-
/**
|
| 1104 |
-
* check if the hook is scheduled - if not, schedule it.
|
| 1105 |
-
*/
|
| 1106 |
-
function polldaddy_setup_schedule() {
|
| 1107 |
-
if ( false == wp_next_scheduled( 'polldaddy_rating_update_job' ) ) {
|
| 1108 |
-
wp_schedule_event( time(), 'twicedaily', 'polldaddy_rating_update_job');
|
| 1109 |
-
}
|
| 1110 |
-
}
|
| 1111 |
-
add_action( 'init', 'polldaddy_setup_schedule' );
|
| 1112 |
-
|
| 1113 |
-
/**
|
| 1114 |
-
* On deactivation, remove all functions from the scheduled action hook.
|
| 1115 |
-
*/
|
| 1116 |
-
function polldaddy_deactivation() {
|
| 1117 |
-
wp_clear_scheduled_hook( 'polldaddy_rating_update_job' );
|
| 1118 |
-
}
|
| 1119 |
-
register_deactivation_hook( __FILE__, 'polldaddy_deactivation' );
|
| 1120 |
-
|
| 1121 |
-
/**
|
| 1122 |
-
* On the scheduled action hook, run a function.
|
| 1123 |
-
*/
|
| 1124 |
-
function polldaddy_rating_update() {
|
| 1125 |
-
if ( false == get_option( 'pd-rich-snippets', 1 ) )
|
| 1126 |
-
return false;
|
| 1127 |
-
|
| 1128 |
-
global $polldaddy_object;
|
| 1129 |
-
$polldaddy = $polldaddy_object->get_client( WP_POLLDADDY__PARTNERGUID, get_option( 'pd-rating-usercode' ) );
|
| 1130 |
-
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 1131 |
-
$finished = false;
|
| 1132 |
-
$c = 0;
|
| 1133 |
-
while ( !$finished ) {
|
| 1134 |
-
$response = $polldaddy->get_rating_results( $rating_id, 2, $c, 50 );
|
| 1135 |
-
$ratings = $response->rating;
|
| 1136 |
-
if ( false == is_array( $ratings ) )
|
| 1137 |
-
$finished = true;
|
| 1138 |
-
else
|
| 1139 |
-
polldaddy_update_ratings_cache( $ratings );
|
| 1140 |
-
$c += 50;
|
| 1141 |
-
if ( $c > 1000 ) // gotta stop somewhere
|
| 1142 |
-
$finished = true;
|
| 1143 |
-
}
|
| 1144 |
-
return true;
|
| 1145 |
-
}
|
| 1146 |
-
|
| 1147 |
-
add_action( 'polldaddy_rating_update_job', 'polldaddy_rating_update' );
|
| 1148 |
-
|
| 1149 |
-
function polldaddy_update_ratings_cache( $ratings ) {
|
| 1150 |
-
foreach( $ratings as $rating ) {
|
| 1151 |
-
$post_id = str_replace( 'wp-post-', '', $rating->uid );
|
| 1152 |
-
update_post_meta( $post_id, 'pd_rating', array( 'type' => $rating->_type, 'votes' => $rating->_votes,
|
| 1153 |
-
'total1' => $rating->total1,
|
| 1154 |
-
'total2' => $rating->total2,
|
| 1155 |
-
'total3' => $rating->total3,
|
| 1156 |
-
'total4' => $rating->total4,
|
| 1157 |
-
'total5' => $rating->total5,
|
| 1158 |
-
'average' => $rating->average_rating ) );
|
| 1159 |
-
}
|
| 1160 |
-
}
|
| 1161 |
-
|
| 1162 |
-
function polldaddy_post_rating( $content ) {
|
| 1163 |
-
if ( false == get_option( 'pd-rich-snippets', 1 ) )
|
| 1164 |
-
return $content;
|
| 1165 |
-
if ( false == is_singular() )
|
| 1166 |
-
return $content;
|
| 1167 |
-
if ( false == get_option( 'pd-rating-usercode' ) )
|
| 1168 |
-
return $content;
|
| 1169 |
-
$rating = get_post_meta( $GLOBALS[ 'post' ]->ID, 'pd_rating' );
|
| 1170 |
-
if ( false == $rating )
|
| 1171 |
-
return $content;
|
| 1172 |
-
// convert to 5 star rating
|
| 1173 |
-
if ( $rating[0][ 'type' ] == 1 )
|
| 1174 |
-
$average = ceil( ( $rating[0][ 'average' ] / $rating[0][ 'votes' ] ) * 5 );
|
| 1175 |
-
|
| 1176 |
-
$average = $rating[ 'average' ];
|
| 1177 |
-
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
if ( function_exists( 'get_option' ) == false )
|
| 4 |
+
die( "Cheatin' eh?" );
|
| 5 |
+
|
| 6 |
+
require_once dirname( __FILE__ ) . '/polldaddy-client.php';
|
| 7 |
+
|
| 8 |
+
$GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
|
| 9 |
+
|
| 10 |
+
class WPORG_Polldaddy extends WP_Polldaddy {
|
| 11 |
+
var $use_ssl;
|
| 12 |
+
var $inline;
|
| 13 |
+
|
| 14 |
+
function __construct() {
|
| 15 |
+
parent::__construct();
|
| 16 |
+
$this->log( 'Created WPORG_Polldaddy Object: constructor' );
|
| 17 |
+
$this->version = '2.0.22';
|
| 18 |
+
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
| 19 |
+
$this->polldaddy_client_class = 'WPORG_Polldaddy_Client';
|
| 20 |
+
$this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
|
| 21 |
+
$this->multiple_accounts = (bool) get_option( 'polldaddy_multiple_accounts' );
|
| 22 |
+
$this->inline = (bool) get_option( 'polldaddy_load_poll_inline' );
|
| 23 |
+
$this->is_author = ( ( (bool) current_user_can('edit_others_posts')) or ( $this->multiple_accounts ) );
|
| 24 |
+
return;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
function log( $message ) {
|
| 28 |
+
if ( defined( 'WP_DEBUG_LOG' ) )
|
| 29 |
+
$GLOBALS[ 'wp_log' ][ 'polldaddy' ][] = $message;
|
| 30 |
+
parent::log( $message );
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
function set_api_user_code() {
|
| 34 |
+
if ( empty( $this->rating_user_code ) ) {
|
| 35 |
+
$this->rating_user_code = get_option( 'pd-rating-usercode' );
|
| 36 |
+
|
| 37 |
+
if ( empty( $this->rating_user_code ) ) {
|
| 38 |
+
$this->log( 'set_api_user_code: retrieve usercode from Polldaddy' );
|
| 39 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
| 40 |
+
$polldaddy->reset();
|
| 41 |
+
|
| 42 |
+
if ( $this->multiple_accounts ) {
|
| 43 |
+
//need to retrieve initial admin user code to use as ratings user code
|
| 44 |
+
$polldaddy->update_partner_account( array( 'role' => 0 ) );
|
| 45 |
+
update_option( 'polldaddy_multiple_accounts', 0 );
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
$this->rating_user_code = $polldaddy->get_usercode( $this->id );
|
| 49 |
+
if ( !empty( $this->rating_user_code ) )
|
| 50 |
+
update_option( 'pd-rating-usercode', $this->rating_user_code );
|
| 51 |
+
|
| 52 |
+
if ( $this->multiple_accounts ) {
|
| 53 |
+
$polldaddy->update_partner_account( array( 'role' => 1 ) );
|
| 54 |
+
update_option( 'polldaddy_multiple_accounts', 1 );
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
parent::set_api_user_code();
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
function admin_title( $admin_title ) {
|
| 62 |
+
global $page;
|
| 63 |
+
|
| 64 |
+
if ( $page == 'ratings' )
|
| 65 |
+
return (stripos( $admin_title, $page ) === false ? __( "Ratings", "polldaddy" ) : '' ).$admin_title;
|
| 66 |
+
elseif ( $page == 'polls' )
|
| 67 |
+
return (stripos( $admin_title, $page ) === false ? __( "Polls", "polldaddy" ) : '' ).$admin_title;
|
| 68 |
+
|
| 69 |
+
return $admin_title;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
function admin_menu() {
|
| 73 |
+
parent::admin_menu();
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
function management_page_load() {
|
| 77 |
+
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
| 78 |
+
|
| 79 |
+
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 80 |
+
wp_reset_vars( array( 'action', 'page' ) );
|
| 81 |
+
global $action, $page;
|
| 82 |
+
|
| 83 |
+
$this->set_api_user_code();
|
| 84 |
+
|
| 85 |
+
if ( $page == 'polls' ) {
|
| 86 |
+
switch ( $action ) {
|
| 87 |
+
case 'update-options' :
|
| 88 |
+
if ( !$is_POST )
|
| 89 |
+
return;
|
| 90 |
+
|
| 91 |
+
if ( $this->is_admin ) {
|
| 92 |
+
check_admin_referer( 'polldaddy-account' );
|
| 93 |
+
|
| 94 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 95 |
+
$polldaddy->reset();
|
| 96 |
+
|
| 97 |
+
$polldaddy_sync_account = 0;
|
| 98 |
+
$polldaddy_multiple_accounts = 0;
|
| 99 |
+
$polldaddy_load_poll_inline = 0;
|
| 100 |
+
|
| 101 |
+
if ( isset( $_POST['polldaddy-sync-account'] ) )
|
| 102 |
+
$polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
|
| 103 |
+
|
| 104 |
+
if ( $polldaddy_sync_account > 0 ) {
|
| 105 |
+
$this->log( 'management_page_load: sync usercode' );
|
| 106 |
+
$this->rating_user_code = '';
|
| 107 |
+
update_option( 'pd-rating-usercode', '' );
|
| 108 |
+
$this->set_api_user_code();
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
if ( isset( $_POST['polldaddy-multiple-accounts'] ) )
|
| 112 |
+
$polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
|
| 113 |
+
|
| 114 |
+
if ( isset( $_POST['polldaddy-load-poll-inline'] ) )
|
| 115 |
+
$polldaddy_load_poll_inline = (int) $_POST['polldaddy-load-poll-inline'];
|
| 116 |
+
|
| 117 |
+
$partner = array( 'role' => $polldaddy_multiple_accounts );
|
| 118 |
+
$polldaddy->update_partner_account( $partner );
|
| 119 |
+
update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
|
| 120 |
+
update_option( 'polldaddy_load_poll_inline', $polldaddy_load_poll_inline );
|
| 121 |
+
|
| 122 |
+
$rating_title_filter = '';
|
| 123 |
+
if ( isset( $_POST['polldaddy-ratings-title-filter'] ) )
|
| 124 |
+
$rating_title_filter = sanitize_text_field( $_POST['polldaddy-ratings-title-filter'] );
|
| 125 |
+
|
| 126 |
+
update_option( 'pd-rating-title-filter', $rating_title_filter );
|
| 127 |
+
}
|
| 128 |
+
break;
|
| 129 |
+
} //end switch
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
global $parent_file, $submenu_file, $typenow;
|
| 133 |
+
|
| 134 |
+
//need to set this to make sure that menus behave properly
|
| 135 |
+
if ( in_array( $action, array( 'options', 'update-rating' ) ) ) {
|
| 136 |
+
$parent_file = 'options-general.php';
|
| 137 |
+
$submenu_file = $page.'&action=options';
|
| 138 |
+
} else {
|
| 139 |
+
add_filter( 'admin_title', array( &$this, 'admin_title' ) );
|
| 140 |
+
$submenu_file = $page;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
parent::management_page_load();
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
function api_key_page_load() {
|
| 147 |
+
if ( 'post' != strtolower( $_SERVER['REQUEST_METHOD'] ) || empty( $_POST['action'] ) || 'account' != $_POST['action'] )
|
| 148 |
+
return false;
|
| 149 |
+
|
| 150 |
+
check_admin_referer( 'polldaddy-account' );
|
| 151 |
+
|
| 152 |
+
$polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
|
| 153 |
+
$polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
|
| 154 |
+
|
| 155 |
+
$this->log( 'api_key_page_load: get Polldaddy API key for account - '.$polldaddy_email );
|
| 156 |
+
|
| 157 |
+
if ( !$polldaddy_email )
|
| 158 |
+
$this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
|
| 159 |
+
|
| 160 |
+
if ( !$polldaddy_password )
|
| 161 |
+
$this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
|
| 162 |
+
|
| 163 |
+
if ( $this->errors->get_error_codes() )
|
| 164 |
+
return false;
|
| 165 |
+
|
| 166 |
+
if ( !empty( $_POST['polldaddy_use_ssl_checkbox'] ) ) {
|
| 167 |
+
if ( $polldaddy_use_ssl = (int) $_POST['polldaddy_use_ssl'] ) {
|
| 168 |
+
$this->use_ssl = 0; //checked (by default)
|
| 169 |
+
} else {
|
| 170 |
+
$this->use_ssl = 1; //unchecked
|
| 171 |
+
$this->scheme = 'http';
|
| 172 |
+
}
|
| 173 |
+
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
$details = array(
|
| 177 |
+
'uName' => get_bloginfo( 'name' ),
|
| 178 |
+
'uEmail' => $polldaddy_email,
|
| 179 |
+
'uPass' => $polldaddy_password,
|
| 180 |
+
'partner_userid' => $this->id
|
| 181 |
+
);
|
| 182 |
+
|
| 183 |
+
if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
|
| 184 |
+
$polldaddy_api_key = wp_remote_post( $this->scheme . '://api.polldaddy.com/key.php', array(
|
| 185 |
+
'body' => $details
|
| 186 |
+
) );
|
| 187 |
+
if ( is_wp_error( $polldaddy_api_key ) ) {
|
| 188 |
+
$this->errors = $polldaddy_api_key;
|
| 189 |
+
return false;
|
| 190 |
+
}
|
| 191 |
+
$response_code = wp_remote_retrieve_response_code( $polldaddy_api_key );
|
| 192 |
+
if ( 200 != $response_code ) {
|
| 193 |
+
$this->log( 'management_page_load: could not connect to Polldaddy API key service' );
|
| 194 |
+
$this->errors->add( 'http_code', __( 'Could not connect to Polldaddy API Key service', 'polldaddy' ) );
|
| 195 |
+
return false;
|
| 196 |
+
}
|
| 197 |
+
$polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
|
| 198 |
+
} else {
|
| 199 |
+
$fp = fsockopen(
|
| 200 |
+
'api.polldaddy.com',
|
| 201 |
+
80,
|
| 202 |
+
$err_num,
|
| 203 |
+
$err_str,
|
| 204 |
+
3
|
| 205 |
+
);
|
| 206 |
+
|
| 207 |
+
if ( !$fp ) {
|
| 208 |
+
$this->log( 'management_page_load: could not connect to Polldaddy API key service' );
|
| 209 |
+
$this->errors->add( 'connect', __( "Can't connect to Polldaddy.com", 'polldaddy' ) );
|
| 210 |
+
return false;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
if ( function_exists( 'stream_set_timeout' ) )
|
| 214 |
+
stream_set_timeout( $fp, 3 );
|
| 215 |
+
|
| 216 |
+
global $wp_version;
|
| 217 |
+
|
| 218 |
+
$request_body = http_build_query( $details, null, '&' );
|
| 219 |
+
|
| 220 |
+
$request = "POST /key.php HTTP/1.0\r\n";
|
| 221 |
+
$request .= "Host: api.polldaddy.com\r\n";
|
| 222 |
+
$request .= "User-agent: WordPress/$wp_version\r\n";
|
| 223 |
+
$request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
|
| 224 |
+
$request .= 'Content-Length: ' . strlen( $request_body ) . "\r\n";
|
| 225 |
+
|
| 226 |
+
fwrite( $fp, "$request\r\n$request_body" );
|
| 227 |
+
|
| 228 |
+
$response = '';
|
| 229 |
+
while ( !feof( $fp ) )
|
| 230 |
+
$response .= fread( $fp, 4096 );
|
| 231 |
+
fclose( $fp );
|
| 232 |
+
list($headers, $polldaddy_api_key) = explode( "\r\n\r\n", $response, 2 );
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
if ( isset( $polldaddy_api_key ) && strlen( $polldaddy_api_key ) > 0 ) {
|
| 236 |
+
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 237 |
+
} else {
|
| 238 |
+
$this->log( 'management_page_load: login to Polldaddy failed' );
|
| 239 |
+
$this->errors->add( 'polldaddy_api_key', __( 'Login to Polldaddy failed. Double check your email address and password.', 'polldaddy' ) );
|
| 240 |
+
if ( 1 !== $this->use_ssl ) {
|
| 241 |
+
$this->errors->add( 'polldaddy_api_key', __( 'If your email address and password are correct, your host may not support secure logins.', 'polldaddy' ) );
|
| 242 |
+
$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.', 'polldaddy' ) );
|
| 243 |
+
$this->use_ssl = 0;
|
| 244 |
+
}
|
| 245 |
+
update_option( 'polldaddy_use_ssl', $this->use_ssl );
|
| 246 |
+
return false;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 250 |
+
$polldaddy->reset();
|
| 251 |
+
if ( !$polldaddy->get_usercode( $this->id ) ) {
|
| 252 |
+
$this->parse_errors( $polldaddy );
|
| 253 |
+
$this->log( 'management_page_load: get usercode from Polldaddy failed' );
|
| 254 |
+
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?', 'polldaddy' ) );
|
| 255 |
+
return false;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
wp_redirect( add_query_arg( array( 'page' => 'polls' ), wp_get_referer() ) );
|
| 259 |
+
return true;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
function api_key_page() {
|
| 263 |
+
$this->print_errors();
|
| 264 |
+
?>
|
| 265 |
+
|
| 266 |
+
<div class="wrap">
|
| 267 |
+
|
| 268 |
+
<h2><?php _e( 'Polldaddy Account', 'polldaddy' ); ?></h2>
|
| 269 |
+
|
| 270 |
+
<p><?php printf( __( 'Before you can use the Polldaddy plugin, you need to enter your <a href="%s">Polldaddy.com</a> account details.', 'polldaddy' ), 'http://polldaddy.com/' ); ?></p>
|
| 271 |
+
|
| 272 |
+
<form action="" method="post">
|
| 273 |
+
<table class="form-table">
|
| 274 |
+
<tbody>
|
| 275 |
+
<tr class="form-field form-required">
|
| 276 |
+
<th valign="top" scope="row">
|
| 277 |
+
<label for="polldaddy-email"><?php _e( 'Polldaddy Email Address', 'polldaddy' ); ?></label>
|
| 278 |
+
</th>
|
| 279 |
+
<td>
|
| 280 |
+
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" value="<?php if ( isset( $_POST['polldaddy_email'] ) ) echo esc_attr( $_POST['polldaddy_email'] ); ?>" />
|
| 281 |
+
</td>
|
| 282 |
+
</tr>
|
| 283 |
+
<tr class="form-field form-required">
|
| 284 |
+
<th valign="top" scope="row">
|
| 285 |
+
<label for="polldaddy-password"><?php _e( 'Polldaddy Password', 'polldaddy' ); ?></label>
|
| 286 |
+
</th>
|
| 287 |
+
<td>
|
| 288 |
+
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
| 289 |
+
</td>
|
| 290 |
+
</tr>
|
| 291 |
+
<?php
|
| 292 |
+
$checked = '';
|
| 293 |
+
if ( $this->use_ssl == 0 )
|
| 294 |
+
$checked = 'checked="checked"';
|
| 295 |
+
?>
|
| 296 |
+
<tr class="form-field form-required">
|
| 297 |
+
<th valign="top" scope="row">
|
| 298 |
+
<label for="polldaddy-use-ssl"><?php _e( 'Use SSL to Log in', 'polldaddy' ); ?></label>
|
| 299 |
+
</th>
|
| 300 |
+
<td>
|
| 301 |
+
<input type="checkbox" name="polldaddy_use_ssl" id="polldaddy-use-ssl" value="1" <?php echo $checked ?> style="width: auto"/>
|
| 302 |
+
<label for="polldaddy-use-ssl"><?php _e( 'This ensures a secure login to your Polldaddy account. Only uncheck if you are having problems logging in.', 'polldaddy' ); ?></label>
|
| 303 |
+
<input type="hidden" name="polldaddy_use_ssl_checkbox" value="1" />
|
| 304 |
+
</td>
|
| 305 |
+
</tr>
|
| 306 |
+
</tbody>
|
| 307 |
+
</table>
|
| 308 |
+
<p class="submit">
|
| 309 |
+
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 310 |
+
<input type="hidden" name="action" value="account" />
|
| 311 |
+
<input type="hidden" name="account" value="import" />
|
| 312 |
+
<input class="button-secondary" type="submit" value="<?php echo esc_attr( __( 'Submit', 'polldaddy' ) ); ?>" />
|
| 313 |
+
</p>
|
| 314 |
+
</form>
|
| 315 |
+
</div>
|
| 316 |
+
|
| 317 |
+
<?php
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
function plugin_options_add() {
|
| 321 |
+
if ( $this->is_admin ) {
|
| 322 |
+
$inline = '';
|
| 323 |
+
if ( $this->inline )
|
| 324 |
+
$inline = 'checked="checked"';
|
| 325 |
+
|
| 326 |
+
$checked = '';
|
| 327 |
+
if ( $this->multiple_accounts )
|
| 328 |
+
$checked = 'checked="checked"';
|
| 329 |
+
|
| 330 |
+
$rating_title_filter = get_option( 'pd-rating-title-filter' );
|
| 331 |
+
|
| 332 |
+
if ( $rating_title_filter === false )
|
| 333 |
+
$rating_title_filter = 'wp_title';
|
| 334 |
+
|
| 335 |
+
?><tr class="form-field form-required">
|
| 336 |
+
<th valign="top" scope="row">
|
| 337 |
+
<label for="polldaddy-load-poll-inline">
|
| 338 |
+
<?php _e( 'Load Shortcodes Inline', 'polldaddy' ); ?>
|
| 339 |
+
</label>
|
| 340 |
+
</th>
|
| 341 |
+
<td>
|
| 342 |
+
<input type="checkbox" name="polldaddy-load-poll-inline" id="polldaddy-load-poll-inline" value="1" <?php echo $inline ?> style="width: auto" />
|
| 343 |
+
<span class="description">
|
| 344 |
+
<label for="polldaddy-load-poll-inline"><?php _e( 'This will load the Polldaddy shortcodes inline rather than in the page footer.', 'polldaddy' ); ?></label>
|
| 345 |
+
</span>
|
| 346 |
+
</td>
|
| 347 |
+
</tr><tr class="form-field form-required">
|
| 348 |
+
<th valign="top" scope="row">
|
| 349 |
+
<label for="polldaddy-multiple-accounts">
|
| 350 |
+
<?php _e( 'Multiple Polldaddy Accounts', 'polldaddy' ); ?>
|
| 351 |
+
</label>
|
| 352 |
+
</th>
|
| 353 |
+
<td>
|
| 354 |
+
<input type="checkbox" name="polldaddy-multiple-accounts" id="polldaddy-multiple-accounts" value="1" <?php echo $checked ?> style="width: auto" />
|
| 355 |
+
<span class="description">
|
| 356 |
+
<label for="polldaddy-multiple-accounts"><?php _e( 'This setting will allow each blog user to import a Polldaddy account.', 'polldaddy' ); ?></label>
|
| 357 |
+
</span>
|
| 358 |
+
</td>
|
| 359 |
+
</tr>
|
| 360 |
+
<tr class="form-field form-required">
|
| 361 |
+
<th valign="top" scope="row">
|
| 362 |
+
<label for="polldaddy-sync-account">
|
| 363 |
+
<?php _e( 'Sync Ratings Account', 'polldaddy' ); ?>
|
| 364 |
+
</label>
|
| 365 |
+
</th>
|
| 366 |
+
<td>
|
| 367 |
+
<input type="checkbox" name="polldaddy-sync-account" id="polldaddy-sync-account" value="1" style="width: auto" />
|
| 368 |
+
<span class="description">
|
| 369 |
+
<label for="polldaddy-sync-account"><?php _e( 'This will synchronize your ratings Polldaddy account.', 'polldaddy' ); ?></label>
|
| 370 |
+
</span>
|
| 371 |
+
</td>
|
| 372 |
+
</tr>
|
| 373 |
+
<tr class="form-field form-required">
|
| 374 |
+
<th valign="top" scope="row">
|
| 375 |
+
<label for="polldaddy-ratings-title-filter">
|
| 376 |
+
<?php _e( 'Ratings Title Filter', 'polldaddy' ); ?>
|
| 377 |
+
</label>
|
| 378 |
+
</th>
|
| 379 |
+
<td>
|
| 380 |
+
<input type="text" name="polldaddy-ratings-title-filter" id="polldaddy-ratings-title-filter" value="<?php echo esc_attr( $rating_title_filter ); ?>" style="width: auto" />
|
| 381 |
+
<span class="description">
|
| 382 |
+
<label for="polldaddy-ratings-title-filter"><?php _e( 'This setting allows you to specify a filter to use with your ratings title.', 'polldaddy' ); ?></label>
|
| 383 |
+
</span>
|
| 384 |
+
</td>
|
| 385 |
+
</tr><?php }
|
| 386 |
+
return parent::plugin_options_add();
|
| 387 |
+
}
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
class WPORG_Polldaddy_Client extends api_client {
|
| 391 |
+
/**
|
| 392 |
+
*
|
| 393 |
+
*
|
| 394 |
+
* @return string|false Polldaddy partner account or false on failure
|
| 395 |
+
*/
|
| 396 |
+
function get_partner_account() {
|
| 397 |
+
$pos = $this->add_request( 'getpartneraccount' );
|
| 398 |
+
$this->send_request();
|
| 399 |
+
$r = $this->response_part( $pos );
|
| 400 |
+
if ( isset( $r->partner ) && !is_null( $r->partner->_role ) )
|
| 401 |
+
return $r->partner;
|
| 402 |
+
return false;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
/**
|
| 406 |
+
*
|
| 407 |
+
*
|
| 408 |
+
* @see polldaddy_partner()
|
| 409 |
+
* @param array $args polldaddy_partner() args
|
| 410 |
+
* @return string|false Polldaddy partner account or false on failure
|
| 411 |
+
*/
|
| 412 |
+
function update_partner_account( $args ) {
|
| 413 |
+
if ( !$partner = polldaddy_partner( $args ) )
|
| 414 |
+
return false;
|
| 415 |
+
|
| 416 |
+
$pos = $this->add_request( 'updatepartneraccount', $partner );
|
| 417 |
+
$this->send_request();
|
| 418 |
+
$r = $this->response_part( $pos );
|
| 419 |
+
if ( isset( $r->partner ) && !is_null( $r->partner->_role ) )
|
| 420 |
+
return $r->partner;
|
| 421 |
+
return false;
|
| 422 |
+
}
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
function &polldaddy_partner( $args = null ) {
|
| 426 |
+
$false = false;
|
| 427 |
+
if ( is_a( $args, 'Polldaddy_Partner' ) )
|
| 428 |
+
return $args;
|
| 429 |
+
|
| 430 |
+
$defaults = _polldaddy_partner_defaults();
|
| 431 |
+
|
| 432 |
+
$args = wp_parse_args( $args, $defaults );
|
| 433 |
+
|
| 434 |
+
foreach ( array( 'name' ) as $required )
|
| 435 |
+
if ( !is_string( $args[$required] ) || !$args[$required] )
|
| 436 |
+
return $false;
|
| 437 |
+
|
| 438 |
+
$obj = new Polldaddy_Partner( $args, $args );
|
| 439 |
+
|
| 440 |
+
return $obj;
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
function _polldaddy_partner_defaults() {
|
| 444 |
+
return array(
|
| 445 |
+
'name' => get_bloginfo( 'name' ),
|
| 446 |
+
'role' => 0
|
| 447 |
+
);
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
if ( !function_exists( 'wp_strip_all_tags' ) ) {
|
| 451 |
+
function wp_strip_all_tags($string, $remove_breaks = false) {
|
| 452 |
+
$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
|
| 453 |
+
$string = strip_tags($string);
|
| 454 |
+
|
| 455 |
+
if ( $remove_breaks )
|
| 456 |
+
$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
|
| 457 |
+
|
| 458 |
+
return trim($string);
|
| 459 |
+
}
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
define( 'WP_POLLDADDY__CLASS', 'WPORG_Polldaddy' );
|
| 463 |
+
define( 'WP_POLLDADDY__POLLDADDY_CLIENT_PATH', dirname( __FILE__ ) . '/polldaddy-client.php' );
|
| 464 |
+
|
| 465 |
+
function polldaddy_loader() {
|
| 466 |
+
global $polldaddy_object;
|
| 467 |
+
$polldaddy_class = WP_POLLDADDY__CLASS;
|
| 468 |
+
$polldaddy_object = new $polldaddy_class;
|
| 469 |
+
load_plugin_textdomain( 'polldaddy', '', 'polldaddy/locale' );
|
| 470 |
+
add_action( 'admin_menu', array( &$polldaddy_object, 'admin_menu' ) );
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
|
| 474 |
+
if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
| 475 |
+
function polldaddy_shortcode_handler() {}
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
if ( !class_exists( 'PolldaddyShortcode' ) ) {
|
| 479 |
+
/**
|
| 480 |
+
* Class wrapper for polldaddy shortcodes
|
| 481 |
+
*/
|
| 482 |
+
class PolldaddyShortcode {
|
| 483 |
+
|
| 484 |
+
static $add_script = false;
|
| 485 |
+
static $scripts = false;
|
| 486 |
+
|
| 487 |
+
/**
|
| 488 |
+
* Add all the actions & resgister the shortcode
|
| 489 |
+
*/
|
| 490 |
+
function __construct() {
|
| 491 |
+
if ( defined( 'GLOBAL_TAGS' ) == false )
|
| 492 |
+
add_shortcode( 'polldaddy', array( $this, 'polldaddy_shortcode' ) );
|
| 493 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'check_infinite' ) );
|
| 494 |
+
add_action( 'infinite_scroll_render', array( $this, 'polldaddy_shortcode_infinite' ), 11 );
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
private function get_async_code( array $settings, $survey_link ) {
|
| 498 |
+
$embed_src = 'http://i0.poll.fm/survey.js';
|
| 499 |
+
$embed_src_ssl = 'https://polldaddy.com/survey.js';
|
| 500 |
+
|
| 501 |
+
$include = <<<CONTAINER
|
| 502 |
+
( function( d, c, j ) {
|
| 503 |
+
if ( !d.getElementById( j ) ) {
|
| 504 |
+
var pd = d.createElement( c ), s;
|
| 505 |
+
pd.id = j;
|
| 506 |
+
pd.src = ( 'https:' == d.location.protocol ) ? '{$embed_src_ssl}' : '{$embed_src}';
|
| 507 |
+
s = d.getElementsByTagName( c )[0];
|
| 508 |
+
s.parentNode.insertBefore( pd, s );
|
| 509 |
+
}
|
| 510 |
+
}( document, 'script', 'pd-embed' ) );
|
| 511 |
+
CONTAINER;
|
| 512 |
+
|
| 513 |
+
// Compress it a bit
|
| 514 |
+
$include = $this->compress_it( $include );
|
| 515 |
+
|
| 516 |
+
$placeholder = '<div class="pd-embed" data-settings="'.esc_attr( json_encode( $settings ) ).'"></div>';
|
| 517 |
+
if ( $type === 'button' )
|
| 518 |
+
$placeholder = '<a class="pd-embed" href="'.esc_attr( $survey_link ).'" data-settings="'.esc_attr( json_encode( $settings ) ).'">'.esc_html( $settings['title'] ).'</a>';
|
| 519 |
+
|
| 520 |
+
$js_include = $placeholder."\n";
|
| 521 |
+
$js_include .= '<script type="text/javascript"><!--//--><![CDATA[//><!--'."\n";
|
| 522 |
+
$js_include .= $include."\n";
|
| 523 |
+
$js_include .= "//--><!]]></script>\n";
|
| 524 |
+
|
| 525 |
+
if ( $type !== 'button' )
|
| 526 |
+
$js_include .= '<noscript>'.$survey_link."</noscript>\n";
|
| 527 |
+
|
| 528 |
+
return $js_include;
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
private function compress_it( $js ) {
|
| 532 |
+
$js = str_replace( array( "\n", "\t", "\r" ), '', $js );
|
| 533 |
+
$js = preg_replace( '/\s*([,:\?\{;\-=\(\)])\s*/', '$1', $js );
|
| 534 |
+
return $js;
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
/**
|
| 538 |
+
* Shortcode for polldadddy
|
| 539 |
+
* [polldaddy poll|survey|rating="123456"]
|
| 540 |
+
*
|
| 541 |
+
* */
|
| 542 |
+
function polldaddy_shortcode( $atts ) {
|
| 543 |
+
global $post;
|
| 544 |
+
global $content_width;
|
| 545 |
+
|
| 546 |
+
extract( shortcode_atts( array(
|
| 547 |
+
'survey' => null,
|
| 548 |
+
'link_text' => 'Take Our Survey',
|
| 549 |
+
'poll' => 'empty',
|
| 550 |
+
'rating' => 'empty',
|
| 551 |
+
'unique_id' => null,
|
| 552 |
+
'item_id' => null,
|
| 553 |
+
'title' => null,
|
| 554 |
+
'permalink' => null,
|
| 555 |
+
'cb' => 0,
|
| 556 |
+
'type' => 'button',
|
| 557 |
+
'body' => '',
|
| 558 |
+
'button' => '',
|
| 559 |
+
'text_color' => '000000',
|
| 560 |
+
'back_color' => 'FFFFFF',
|
| 561 |
+
'align' => '',
|
| 562 |
+
'style' => '',
|
| 563 |
+
'width' => $content_width,
|
| 564 |
+
'height' => floor( $content_width * 3 / 4 ),
|
| 565 |
+
'delay' => 100,
|
| 566 |
+
'visit' => 'single',
|
| 567 |
+
'domain' => '',
|
| 568 |
+
'id' => ''
|
| 569 |
+
), $atts, 'polldaddy' ) );
|
| 570 |
+
|
| 571 |
+
if ( ! is_array( $atts ) ) {
|
| 572 |
+
return '<!-- Polldaddy shortcode passed invalid attributes -->';
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
$inline = !in_the_loop();
|
| 576 |
+
$no_script = false;
|
| 577 |
+
$infinite_scroll = false;
|
| 578 |
+
|
| 579 |
+
if ( is_home() && current_theme_supports( 'infinite-scroll' ) )
|
| 580 |
+
$infinite_scroll = true;
|
| 581 |
+
|
| 582 |
+
if ( defined( 'PADPRESS_LOADED' ) )
|
| 583 |
+
$inline = true;
|
| 584 |
+
|
| 585 |
+
if ( function_exists( 'get_option' ) && get_option( 'polldaddy_load_poll_inline' ) )
|
| 586 |
+
$inline = true;
|
| 587 |
+
|
| 588 |
+
if ( is_feed() || ( defined( 'DOING_AJAX' ) && !$infinite_scroll ) )
|
| 589 |
+
$no_script = false;
|
| 590 |
+
|
| 591 |
+
self::$add_script = $infinite_scroll;
|
| 592 |
+
|
| 593 |
+
if ( intval( $rating ) > 0 && !$no_script ) { //rating embed
|
| 594 |
+
|
| 595 |
+
if ( empty( $unique_id ) )
|
| 596 |
+
$unique_id = is_page() ? 'wp-page-'.$post->ID : 'wp-post-'.$post->ID;
|
| 597 |
+
|
| 598 |
+
if ( empty( $item_id ) )
|
| 599 |
+
$item_id = is_page() ? '_page_'.$post->ID : '_post_'.$post->ID;
|
| 600 |
+
|
| 601 |
+
if ( empty( $title ) )
|
| 602 |
+
$title = apply_filters( 'the_title', $post->post_title );
|
| 603 |
+
|
| 604 |
+
if ( empty( $permalink ) )
|
| 605 |
+
$permalink = get_permalink( $post->ID );
|
| 606 |
+
|
| 607 |
+
$rating = intval( $rating );
|
| 608 |
+
$unique_id = preg_replace( '/[^\-_a-z0-9]/i', '', wp_strip_all_tags( $unique_id ) );
|
| 609 |
+
$item_id = wp_strip_all_tags( $item_id );
|
| 610 |
+
$item_id = preg_replace( '/[^_a-z0-9]/i', '', $item_id );
|
| 611 |
+
|
| 612 |
+
$settings = json_encode( array(
|
| 613 |
+
'id' => $rating,
|
| 614 |
+
'unique_id' => $unique_id,
|
| 615 |
+
'title' => rawurlencode( trim( $title ) ),
|
| 616 |
+
'permalink' => esc_url( $permalink ),
|
| 617 |
+
'item_id' => $item_id
|
| 618 |
+
) );
|
| 619 |
+
|
| 620 |
+
$item_id = esc_js( $item_id );
|
| 621 |
+
if ( is_ssl() )
|
| 622 |
+
$rating_js_file = "https://polldaddy.com/js/rating/rating.js";
|
| 623 |
+
else
|
| 624 |
+
$rating_js_file = "http://i0.poll.fm/js/rating/rating.js";
|
| 625 |
+
|
| 626 |
+
if ( $inline ) {
|
| 627 |
+
return <<<SCRIPT
|
| 628 |
+
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
| 629 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
| 630 |
+
PDRTJS_settings_{$rating}{$item_id}={$settings};
|
| 631 |
+
//--><!]]></script>
|
| 632 |
+
<script type="text/javascript" charset="UTF-8" src="{$rating_js_file}"></script>
|
| 633 |
+
SCRIPT;
|
| 634 |
+
} else {
|
| 635 |
+
if ( self::$scripts === false )
|
| 636 |
+
self::$scripts = array();
|
| 637 |
+
|
| 638 |
+
$data = array( 'id' => $rating, 'item_id' => $item_id, 'settings' => $settings );
|
| 639 |
+
|
| 640 |
+
self::$scripts['rating'][] = $data;
|
| 641 |
+
|
| 642 |
+
add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
|
| 643 |
+
|
| 644 |
+
$data = esc_attr( json_encode( $data ) );
|
| 645 |
+
|
| 646 |
+
if ( $infinite_scroll )
|
| 647 |
+
return <<<CONTAINER
|
| 648 |
+
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}" data-settings="{$data}"></div>
|
| 649 |
+
CONTAINER;
|
| 650 |
+
else
|
| 651 |
+
return <<<CONTAINER
|
| 652 |
+
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
| 653 |
+
CONTAINER;
|
| 654 |
+
}
|
| 655 |
+
} elseif ( intval( $poll ) > 0 ) { //poll embed
|
| 656 |
+
|
| 657 |
+
$poll = intval( $poll );
|
| 658 |
+
$poll_url = sprintf( 'http://polldaddy.com/poll/%d', $poll );
|
| 659 |
+
$poll_js = sprintf( '%s.polldaddy.com/p/%d.js', '//static', $poll );
|
| 660 |
+
$poll_link = sprintf( '<a href="%s">Take Our Poll</a>', $poll_url );
|
| 661 |
+
|
| 662 |
+
if ( $no_script ) {
|
| 663 |
+
return $poll_link;
|
| 664 |
+
} else {
|
| 665 |
+
if ( $type == 'slider' && !$inline ) {
|
| 666 |
+
|
| 667 |
+
if( !in_array( $visit, array( 'single', 'multiple' ) ) )
|
| 668 |
+
$visit = 'single';
|
| 669 |
+
|
| 670 |
+
$settings = array(
|
| 671 |
+
'type' => 'slider',
|
| 672 |
+
'embed' => 'poll',
|
| 673 |
+
'delay' => intval( $delay ),
|
| 674 |
+
'visit' => $visit,
|
| 675 |
+
'id' => intval( $poll )
|
| 676 |
+
);
|
| 677 |
+
|
| 678 |
+
return $this->get_async_code( $settings, $poll_link );
|
| 679 |
+
} else {
|
| 680 |
+
$cb = ( $cb == 1 ? '?cb='. time() : false );
|
| 681 |
+
$margins = '';
|
| 682 |
+
$float = '';
|
| 683 |
+
|
| 684 |
+
if ( in_array( $align, array( 'right', 'left' ) ) ) {
|
| 685 |
+
$float = sprintf( 'float: %s;', $align );
|
| 686 |
+
|
| 687 |
+
if ( $align == 'left')
|
| 688 |
+
$margins = 'margin: 0px 10px 0px 0px;';
|
| 689 |
+
elseif ( $align == 'right' )
|
| 690 |
+
$margins = 'margin: 0px 0px 0px 10px';
|
| 691 |
+
}
|
| 692 |
+
|
| 693 |
+
// Force the normal style embed on single posts/pages otherwise it's not rendered on infinite scroll themed blogs ('infinite_scroll_render' isn't fired)
|
| 694 |
+
if ( is_singular() )
|
| 695 |
+
$inline = true;
|
| 696 |
+
|
| 697 |
+
if ( $cb === false && !$inline ) {
|
| 698 |
+
if ( self::$scripts === false )
|
| 699 |
+
self::$scripts = array();
|
| 700 |
+
|
| 701 |
+
$data = array( 'url' => $poll_js );
|
| 702 |
+
|
| 703 |
+
self::$scripts['poll'][] = $data;
|
| 704 |
+
|
| 705 |
+
add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
|
| 706 |
+
|
| 707 |
+
$data = esc_attr( json_encode( $data ) );
|
| 708 |
+
|
| 709 |
+
$script_url = esc_url_raw( plugins_url( 'js/polldaddy-shortcode.js', __FILE__ ) );
|
| 710 |
+
|
| 711 |
+
$str = <<<CONTAINER
|
| 712 |
+
<a name="pd_a_{$poll}"></a>
|
| 713 |
+
<div class="PDS_Poll" id="PDI_container{$poll}" data-settings="{$data}" style="display:inline-block;{$float}{$margins}"></div>
|
| 714 |
+
<div id="PD_superContainer"></div>
|
| 715 |
+
<noscript>{$poll_link}</noscript>
|
| 716 |
+
CONTAINER;
|
| 717 |
+
|
| 718 |
+
$loader = <<<SCRIPT
|
| 719 |
+
( function( d, c, j ) {
|
| 720 |
+
if ( !d.getElementById( j ) ) {
|
| 721 |
+
var pd = d.createElement( c ), s;
|
| 722 |
+
pd.id = j;
|
| 723 |
+
pd.src = '{$script_url}';
|
| 724 |
+
s = d.getElementsByTagName( c )[0];
|
| 725 |
+
s.parentNode.insertBefore( pd, s );
|
| 726 |
+
}
|
| 727 |
+
else if ( typeof jQuery !== 'undefined' )
|
| 728 |
+
jQuery( d.body ).trigger( 'pd-script-load' );
|
| 729 |
+
}( document, 'script', 'pd-polldaddy-loader' ) );
|
| 730 |
+
SCRIPT;
|
| 731 |
+
|
| 732 |
+
$loader = $this->compress_it( $loader );
|
| 733 |
+
$loader = "<script type='text/javascript'>\n".$loader."\n</script>";
|
| 734 |
+
|
| 735 |
+
return $str.$loader;
|
| 736 |
+
} else {
|
| 737 |
+
if ( $inline )
|
| 738 |
+
$cb = '';
|
| 739 |
+
|
| 740 |
+
return <<<CONTAINER
|
| 741 |
+
<a name="pd_a_{$poll}"></a>
|
| 742 |
+
<div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div>
|
| 743 |
+
<div id="PD_superContainer"></div>
|
| 744 |
+
<script type="text/javascript" charset="UTF-8" src="{$poll_js}{$cb}"></script>
|
| 745 |
+
<noscript>{$poll_link}</noscript>
|
| 746 |
+
CONTAINER;
|
| 747 |
+
}
|
| 748 |
+
}
|
| 749 |
+
}
|
| 750 |
+
} elseif ( !empty( $survey ) ) { //survey embed
|
| 751 |
+
|
| 752 |
+
if ( in_array( $type, array( 'iframe', 'button', 'banner', 'slider' ) ) ) {
|
| 753 |
+
|
| 754 |
+
if ( empty( $title ) ) {
|
| 755 |
+
$title = __( 'Take Our Survey!', 'polldaddy' );
|
| 756 |
+
if( !empty( $link_text ) )
|
| 757 |
+
$title = $link_text;
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
+
if ( $type == 'banner' || $type == 'slider' )
|
| 761 |
+
$inline = false;
|
| 762 |
+
|
| 763 |
+
$survey = preg_replace( '/[^a-f0-9]/i', '', $survey );
|
| 764 |
+
$survey_url = esc_url( "http://polldaddy.com/s/{$survey}" );
|
| 765 |
+
$survey_link = sprintf( '<a href="%s">%s</a>', $survey_url, esc_html( $title ) );
|
| 766 |
+
|
| 767 |
+
if ( $no_script || $inline || $infinite_scroll )
|
| 768 |
+
return $survey_link;
|
| 769 |
+
|
| 770 |
+
if ( $type == 'iframe' ) {
|
| 771 |
+
if ( $height != 'auto' ) {
|
| 772 |
+
if ( isset( $content_width ) && is_numeric( $width ) && $width > $content_width )
|
| 773 |
+
$width = $content_width;
|
| 774 |
+
|
| 775 |
+
if ( !$width )
|
| 776 |
+
$width = '100%';
|
| 777 |
+
else
|
| 778 |
+
$width = (int) $width;
|
| 779 |
+
|
| 780 |
+
if ( !$height )
|
| 781 |
+
$height = '600';
|
| 782 |
+
else
|
| 783 |
+
$height = (int) $height;
|
| 784 |
+
|
| 785 |
+
return <<<CONTAINER
|
| 786 |
+
<iframe src="{$survey_url}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" allowtransparency="true" marginheight="0" marginwidth="0">{$survey_link}</iframe>
|
| 787 |
+
CONTAINER;
|
| 788 |
+
} elseif ( !empty( $domain ) && !empty( $id ) ) {
|
| 789 |
+
|
| 790 |
+
$domain = preg_replace( '/[^a-z0-9\-]/i', '', $domain );
|
| 791 |
+
$id = preg_replace( '/[\/\?&\{\}]/', '', $id );
|
| 792 |
+
|
| 793 |
+
$auto_src = esc_url( "http://{$domain}.polldaddy.com/s/{$id}" );
|
| 794 |
+
$auto_src = parse_url( $auto_src );
|
| 795 |
+
|
| 796 |
+
if ( !is_array( $auto_src ) || count( $auto_src ) == 0 )
|
| 797 |
+
return '<!-- no polldaddy output -->';
|
| 798 |
+
|
| 799 |
+
if ( !isset( $auto_src['host'] ) || !isset( $auto_src['path'] ) )
|
| 800 |
+
return '<!-- no polldaddy output -->';
|
| 801 |
+
|
| 802 |
+
$domain = $auto_src['host'].'/s/';
|
| 803 |
+
$id = str_ireplace( '/s/', '', $auto_src['path'] );
|
| 804 |
+
|
| 805 |
+
$settings = array(
|
| 806 |
+
'type' => $type,
|
| 807 |
+
'auto' => true,
|
| 808 |
+
'domain' => $domain,
|
| 809 |
+
'id' => $id
|
| 810 |
+
);
|
| 811 |
+
}
|
| 812 |
+
} else {
|
| 813 |
+
$text_color = preg_replace( '/[^a-f0-9]/i', '', $text_color );
|
| 814 |
+
$back_color = preg_replace( '/[^a-f0-9]/i', '', $back_color );
|
| 815 |
+
|
| 816 |
+
if ( !in_array( $align, array( 'right', 'left', 'top-left', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-right' ) ) )
|
| 817 |
+
$align = '';
|
| 818 |
+
|
| 819 |
+
if ( !in_array( $style, array( 'inline', 'side', 'corner', 'rounded', 'square' ) ) )
|
| 820 |
+
$style = '';
|
| 821 |
+
|
| 822 |
+
$title = wp_strip_all_tags( $title );
|
| 823 |
+
$body = wp_strip_all_tags( $body );
|
| 824 |
+
$button = wp_strip_all_tags( $button );
|
| 825 |
+
|
| 826 |
+
$settings = array_filter( array(
|
| 827 |
+
'title' => $title,
|
| 828 |
+
'type' => $type,
|
| 829 |
+
'body' => $body,
|
| 830 |
+
'button' => $button,
|
| 831 |
+
'text_color' => $text_color,
|
| 832 |
+
'back_color' => $back_color,
|
| 833 |
+
'align' => $align,
|
| 834 |
+
'style' => $style,
|
| 835 |
+
'id' => $survey
|
| 836 |
+
) );
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
if ( empty( $settings ) )
|
| 840 |
+
return '<!-- no polldaddy output -->';
|
| 841 |
+
|
| 842 |
+
return $this->get_async_code( $settings, $survey_link );
|
| 843 |
+
}
|
| 844 |
+
} else {
|
| 845 |
+
return '<!-- no polldaddy output -->';
|
| 846 |
+
}
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
function generate_scripts() {
|
| 850 |
+
$script = '';
|
| 851 |
+
|
| 852 |
+
if ( is_array( self::$scripts ) ) {
|
| 853 |
+
if ( is_ssl() )
|
| 854 |
+
$rating_js_file = "https://polldaddy.com/js/rating/rating.js";
|
| 855 |
+
else
|
| 856 |
+
$rating_js_file = "http://i0.poll.fm/js/rating/rating.js";
|
| 857 |
+
|
| 858 |
+
if ( isset( self::$scripts['rating'] ) ) {
|
| 859 |
+
$script = "<script type='text/javascript' charset='UTF-8' id='polldaddyRatings'><!--//--><![CDATA[//><!--\n";
|
| 860 |
+
foreach( self::$scripts['rating'] as $rating ) {
|
| 861 |
+
$script .= "PDRTJS_settings_{$rating['id']}{$rating['item_id']}={$rating['settings']}; if ( typeof PDRTJS_RATING !== 'undefined' ){if ( typeof PDRTJS_{$rating['id']}{$rating['item_id']} == 'undefined' ){PDRTJS_{$rating['id']}{$rating['item_id']} = new PDRTJS_RATING( PDRTJS_settings_{$rating['id']}{$rating['item_id']} );}}";
|
| 862 |
+
}
|
| 863 |
+
$script .= "\n//--><!]]></script><script type='text/javascript' charset='UTF-8' src='{$rating_js_file}'></script>";
|
| 864 |
+
|
| 865 |
+
}
|
| 866 |
+
|
| 867 |
+
if ( isset( self::$scripts['poll'] ) ) {
|
| 868 |
+
foreach( self::$scripts['poll'] as $poll ) {
|
| 869 |
+
$script .= "<script type='text/javascript' charset='UTF-8' src='{$poll['url']}'></script>";
|
| 870 |
+
}
|
| 871 |
+
}
|
| 872 |
+
}
|
| 873 |
+
|
| 874 |
+
self::$scripts = false;
|
| 875 |
+
echo $script;
|
| 876 |
+
}
|
| 877 |
+
|
| 878 |
+
/**
|
| 879 |
+
* If the theme uses infinite scroll, include jquery at the start
|
| 880 |
+
*/
|
| 881 |
+
function check_infinite() {
|
| 882 |
+
if ( current_theme_supports( 'infinite-scroll' ) && class_exists( 'The_Neverending_Home_Page' ) && The_Neverending_Home_Page::archive_supports_infinity() )
|
| 883 |
+
wp_enqueue_script( 'jquery' );
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
/**
|
| 887 |
+
* Dynamically load the .js, if needed
|
| 888 |
+
*
|
| 889 |
+
* This hooks in late (priority 11) to infinite_scroll_render to determine
|
| 890 |
+
* a posteriori if a shortcode has been called.
|
| 891 |
+
*/
|
| 892 |
+
function polldaddy_shortcode_infinite() {
|
| 893 |
+
// only try to load if a shortcode has been called and theme supports infinite scroll
|
| 894 |
+
if( self::$add_script ) {
|
| 895 |
+
$script_url = esc_url_raw( plugins_url( 'js/polldaddy-shortcode.js', __FILE__ ) );
|
| 896 |
+
|
| 897 |
+
// if the script hasn't been loaded, load it
|
| 898 |
+
// if the script loads successfully, fire an 'pd-script-load' event
|
| 899 |
+
echo <<<SCRIPT
|
| 900 |
+
<script type='text/javascript'>
|
| 901 |
+
//<![CDATA[
|
| 902 |
+
( function( d, c, j ) {
|
| 903 |
+
if ( !d.getElementById( j ) ) {
|
| 904 |
+
var pd = d.createElement( c ), s;
|
| 905 |
+
pd.id = j;
|
| 906 |
+
pd.src = '{$script_url}';
|
| 907 |
+
s = d.getElementsByTagName( c )[0];
|
| 908 |
+
s.parentNode.insertBefore( pd, s );
|
| 909 |
+
}
|
| 910 |
+
else if ( typeof jQuery !== 'undefined' )
|
| 911 |
+
jQuery( d.body ).trigger( 'pd-script-load' );
|
| 912 |
+
}( document, 'script', 'pd-polldaddy-loader' ) );
|
| 913 |
+
//]]>
|
| 914 |
+
</script>
|
| 915 |
+
SCRIPT;
|
| 916 |
+
|
| 917 |
+
}
|
| 918 |
+
}
|
| 919 |
+
}
|
| 920 |
+
|
| 921 |
+
// kick it all off
|
| 922 |
+
new PolldaddyShortcode();
|
| 923 |
+
|
| 924 |
+
if ( !function_exists( 'polldaddy_link' ) ) {
|
| 925 |
+
// http://polldaddy.com/poll/1562975/?view=results&msg=voted
|
| 926 |
+
function polldaddy_link( $content ) {
|
| 927 |
+
if ( false === strpos( $content, "polldaddy.com/" ) )
|
| 928 |
+
return $content;
|
| 929 |
+
$textarr = wp_html_split( $content );
|
| 930 |
+
unset( $content );
|
| 931 |
+
foreach( $textarr as &$element ) {
|
| 932 |
+
if ( '' === $element || '<' === $element{0} )
|
| 933 |
+
continue;
|
| 934 |
+
$element = preg_replace( '!(?:\n|\A)http://polldaddy.com/poll/([0-9]+?)/(.+)?(?:\n|\Z)!i', "\n<script type='text/javascript' charset='utf-8' src='//static.polldaddy.com/p/$1.js'></script><noscript> <a href='http://polldaddy.com/poll/$1/'>View Poll</a></noscript>\n", $element );
|
| 935 |
+
}
|
| 936 |
+
return join( $textarr );
|
| 937 |
+
}
|
| 938 |
+
|
| 939 |
+
// higher priority because we need it before auto-link and autop get to it
|
| 940 |
+
add_filter( 'the_content', 'polldaddy_link', 1 );
|
| 941 |
+
add_filter( 'the_content_rss', 'polldaddy_link', 1 );
|
| 942 |
+
}
|
| 943 |
+
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
add_action( 'init', 'polldaddy_loader' );
|
| 947 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
| 948 |
+
|
| 949 |
+
/**
|
| 950 |
+
* Polldaddy Top Rated Widget
|
| 951 |
+
*
|
| 952 |
+
* **/
|
| 953 |
+
if ( class_exists( 'WP_Widget' ) ) {
|
| 954 |
+
class PD_Top_Rated extends WP_Widget {
|
| 955 |
+
|
| 956 |
+
function __construct() {
|
| 957 |
+
|
| 958 |
+
$widget_ops = array( 'classname' => 'top_rated', 'description' => __( 'A list of your top rated posts, pages or comments.', 'polldaddy' ) );
|
| 959 |
+
parent::__construct( 'PD_Top_Rated', 'Top Rated', $widget_ops );
|
| 960 |
+
}
|
| 961 |
+
|
| 962 |
+
function PD_Top_Rated() {
|
| 963 |
+
$this->__construct();
|
| 964 |
+
}
|
| 965 |
+
|
| 966 |
+
function widget($args, $instance) {
|
| 967 |
+
|
| 968 |
+
extract($args, EXTR_SKIP);
|
| 969 |
+
|
| 970 |
+
$title = empty( $instance['title'] ) ? __( 'Top Rated', 'polldaddy' ) : apply_filters( 'widget_title', $instance['title'] );
|
| 971 |
+
$posts_rating_id = (int) get_option( 'pd-rating-posts-id' );
|
| 972 |
+
$pages_rating_id = (int) get_option( 'pd-rating-pages-id' );
|
| 973 |
+
$comments_rating_id = (int) get_option( 'pd-rating-comments-id' );
|
| 974 |
+
$rating_seq = $instance['show_posts'] . $instance['show_pages'] . $instance['show_comments'];
|
| 975 |
+
|
| 976 |
+
$filter = '';
|
| 977 |
+
if ( $instance['show_posts'] == 1 && $instance['filter_by_category'] == 1 ) {
|
| 978 |
+
if ( is_single() ) { //get all posts in current category
|
| 979 |
+
global $post;
|
| 980 |
+
if( !empty( $post ) )
|
| 981 |
+
$current_category = get_the_category( $post->ID );
|
| 982 |
+
}
|
| 983 |
+
|
| 984 |
+
if ( is_category() ) { //get all posts in category archive page
|
| 985 |
+
global $posts;
|
| 986 |
+
if( !empty( $posts ) )
|
| 987 |
+
$current_category = get_the_category( $posts[0]->ID );
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
if ( is_array( $current_category ) && (int) $current_category[0]->cat_ID > 0 ) {
|
| 991 |
+
$args = array( 'category' => $current_category[0]->cat_ID );
|
| 992 |
+
$post_ids = '';
|
| 993 |
+
foreach( get_posts( $args ) as $p )
|
| 994 |
+
$post_ids .= $p->ID . ',';
|
| 995 |
+
$post_ids = substr( $post_ids, 0, -1 );
|
| 996 |
+
}
|
| 997 |
+
|
| 998 |
+
if ( !empty( $post_ids ) ) //set variable
|
| 999 |
+
$filter = 'PDRTJS_TOP.filters = [' . $post_ids . '];';
|
| 1000 |
+
}
|
| 1001 |
+
|
| 1002 |
+
$show = "PDRTJS_TOP.get_top( 'posts', '0' );";
|
| 1003 |
+
$widget_class = 'posts';
|
| 1004 |
+
if ( $instance['show_pages'] == 1 ) {
|
| 1005 |
+
$show = "PDRTJS_TOP.get_top( 'pages', '0' );";
|
| 1006 |
+
$widget_class = 'pages';
|
| 1007 |
+
} elseif ( $instance['show_comments'] == 1 ) {
|
| 1008 |
+
$show = "PDRTJS_TOP.get_top( 'comments', '0' );";
|
| 1009 |
+
$widget_class = 'comments';
|
| 1010 |
+
}
|
| 1011 |
+
|
| 1012 |
+
echo '</script>';
|
| 1013 |
+
|
| 1014 |
+
if ( is_ssl() )
|
| 1015 |
+
$rating_js_file = "https://polldaddy.com/js/rating/rating-top.js";
|
| 1016 |
+
else
|
| 1017 |
+
$rating_js_file = "http://i0.poll.fm/js/rating/rating-top.js";
|
| 1018 |
+
$widget = <<<EOD
|
| 1019 |
+
{$before_title}{$title}{$after_title}
|
| 1020 |
+
<div id="pd_top_rated_holder" class="pd_top_rated_holder_{$widget_class}"></div>
|
| 1021 |
+
<script language="javascript" charset="UTF-8" src="{$rating_js_file}"></script>
|
| 1022 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
| 1023 |
+
PDRTJS_TOP = new PDRTJS_RATING_TOP( {$posts_rating_id}, {$pages_rating_id}, {$comments_rating_id}, '{$rating_seq}', {$instance['item_count']} );{$filter}{$show}
|
| 1024 |
+
//--><!]]></script>
|
| 1025 |
+
EOD;
|
| 1026 |
+
echo $before_widget;
|
| 1027 |
+
echo $widget;
|
| 1028 |
+
echo $after_widget;
|
| 1029 |
+
}
|
| 1030 |
+
|
| 1031 |
+
function update( $new_instance, $old_instance ) {
|
| 1032 |
+
|
| 1033 |
+
$instance = $old_instance;
|
| 1034 |
+
$instance['title'] = strip_tags($new_instance['title']);
|
| 1035 |
+
$instance['show_posts'] = (int) $new_instance['show_posts'];
|
| 1036 |
+
$instance['show_pages'] = (int) $new_instance['show_pages'];
|
| 1037 |
+
$instance['show_comments'] = (int) $new_instance['show_comments'];
|
| 1038 |
+
$instance['filter_by_category'] = (int) $new_instance['filter_by_category'];
|
| 1039 |
+
$instance['item_count'] = (int) $new_instance['item_count'];
|
| 1040 |
+
return $instance;
|
| 1041 |
+
}
|
| 1042 |
+
|
| 1043 |
+
function form( $instance ) {
|
| 1044 |
+
|
| 1045 |
+
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'show_posts' => '1', 'show_pages' => '1', 'show_comments' => '1', 'item_count' => '5', 'filter_by_category' => '', ) );
|
| 1046 |
+
$title = strip_tags( $instance['title'] );
|
| 1047 |
+
$show_posts = (int) $instance['show_posts'];
|
| 1048 |
+
$show_pages = (int) $instance['show_pages'];
|
| 1049 |
+
$show_comments = (int) $instance['show_comments'];
|
| 1050 |
+
$filter_by_category = (int) $instance['filter_by_category'];
|
| 1051 |
+
$item_count = (int) $instance['item_count'];
|
| 1052 |
+
?>
|
| 1053 |
+
<p>
|
| 1054 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title', 'polldaddy' ); ?>: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
|
| 1055 |
+
<p>
|
| 1056 |
+
<label for="<?php echo $this->get_field_id( 'show_posts' ); ?>">
|
| 1057 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'show_posts' ); ?>" name="<?php echo $this->get_field_name( 'show_posts' ); ?>" value="1" <?php echo $show_posts == 1 ? 'checked="checked"' : ''; ?> />
|
| 1058 |
+
<?php _e( 'Show for posts', 'polldaddy' ); ?>
|
| 1059 |
+
</label>
|
| 1060 |
+
</p>
|
| 1061 |
+
<p>
|
| 1062 |
+
<label for="<?php echo $this->get_field_id( 'show_pages' ); ?>">
|
| 1063 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'show_pages' ); ?>" name="<?php echo $this->get_field_name( 'show_pages' ); ?>" value="1" <?php echo $show_pages == 1 ? 'checked="checked"' : ''; ?> />
|
| 1064 |
+
<?php _e( 'Show for pages', 'polldaddy' ); ?>
|
| 1065 |
+
</label>
|
| 1066 |
+
</p>
|
| 1067 |
+
<p>
|
| 1068 |
+
<label for="<?php echo $this->get_field_id( 'show_comments' ); ?>">
|
| 1069 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'show_comments' ); ?>" name="<?php echo $this->get_field_name( 'show_comments' ); ?>" value="1" <?php echo $show_comments == 1 ? 'checked="checked"' : ''; ?> />
|
| 1070 |
+
<?php _e( 'Show for comments', 'polldaddy' ); ?>
|
| 1071 |
+
</label>
|
| 1072 |
+
</p>
|
| 1073 |
+
<p>
|
| 1074 |
+
<label for="<?php echo $this->get_field_id( 'filter_by_category' ); ?>">
|
| 1075 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'filter_by_category' ); ?>" name="<?php echo $this->get_field_name( 'filter_by_category' ); ?>" value="1" <?php echo $filter_by_category == 1 ? 'checked="checked"':''; ?>/>
|
| 1076 |
+
<?php _e('Filter by category'); ?>
|
| 1077 |
+
</label>
|
| 1078 |
+
</p>
|
| 1079 |
+
<p>
|
| 1080 |
+
<label for="rss-items-<?php echo $number; ?>"><?php _e( 'How many items would you like to display?', 'polldaddy' ); ?>
|
| 1081 |
+
<select id="<?php echo $this->get_field_id( 'item_count' ); ?>" name="<?php echo $this->get_field_name( 'item_count' ); ?>">
|
| 1082 |
+
<?php
|
| 1083 |
+
for ( $i = 1; $i <= 20; ++$i )
|
| 1084 |
+
echo "<option value='$i' " . ( $item_count == $i ? "selected='selected'" : '' ) . ">$i</option>";
|
| 1085 |
+
?>
|
| 1086 |
+
</select>
|
| 1087 |
+
</label>
|
| 1088 |
+
</p>
|
| 1089 |
+
<?php
|
| 1090 |
+
}
|
| 1091 |
+
}
|
| 1092 |
+
add_action('widgets_init', create_function('', 'return register_widget("PD_Top_Rated");'));
|
| 1093 |
+
}
|
| 1094 |
+
|
| 1095 |
+
function polldaddy_login_warning() {
|
| 1096 |
+
global $cache_enabled, $hook_suffix;
|
| 1097 |
+
$page = isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : '';
|
| 1098 |
+
if ( ( $hook_suffix == 'plugins.php' || $page == 'polls' ) && false == get_option( 'polldaddy_api_key' ) && function_exists( "admin_url" ) )
|
| 1099 |
+
echo '<div class="updated"><p><strong>' . sprintf( __( 'Warning! The Polldaddy plugin must be linked to your Polldaddy.com account. Please visit the <a href="%s">plugin settings page</a> to login.', 'polldaddy' ), admin_url( 'options-general.php?page=polls&action=options' ) ) . '</strong></p></div>';
|
| 1100 |
+
}
|
| 1101 |
+
add_action( 'admin_notices', 'polldaddy_login_warning' );
|
| 1102 |
+
|
| 1103 |
+
/**
|
| 1104 |
+
* check if the hook is scheduled - if not, schedule it.
|
| 1105 |
+
*/
|
| 1106 |
+
function polldaddy_setup_schedule() {
|
| 1107 |
+
if ( false == wp_next_scheduled( 'polldaddy_rating_update_job' ) ) {
|
| 1108 |
+
wp_schedule_event( time(), 'twicedaily', 'polldaddy_rating_update_job');
|
| 1109 |
+
}
|
| 1110 |
+
}
|
| 1111 |
+
add_action( 'init', 'polldaddy_setup_schedule' );
|
| 1112 |
+
|
| 1113 |
+
/**
|
| 1114 |
+
* On deactivation, remove all functions from the scheduled action hook.
|
| 1115 |
+
*/
|
| 1116 |
+
function polldaddy_deactivation() {
|
| 1117 |
+
wp_clear_scheduled_hook( 'polldaddy_rating_update_job' );
|
| 1118 |
+
}
|
| 1119 |
+
register_deactivation_hook( __FILE__, 'polldaddy_deactivation' );
|
| 1120 |
+
|
| 1121 |
+
/**
|
| 1122 |
+
* On the scheduled action hook, run a function.
|
| 1123 |
+
*/
|
| 1124 |
+
function polldaddy_rating_update() {
|
| 1125 |
+
if ( false == get_option( 'pd-rich-snippets', 1 ) )
|
| 1126 |
+
return false;
|
| 1127 |
+
|
| 1128 |
+
global $polldaddy_object;
|
| 1129 |
+
$polldaddy = $polldaddy_object->get_client( WP_POLLDADDY__PARTNERGUID, get_option( 'pd-rating-usercode' ) );
|
| 1130 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 1131 |
+
$finished = false;
|
| 1132 |
+
$c = 0;
|
| 1133 |
+
while ( !$finished ) {
|
| 1134 |
+
$response = $polldaddy->get_rating_results( $rating_id, 2, $c, 50 );
|
| 1135 |
+
$ratings = $response->rating;
|
| 1136 |
+
if ( false == is_array( $ratings ) )
|
| 1137 |
+
$finished = true;
|
| 1138 |
+
else
|
| 1139 |
+
polldaddy_update_ratings_cache( $ratings );
|
| 1140 |
+
$c += 50;
|
| 1141 |
+
if ( $c > 1000 ) // gotta stop somewhere
|
| 1142 |
+
$finished = true;
|
| 1143 |
+
}
|
| 1144 |
+
return true;
|
| 1145 |
+
}
|
| 1146 |
+
|
| 1147 |
+
add_action( 'polldaddy_rating_update_job', 'polldaddy_rating_update' );
|
| 1148 |
+
|
| 1149 |
+
function polldaddy_update_ratings_cache( $ratings ) {
|
| 1150 |
+
foreach( $ratings as $rating ) {
|
| 1151 |
+
$post_id = str_replace( 'wp-post-', '', $rating->uid );
|
| 1152 |
+
update_post_meta( $post_id, 'pd_rating', array( 'type' => $rating->_type, 'votes' => $rating->_votes,
|
| 1153 |
+
'total1' => $rating->total1,
|
| 1154 |
+
'total2' => $rating->total2,
|
| 1155 |
+
'total3' => $rating->total3,
|
| 1156 |
+
'total4' => $rating->total4,
|
| 1157 |
+
'total5' => $rating->total5,
|
| 1158 |
+
'average' => $rating->average_rating ) );
|
| 1159 |
+
}
|
| 1160 |
+
}
|
| 1161 |
+
|
| 1162 |
+
function polldaddy_post_rating( $content ) {
|
| 1163 |
+
if ( false == get_option( 'pd-rich-snippets', 1 ) )
|
| 1164 |
+
return $content;
|
| 1165 |
+
if ( false == is_singular() )
|
| 1166 |
+
return $content;
|
| 1167 |
+
if ( false == get_option( 'pd-rating-usercode' ) )
|
| 1168 |
+
return $content;
|
| 1169 |
+
$rating = get_post_meta( $GLOBALS[ 'post' ]->ID, 'pd_rating' );
|
| 1170 |
+
if ( false == $rating )
|
| 1171 |
+
return $content;
|
| 1172 |
+
// convert to 5 star rating
|
| 1173 |
+
if ( $rating[0][ 'type' ] == 1 ) {
|
| 1174 |
+
$average = ceil( ( $rating[0][ 'average' ] / $rating[0][ 'votes' ] ) * 5 );
|
| 1175 |
+
} elseif ( isset( $rating[ 'average' ] ) ) {
|
| 1176 |
+
$average = $rating[ 'average' ];
|
| 1177 |
+
} else {
|
| 1178 |
+
$average = 0;
|
| 1179 |
+
}
|
| 1180 |
+
if ( $average < 0 || $average == '' )
|
| 1181 |
+
return $content;
|
| 1182 |
+
global $post;
|
| 1183 |
+
return $content . '<span class="hreview-aggregate"><span class="item"><span class="fn">"' . $post->post_title . '"</span></span>, <span class="rating"><span class="average">' . $average . '</span> out of <span class="best">5</span> based on <span class="votes">' . $rating[0][ 'votes' ] . '</span> ratings.</span></span>';
|
| 1184 |
+
}
|
| 1185 |
+
add_filter( 'the_content', 'polldaddy_post_rating' );
|
| 1186 |
+
?>
|
polldaddy.php
CHANGED
|
@@ -1,5232 +1,5232 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
Plugin Name: Polldaddy Polls & Ratings
|
| 5 |
-
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://polldaddy.com/
|
| 9 |
-
Version: 2.0.
|
| 10 |
-
*/
|
| 11 |
-
|
| 12 |
-
//
|
| 13 |
-
//define( 'WP_POLLDADDY__PARTNERGUID', '12345…' );
|
| 14 |
-
|
| 15 |
-
class WP_Polldaddy {
|
| 16 |
-
var $errors;
|
| 17 |
-
var $base_url;
|
| 18 |
-
var $is_admin;
|
| 19 |
-
var $is_author;
|
| 20 |
-
var $scheme;
|
| 21 |
-
var $version;
|
| 22 |
-
var $polldaddy_client_class;
|
| 23 |
-
var $polldaddy_clients;
|
| 24 |
-
var $id;
|
| 25 |
-
var $multiple_accounts;
|
| 26 |
-
var $user_code;
|
| 27 |
-
var $rating_user_code;
|
| 28 |
-
var $has_feedback_menu;
|
| 29 |
-
|
| 30 |
-
function __construct() {
|
| 31 |
-
global $current_user;
|
| 32 |
-
$this->log( 'Created WP_Polldaddy Object: constructor' );
|
| 33 |
-
$this->errors = new WP_Error;
|
| 34 |
-
$this->scheme = 'https';
|
| 35 |
-
$this->version = '2.0.22';
|
| 36 |
-
$this->multiple_accounts = true;
|
| 37 |
-
$this->polldaddy_client_class = 'api_client';
|
| 38 |
-
$this->polldaddy_clients = array();
|
| 39 |
-
$this->is_admin = (bool) current_user_can( 'manage_options' );
|
| 40 |
-
$this->is_author = (bool) current_user_can( 'edit_posts' );
|
| 41 |
-
$this->is_editor = (bool) current_user_can( 'delete_others_pages' );
|
| 42 |
-
$this->user_code = null;
|
| 43 |
-
$this->rating_user_code = null;
|
| 44 |
-
$this->id = ($current_user instanceof WP_User) ? intval( $current_user->ID ): 0;
|
| 45 |
-
$this->has_feedback_menu = false;
|
| 46 |
-
|
| 47 |
-
if ( class_exists( 'Jetpack' ) ) {
|
| 48 |
-
if ( method_exists( 'Jetpack', 'is_active' ) && Jetpack::is_active() ) {
|
| 49 |
-
$jetpack_active_modules = get_option('jetpack_active_modules');
|
| 50 |
-
if ( $jetpack_active_modules && in_array( 'contact-form', $jetpack_active_modules ) )
|
| 51 |
-
$this->has_feedback_menu = true;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
if ( class_exists( 'Jetpack_Sync' ) && defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '4.1', '<' ) ) {
|
| 55 |
-
Jetpack_Sync::sync_options( __FILE__, 'polldaddy_api_key' );
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
add_filter( 'jetpack_options_whitelist', array( $this, 'add_to_jetpack_options_whitelist' ) );
|
| 59 |
-
}
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
/**
|
| 63 |
-
* Add the polldaddy option to the Jetpack options management whitelist.
|
| 64 |
-
*
|
| 65 |
-
* @param array $options The list of whitelisted option names.
|
| 66 |
-
* @return array The updated whitelist
|
| 67 |
-
*/
|
| 68 |
-
public static function add_to_jetpack_options_whitelist( $options ) {
|
| 69 |
-
$options[] = 'polldaddy_api_key';
|
| 70 |
-
return $options;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
function &get_client( $api_key, $userCode = null ) {
|
| 74 |
-
if ( isset( $this->polldaddy_clients[$api_key] ) ) {
|
| 75 |
-
if ( !is_null( $userCode ) )
|
| 76 |
-
$this->polldaddy_clients[$api_key]->userCode = $userCode;
|
| 77 |
-
return $this->polldaddy_clients[$api_key];
|
| 78 |
-
}
|
| 79 |
-
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
| 80 |
-
$this->polldaddy_clients[$api_key] = $this->config_client( new $this->polldaddy_client_class( $api_key, $userCode ) );
|
| 81 |
-
return $this->polldaddy_clients[$api_key];
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
function config_client( $client ) {
|
| 85 |
-
|
| 86 |
-
return $client;
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
function admin_menu() {
|
| 90 |
-
add_action( 'wp_enqueue_scripts', array( &$this, 'register_polldaddy_styles' ) );
|
| 91 |
-
add_action( 'admin_head', array( &$this, 'do_admin_css' ) );
|
| 92 |
-
add_action( 'admin_enqueue_scripts', array( &$this, 'menu_alter' ) );
|
| 93 |
-
|
| 94 |
-
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) ) {
|
| 95 |
-
$guid = get_option( 'polldaddy_api_key' );
|
| 96 |
-
if ( !$guid || !is_string( $guid ) )
|
| 97 |
-
$guid = false;
|
| 98 |
-
define( 'WP_POLLDADDY__PARTNERGUID', $guid );
|
| 99 |
-
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
$capability = 'edit_posts';
|
| 103 |
-
$function = array( &$this, 'management_page' );
|
| 104 |
-
|
| 105 |
-
$hook = add_menu_page( __( 'Feedback', 'polldaddy' ), __( 'Feedback', 'polldaddy' ), $capability, 'feedback', $function, 'div' );
|
| 106 |
-
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
| 107 |
-
|
| 108 |
-
foreach( array( 'polls' => __( 'Polls', 'polldaddy' ), 'ratings' => __( 'Ratings', 'polldaddy' ) ) as $menu_slug => $page_title ) {
|
| 109 |
-
$menu_title = $page_title;
|
| 110 |
-
|
| 111 |
-
$hook = add_menu_page( $menu_title, $menu_title, $capability, $menu_slug, $function, 'div' );
|
| 112 |
-
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
| 113 |
-
|
| 114 |
-
add_submenu_page( 'feedback', $page_title, $page_title, $capability, $menu_slug, $function );
|
| 115 |
-
add_options_page( $page_title, $page_title, $menu_slug == 'ratings' ? 'manage_options' : $capability, $menu_slug.'&action=options', $function );
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
remove_submenu_page( 'feedback', 'feedback' );
|
| 119 |
-
remove_menu_page( 'polls' );
|
| 120 |
-
remove_menu_page( 'ratings' );
|
| 121 |
-
|
| 122 |
-
if ( $this->has_feedback_menu ) {
|
| 123 |
-
add_submenu_page( 'feedback', __( 'Feedback', 'polldaddy' ), __( 'Feedback', 'polldaddy' ), 'edit_posts', 'edit.php?post_type=feedback' );
|
| 124 |
-
remove_menu_page( 'edit.php?post_type=feedback' );
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
function do_admin_css() {
|
| 131 |
-
wp_register_style( 'polldaddy-icons', plugins_url( 'css/polldaddy-icons.css', __FILE__ ) );
|
| 132 |
-
wp_enqueue_style( 'polldaddy-icons' );
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
function menu_alter() {
|
| 136 |
-
// Make sure we're working off a clean version.
|
| 137 |
-
include( ABSPATH . WPINC . '/version.php' );
|
| 138 |
-
if ( version_compare( $wp_version, '3.8', '>=' ) ) {
|
| 139 |
-
wp_enqueue_style( 'polldaddy-icons' );
|
| 140 |
-
$css = "
|
| 141 |
-
#toplevel_page_feedback .wp-menu-image:before {
|
| 142 |
-
font-family: 'polldaddy' !important;
|
| 143 |
-
content: '\\0061';
|
| 144 |
-
}
|
| 145 |
-
#toplevel_page_feedback .wp-menu-image {
|
| 146 |
-
background-repeat: no-repeat;
|
| 147 |
-
}
|
| 148 |
-
#menu-posts-feedback .wp-menu-image:before {
|
| 149 |
-
font-family: dashicons !important;
|
| 150 |
-
content: '\\f175';
|
| 151 |
-
}
|
| 152 |
-
#adminmenu #menu-posts-feedback div.wp-menu-image {
|
| 153 |
-
background: none !important;
|
| 154 |
-
background-repeat: no-repeat;
|
| 155 |
-
}";
|
| 156 |
-
} else {
|
| 157 |
-
$css = "
|
| 158 |
-
#toplevel_page_polldaddy .wp-menu-image {
|
| 159 |
-
background: url( " . plugins_url( 'img/polldaddy.png', __FILE__ ) . " ) 0 90% no-repeat;
|
| 160 |
-
}
|
| 161 |
-
/* Retina Polldaddy Menu Icon */
|
| 162 |
-
@media only screen and (-moz-min-device-pixel-ratio: 1.5),
|
| 163 |
-
only screen and (-o-min-device-pixel-ratio: 3/2),
|
| 164 |
-
only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
| 165 |
-
only screen and (min-device-pixel-ratio: 1.5) {
|
| 166 |
-
#toplevel_page_polldaddy .wp-menu-image {
|
| 167 |
-
background: url( " . plugins_url( 'polldaddy@2x.png', __FILE__ ) . " ) 0 90% no-repeat;
|
| 168 |
-
background-size:30px 64px;
|
| 169 |
-
}
|
| 170 |
-
}
|
| 171 |
-
#toplevel_page_polldaddy.current .wp-menu-image,
|
| 172 |
-
#toplevel_page_polldaddy.wp-has-current-submenu .wp-menu-image,
|
| 173 |
-
#toplevel_page_polldaddy:hover .wp-menu-image {
|
| 174 |
-
background-position: top left;
|
| 175 |
-
}";
|
| 176 |
-
}
|
| 177 |
-
wp_add_inline_style( 'wp-admin', $css );
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
function api_key_page_load() {
|
| 181 |
-
|
| 182 |
-
if ( 'post' != strtolower( $_SERVER['REQUEST_METHOD'] ) || empty( $_POST['action'] ) || 'account' != $_POST['action'] )
|
| 183 |
-
return false;
|
| 184 |
-
|
| 185 |
-
check_admin_referer( 'polldaddy-account' );
|
| 186 |
-
|
| 187 |
-
$polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
|
| 188 |
-
$polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
|
| 189 |
-
|
| 190 |
-
if ( !$polldaddy_email )
|
| 191 |
-
$this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
|
| 192 |
-
|
| 193 |
-
if ( !$polldaddy_password )
|
| 194 |
-
$this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
|
| 195 |
-
|
| 196 |
-
if ( $this->errors->get_error_codes() )
|
| 197 |
-
return false;
|
| 198 |
-
|
| 199 |
-
$details = array(
|
| 200 |
-
'uName' => get_bloginfo( 'name' ),
|
| 201 |
-
'uEmail' => $polldaddy_email,
|
| 202 |
-
'uPass' => $polldaddy_password,
|
| 203 |
-
'partner_userid' => $this->id
|
| 204 |
-
);
|
| 205 |
-
if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
|
| 206 |
-
$polldaddy_api_key = wp_remote_post( $this->scheme . '://api.polldaddy.com/key.php', array(
|
| 207 |
-
'body' => $details
|
| 208 |
-
) );
|
| 209 |
-
if ( is_wp_error( $polldaddy_api_key ) ) {
|
| 210 |
-
$this->errors = $polldaddy_api_key;
|
| 211 |
-
return false;
|
| 212 |
-
}
|
| 213 |
-
$polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
|
| 214 |
-
} else {
|
| 215 |
-
$fp = fsockopen(
|
| 216 |
-
'api.polldaddy.com',
|
| 217 |
-
80,
|
| 218 |
-
$err_num,
|
| 219 |
-
$err_str,
|
| 220 |
-
3
|
| 221 |
-
);
|
| 222 |
-
|
| 223 |
-
if ( !$fp ) {
|
| 224 |
-
$this->errors->add( 'connect', __( "Can't connect to Polldaddy.com", 'polldaddy' ) );
|
| 225 |
-
return false;
|
| 226 |
-
}
|
| 227 |
-
|
| 228 |
-
if ( function_exists( 'stream_set_timeout' ) )
|
| 229 |
-
stream_set_timeout( $fp, 3 );
|
| 230 |
-
|
| 231 |
-
global $wp_version;
|
| 232 |
-
|
| 233 |
-
$request_body = http_build_query( $details, null, '&' );
|
| 234 |
-
|
| 235 |
-
$request = "POST /key.php HTTP/1.0\r\n";
|
| 236 |
-
$request .= "Host: api.polldaddy.com\r\n";
|
| 237 |
-
$request .= "User-agent: WordPress/$wp_version\r\n";
|
| 238 |
-
$request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ) . "\r\n";
|
| 239 |
-
$request .= 'Content-Length: ' . strlen( $request_body ) . "\r\n";
|
| 240 |
-
|
| 241 |
-
fwrite( $fp, "$request\r\n$request_body" );
|
| 242 |
-
|
| 243 |
-
$response = '';
|
| 244 |
-
while ( !feof( $fp ) )
|
| 245 |
-
$response .= fread( $fp, 4096 );
|
| 246 |
-
fclose( $fp );
|
| 247 |
-
list( $headers, $polldaddy_api_key ) = explode( "\r\n\r\n", $response, 2 );
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
if ( !$polldaddy_api_key ) {
|
| 251 |
-
$this->errors->add( 'polldaddy_password', __( 'Invalid Account', 'polldaddy' ) );
|
| 252 |
-
return false;
|
| 253 |
-
}
|
| 254 |
-
|
| 255 |
-
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 256 |
-
|
| 257 |
-
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 258 |
-
$polldaddy->reset();
|
| 259 |
-
if ( !$polldaddy->get_usercode( $this->id ) ) {
|
| 260 |
-
$this->parse_errors( $polldaddy );
|
| 261 |
-
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?', 'polldaddy' ) );
|
| 262 |
-
return false;
|
| 263 |
-
}
|
| 264 |
-
|
| 265 |
-
return true;
|
| 266 |
-
}
|
| 267 |
-
|
| 268 |
-
function parse_errors( &$polldaddy ) {
|
| 269 |
-
if ( $polldaddy->errors )
|
| 270 |
-
foreach ( $polldaddy->errors as $code => $error )
|
| 271 |
-
$this->errors->add( $code, $error );
|
| 272 |
-
|
| 273 |
-
if ( isset( $this->errors->errors[4] ) ) {
|
| 274 |
-
//need to get latest usercode
|
| 275 |
-
update_option( 'pd-usercode-'.$this->id, '' );
|
| 276 |
-
$this->set_api_user_code();
|
| 277 |
-
}
|
| 278 |
-
}
|
| 279 |
-
|
| 280 |
-
function print_errors() {
|
| 281 |
-
if ( !$error_codes = $this->errors->get_error_codes() )
|
| 282 |
-
return;
|
| 283 |
-
?>
|
| 284 |
-
|
| 285 |
-
<div class="error" id="polldaddy-error">
|
| 286 |
-
|
| 287 |
-
<?php
|
| 288 |
-
|
| 289 |
-
foreach ( $error_codes as $error_code ) :
|
| 290 |
-
foreach ( $this->errors->get_error_messages( $error_code ) as $error_message ) :
|
| 291 |
-
?>
|
| 292 |
-
|
| 293 |
-
<p><?php echo $this->errors->get_error_data( $error_code ) ? $error_message : esc_html( $error_message ); ?></p>
|
| 294 |
-
|
| 295 |
-
<?php
|
| 296 |
-
endforeach;
|
| 297 |
-
endforeach;
|
| 298 |
-
|
| 299 |
-
$this->errors = new WP_Error;
|
| 300 |
-
?>
|
| 301 |
-
|
| 302 |
-
</div>
|
| 303 |
-
<br class="clear" />
|
| 304 |
-
|
| 305 |
-
<?php
|
| 306 |
-
}
|
| 307 |
-
|
| 308 |
-
function api_key_page() {
|
| 309 |
-
$this->print_errors();
|
| 310 |
-
?>
|
| 311 |
-
|
| 312 |
-
<div class="wrap">
|
| 313 |
-
<h2 id="polldaddy-header"><?php _e( 'Polldaddy', 'polldaddy' ); ?></h2>
|
| 314 |
-
|
| 315 |
-
<p><?php printf( __( 'Before you can use the Polldaddy plugin, you need to enter your <a href="%s">Polldaddy.com</a> account details.', 'polldaddy' ), 'http://polldaddy.com/' ); ?></p>
|
| 316 |
-
|
| 317 |
-
<form action="" method="post">
|
| 318 |
-
<table class="form-table">
|
| 319 |
-
<tbody>
|
| 320 |
-
<tr class="form-field form-required">
|
| 321 |
-
<th valign="top" scope="row">
|
| 322 |
-
<label for="polldaddy-email"><?php _e( 'Polldaddy Email Address', 'polldaddy' ); ?></label>
|
| 323 |
-
</th>
|
| 324 |
-
<td>
|
| 325 |
-
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" />
|
| 326 |
-
</td>
|
| 327 |
-
</tr>
|
| 328 |
-
<tr class="form-field form-required">
|
| 329 |
-
<th valign="top" scope="row">
|
| 330 |
-
<label for="polldaddy-password"><?php _e( 'Polldaddy Password', 'polldaddy' ); ?></label>
|
| 331 |
-
</th>
|
| 332 |
-
<td>
|
| 333 |
-
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
| 334 |
-
</td>
|
| 335 |
-
</tr>
|
| 336 |
-
</tbody>
|
| 337 |
-
</table>
|
| 338 |
-
<p class="submit">
|
| 339 |
-
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 340 |
-
<input type="hidden" name="action" value="account" />
|
| 341 |
-
<input type="hidden" name="account" value="import" />
|
| 342 |
-
<input class="button-secondary" type="submit" value="<?php echo esc_attr( __( 'Submit', 'polldaddy' ) ); ?>" />
|
| 343 |
-
</p>
|
| 344 |
-
</form>
|
| 345 |
-
</div>
|
| 346 |
-
|
| 347 |
-
<?php
|
| 348 |
-
}
|
| 349 |
-
|
| 350 |
-
function media_buttons() {
|
| 351 |
-
$title = __( 'Add Poll', 'polldaddy' );
|
| 352 |
-
echo " <a href='admin.php?page=polls&iframe&TB_iframe=true' onclick='return false;' id='add_poll' class='button thickbox' title='" . esc_attr( $title ) . "'><img src='{$this->base_url}img/polldaddy@2x.png' width='15' height='15' alt='" . esc_attr( $title ) . "' style='margin: -2px 0 0 -1px; padding: 0 2px 0 0; vertical-align: middle;' /> " . esc_html( $title ) . "</a>";
|
| 353 |
-
}
|
| 354 |
-
|
| 355 |
-
function set_api_user_code() {
|
| 356 |
-
|
| 357 |
-
$this->user_code = get_option( 'pd-usercode-'.$this->id );
|
| 358 |
-
|
| 359 |
-
if ( empty( $this->user_code ) ) {
|
| 360 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
| 361 |
-
$polldaddy->reset();
|
| 362 |
-
|
| 363 |
-
$this->user_code = $polldaddy->get_usercode( $this->id );
|
| 364 |
-
|
| 365 |
-
if ( !empty( $this->user_code ) ) {
|
| 366 |
-
update_option( 'pd-usercode-'.$this->id, $this->user_code );
|
| 367 |
-
} elseif ( get_option( 'polldaddy_api_key' ) ) {
|
| 368 |
-
$this->contact_support_message( 'There was a problem linking your account', $polldaddy->errors );
|
| 369 |
-
}
|
| 370 |
-
}
|
| 371 |
-
}
|
| 372 |
-
|
| 373 |
-
function management_page_load() {
|
| 374 |
-
|
| 375 |
-
wp_reset_vars( array( 'page', 'action', 'poll', 'style', 'rating', 'id' ) );
|
| 376 |
-
global $plugin_page, $page, $action, $poll, $style, $rating, $id, $wp_locale;
|
| 377 |
-
|
| 378 |
-
$this->set_api_user_code();
|
| 379 |
-
|
| 380 |
-
if ( empty( $this->user_code ) && $page == 'polls' ) {
|
| 381 |
-
// one last try to get the user code automatically if possible
|
| 382 |
-
$this->user_code = apply_filters_ref_array( 'polldaddy_get_user_code', array( $this->user_code, &$this ) );
|
| 383 |
-
if ( false == $this->user_code && $action != 'restore-account' )
|
| 384 |
-
$action = 'signup';
|
| 385 |
-
}
|
| 386 |
-
|
| 387 |
-
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
| 388 |
-
|
| 389 |
-
wp_enqueue_script( 'polls', "{$this->base_url}js/polldaddy.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-form' ), $this->version );
|
| 390 |
-
wp_enqueue_script( 'polls-common', "{$this->base_url}js/common.js", array(), $this->version );
|
| 391 |
-
|
| 392 |
-
if ( $page == 'polls' ) {
|
| 393 |
-
if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
|
| 394 |
-
$action = '';
|
| 395 |
-
}
|
| 396 |
-
|
| 397 |
-
switch ( $action ) {
|
| 398 |
-
case 'edit' :
|
| 399 |
-
case 'edit-poll' :
|
| 400 |
-
case 'create-poll' :
|
| 401 |
-
case 'add-media' :
|
| 402 |
-
wp_enqueue_script( 'media-upload', array(), $this->version );
|
| 403 |
-
wp_enqueue_script( 'polls-style', "{$this->base_url}js/poll-style-picker.js", array( 'polls', 'polls-common' ), $this->version );
|
| 404 |
-
|
| 405 |
-
if ( $action == 'create-poll' )
|
| 406 |
-
$plugin_page = 'polls&action=create-poll';
|
| 407 |
-
|
| 408 |
-
break;
|
| 409 |
-
case 'edit-style' :
|
| 410 |
-
case 'create-style' :
|
| 411 |
-
wp_enqueue_script( 'polls-style', "{$this->base_url}js/style-editor.js", array( 'polls', 'polls-common' ), $this->version );
|
| 412 |
-
wp_enqueue_script( 'polls-style-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 413 |
-
wp_enqueue_style( 'polls', "{$this->base_url}css/style-editor.css", array(), $this->version );
|
| 414 |
-
$plugin_page = 'polls&action=list-styles';
|
| 415 |
-
break;
|
| 416 |
-
case 'list-styles' :
|
| 417 |
-
$plugin_page = 'polls&action=list-styles';
|
| 418 |
-
break;
|
| 419 |
-
case 'options' :
|
| 420 |
-
case 'update-options' :
|
| 421 |
-
case 'import-account' :
|
| 422 |
-
case 'reset-account' :
|
| 423 |
-
case 'restore-account' :
|
| 424 |
-
$plugin_page = 'polls&action=options';
|
| 425 |
-
break;
|
| 426 |
-
}//end switch
|
| 427 |
-
} elseif ( $page == 'ratings' ) {
|
| 428 |
-
switch ( $action ) {
|
| 429 |
-
case 'update-rating' :
|
| 430 |
-
case 'options':
|
| 431 |
-
$plugin_page = 'ratings&action=options';
|
| 432 |
-
wp_enqueue_script( 'rating-text-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 433 |
-
wp_enqueue_script( 'ratings', "{$this->base_url}js/rating.js", array(), $this->version );
|
| 434 |
-
wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
|
| 435 |
-
'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
|
| 436 |
-
'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
|
| 437 |
-
break;
|
| 438 |
-
default :
|
| 439 |
-
if ( empty( $action ) )
|
| 440 |
-
$action = 'reports';
|
| 441 |
-
$plugin_page = 'ratings&action=reports';
|
| 442 |
-
}//end switch
|
| 443 |
-
}
|
| 444 |
-
|
| 445 |
-
wp_enqueue_style( 'polldaddy', "{$this->base_url}css/polldaddy.css", array(), $this->version );
|
| 446 |
-
wp_enqueue_script( 'admin-forms' );
|
| 447 |
-
add_thickbox();
|
| 448 |
-
|
| 449 |
-
if ( isset( $_GET['iframe'] ) ) {
|
| 450 |
-
add_action( 'admin_head', array( &$this, 'hide_admin_menu' ) );
|
| 451 |
-
}
|
| 452 |
-
|
| 453 |
-
if ( isset( $wp_locale->text_direction ) && 'rtl' == $wp_locale->text_direction )
|
| 454 |
-
wp_enqueue_style( 'polls-rtl', "{$this->base_url}css/polldaddy-rtl.css", array( 'global', 'wp-admin' ), $this->version );
|
| 455 |
-
add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
|
| 456 |
-
|
| 457 |
-
add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
|
| 458 |
-
|
| 459 |
-
$query_args = array();
|
| 460 |
-
$args = array();
|
| 461 |
-
|
| 462 |
-
$allowedtags = array(
|
| 463 |
-
'a' => array(
|
| 464 |
-
'href' => array(),
|
| 465 |
-
'title' => array(),
|
| 466 |
-
'target' => array() ),
|
| 467 |
-
'img' => array(
|
| 468 |
-
'alt' => array(),
|
| 469 |
-
'align' => array(),
|
| 470 |
-
'border' => array(),
|
| 471 |
-
'class' => array(),
|
| 472 |
-
'height' => array(),
|
| 473 |
-
'hspace' => array(),
|
| 474 |
-
'longdesc' => array(),
|
| 475 |
-
'vspace' => array(),
|
| 476 |
-
'src' => array(),
|
| 477 |
-
'width' => array() ),
|
| 478 |
-
'abbr' => array( 'title' => array() ),
|
| 479 |
-
'acronym' => array( 'title' => array() ),
|
| 480 |
-
'blockquote' => array( 'cite' => array() ),
|
| 481 |
-
'q' => array( 'cite' => array() ),
|
| 482 |
-
'b' => array(),
|
| 483 |
-
'cite' => array(),
|
| 484 |
-
'em' => array(),
|
| 485 |
-
'i' => array(),
|
| 486 |
-
'strike' => array(),
|
| 487 |
-
'strong' => array()
|
| 488 |
-
);
|
| 489 |
-
|
| 490 |
-
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 491 |
-
|
| 492 |
-
if ( $page == 'polls' ) {
|
| 493 |
-
switch ( $action ) {
|
| 494 |
-
case 'reset-account' : // reset everything
|
| 495 |
-
global $current_user;
|
| 496 |
-
check_admin_referer( 'polldaddy-reset' . $this->id );
|
| 497 |
-
$fields = array( 'polldaddy_api_key', 'pd-rating-comments', 'pd-rating-comments-id', 'pd-rating-comments-pos', 'pd-rating-exclude-post-ids', 'pd-rating-pages', 'pd-rating-pages-id', 'pd-rating-posts', 'pd-rating-posts-id', 'pd-rating-posts-index', 'pd-rating-posts-index-id', 'pd-rating-posts-index-pos', 'pd-rating-posts-pos', 'pd-rating-title-filter', 'pd-rating-usercode', 'pd-rich-snippets', 'pd-usercode-' . $current_user->ID );
|
| 498 |
-
$msg = __( "You have just reset your Polldaddy connection settings." ) . "\n\n";
|
| 499 |
-
foreach( $fields as $field ) {
|
| 500 |
-
$value = get_option( $field );
|
| 501 |
-
if ( $value != false ) {
|
| 502 |
-
$settings[ $field ] = $value;
|
| 503 |
-
$msg .= "$field: $value\n";
|
| 504 |
-
delete_option( $field );
|
| 505 |
-
}
|
| 506 |
-
}
|
| 507 |
-
if ( isset( $_POST[ 'email' ] ) )
|
| 508 |
-
wp_mail( $current_user->user_email, "Polldaddy Settings", $msg );
|
| 509 |
-
update_option( 'polldaddy_settings', $settings );
|
| 510 |
-
break;
|
| 511 |
-
case 'restore-account' : // restore everything
|
| 512 |
-
global $current_user;
|
| 513 |
-
check_admin_referer( 'polldaddy-restore' . $this->id );
|
| 514 |
-
$previous_settings = get_option( 'polldaddy_settings' );
|
| 515 |
-
foreach( $previous_settings as $key => $value )
|
| 516 |
-
update_option( $key, $value );
|
| 517 |
-
delete_option( 'polldaddy_settings' );
|
| 518 |
-
break;
|
| 519 |
-
case 'restore-ratings' : // restore ratings
|
| 520 |
-
global $current_user;
|
| 521 |
-
check_admin_referer( 'polldaddy-restore-ratings' . $this->id );
|
| 522 |
-
$previous_settings = get_option( 'polldaddy_settings' );
|
| 523 |
-
$fields = array( 'pd-rating-comments', 'pd-rating-comments-id', 'pd-rating-comments-pos', 'pd-rating-exclude-post-ids', 'pd-rating-pages', 'pd-rating-pages-id', 'pd-rating-posts', 'pd-rating-posts-id', 'pd-rating-posts-index', 'pd-rating-posts-index-id', 'pd-rating-posts-index-pos', 'pd-rating-posts-pos', 'pd-rating-title-filter' );
|
| 524 |
-
foreach( $fields as $key ) {
|
| 525 |
-
if ( isset( $previous_settings[ $key ] ) )
|
| 526 |
-
update_option( $key, $previous_settings[ $key ] );
|
| 527 |
-
}
|
| 528 |
-
break;
|
| 529 |
-
case 'signup' : // sign up for first time
|
| 530 |
-
case 'account' : // reauthenticate
|
| 531 |
-
case 'import-account' : // reauthenticate
|
| 532 |
-
if ( !$is_POST )
|
| 533 |
-
return;
|
| 534 |
-
|
| 535 |
-
check_admin_referer( 'polldaddy-account' );
|
| 536 |
-
|
| 537 |
-
$this->user_code = '';
|
| 538 |
-
update_option( 'pd-usercode-'.$this->id, '' );
|
| 539 |
-
|
| 540 |
-
if ( $new_args = $this->management_page_load_signup() )
|
| 541 |
-
$query_args = array_merge( $query_args, $new_args );
|
| 542 |
-
|
| 543 |
-
if ( $this->errors->get_error_codes() )
|
| 544 |
-
return false;
|
| 545 |
-
|
| 546 |
-
$query_args['message'] = 'imported-account';
|
| 547 |
-
|
| 548 |
-
wp_reset_vars( array( 'action' ) );
|
| 549 |
-
if ( !empty( $_GET['reaction'] ) )
|
| 550 |
-
$query_args['action'] = $_GET['reaction'];
|
| 551 |
-
elseif ( !empty( $_GET['action'] ) && 'account' == $_GET['action'] )
|
| 552 |
-
$query_args['action'] = $_GET['action'];
|
| 553 |
-
else
|
| 554 |
-
$query_args['action'] = false;
|
| 555 |
-
if ( $action == 'import-account' )
|
| 556 |
-
$query_args[ 'action' ] = 'options'; // make sure we redirect back to the right page.
|
| 557 |
-
break;
|
| 558 |
-
|
| 559 |
-
case 'delete' :
|
| 560 |
-
if ( empty( $poll ) )
|
| 561 |
-
return;
|
| 562 |
-
|
| 563 |
-
if ( is_array( $poll ) )
|
| 564 |
-
check_admin_referer( 'action-poll_bulk' );
|
| 565 |
-
else
|
| 566 |
-
check_admin_referer( "delete-poll_$poll" );
|
| 567 |
-
|
| 568 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 569 |
-
|
| 570 |
-
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
| 571 |
-
$polldaddy->reset();
|
| 572 |
-
$poll_object = $polldaddy->get_poll( $poll_id );
|
| 573 |
-
|
| 574 |
-
if ( !$this->can_edit( $poll_object ) ) {
|
| 575 |
-
$this->errors->add( 'permission', __( 'You are not allowed to delete this poll.', 'polldaddy' ) );
|
| 576 |
-
return false;
|
| 577 |
-
}
|
| 578 |
-
|
| 579 |
-
// Send Poll Author credentials
|
| 580 |
-
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 581 |
-
$polldaddy->reset();
|
| 582 |
-
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 583 |
-
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 584 |
-
}
|
| 585 |
-
$polldaddy->userCode = $userCode;
|
| 586 |
-
}
|
| 587 |
-
|
| 588 |
-
$polldaddy->reset();
|
| 589 |
-
$polldaddy->delete_poll( $poll_id );
|
| 590 |
-
}
|
| 591 |
-
|
| 592 |
-
$query_args['message'] = 'deleted';
|
| 593 |
-
$query_args['deleted'] = count( (array) $poll );
|
| 594 |
-
break;
|
| 595 |
-
case 'open' :
|
| 596 |
-
if ( empty( $poll ) )
|
| 597 |
-
return;
|
| 598 |
-
|
| 599 |
-
if ( is_array( $poll ) )
|
| 600 |
-
check_admin_referer( 'action-poll_bulk' );
|
| 601 |
-
else
|
| 602 |
-
check_admin_referer( "open-poll_$poll" );
|
| 603 |
-
|
| 604 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 605 |
-
|
| 606 |
-
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
| 607 |
-
$polldaddy->reset();
|
| 608 |
-
$poll_object = $polldaddy->get_poll( $poll_id );
|
| 609 |
-
|
| 610 |
-
if ( !$this->can_edit( $poll_object ) ) {
|
| 611 |
-
$this->errors->add( 'permission', __( 'You are not allowed to open this poll.', 'polldaddy' ) );
|
| 612 |
-
return false;
|
| 613 |
-
}
|
| 614 |
-
|
| 615 |
-
// Send Poll Author credentials
|
| 616 |
-
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 617 |
-
$polldaddy->reset();
|
| 618 |
-
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 619 |
-
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 620 |
-
}
|
| 621 |
-
$polldaddy->userCode = $userCode;
|
| 622 |
-
}
|
| 623 |
-
|
| 624 |
-
$polldaddy->reset();
|
| 625 |
-
$polldaddy->open_poll( $poll_id );
|
| 626 |
-
}
|
| 627 |
-
|
| 628 |
-
$query_args['message'] = 'opened';
|
| 629 |
-
$query_args['opened'] = count( (array) $poll );
|
| 630 |
-
break;
|
| 631 |
-
case 'close' :
|
| 632 |
-
if ( empty( $poll ) )
|
| 633 |
-
return;
|
| 634 |
-
|
| 635 |
-
if ( is_array( $poll ) )
|
| 636 |
-
check_admin_referer( 'action-poll_bulk' );
|
| 637 |
-
else
|
| 638 |
-
check_admin_referer( "close-poll_$poll" );
|
| 639 |
-
|
| 640 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 641 |
-
|
| 642 |
-
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
| 643 |
-
$polldaddy->reset();
|
| 644 |
-
$poll_object = $polldaddy->get_poll( $poll_id );
|
| 645 |
-
|
| 646 |
-
if ( !$this->can_edit( $poll_object ) ) {
|
| 647 |
-
$this->errors->add( 'permission', __( 'You are not allowed to close this poll.', 'polldaddy' ) );
|
| 648 |
-
return false;
|
| 649 |
-
}
|
| 650 |
-
|
| 651 |
-
// Send Poll Author credentials
|
| 652 |
-
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 653 |
-
$polldaddy->reset();
|
| 654 |
-
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 655 |
-
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 656 |
-
}
|
| 657 |
-
$polldaddy->userCode = $userCode;
|
| 658 |
-
}
|
| 659 |
-
|
| 660 |
-
$polldaddy->reset();
|
| 661 |
-
$polldaddy->close_poll( $poll_id );
|
| 662 |
-
}
|
| 663 |
-
|
| 664 |
-
$query_args['message'] = 'closed';
|
| 665 |
-
$query_args['closed'] = count( (array) $poll );
|
| 666 |
-
break;
|
| 667 |
-
case 'edit-poll' : // TODO: use polldaddy_poll
|
| 668 |
-
if ( !$is_POST || !$poll = (int) $poll )
|
| 669 |
-
return;
|
| 670 |
-
|
| 671 |
-
check_admin_referer( "edit-poll_$poll" );
|
| 672 |
-
|
| 673 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 674 |
-
$polldaddy->reset();
|
| 675 |
-
|
| 676 |
-
$poll_object = $polldaddy->get_poll( $poll );
|
| 677 |
-
$this->parse_errors( $polldaddy );
|
| 678 |
-
|
| 679 |
-
if ( !$this->can_edit( $poll_object ) ) {
|
| 680 |
-
$this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
|
| 681 |
-
return false;
|
| 682 |
-
}
|
| 683 |
-
|
| 684 |
-
// Send Poll Author credentials
|
| 685 |
-
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 686 |
-
$polldaddy->reset();
|
| 687 |
-
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 688 |
-
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 689 |
-
}
|
| 690 |
-
$this->parse_errors( $polldaddy );
|
| 691 |
-
$polldaddy->userCode = $userCode;
|
| 692 |
-
}
|
| 693 |
-
|
| 694 |
-
if ( !$poll_object )
|
| 695 |
-
$this->errors->add( 'GetPoll', __( 'Poll not found', 'polldaddy' ) );
|
| 696 |
-
|
| 697 |
-
if ( $this->errors->get_error_codes() )
|
| 698 |
-
return false;
|
| 699 |
-
|
| 700 |
-
$media = $mediaType = array();
|
| 701 |
-
if ( isset( $_POST['media'] ) ) {
|
| 702 |
-
$media = $_POST['media'];
|
| 703 |
-
unset( $_POST['media'] );
|
| 704 |
-
}
|
| 705 |
-
|
| 706 |
-
if ( isset( $_POST['mediaType'] ) ) {
|
| 707 |
-
$mediaType = $_POST['mediaType'];
|
| 708 |
-
unset( $_POST['mediaType'] );
|
| 709 |
-
}
|
| 710 |
-
|
| 711 |
-
$poll_data = get_object_vars( $poll_object );
|
| 712 |
-
foreach ( $poll_data as $key => $value )
|
| 713 |
-
if ( '_' === $key[0] )
|
| 714 |
-
unset( $poll_data[$key] );
|
| 715 |
-
|
| 716 |
-
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
| 717 |
-
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
| 718 |
-
$poll_data[$option] = 'yes';
|
| 719 |
-
else
|
| 720 |
-
$poll_data[$option] = 'no';
|
| 721 |
-
}
|
| 722 |
-
|
| 723 |
-
$blocks = array( 'off', 'cookie', 'cookieip' );
|
| 724 |
-
if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
|
| 725 |
-
$poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
| 726 |
-
|
| 727 |
-
$results = array( 'show', 'percent', 'hide' );
|
| 728 |
-
if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
|
| 729 |
-
$poll_data['resultsType'] = $_POST['resultsType'];
|
| 730 |
-
$poll_data['question'] = stripslashes( $_POST['question'] );
|
| 731 |
-
|
| 732 |
-
$comments = array( 'off', 'allow', 'moderate' );
|
| 733 |
-
if ( isset( $_POST['comments'] ) && in_array( $_POST['comments'], $comments ) )
|
| 734 |
-
$poll_data['comments'] = $_POST['comments'];
|
| 735 |
-
|
| 736 |
-
if ( empty( $_POST['answer'] ) || !is_array( $_POST['answer'] ) )
|
| 737 |
-
$this->errors->add( 'answer', __( 'Invalid answers', 'polldaddy' ) );
|
| 738 |
-
|
| 739 |
-
$answers = array();
|
| 740 |
-
foreach ( $_POST['answer'] as $answer_id => $answer ) {
|
| 741 |
-
$answer = stripslashes( trim( $answer ) );
|
| 742 |
-
|
| 743 |
-
if ( strlen( $answer ) > 0 ) {
|
| 744 |
-
$answer = wp_kses( $answer, $allowedtags );
|
| 745 |
-
|
| 746 |
-
$args['text'] = (string) $answer;
|
| 747 |
-
|
| 748 |
-
$answer_id = str_replace('new', '', $answer_id );
|
| 749 |
-
$mc = '';
|
| 750 |
-
$mt = 0;
|
| 751 |
-
|
| 752 |
-
if ( isset( $media[$answer_id] ) )
|
| 753 |
-
$mc = esc_html( $media[$answer_id] );
|
| 754 |
-
|
| 755 |
-
if ( isset( $mediaType[$answer_id] ) )
|
| 756 |
-
$mt = intval( $mediaType[$answer_id] );
|
| 757 |
-
|
| 758 |
-
$args['mediaType'] = $mt;
|
| 759 |
-
$args['mediaCode'] = $mc;
|
| 760 |
-
|
| 761 |
-
if ( $answer_id > 1000 )
|
| 762 |
-
$answer = polldaddy_poll_answer( $args, $answer_id );
|
| 763 |
-
else
|
| 764 |
-
$answer = polldaddy_poll_answer( $args );
|
| 765 |
-
|
| 766 |
-
if ( isset( $answer ) && is_a( $answer, 'Polldaddy_Poll_Answer' ) )
|
| 767 |
-
$answers[] = $answer;
|
| 768 |
-
}
|
| 769 |
-
}
|
| 770 |
-
|
| 771 |
-
if ( 2 > count( $answers ) )
|
| 772 |
-
$this->errors->add( 'answer', __( 'You must include at least 2 answers', 'polldaddy' ) );
|
| 773 |
-
|
| 774 |
-
if ( $this->errors->get_error_codes() )
|
| 775 |
-
return false;
|
| 776 |
-
|
| 777 |
-
$poll_data['answers'] = $answers;
|
| 778 |
-
|
| 779 |
-
$poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
|
| 780 |
-
|
| 781 |
-
if ( isset ( $_POST['styleID'] ) ) {
|
| 782 |
-
if ( $_POST['styleID'] == 'x' ) {
|
| 783 |
-
$this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
|
| 784 |
-
return false;
|
| 785 |
-
}
|
| 786 |
-
}
|
| 787 |
-
$poll_data['styleID'] = (int) $_POST['styleID'];
|
| 788 |
-
$poll_data['choices'] = (int) $_POST['choices'];
|
| 789 |
-
|
| 790 |
-
if ( $poll_data['blockRepeatVotersType'] == 'cookie' ) {
|
| 791 |
-
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 792 |
-
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 793 |
-
} elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ) {
|
| 794 |
-
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 795 |
-
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 796 |
-
}
|
| 797 |
-
|
| 798 |
-
if ( isset( $media[999999999] ) )
|
| 799 |
-
$poll_data['mediaCode'] = esc_html( $media[999999999] );
|
| 800 |
-
|
| 801 |
-
if ( isset( $mediaType[999999999] ) )
|
| 802 |
-
$poll_data['mediaType'] = intval( $mediaType[999999999] );
|
| 803 |
-
|
| 804 |
-
if( isset( $GLOBALS['blog_id'] ) )
|
| 805 |
-
$poll_data['parentID'] = (int) $GLOBALS['blog_id'];
|
| 806 |
-
|
| 807 |
-
$polldaddy->reset();
|
| 808 |
-
|
| 809 |
-
$update_response = $polldaddy->update_poll( $poll, $poll_data );
|
| 810 |
-
$this->parse_errors( $polldaddy );
|
| 811 |
-
|
| 812 |
-
if ( !$update_response )
|
| 813 |
-
$this->errors->add( 'UpdatePoll', __( 'Poll could not be updated', 'polldaddy' ) );
|
| 814 |
-
|
| 815 |
-
if ( $this->errors->get_error_codes() )
|
| 816 |
-
return false;
|
| 817 |
-
|
| 818 |
-
$query_args['message'] = 'updated';
|
| 819 |
-
if ( isset( $_POST['iframe'] ) )
|
| 820 |
-
$query_args['iframe'] = '';
|
| 821 |
-
break;
|
| 822 |
-
case 'create-poll' :
|
| 823 |
-
if ( !$is_POST )
|
| 824 |
-
return;
|
| 825 |
-
|
| 826 |
-
check_admin_referer( 'create-poll' );
|
| 827 |
-
|
| 828 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 829 |
-
$polldaddy->reset();
|
| 830 |
-
|
| 831 |
-
$media = $mediaType = array();
|
| 832 |
-
if ( isset( $_POST['media'] ) ) {
|
| 833 |
-
$media = $_POST['media'];
|
| 834 |
-
unset( $_POST['media'] );
|
| 835 |
-
}
|
| 836 |
-
|
| 837 |
-
if ( isset( $_POST['mediaType'] ) ) {
|
| 838 |
-
$mediaType = $_POST['mediaType'];
|
| 839 |
-
unset( $_POST['mediaType'] );
|
| 840 |
-
}
|
| 841 |
-
|
| 842 |
-
$answers = array();
|
| 843 |
-
foreach ( $_POST['answer'] as $answer_id => $answer ) {
|
| 844 |
-
$answer = stripslashes( trim( $answer ) );
|
| 845 |
-
|
| 846 |
-
if ( strlen( $answer ) > 0 ) {
|
| 847 |
-
$answer = wp_kses( $answer, $allowedtags );
|
| 848 |
-
|
| 849 |
-
$args['text'] = (string) $answer;
|
| 850 |
-
|
| 851 |
-
$answer_id = (int) str_replace('new', '', $answer_id );
|
| 852 |
-
$mc = '';
|
| 853 |
-
$mt = 0;
|
| 854 |
-
|
| 855 |
-
if ( isset( $media[$answer_id] ) )
|
| 856 |
-
$mc = esc_html( $media[$answer_id] );
|
| 857 |
-
|
| 858 |
-
if ( isset( $mediaType[$answer_id] ) )
|
| 859 |
-
$mt = intval( $mediaType[$answer_id] );
|
| 860 |
-
|
| 861 |
-
$args['mediaType'] = $mt;
|
| 862 |
-
$args['mediaCode'] = $mc;
|
| 863 |
-
|
| 864 |
-
$answer = polldaddy_poll_answer( $args );
|
| 865 |
-
|
| 866 |
-
if ( isset( $answer ) && is_a( $answer, 'Polldaddy_Poll_Answer' ) )
|
| 867 |
-
$answers[] = $answer;
|
| 868 |
-
}
|
| 869 |
-
}
|
| 870 |
-
|
| 871 |
-
if ( !$answers )
|
| 872 |
-
return false;
|
| 873 |
-
|
| 874 |
-
$poll_data = _polldaddy_poll_defaults();
|
| 875 |
-
|
| 876 |
-
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
| 877 |
-
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
| 878 |
-
$poll_data[$option] = 'yes';
|
| 879 |
-
else
|
| 880 |
-
$poll_data[$option] = 'no';
|
| 881 |
-
}
|
| 882 |
-
|
| 883 |
-
$blocks = array( 'off', 'cookie', 'cookieip' );
|
| 884 |
-
if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
|
| 885 |
-
$poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
| 886 |
-
|
| 887 |
-
$results = array( 'show', 'percent', 'hide' );
|
| 888 |
-
if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
|
| 889 |
-
$poll_data['resultsType'] = $_POST['resultsType'];
|
| 890 |
-
|
| 891 |
-
$comments = array( 'off', 'allow', 'moderate' );
|
| 892 |
-
if ( isset( $_POST['comments'] ) && in_array( $_POST['comments'], $comments ) )
|
| 893 |
-
$poll_data['comments'] = $_POST['comments'];
|
| 894 |
-
|
| 895 |
-
$poll_data['answers'] = $answers;
|
| 896 |
-
|
| 897 |
-
$poll_data['question'] = stripslashes( $_POST['question'] );
|
| 898 |
-
$poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
|
| 899 |
-
|
| 900 |
-
if ( isset ( $_POST['styleID'] ) ) {
|
| 901 |
-
if ( $_POST['styleID'] == 'x' ) {
|
| 902 |
-
$this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
|
| 903 |
-
return false;
|
| 904 |
-
}
|
| 905 |
-
}
|
| 906 |
-
$poll_data['styleID'] = (int) $_POST['styleID'];
|
| 907 |
-
$poll_data['choices'] = (int) $_POST['choices'];
|
| 908 |
-
|
| 909 |
-
if ( $poll_data['blockRepeatVotersType'] == 'cookie' ) {
|
| 910 |
-
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 911 |
-
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 912 |
-
} elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ) {
|
| 913 |
-
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 914 |
-
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 915 |
-
}
|
| 916 |
-
|
| 917 |
-
if ( isset( $media[999999999] ) )
|
| 918 |
-
$poll_data['mediaCode'] = esc_html( $media[999999999] );
|
| 919 |
-
|
| 920 |
-
if ( isset( $mediaType[999999999] ) )
|
| 921 |
-
$poll_data['mediaType'] = intval( $mediaType[999999999] );
|
| 922 |
-
|
| 923 |
-
$poll = $polldaddy->create_poll( $poll_data );
|
| 924 |
-
$this->parse_errors( $polldaddy );
|
| 925 |
-
|
| 926 |
-
if ( !$poll || empty( $poll->_id ) )
|
| 927 |
-
$this->errors->add( 'CreatePoll', __( 'Poll could not be created', 'polldaddy' ) );
|
| 928 |
-
|
| 929 |
-
if ( $this->errors->get_error_codes() )
|
| 930 |
-
return false;
|
| 931 |
-
|
| 932 |
-
$query_args['message'] = 'created';
|
| 933 |
-
$query_args['action'] = 'edit-poll';
|
| 934 |
-
$query_args['poll'] = $poll->_id;
|
| 935 |
-
if ( isset( $_POST['iframe'] ) )
|
| 936 |
-
$query_args['iframe'] = '';
|
| 937 |
-
break;
|
| 938 |
-
case 'delete-style' :
|
| 939 |
-
if ( empty( $style ) )
|
| 940 |
-
return;
|
| 941 |
-
|
| 942 |
-
if ( is_array( $style ) )
|
| 943 |
-
check_admin_referer( 'action-style_bulk' );
|
| 944 |
-
else
|
| 945 |
-
check_admin_referer( "delete-style_$style" );
|
| 946 |
-
|
| 947 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 948 |
-
|
| 949 |
-
foreach ( (array) $_REQUEST['style'] as $style_id ) {
|
| 950 |
-
$polldaddy->reset();
|
| 951 |
-
$polldaddy->delete_style( $style_id );
|
| 952 |
-
}
|
| 953 |
-
|
| 954 |
-
$query_args['message'] = 'deleted-style';
|
| 955 |
-
$query_args['deleted'] = count( (array) $style );
|
| 956 |
-
break;
|
| 957 |
-
case 'edit-style' :
|
| 958 |
-
if ( !$is_POST || !$style = (int) $style )
|
| 959 |
-
return;
|
| 960 |
-
|
| 961 |
-
check_admin_referer( "edit-style$style" );
|
| 962 |
-
|
| 963 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 964 |
-
$polldaddy->reset();
|
| 965 |
-
|
| 966 |
-
$style_data = _polldaddy_style_defaults();
|
| 967 |
-
|
| 968 |
-
if ( isset( $_POST['style-title'] ) )
|
| 969 |
-
$style_data['title'] = stripslashes( trim( (string) $_POST['style-title'] ) );
|
| 970 |
-
|
| 971 |
-
if ( isset( $_POST['CSSXML'] ) )
|
| 972 |
-
$style_data['css'] = urlencode( stripslashes( trim( (string) $_POST['CSSXML'] ) ) );
|
| 973 |
-
|
| 974 |
-
if ( isset( $_REQUEST['updatePollCheck'] ) && $_REQUEST['updatePollCheck'] == 'on' )
|
| 975 |
-
$style_data['retro'] = 1;
|
| 976 |
-
|
| 977 |
-
$update_response = $polldaddy->update_style( $style, $style_data );
|
| 978 |
-
|
| 979 |
-
$this->parse_errors( $polldaddy );
|
| 980 |
-
|
| 981 |
-
if ( !$update_response )
|
| 982 |
-
$this->errors->add( 'UpdateStyle', __( 'Style could not be updated', 'polldaddy' ) );
|
| 983 |
-
|
| 984 |
-
if ( $this->errors->get_error_codes() )
|
| 985 |
-
return false;
|
| 986 |
-
|
| 987 |
-
$query_args['message'] = 'updated-style';
|
| 988 |
-
if ( isset( $_POST['iframe'] ) )
|
| 989 |
-
$query_args['iframe'] = '';
|
| 990 |
-
break;
|
| 991 |
-
case 'create-style' :
|
| 992 |
-
if ( !$is_POST )
|
| 993 |
-
return;
|
| 994 |
-
|
| 995 |
-
check_admin_referer( 'create-style' );
|
| 996 |
-
|
| 997 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 998 |
-
$polldaddy->reset();
|
| 999 |
-
|
| 1000 |
-
$style_data = _polldaddy_style_defaults();
|
| 1001 |
-
|
| 1002 |
-
if ( isset( $_POST['style-title'] ) )
|
| 1003 |
-
$style_data['title'] = stripslashes( strip_tags( trim( (string) $_POST['style-title'] ) ) );
|
| 1004 |
-
|
| 1005 |
-
if ( isset( $_POST['CSSXML'] ) )
|
| 1006 |
-
$style_data['css'] = urlencode( stripslashes( trim( (string) $_POST['CSSXML'] ) ) );
|
| 1007 |
-
|
| 1008 |
-
$style = $polldaddy->create_style( $style_data );
|
| 1009 |
-
$this->parse_errors( $polldaddy );
|
| 1010 |
-
|
| 1011 |
-
if ( !$style || empty( $style->_id ) )
|
| 1012 |
-
$this->errors->add( 'CreateStyle', __( 'Style could not be created', 'polldaddy' ) );
|
| 1013 |
-
|
| 1014 |
-
if ( $this->errors->get_error_codes() )
|
| 1015 |
-
return false;
|
| 1016 |
-
|
| 1017 |
-
$query_args['message'] = 'created-style';
|
| 1018 |
-
$query_args['action'] = 'edit-style';
|
| 1019 |
-
$query_args['style'] = $style->_id;
|
| 1020 |
-
if ( isset( $_POST['iframe'] ) )
|
| 1021 |
-
$query_args['iframe'] = '';
|
| 1022 |
-
break;
|
| 1023 |
-
case 'update-options' :
|
| 1024 |
-
if ( !$is_POST )
|
| 1025 |
-
return;
|
| 1026 |
-
|
| 1027 |
-
check_admin_referer( 'polldaddy-account' );
|
| 1028 |
-
|
| 1029 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1030 |
-
$polldaddy->reset();
|
| 1031 |
-
|
| 1032 |
-
$poll_defaults = _polldaddy_poll_defaults();
|
| 1033 |
-
|
| 1034 |
-
$user_defaults = array();
|
| 1035 |
-
|
| 1036 |
-
foreach ( array( "multipleChoice", "randomiseAnswers", "otherAnswer", "sharing", "resultsType", "styleID", "blockRepeatVotersType", "blockExpiration" ) as $option ) {
|
| 1037 |
-
if ( isset( $poll_defaults[$option] ) && $poll_defaults[$option] )
|
| 1038 |
-
$user_defaults[$option] = $poll_defaults[$option];
|
| 1039 |
-
}
|
| 1040 |
-
|
| 1041 |
-
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
| 1042 |
-
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
| 1043 |
-
$user_defaults[$option] = 'yes';
|
| 1044 |
-
else
|
| 1045 |
-
$user_defaults[$option] = 'no';
|
| 1046 |
-
}
|
| 1047 |
-
|
| 1048 |
-
$results = array( 'show', 'percent', 'hide' );
|
| 1049 |
-
if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
|
| 1050 |
-
$user_defaults['resultsType'] = $_POST['resultsType'];
|
| 1051 |
-
|
| 1052 |
-
if ( isset ( $_POST['styleID'] ) ) {
|
| 1053 |
-
$user_defaults['styleID'] = (int) $_POST['styleID'];
|
| 1054 |
-
}
|
| 1055 |
-
|
| 1056 |
-
$blocks = array( 'off', 'cookie', 'cookieip' );
|
| 1057 |
-
if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
|
| 1058 |
-
$user_defaults['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
| 1059 |
-
|
| 1060 |
-
if ( isset( $_POST['blockExpiration'] ) )
|
| 1061 |
-
$user_defaults['blockExpiration'] = (int) $_POST['blockExpiration'];
|
| 1062 |
-
|
| 1063 |
-
$polldaddy->update_poll_defaults( 0, $user_defaults );
|
| 1064 |
-
|
| 1065 |
-
$this->parse_errors( $polldaddy );
|
| 1066 |
-
if ( $this->errors->get_error_codes() )
|
| 1067 |
-
return false;
|
| 1068 |
-
|
| 1069 |
-
$query_args['message'] = 'updated-options';
|
| 1070 |
-
break;
|
| 1071 |
-
default :
|
| 1072 |
-
return;
|
| 1073 |
-
}//end switch
|
| 1074 |
-
} elseif ( $page == 'ratings' ) {
|
| 1075 |
-
|
| 1076 |
-
switch ( $action ) {
|
| 1077 |
-
case 'delete' :
|
| 1078 |
-
if ( empty( $id ) )
|
| 1079 |
-
return;
|
| 1080 |
-
if ( empty( $rating ) )
|
| 1081 |
-
return;
|
| 1082 |
-
|
| 1083 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 1084 |
-
|
| 1085 |
-
if ( is_array( $rating ) ) {
|
| 1086 |
-
check_admin_referer( 'action-rating_bulk' );
|
| 1087 |
-
|
| 1088 |
-
foreach ( $rating as $key => $value ) {
|
| 1089 |
-
$polldaddy->reset();
|
| 1090 |
-
$polldaddy->delete_rating_result( $id, $value );
|
| 1091 |
-
}
|
| 1092 |
-
} else {
|
| 1093 |
-
check_admin_referer( "delete-rating_$rating" );
|
| 1094 |
-
|
| 1095 |
-
$polldaddy->delete_rating_result( $id, $rating );
|
| 1096 |
-
}
|
| 1097 |
-
|
| 1098 |
-
if ( isset( $_REQUEST['filter'] ) )
|
| 1099 |
-
$query_args['filter'] = $_REQUEST['filter'];
|
| 1100 |
-
if ( isset( $_REQUEST['change-report-to'] ) )
|
| 1101 |
-
$query_args['change-report-to'] = $_REQUEST['change-report-to'];
|
| 1102 |
-
$query_args['message'] = 'deleted-rating';
|
| 1103 |
-
$query_args['deleted'] = count( (array) $rating );
|
| 1104 |
-
break;
|
| 1105 |
-
default :
|
| 1106 |
-
return;
|
| 1107 |
-
}//end switch
|
| 1108 |
-
}
|
| 1109 |
-
|
| 1110 |
-
wp_safe_redirect( add_query_arg( $query_args, wp_get_referer() ) );
|
| 1111 |
-
exit;
|
| 1112 |
-
}
|
| 1113 |
-
|
| 1114 |
-
function hide_admin_menu() {
|
| 1115 |
-
echo '<style>#adminmenuback,#adminmenuwrap,#screen-meta-links,#footer{display:none;visibility:hidden;}#wpcontent{margin-left:10px;}</style>';
|
| 1116 |
-
}
|
| 1117 |
-
|
| 1118 |
-
function management_page_load_signup() {
|
| 1119 |
-
|
| 1120 |
-
switch ( $_POST['account'] ) {
|
| 1121 |
-
case 'import' :
|
| 1122 |
-
return array( $this->import_account() );
|
| 1123 |
-
break;
|
| 1124 |
-
default :
|
| 1125 |
-
return;
|
| 1126 |
-
}//end switch
|
| 1127 |
-
}
|
| 1128 |
-
|
| 1129 |
-
function import_account() {
|
| 1130 |
-
if ( isset( $_POST[ 'polldaddy_key' ] ) ) {
|
| 1131 |
-
$polldaddy_api_key = trim( stripslashes( $_POST[ 'polldaddy_key' ] ) );
|
| 1132 |
-
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 1133 |
-
$polldaddy->reset();
|
| 1134 |
-
if ( !$polldaddy->get_usercode( $this->id ) ) {
|
| 1135 |
-
$this->parse_errors( $polldaddy );
|
| 1136 |
-
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Is your API code correct?', 'polldaddy' ) );
|
| 1137 |
-
return false;
|
| 1138 |
-
}
|
| 1139 |
-
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 1140 |
-
} else {
|
| 1141 |
-
$this->user_code = false;
|
| 1142 |
-
$this->errors->add( 'import-account', __( 'Account could not be imported. Did you enter the correct API key?', 'polldaddy' ) );
|
| 1143 |
-
return false;
|
| 1144 |
-
}
|
| 1145 |
-
}
|
| 1146 |
-
|
| 1147 |
-
function admin_body_class( $class ) {
|
| 1148 |
-
if ( isset( $_GET['iframe'] ) )
|
| 1149 |
-
$class .= 'poll-preview-iframe ';
|
| 1150 |
-
if ( isset( $_GET['TB_iframe'] ) )
|
| 1151 |
-
$class .= 'poll-preview-iframe-editor ';
|
| 1152 |
-
return $class;
|
| 1153 |
-
}
|
| 1154 |
-
|
| 1155 |
-
function management_page_notices( $message = false ) {
|
| 1156 |
-
|
| 1157 |
-
switch ( (string) @$_GET['message'] ) {
|
| 1158 |
-
case 'deleted' :
|
| 1159 |
-
$deleted = (int) $_GET['deleted'];
|
| 1160 |
-
if ( 1 == $deleted )
|
| 1161 |
-
$message = __( 'Poll deleted.', 'polldaddy' );
|
| 1162 |
-
else
|
| 1163 |
-
$message = sprintf( _n( '%s Poll Deleted.', '%s Polls Deleted.', $deleted, 'polldaddy' ), number_format_i18n( $deleted ) );
|
| 1164 |
-
break;
|
| 1165 |
-
case 'opened' :
|
| 1166 |
-
$opened = (int) $_GET['opened'];
|
| 1167 |
-
if ( 1 == $opened )
|
| 1168 |
-
$message = __( 'Poll opened.', 'polldaddy' );
|
| 1169 |
-
else
|
| 1170 |
-
$message = sprintf( _n( '%s Poll Opened.', '%s Polls Opened.', $opened, 'polldaddy' ), number_format_i18n( $opened ) );
|
| 1171 |
-
break;
|
| 1172 |
-
case 'closed' :
|
| 1173 |
-
$closed = (int) $_GET['closed'];
|
| 1174 |
-
if ( 1 == $closed )
|
| 1175 |
-
$message = __( 'Poll closed.', 'polldaddy' );
|
| 1176 |
-
else
|
| 1177 |
-
$message = sprintf( _n( '%s Poll Closed.', '%s Polls Closed.', $closed, 'polldaddy' ), number_format_i18n( $closed ) );
|
| 1178 |
-
break;
|
| 1179 |
-
case 'updated' :
|
| 1180 |
-
$message = __( 'Poll updated.', 'polldaddy' );
|
| 1181 |
-
break;
|
| 1182 |
-
case 'created' :
|
| 1183 |
-
$message = __( 'Poll created.', 'polldaddy' );
|
| 1184 |
-
if ( isset( $_GET['iframe'] ) )
|
| 1185 |
-
$message .= ' <input type="button" class="button polldaddy-send-to-editor" value="' . esc_attr( __( 'Embed in Post', 'polldaddy' ) ) . '" />';
|
| 1186 |
-
break;
|
| 1187 |
-
case 'updated-style' :
|
| 1188 |
-
$message = __( 'Custom Style updated.', 'polldaddy' );
|
| 1189 |
-
break;
|
| 1190 |
-
case 'created-style' :
|
| 1191 |
-
$message = __( 'Custom Style created.', 'polldaddy' );
|
| 1192 |
-
break;
|
| 1193 |
-
case 'deleted-style' :
|
| 1194 |
-
$deleted = (int) $_GET['deleted'];
|
| 1195 |
-
if ( 1 == $deleted )
|
| 1196 |
-
$message = __( 'Custom Style deleted.', 'polldaddy' );
|
| 1197 |
-
else
|
| 1198 |
-
$message = sprintf( _n( '%s Style Deleted.', '%s Custom Styles Deleted.', $deleted, 'polldaddy' ), number_format_i18n( $deleted ) );
|
| 1199 |
-
break;
|
| 1200 |
-
case 'imported-account' :
|
| 1201 |
-
$message = __( 'Account Linked.', 'polldaddy' );
|
| 1202 |
-
break;
|
| 1203 |
-
case 'updated-options' :
|
| 1204 |
-
$message = __( 'Options Updated.', 'polldaddy' );
|
| 1205 |
-
break;
|
| 1206 |
-
case 'deleted-rating' :
|
| 1207 |
-
$deleted = (int) $_GET['deleted'];
|
| 1208 |
-
if ( 1 == $deleted )
|
| 1209 |
-
$message = __( 'Rating deleted.', 'polldaddy' );
|
| 1210 |
-
else
|
| 1211 |
-
$message = sprintf( _n( '%s Rating Deleted.', '%s Ratings Deleted.', $deleted, 'polldaddy' ), number_format_i18n( $deleted ) );
|
| 1212 |
-
break;
|
| 1213 |
-
}//end switch
|
| 1214 |
-
|
| 1215 |
-
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 1216 |
-
|
| 1217 |
-
if ( $is_POST ) {
|
| 1218 |
-
switch ( $GLOBALS['action'] ) {
|
| 1219 |
-
case 'create-poll' :
|
| 1220 |
-
$message = __( 'Error: An error has occurred; Poll not created.', 'polldaddy' );
|
| 1221 |
-
break;
|
| 1222 |
-
case 'edit-poll' :
|
| 1223 |
-
$message = __( 'Error: An error has occurred; Poll not updated.', 'polldaddy' );
|
| 1224 |
-
break;
|
| 1225 |
-
case 'account' :
|
| 1226 |
-
if ( 'import' == $_POST['account'] )
|
| 1227 |
-
$message = __( 'Error: An error has occurred; Account could not be imported. Perhaps your email address or password is incorrect?', 'polldaddy' );
|
| 1228 |
-
else
|
| 1229 |
-
$message = __( 'Error: An error has occurred; Account could not be created.', 'polldaddy' );
|
| 1230 |
-
break;
|
| 1231 |
-
}//end switch
|
| 1232 |
-
}
|
| 1233 |
-
|
| 1234 |
-
if ( !$message )
|
| 1235 |
-
return;
|
| 1236 |
-
?>
|
| 1237 |
-
<div class='updated'><p><?php echo $message; ?></p></div>
|
| 1238 |
-
<?php
|
| 1239 |
-
$this->print_errors();
|
| 1240 |
-
}
|
| 1241 |
-
|
| 1242 |
-
function management_page() {
|
| 1243 |
-
|
| 1244 |
-
global $page, $action, $poll, $style, $rating;
|
| 1245 |
-
$poll = (int) $poll;
|
| 1246 |
-
$style = (int) $style;
|
| 1247 |
-
$rating = esc_html( $rating );
|
| 1248 |
-
?>
|
| 1249 |
-
|
| 1250 |
-
<div class="wrap" id="manage-polls">
|
| 1251 |
-
|
| 1252 |
-
<?php
|
| 1253 |
-
if ( $page == 'polls' ) {
|
| 1254 |
-
if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
|
| 1255 |
-
$action = '';
|
| 1256 |
-
}
|
| 1257 |
-
switch ( $action ) {
|
| 1258 |
-
case 'preview' :
|
| 1259 |
-
if ( isset( $_GET['iframe'] ) ):
|
| 1260 |
-
if ( !isset( $_GET['popup'] ) ) { ?>
|
| 1261 |
-
<h2 id="poll-list-header"><?php _e( 'Polldaddy Polls', 'polldaddy' ); ?></h2>
|
| 1262 |
-
<?php
|
| 1263 |
-
} else { ?>
|
| 1264 |
-
<h2 id="poll-list-header"><?php printf( __( 'Preview Poll <a href="%s" class="add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
|
| 1265 |
-
<?php
|
| 1266 |
-
}
|
| 1267 |
-
endif;
|
| 1268 |
-
|
| 1269 |
-
echo do_shortcode( "[polldaddy poll=$poll cb=1]" );
|
| 1270 |
-
|
| 1271 |
-
wp_print_scripts( 'polldaddy-poll-js' );
|
| 1272 |
-
break;
|
| 1273 |
-
case 'results' :
|
| 1274 |
-
?>
|
| 1275 |
-
|
| 1276 |
-
<h2 id="poll-list-header"><?php printf( __( 'Poll Results <a href="%s" class="add-new-h2">All Polls</a> <a href="%s" class="add-new-h2">Edit Poll</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ), esc_url( add_query_arg( array( 'action' => 'edit-poll', 'poll' => $poll, 'message' => false ) ) ) ); ?></h2>
|
| 1277 |
-
|
| 1278 |
-
<?php
|
| 1279 |
-
$this->poll_results_page( $poll );
|
| 1280 |
-
break;
|
| 1281 |
-
case 'edit' :
|
| 1282 |
-
case 'edit-poll' :
|
| 1283 |
-
?>
|
| 1284 |
-
|
| 1285 |
-
<h2 id="poll-list-header"><?php printf( __( 'Edit Poll <a href="%s" class="add-new-h2">All Polls</a> <a href="%s" class="add-new-h2">View Results</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ), esc_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll, 'message' => false ) ) ) ); ?></h2>
|
| 1286 |
-
|
| 1287 |
-
<?php
|
| 1288 |
-
|
| 1289 |
-
$this->poll_edit_form( $poll );
|
| 1290 |
-
break;
|
| 1291 |
-
case 'create-poll' :
|
| 1292 |
-
?>
|
| 1293 |
-
|
| 1294 |
-
<h2 id="poll-list-header"><?php printf( __( 'Add New Poll <a href="%s" class="add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
|
| 1295 |
-
|
| 1296 |
-
<?php
|
| 1297 |
-
$this->poll_edit_form();
|
| 1298 |
-
break;
|
| 1299 |
-
case 'list-styles' :
|
| 1300 |
-
?>
|
| 1301 |
-
|
| 1302 |
-
<h2 id="polldaddy-header"><?php
|
| 1303 |
-
if ( $this->is_author )
|
| 1304 |
-
printf( __( 'Custom Styles <a href="%s" class="add-new-h2">Add New</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'create-style', 'poll' => false, 'message' => false ) ) ) );
|
| 1305 |
-
else
|
| 1306 |
-
_e( 'Custom Styles', 'polldaddy' ); ?></h2>
|
| 1307 |
-
|
| 1308 |
-
<?php
|
| 1309 |
-
$this->styles_table();
|
| 1310 |
-
break;
|
| 1311 |
-
case 'edit-style' :
|
| 1312 |
-
?>
|
| 1313 |
-
|
| 1314 |
-
<h2 id="polldaddy-header"><?php printf( __( 'Edit Style <a href="%s" class="add-new-h2">List Styles</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
|
| 1315 |
-
|
| 1316 |
-
<?php
|
| 1317 |
-
|
| 1318 |
-
$this->style_edit_form( $style );
|
| 1319 |
-
break;
|
| 1320 |
-
case 'create-style' :
|
| 1321 |
-
?>
|
| 1322 |
-
|
| 1323 |
-
<h2 id="polldaddy-header"><?php printf( __( 'Create Style <a href="%s" class="add-new-h2">List Styles</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
|
| 1324 |
-
|
| 1325 |
-
<?php
|
| 1326 |
-
$this->style_edit_form();
|
| 1327 |
-
break;
|
| 1328 |
-
case 'options' :
|
| 1329 |
-
case 'import-account' :
|
| 1330 |
-
case 'update-options' :
|
| 1331 |
-
$this->plugin_options();
|
| 1332 |
-
break;
|
| 1333 |
-
default :
|
| 1334 |
-
|
| 1335 |
-
?>
|
| 1336 |
-
|
| 1337 |
-
<h2 id="poll-list-header"><?php
|
| 1338 |
-
if ( $this->is_author )
|
| 1339 |
-
printf( __( 'Polldaddy Polls <a href="%s" class="add-new-h2">Add New</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'create-poll', 'poll' => false, 'message' => false ) ) ) );
|
| 1340 |
-
else
|
| 1341 |
-
_e( 'Polldaddy Polls ', 'polldaddy' );
|
| 1342 |
-
?></h2><?php
|
| 1343 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1344 |
-
$account = $polldaddy->get_account();
|
| 1345 |
-
if ( !empty( $account ) )
|
| 1346 |
-
$account_email = esc_attr( $account->email );
|
| 1347 |
-
if ( isset( $account_email ) && current_user_can( 'manage_options' ) ) {
|
| 1348 |
-
echo "<p>" . sprintf( __( 'Linked to WordPress.com Account: <strong>%s</strong> (<a target="_blank" href="options-general.php?page=polls&action=options">Settings</a> / <a target="_blank" href="http://polldaddy.com/dashboard/">Polldaddy.com</a>)', 'polldaddy' ), $account_email ) . "</p>";
|
| 1349 |
-
}
|
| 1350 |
-
|
| 1351 |
-
if ( !isset( $_GET['view'] ) )
|
| 1352 |
-
$this->polls_table( 'user' );
|
| 1353 |
-
else
|
| 1354 |
-
$this->polls_table( 'blog' );
|
| 1355 |
-
|
| 1356 |
-
}//end switch
|
| 1357 |
-
} elseif ( $page == 'ratings' ) {
|
| 1358 |
-
if ( !$this->is_admin && !in_array( $action, array( 'delete', 'reports' ) ) ) {//check user privileges has access to action
|
| 1359 |
-
$action = 'reports';
|
| 1360 |
-
}
|
| 1361 |
-
|
| 1362 |
-
switch ( $action ) {
|
| 1363 |
-
case 'delete' :
|
| 1364 |
-
case 'reports' :
|
| 1365 |
-
$this->rating_reports();
|
| 1366 |
-
break;
|
| 1367 |
-
case 'update-rating' :
|
| 1368 |
-
$this->update_rating();
|
| 1369 |
-
$this->rating_settings();
|
| 1370 |
-
break;
|
| 1371 |
-
default :
|
| 1372 |
-
$this->rating_settings();
|
| 1373 |
-
}//end switch
|
| 1374 |
-
}
|
| 1375 |
-
?>
|
| 1376 |
-
|
| 1377 |
-
</div>
|
| 1378 |
-
|
| 1379 |
-
<?php
|
| 1380 |
-
|
| 1381 |
-
}
|
| 1382 |
-
|
| 1383 |
-
function polls_table( $view = 'user' ) {
|
| 1384 |
-
$page = 1;
|
| 1385 |
-
if ( isset( $_GET['paged'] ) )
|
| 1386 |
-
$page = absint( $_GET['paged'] );
|
| 1387 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1388 |
-
$polldaddy->reset();
|
| 1389 |
-
|
| 1390 |
-
if ( 'user' == $view )
|
| 1391 |
-
$polls_object = $polldaddy->get_polls( ( $page - 1 ) * 10 + 1, $page * 10 );
|
| 1392 |
-
else
|
| 1393 |
-
$polls_object = $polldaddy->get_polls_by_parent_id( ( $page - 1 ) * 10 + 1, $page * 10 );
|
| 1394 |
-
|
| 1395 |
-
$this->parse_errors( $polldaddy );
|
| 1396 |
-
if ( in_array( 'API Key Not Found, 890', $polldaddy->errors ) )
|
| 1397 |
-
return false;
|
| 1398 |
-
$this->print_errors();
|
| 1399 |
-
$polls = & $polls_object->poll;
|
| 1400 |
-
if ( isset( $polls_object->_total ) )
|
| 1401 |
-
$total_polls = $polls_object->_total;
|
| 1402 |
-
else
|
| 1403 |
-
$total_polls = count( $polls );
|
| 1404 |
-
$class = '';
|
| 1405 |
-
|
| 1406 |
-
$page_links = paginate_links( array(
|
| 1407 |
-
'base' => add_query_arg( 'paged', '%#%' ),
|
| 1408 |
-
'format' => '',
|
| 1409 |
-
'total' => ceil( $total_polls / 10 ),
|
| 1410 |
-
'current' => $page,
|
| 1411 |
-
'prev_text' => '«',
|
| 1412 |
-
'next_text' => '»'
|
| 1413 |
-
) );
|
| 1414 |
-
|
| 1415 |
-
|
| 1416 |
-
?>
|
| 1417 |
-
<form method="post" action="">
|
| 1418 |
-
<input type="hidden" name="iframe" id="iframe1" value="<?php echo isset( $_GET['iframe'] ) ? 1: 0;?>">
|
| 1419 |
-
<div class="tablenav">
|
| 1420 |
-
|
| 1421 |
-
<?php if ( $this->is_author ) { ?>
|
| 1422 |
-
<div class="alignleft actions">
|
| 1423 |
-
<select name="action">
|
| 1424 |
-
<option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
|
| 1425 |
-
<option value="delete"><?php _e( 'Delete', 'polldaddy' ); ?></option>
|
| 1426 |
-
<option value="close"><?php _e( 'Close', 'polldaddy' ); ?></option>
|
| 1427 |
-
<option value="open"><?php _e( 'Open', 'polldaddy' ); ?></option>
|
| 1428 |
-
</select>
|
| 1429 |
-
|
| 1430 |
-
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
|
| 1431 |
-
<?php wp_nonce_field( 'action-poll_bulk' ); ?>
|
| 1432 |
-
</div>
|
| 1433 |
-
<div class="alignleft actions">
|
| 1434 |
-
<select name="filter" id="filter-options" style="margin-left:15px;">
|
| 1435 |
-
<option <?php if (!isset( $_GET['view'] ) ): ?> selected="selected" <?php endif; ?> value=""><?php _e( 'View All Polls', 'polldaddy' ); ?></option>
|
| 1436 |
-
<option <?php if ( $_GET['view']
|
| 1437 |
-
</select>
|
| 1438 |
-
<input class="button-secondary action" type="button" id="filter-polls" name="dofilter" value="<?php _e( 'Filter', 'polldaddy' ); ?>" />
|
| 1439 |
-
|
| 1440 |
-
|
| 1441 |
-
</div>
|
| 1442 |
-
|
| 1443 |
-
|
| 1444 |
-
<div class="tablenav-pages"><?php echo $page_links; ?></div>
|
| 1445 |
-
</div>
|
| 1446 |
-
|
| 1447 |
-
<?php } ?>
|
| 1448 |
-
<table class="widefat">
|
| 1449 |
-
<thead>
|
| 1450 |
-
<tr>
|
| 1451 |
-
<th id="cb" class="manage-column column-cb check-column" scope="col"><?php if ( $this->is_author ) { ?><input type="checkbox" /><?php } ?></th>
|
| 1452 |
-
<th id="title" class="manage-column column-title" scope="col"><?php _e( 'Poll', 'polldaddy' ); ?></th>
|
| 1453 |
-
<th id="votes" class="manage-column column-vote num" scope="col"> </th>
|
| 1454 |
-
</tr>
|
| 1455 |
-
</thead>
|
| 1456 |
-
<tbody>
|
| 1457 |
-
|
| 1458 |
-
<?php
|
| 1459 |
-
if ( $polls ) :
|
| 1460 |
-
foreach ( $polls as $poll ) :
|
| 1461 |
-
$poll_id = (int) $poll->_id;
|
| 1462 |
-
|
| 1463 |
-
$poll->___content = trim( strip_tags( $poll->___content ) );
|
| 1464 |
-
if ( strlen( $poll->___content ) == 0 ) {
|
| 1465 |
-
$poll->___content = '-- empty HTML tag --';
|
| 1466 |
-
}
|
| 1467 |
-
|
| 1468 |
-
$poll_closed = (int) $poll->_closed;
|
| 1469 |
-
|
| 1470 |
-
if ( $this->is_author and $this->can_edit( $poll ) ) {
|
| 1471 |
-
$edit_link = esc_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll_id, 'message' => false ) ) );
|
| 1472 |
-
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'poll' => $poll_id, 'message' => false ) ), "delete-poll_$poll_id" ) );
|
| 1473 |
-
$open_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'open', 'poll' => $poll_id, 'message' => false ) ), "open-poll_$poll_id" ) );
|
| 1474 |
-
$close_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'close', 'poll' => $poll_id, 'message' => false ) ), "close-poll_$poll_id" ) );
|
| 1475 |
-
}
|
| 1476 |
-
else {
|
| 1477 |
-
$edit_link = false;
|
| 1478 |
-
$delete_link = false;
|
| 1479 |
-
$open_link = false;
|
| 1480 |
-
$close_link = false;
|
| 1481 |
-
}
|
| 1482 |
-
|
| 1483 |
-
$class = $class ? '' : ' class="alternate"';
|
| 1484 |
-
$results_link = esc_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll_id, 'message' => false ) ) );
|
| 1485 |
-
$preview = array( 'action' => 'preview', 'poll' => $poll_id, 'message' => false );
|
| 1486 |
-
|
| 1487 |
-
if ( isset( $_GET['iframe'] ) ) {
|
| 1488 |
-
$preview[ 'popup' ] = 1;
|
| 1489 |
-
}
|
| 1490 |
-
|
| 1491 |
-
$preview_link = esc_url( add_query_arg( $preview ) );
|
| 1492 |
-
|
| 1493 |
-
list( $poll_time ) = explode( '.', $poll->_created );
|
| 1494 |
-
$poll_time = strtotime( $poll_time );
|
| 1495 |
-
?>
|
| 1496 |
-
<tr<?php echo $class; ?>>
|
| 1497 |
-
<th class="check-column" scope="row"><?php if ( $this->is_author and $this->can_edit( $poll ) ) { ?><input type="checkbox" value="<?php echo (int) $poll_id; ?>" name="poll[]" /><?php } ?></th>
|
| 1498 |
-
<td class="post-title column-title" style="padding-top:7px;">
|
| 1499 |
-
<?php if ( $edit_link ) { ?>
|
| 1500 |
-
<a class="row-title" style="display:block;" href="<?php echo $edit_link; ?>"><strong><?php echo esc_html( $poll->___content ); ?></strong></a>
|
| 1501 |
-
|
| 1502 |
-
<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>
|
| 1503 |
-
|
| 1504 |
-
<div class="row-actions">
|
| 1505 |
-
<span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a></span><span> | </span>
|
| 1506 |
-
<?php } else { ?>
|
| 1507 |
-
<strong><?php echo esc_html( $poll->___content ); ?></strong>
|
| 1508 |
-
<div class="row-actions">
|
| 1509 |
-
|
| 1510 |
-
<?php } ?>
|
| 1511 |
-
|
| 1512 |
-
<?php if ( !isset( $_GET['iframe'] ) ):?>
|
| 1513 |
-
<span class="shortcode"><a href="javascript:void(0);" class="polldaddy-show-shortcode"><?php _e( 'Embed & Link', 'polldaddy' ); ?></a></span>
|
| 1514 |
-
<?php else: ?>
|
| 1515 |
-
<input type="hidden" class="polldaddy-poll-id" value="<?php echo $poll_id; ?>" />
|
| 1516 |
-
<span><a href="javascript:void(0);" class="polldaddy-send-to-editor"><?php _e( 'Embed in Post', 'polldaddy' ); ?></a></span>
|
| 1517 |
-
<?php endif; ?>
|
| 1518 |
-
|
| 1519 |
-
|
| 1520 |
-
<?php
|
| 1521 |
-
if ( $poll_closed == 2 ) {
|
| 1522 |
-
if ( $open_link ) { ?>
|
| 1523 |
-
<span> | </span><span class="open"><a class="open-poll" href="<?php echo $open_link; ?>"><?php _e( 'Open', 'polldaddy' ); ?></a></span>
|
| 1524 |
-
<?php } } else {
|
| 1525 |
-
if ( $close_link ) { ?>
|
| 1526 |
-
<span> | </span><span class="close"><a class="close-poll" href="<?php echo $close_link; ?>"><?php _e( 'Close', 'polldaddy' ); ?></a></span>
|
| 1527 |
-
<?php } }
|
| 1528 |
-
if ( !isset( $_GET['iframe'] ) ): ?>
|
| 1529 |
-
<span> | </span><span class="view"><a class="thickbox" href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a></span>
|
| 1530 |
-
<?php else: ?>
|
| 1531 |
-
<span> | </span><span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a></span>
|
| 1532 |
-
<?php endif;
|
| 1533 |
-
if ( $delete_link ) { ?>
|
| 1534 |
-
<span> | </span><span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
|
| 1535 |
-
<?php }
|
| 1536 |
-
if ( $poll->_responses > 0 ):?>
|
| 1537 |
-
<span> | </span><span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results', 'polldaddy' ); ?></a></span>
|
| 1538 |
-
<?php endif; ?>
|
| 1539 |
-
|
| 1540 |
-
<?php $this->poll_table_add_option( $poll_id ); ?>
|
| 1541 |
-
</div>
|
| 1542 |
-
</td>
|
| 1543 |
-
<td class="poll-votes column-vote num"><?php echo number_format_i18n( $poll->_responses ); ?><span class="votes-label"><?php _e( 'votes', 'polldaddy' ); ?></span></td>
|
| 1544 |
-
</tr>
|
| 1545 |
-
<tr class="polldaddy-shortcode-row <?php if ( $class ): ?> alternate <?php endif; ?>" style="display: none;">
|
| 1546 |
-
<td colspan="4" style="padding:10px 0px 10px 20px;">
|
| 1547 |
-
|
| 1548 |
-
<a style="display:block;font-size:12px;font-weight:bold;" href="<?php echo $edit_link; ?>"><?php echo esc_html( $poll->___content ); ?></a>
|
| 1549 |
-
|
| 1550 |
-
<div class="pd-embed-col">
|
| 1551 |
-
<h4 style="color:#666;font-weight:normal;"><?php _e( 'WordPress Shortcode', 'polldaddy' ); ?></h4>
|
| 1552 |
-
<input type="text" readonly="readonly" style="width: 175px;" onclick="this.select();" value="[polldaddy poll=<?php echo (int) $poll_id; ?>]"/>
|
| 1553 |
-
</div>
|
| 1554 |
-
|
| 1555 |
-
<div class="pd-embed-col">
|
| 1556 |
-
<h4 style="color:#666;font-weight:normal;"><?php _e( 'Short URL (Good for Twitter etc.)', 'polldaddy' ); ?></h4>
|
| 1557 |
-
<input type="text" readonly="readonly" style="width: 175px;" onclick="this.select();" value="http://poll.fm/<?php echo base_convert( $poll_id, 10, 36 ); ?>"/>
|
| 1558 |
-
|
| 1559 |
-
</div>
|
| 1560 |
-
|
| 1561 |
-
<div class="pd-embed-col">
|
| 1562 |
-
<h4 style="color:#666;font-weight:normal;"><?php _e( 'Facebook URL', 'polldaddy' ); ?></h4>
|
| 1563 |
-
<input type="text" readonly="readonly" style="width: 175px;" onclick="this.select();" value="http://poll.fm/f/<?php echo base_convert( $poll_id, 10, 36 ); ?>"/>
|
| 1564 |
-
</div>
|
| 1565 |
-
|
| 1566 |
-
<br class="clearing" />
|
| 1567 |
-
|
| 1568 |
-
|
| 1569 |
-
<h4 style="padding-top:10px;color:#666;font-weight:normal;"><?php _e( 'JavaScript', 'polldaddy' ); ?></h4>
|
| 1570 |
-
<pre class="hardbreak" style="max-width:542px;text-wrap:word-wrap;margin-bottom:20px;"><script type="text/javascript" language="javascript"
|
| 1571 |
-
src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></script>
|
| 1572 |
-
<noscript>
|
| 1573 |
-
<a href="http://polldaddy.com/poll/<?php echo (int) $poll_id; ?>/"><?php echo trim( strip_tags( $poll->___content ) ); ?></a><br/>
|
| 1574 |
-
<span style="font:9px;">(<a href="http://www.polldaddy.com">polls</a>)</span>
|
| 1575 |
-
</noscript></pre>
|
| 1576 |
-
<p class="submit" style="clear:both;padding:0px;">
|
| 1577 |
-
<a href="#" class="button pd-embed-done"><?php _e( 'Done', 'polldaddy' ); ?></a>
|
| 1578 |
-
</p>
|
| 1579 |
-
|
| 1580 |
-
</td>
|
| 1581 |
-
</tr>
|
| 1582 |
-
|
| 1583 |
-
<?php
|
| 1584 |
-
endforeach;
|
| 1585 |
-
elseif ( $total_polls ) : // $polls
|
| 1586 |
-
?>
|
| 1587 |
-
|
| 1588 |
-
<tr>
|
| 1589 |
-
<td colspan="4"><?php printf( __( 'What are you doing here? <a href="%s">Go back</a>.', 'polldaddy' ), esc_url( add_query_arg( 'paged', false ) ) ); ?></td>
|
| 1590 |
-
</tr>
|
| 1591 |
-
|
| 1592 |
-
<?php
|
| 1593 |
-
else : // $polls
|
| 1594 |
-
?>
|
| 1595 |
-
|
| 1596 |
-
<tr>
|
| 1597 |
-
<td colspan="4" id="empty-set"><?php
|
| 1598 |
-
if ( $this->is_author ) { ?>
|
| 1599 |
-
|
| 1600 |
-
<h3 style="margin-bottom:0px;"><?php _e( 'You haven\'t created any polls for this blog.', 'polldaddy');?> </h3>
|
| 1601 |
-
<p style="margin-bottom:20px;"><?php _e( 'Why don\'t you go ahead and get started on that?', 'polldaddy' ); ?></p>
|
| 1602 |
-
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'create-poll' ) ) ); ?>" class="button-primary"><?php _e( 'Create a Poll Now', 'polldaddy' ); ?></a>
|
| 1603 |
-
|
| 1604 |
-
<?php
|
| 1605 |
-
} else { ?>
|
| 1606 |
-
|
| 1607 |
-
<p id="no-polls"><?php _e( 'No one has created any polls for this blog.', 'polldaddy' ); ?></p>
|
| 1608 |
-
|
| 1609 |
-
<?php }
|
| 1610 |
-
?></td>
|
| 1611 |
-
</tr>
|
| 1612 |
-
<?php endif; // $polls ?>
|
| 1613 |
-
|
| 1614 |
-
</tbody>
|
| 1615 |
-
</table>
|
| 1616 |
-
|
| 1617 |
-
|
| 1618 |
-
|
| 1619 |
-
|
| 1620 |
-
|
| 1621 |
-
|
| 1622 |
-
<?php $this->poll_table_extra(); ?>
|
| 1623 |
-
</form>
|
| 1624 |
-
<div class="tablenav" <?php if ( $page_links == '' ) { ?> style="display:none;" <?php } ?> >
|
| 1625 |
-
<div class="tablenav-pages"><?php echo $page_links; ?></div>
|
| 1626 |
-
</div>
|
| 1627 |
-
|
| 1628 |
-
|
| 1629 |
-
|
| 1630 |
-
|
| 1631 |
-
<script type="text/javascript">
|
| 1632 |
-
jQuery( document ).ready(function(){
|
| 1633 |
-
plugin = new Plugin( {
|
| 1634 |
-
delete_rating: '<?php echo esc_js( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 1635 |
-
delete_poll: '<?php echo esc_js( __( 'Are you sure you want to delete the poll %s?', 'polldaddy' ) ); ?>',
|
| 1636 |
-
delete_answer: '<?php echo esc_js( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 1637 |
-
delete_answer_title: '<?php echo esc_js( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 1638 |
-
standard_styles: '<?php echo esc_js( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 1639 |
-
custom_styles: '<?php echo esc_js( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 1640 |
-
} );
|
| 1641 |
-
|
| 1642 |
-
jQuery( '#filter-polls' ).click( function(){
|
| 1643 |
-
|
| 1644 |
-
|
| 1645 |
-
if( jQuery( '#filter-options' ).val() == 'blog' ){
|
| 1646 |
-
window.location = '<?php echo add_query_arg( array( 'page' => 'polls', 'view' => 'blog' ), admin_url( 'admin.php' ) ); ?>';
|
| 1647 |
-
} else {
|
| 1648 |
-
window.location = '<?php echo add_query_arg( array( 'page' => 'polls' ), admin_url( 'admin.php' ) ); ?>';
|
| 1649 |
-
}
|
| 1650 |
-
|
| 1651 |
-
|
| 1652 |
-
|
| 1653 |
-
} );
|
| 1654 |
-
|
| 1655 |
-
|
| 1656 |
-
});
|
| 1657 |
-
</script>
|
| 1658 |
-
|
| 1659 |
-
<?php
|
| 1660 |
-
}
|
| 1661 |
-
|
| 1662 |
-
function poll_table_add_option() {}
|
| 1663 |
-
|
| 1664 |
-
function poll_table_extra() {}
|
| 1665 |
-
|
| 1666 |
-
function poll_edit_form( $poll_id = 1 ) {
|
| 1667 |
-
$poll_id = (int) $poll_id;
|
| 1668 |
-
|
| 1669 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1670 |
-
$polldaddy->reset();
|
| 1671 |
-
|
| 1672 |
-
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 1673 |
-
|
| 1674 |
-
if ( $poll_id ) {
|
| 1675 |
-
$poll = $polldaddy->get_poll( $poll_id );
|
| 1676 |
-
$this->parse_errors( $polldaddy );
|
| 1677 |
-
|
| 1678 |
-
if ( !$this->can_edit( $poll ) ) {
|
| 1679 |
-
$this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
|
| 1680 |
-
}
|
| 1681 |
-
|
| 1682 |
-
if ( $poll_id == 1 ) {
|
| 1683 |
-
$poll->answers = array();
|
| 1684 |
-
$poll_id = 0;
|
| 1685 |
-
}
|
| 1686 |
-
|
| 1687 |
-
} else {
|
| 1688 |
-
$poll = polldaddy_poll( array(), null, false );
|
| 1689 |
-
}
|
| 1690 |
-
|
| 1691 |
-
$question = $is_POST ? esc_attr( stripslashes( $_POST['question'] ) ) : esc_attr( $poll->question );
|
| 1692 |
-
|
| 1693 |
-
$answers = $media = $mediaType = array();
|
| 1694 |
-
if ( $is_POST ) {
|
| 1695 |
-
if ( isset( $_POST['mediaType'] ) )
|
| 1696 |
-
$mediaType = $_POST['mediaType'];
|
| 1697 |
-
|
| 1698 |
-
if ( isset( $_POST['media'] ) ) {
|
| 1699 |
-
$mc = $_POST['media'];
|
| 1700 |
-
|
| 1701 |
-
foreach ( $mc as $key => $value ) {
|
| 1702 |
-
if ( $mediaType[$key] == 1 ) {
|
| 1703 |
-
$media[$key] = $polldaddy->get_media( $value );
|
| 1704 |
-
}
|
| 1705 |
-
}
|
| 1706 |
-
}
|
| 1707 |
-
|
| 1708 |
-
if ( isset( $_POST['answer'] ) )
|
| 1709 |
-
foreach ( $_POST['answer'] as $answer_id => $answer )
|
| 1710 |
-
$answers[esc_attr($answer_id)] = esc_attr( stripslashes($answer) );
|
| 1711 |
-
} elseif ( isset( $poll->answers->answer ) ) {
|
| 1712 |
-
foreach ( $poll->answers->answer as $answer ) {
|
| 1713 |
-
$answers[(int) $answer->_id] = esc_attr( $answer->text );
|
| 1714 |
-
|
| 1715 |
-
if ( $answer->mediaType == 1 && !empty( $answer->mediaCode ) ) {
|
| 1716 |
-
$polldaddy->reset();
|
| 1717 |
-
$media[$answer->_id] = $polldaddy->get_media( $answer->mediaCode );
|
| 1718 |
-
$mediaType[$answer->_id] = 1;
|
| 1719 |
-
}
|
| 1720 |
-
elseif ( $answer->mediaType == 2 ) {
|
| 1721 |
-
$mediaType[$answer->_id] = 2;
|
| 1722 |
-
}
|
| 1723 |
-
}
|
| 1724 |
-
|
| 1725 |
-
if ( isset( $poll->mediaCode ) && isset( $poll->mediaType ) ) {
|
| 1726 |
-
if ( $poll->mediaType == 1 && !empty( $poll->mediaCode ) ) {
|
| 1727 |
-
$polldaddy->reset();
|
| 1728 |
-
$media[999999999] = $polldaddy->get_media( $poll->mediaCode );
|
| 1729 |
-
$mediaType[999999999] = 1;
|
| 1730 |
-
}
|
| 1731 |
-
elseif ( $poll->mediaType == 2 ) {
|
| 1732 |
-
$mediaType[999999999] = 2;
|
| 1733 |
-
}
|
| 1734 |
-
}
|
| 1735 |
-
}
|
| 1736 |
-
$this->print_errors();
|
| 1737 |
-
|
| 1738 |
-
$delete_media_link = '<a href="#" class="delete-media delete hidden" title="' . esc_attr( __( 'delete this image' ) ) . '"><img src="' . $this->base_url . 'img/icon-clear-search.png" width="16" height="16" /></a>';
|
| 1739 |
-
?>
|
| 1740 |
-
|
| 1741 |
-
<form enctype="multipart/form-data" name="send-media" action="admin-ajax.php" method="post">
|
| 1742 |
-
<?php wp_nonce_field( 'send-media' ); ?>
|
| 1743 |
-
<input type="hidden" value="" name="action">
|
| 1744 |
-
<input type="hidden" value="<?php echo $this->user_code; ?>" name="uc">
|
| 1745 |
-
<input type="hidden" value="" name="attach-id">
|
| 1746 |
-
<input type="hidden" value="" name="media-id">
|
| 1747 |
-
<input type="hidden" value="" name="url">
|
| 1748 |
-
</form>
|
| 1749 |
-
|
| 1750 |
-
<form name="add-answer" action="admin-ajax.php" method="post">
|
| 1751 |
-
<?php wp_nonce_field( 'add-answer' ); ?>
|
| 1752 |
-
<input type="hidden" value="" name="action">
|
| 1753 |
-
<input type="hidden" value="" name="aa">
|
| 1754 |
-
<input type="hidden" value="" name="src">
|
| 1755 |
-
<input type="hidden" value="<?php echo isset( $_GET['iframe'] ) ? '1': '0';?>" name="popup">
|
| 1756 |
-
</form>
|
| 1757 |
-
|
| 1758 |
-
<form action="" method="post">
|
| 1759 |
-
<div id="poststuff"><div id="post-body" class="has-sidebar has-right-sidebar">
|
| 1760 |
-
|
| 1761 |
-
<div class="inner-sidebar" id="side-info-column">
|
| 1762 |
-
<div id="submitdiv" class="postbox">
|
| 1763 |
-
<h3><?php _e( 'Save', 'polldaddy' ); ?></h3>
|
| 1764 |
-
<div class="inside">
|
| 1765 |
-
<div class="minor-publishing">
|
| 1766 |
-
|
| 1767 |
-
<ul id="answer-options">
|
| 1768 |
-
|
| 1769 |
-
<?php
|
| 1770 |
-
foreach ( array( 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), 'multipleChoice' => __( 'Multiple choice', 'polldaddy' ), 'sharing' => __( 'Sharing', 'polldaddy' ) ) as $option => $label ) :
|
| 1771 |
-
if ( $is_POST )
|
| 1772 |
-
$checked = 'yes' === $_POST[$option] ? ' checked="checked"' : '';
|
| 1773 |
-
else
|
| 1774 |
-
$checked = 'yes' === $poll->$option ? ' checked="checked"' : '';
|
| 1775 |
-
?>
|
| 1776 |
-
|
| 1777 |
-
<li>
|
| 1778 |
-
<label for="<?php echo $option; ?>"><input type="checkbox"<?php echo $checked; ?> value="yes" id="<?php echo $option; ?>" name="<?php echo $option; ?>" /> <?php echo esc_html( $label ); ?></label>
|
| 1779 |
-
</li>
|
| 1780 |
-
|
| 1781 |
-
<?php endforeach; ?>
|
| 1782 |
-
|
| 1783 |
-
</ul>
|
| 1784 |
-
<?php
|
| 1785 |
-
if ( $is_POST )
|
| 1786 |
-
$style = 'yes' === $_POST['multipleChoice'] ? 'display:block;' : 'display:none;';
|
| 1787 |
-
else
|
| 1788 |
-
$style = 'yes' === $poll->multipleChoice ? 'display:block;' : 'display:none;';
|
| 1789 |
-
?>
|
| 1790 |
-
<div id="numberChoices" name="numberChoices" style="padding-left:15px;<?php echo $style; ?>">
|
| 1791 |
-
<p><?php _e( 'Number of choices', 'polldaddy' ) ?>: <select name="choices" id="choices"><option value="0"><?php _e( 'No Limit', 'polldaddy' ) ?></option>
|
| 1792 |
-
<?php
|
| 1793 |
-
if ( $is_POST )
|
| 1794 |
-
$choices = (int) $_POST['choices'];
|
| 1795 |
-
else
|
| 1796 |
-
$choices = (int) $poll->choices;
|
| 1797 |
-
|
| 1798 |
-
$a = count( $answers ) - 1;
|
| 1799 |
-
|
| 1800 |
-
if ( $a > 1 ) :
|
| 1801 |
-
for ( $i=2; $i<=$a; $i++ ) :
|
| 1802 |
-
$selected = $i == $choices ? 'selected="selected"' : '';
|
| 1803 |
-
printf( "<option value='%d' %s>%d</option>", $i, $selected, $i );
|
| 1804 |
-
endfor;
|
| 1805 |
-
endif; ?>
|
| 1806 |
-
</select>
|
| 1807 |
-
</p>
|
| 1808 |
-
</div>
|
| 1809 |
-
</div>
|
| 1810 |
-
|
| 1811 |
-
|
| 1812 |
-
|
| 1813 |
-
<div id="major-publishing-actions">
|
| 1814 |
-
|
| 1815 |
-
|
| 1816 |
-
|
| 1817 |
-
|
| 1818 |
-
|
| 1819 |
-
|
| 1820 |
-
|
| 1821 |
-
<p id="publishing-action">
|
| 1822 |
-
|
| 1823 |
-
|
| 1824 |
-
|
| 1825 |
-
<?php wp_nonce_field( $poll_id ? "edit-poll_$poll_id" : 'create-poll' ); ?>
|
| 1826 |
-
<input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?>" />
|
| 1827 |
-
<input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?>" />
|
| 1828 |
-
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Save Poll', 'polldaddy' ) ); ?>" />
|
| 1829 |
-
|
| 1830 |
-
<?php if ( isset( $_GET['iframe'] ) && $poll_id ) : ?>
|
| 1831 |
-
<div id="delete-action">
|
| 1832 |
-
<input type="button" class="button polldaddy-send-to-editor" style="margin-top:8px;" value="<?php echo esc_attr( __( 'Embed in Post', 'polldaddy' ) ); ?>" />
|
| 1833 |
-
</div>
|
| 1834 |
-
<?php endif; ?>
|
| 1835 |
-
|
| 1836 |
-
</p>
|
| 1837 |
-
<br class="clear" />
|
| 1838 |
-
</div>
|
| 1839 |
-
</div>
|
| 1840 |
-
</div>
|
| 1841 |
-
|
| 1842 |
-
<div class="postbox">
|
| 1843 |
-
<h3><?php _e( 'Results Display', 'polldaddy' ); ?></h3>
|
| 1844 |
-
<div class="inside">
|
| 1845 |
-
<ul class="poll-options">
|
| 1846 |
-
|
| 1847 |
-
<?php
|
| 1848 |
-
foreach ( array( 'show' => __( 'Show results to voters', 'polldaddy' ), 'percent' => __( 'Only show percentages', 'polldaddy' ), 'hide' => __( 'Hide all results', 'polldaddy' ) ) as $value => $label ) :
|
| 1849 |
-
if ( $is_POST )
|
| 1850 |
-
$checked = $value === $_POST['resultsType'] ? ' checked="checked"' : '';
|
| 1851 |
-
else
|
| 1852 |
-
$checked = $value === $poll->resultsType ? ' checked="checked"' : '';
|
| 1853 |
-
?>
|
| 1854 |
-
|
| 1855 |
-
<li>
|
| 1856 |
-
<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 esc_html( $label ); ?></label>
|
| 1857 |
-
</li>
|
| 1858 |
-
|
| 1859 |
-
<?php endforeach; ?>
|
| 1860 |
-
|
| 1861 |
-
</ul>
|
| 1862 |
-
</div>
|
| 1863 |
-
</div>
|
| 1864 |
-
|
| 1865 |
-
<div class="postbox">
|
| 1866 |
-
<h3><?php _e( 'Repeat Voting', 'polldaddy' ); ?></h3>
|
| 1867 |
-
<div class="inside">
|
| 1868 |
-
<ul class="poll-options">
|
| 1869 |
-
|
| 1870 |
-
<?php
|
| 1871 |
-
foreach ( array( 'off' => __( "Don't block repeat voters", 'polldaddy' ), 'cookie' => __( 'Block by cookie (recommended)', 'polldaddy' ), 'cookieip' => __( 'Block by cookie and by IP address', 'polldaddy' ) ) as $value => $label ) :
|
| 1872 |
-
if ( $is_POST )
|
| 1873 |
-
$checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : '';
|
| 1874 |
-
else
|
| 1875 |
-
$checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : '';
|
| 1876 |
-
?>
|
| 1877 |
-
|
| 1878 |
-
<li>
|
| 1879 |
-
<label for="blockRepeatVotersType-<?php echo $value; ?>"><input class="block-repeat" type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?>" /> <?php echo esc_html( $label ); ?></label>
|
| 1880 |
-
</li>
|
| 1881 |
-
|
| 1882 |
-
<?php endforeach; ?>
|
| 1883 |
-
|
| 1884 |
-
</ul>
|
| 1885 |
-
|
| 1886 |
-
<?php
|
| 1887 |
-
if ( $poll->blockExpiration == 0 || $poll->blockExpiration > 604800 )
|
| 1888 |
-
$poll->blockExpiration = 604800;
|
| 1889 |
-
?>
|
| 1890 |
-
<span style="margin:6px 6px 8px;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?>" id="cookieip_expiration_label"><label><?php _e( 'Expires: ', 'polldaddy' ); ?></label></span>
|
| 1891 |
-
<select id="cookieip_expiration" name="cookieip_expiration" style="width: auto;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?>">
|
| 1892 |
-
<option value="3600" <?php echo (int) $poll->blockExpiration == 3600 ? 'selected' : ''; ?>><?php printf( __( '%d hour', 'polldaddy' ), 1 ); ?></option>
|
| 1893 |
-
<option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 3 ); ?></option>
|
| 1894 |
-
<option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 6 ); ?></option>
|
| 1895 |
-
<option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 12 ); ?></option>
|
| 1896 |
-
<option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected' : ''; ?>><?php printf( __( '%d day', 'polldaddy' ), 1 ); ?></option>
|
| 1897 |
-
<option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected' : ''; ?>><?php printf( __( '%d week', 'polldaddy' ), 1 ); ?></option>
|
| 1898 |
-
</select>
|
| 1899 |
-
<p><?php _e( 'Note: Blocking by cookie and IP address can be problematic for some voters.', 'polldaddy' ); ?></p>
|
| 1900 |
-
</div>
|
| 1901 |
-
</div>
|
| 1902 |
-
|
| 1903 |
-
<div class="postbox">
|
| 1904 |
-
<h3><?php _e( 'Comments', 'polldaddy' ); ?></h3>
|
| 1905 |
-
<div class="inside">
|
| 1906 |
-
<ul class="poll-options">
|
| 1907 |
-
|
| 1908 |
-
<?php
|
| 1909 |
-
foreach ( array( 'allow' => __( "Allow comments", 'polldaddy' ), 'moderate' => __( 'Moderate first', 'polldaddy' ), 'off' => __( 'No comments', 'polldaddy' ) ) as $value => $label ) :
|
| 1910 |
-
if ( $is_POST )
|
| 1911 |
-
$checked = $value === $_POST['comments'] ? ' checked="checked"' : '';
|
| 1912 |
-
else
|
| 1913 |
-
$checked = $value === $poll->comments->___content ? ' checked="checked"' : '';
|
| 1914 |
-
?>
|
| 1915 |
-
|
| 1916 |
-
<li>
|
| 1917 |
-
<label for="comments-<?php echo $value; ?>"><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="comments" id="comments-<?php echo $value; ?>" /> <?php echo esc_html( $label ); ?></label>
|
| 1918 |
-
</li>
|
| 1919 |
-
|
| 1920 |
-
<?php endforeach; ?>
|
| 1921 |
-
|
| 1922 |
-
</ul>
|
| 1923 |
-
</div>
|
| 1924 |
-
</div>
|
| 1925 |
-
</div>
|
| 1926 |
-
|
| 1927 |
-
|
| 1928 |
-
<div id="post-body-content" class="has-sidebar-content">
|
| 1929 |
-
|
| 1930 |
-
<div id="titlediv" style="margin-top:0px;">
|
| 1931 |
-
<div id="titlewrap">
|
| 1932 |
-
|
| 1933 |
-
<table class="question">
|
| 1934 |
-
|
| 1935 |
-
<tr>
|
| 1936 |
-
<td class="question-input">
|
| 1937 |
-
<input type="text" autocomplete="off" id="title" placeholder="<?php _e( 'Enter Question Here', 'polldaddy' ); ?>" value="<?php echo $question; ?>" tabindex="1" size="30" name="question" />
|
| 1938 |
-
</td>
|
| 1939 |
-
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
| 1940 |
-
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
| 1941 |
-
<?php if ( isset( $mediaType[999999999] ) && $mediaType[999999999] == 2 ) { ?>
|
| 1942 |
-
<li class="media-preview image-added" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo $this->base_url; ?>img/icon-report-ip-analysis.png" alt="Video Embed"><?php echo $delete_media_link;?></li>
|
| 1943 |
-
<?php } else {
|
| 1944 |
-
$url = '';
|
| 1945 |
-
if ( isset($media[999999999]) ) {
|
| 1946 |
-
$url = urldecode( $media[999999999]->img_small );
|
| 1947 |
-
|
| 1948 |
-
if ( is_ssl() )
|
| 1949 |
-
$url = preg_replace( '/http\:/', 'https:', $url );
|
| 1950 |
-
}?>
|
| 1951 |
-
<li class="media-preview <?php echo !empty( $url ) ? 'image-added' : ''; ?>" style="width: 20px; height: 16px; padding-left: 5px;"><?php echo $url; ?><?php echo $delete_media_link;?></li>
|
| 1952 |
-
<?php }
|
| 1953 |
-
|
| 1954 |
-
if ( !isset( $_GET['iframe'] ) ) : ?>
|
| 1955 |
-
<li><a title="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" class="thickbox media image" id="add_poll_image999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" src="images/media-button-image.gif"></a></li>
|
| 1956 |
-
<li><a title="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" class="thickbox media video" id="add_poll_video999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" src="images/media-button-video.gif"></a></li>
|
| 1957 |
-
<li><a title="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" class="thickbox media audio" id="add_poll_audio999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" src="images/media-button-music.gif"></a></li>
|
| 1958 |
-
<?php endif; ?>
|
| 1959 |
-
</ul>
|
| 1960 |
-
|
| 1961 |
-
<input type="hidden" value="<?php echo isset( $media[999999999] ) ? $media[999999999]->_id : ''; ?>" id="hMC999999999" name="media[999999999]">
|
| 1962 |
-
<input type="hidden" value="<?php echo isset( $mediaType[999999999] ) ? $mediaType[999999999] : ''; ?>" id="hMT999999999" name="mediaType[999999999]">
|
| 1963 |
-
|
| 1964 |
-
</td>
|
| 1965 |
-
</tr>
|
| 1966 |
-
</table>
|
| 1967 |
-
|
| 1968 |
-
<?php if ( isset( $poll->_id ) && !isset( $_GET['iframe']) ): ?>
|
| 1969 |
-
<div class="inside">
|
| 1970 |
-
<div id="edit-slug-box" style="margin-bottom:30px;">
|
| 1971 |
-
<strong><?php _e( 'WordPress Shortcode:', 'polldaddy' ); ?></strong>
|
| 1972 |
-
<input type="text" style="color:#999;" value="[polldaddy poll=<?php echo $poll->_id; ?>]" id="shortcode-field" readonly="readonly" />
|
| 1973 |
-
<span><a href="post-new.php?content=[polldaddy poll=<?php echo $poll->_id; ?>]" class="button"><?php _e( 'Embed Poll in New Post' ); ?></a></span>
|
| 1974 |
-
</div>
|
| 1975 |
-
</div>
|
| 1976 |
-
<?php endif; ?>
|
| 1977 |
-
|
| 1978 |
-
</div>
|
| 1979 |
-
</div>
|
| 1980 |
-
|
| 1981 |
-
<div id="answersdiv" class="postbox">
|
| 1982 |
-
<h3><?php _e( 'Answers', 'polldaddy' ); ?></h3>
|
| 1983 |
-
|
| 1984 |
-
<div id="answerswrap" class="inside">
|
| 1985 |
-
<ul id="answers">
|
| 1986 |
-
<?php
|
| 1987 |
-
$a = 0;
|
| 1988 |
-
foreach ( $answers as $answer_id => $answer ) :
|
| 1989 |
-
$a++;
|
| 1990 |
-
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-answer', 'poll' => $poll_id, 'answer' => $answer_id, 'message' => false ) ), "delete-answer_$answer_id" ) );
|
| 1991 |
-
?>
|
| 1992 |
-
|
| 1993 |
-
<li>
|
| 1994 |
-
|
| 1995 |
-
|
| 1996 |
-
<table class="answer">
|
| 1997 |
-
|
| 1998 |
-
<tr>
|
| 1999 |
-
<th>
|
| 2000 |
-
<span class="handle" title="<?php echo esc_attr( __( 'click and drag to reorder' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-reorder.png" alt="click and drag to reorder" width="6" height="9" /></span>
|
| 2001 |
-
</th>
|
| 2002 |
-
<td class="answer-input">
|
| 2003 |
-
<input type="text" autocomplete="off" placeholder="<?php echo esc_attr( __( 'Enter an answer here', 'polldaddy' ) ); ?>" id="answer-<?php echo $answer_id; ?>" value="<?php echo $answer; ?>" tabindex="2" size="30" name="answer[<?php echo $answer_id; ?>]" />
|
| 2004 |
-
</td>
|
| 2005 |
-
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
| 2006 |
-
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
| 2007 |
-
<?php if ( isset( $mediaType[$answer_id] ) && $mediaType[$answer_id] == 2 ) { ?>
|
| 2008 |
-
<li class="media-preview image-added" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo $this->base_url; ?>img/icon-report-ip-analysis.png" alt="Video Embed"><?php echo $delete_media_link;?></li>
|
| 2009 |
-
<?php } else {
|
| 2010 |
-
$url = '';
|
| 2011 |
-
if ( isset($media[$answer_id]) ) {
|
| 2012 |
-
$url = urldecode( $media[$answer_id]->img_small );
|
| 2013 |
-
|
| 2014 |
-
if ( is_ssl() )
|
| 2015 |
-
$url = preg_replace( '/http\:/', 'https:', $url );
|
| 2016 |
-
}?>
|
| 2017 |
-
<li class="media-preview <?php echo !empty( $url ) ? 'image-added' : ''; ?>" style="width: 20px; height: 16px; padding-left: 5px;"><?php echo $url; ?><?php echo $delete_media_link;?></li>
|
| 2018 |
-
<?php }
|
| 2019 |
-
|
| 2020 |
-
if ( !isset( $_GET['iframe'] ) ) : ?>
|
| 2021 |
-
<li><a title="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" class="thickbox media image" id="add_poll_image<?php echo $answer_id; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" src="images/media-button-image.gif"></a></li>
|
| 2022 |
-
<li><a title="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" class="thickbox media video" id="add_poll_video<?php echo $answer_id; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" src="images/media-button-video.gif"></a></li>
|
| 2023 |
-
<li><a title="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" class="thickbox media audio" id="add_poll_audio<?php echo $answer_id; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" src="images/media-button-music.gif"></a></li>
|
| 2024 |
-
<?php endif; ?>
|
| 2025 |
-
<li><a href="<?php echo $delete_link; ?>" class="delete-answer delete" title="<?php echo esc_attr( __( 'delete this answer' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-clear-search.png" width="16" height="16" /></a></li>
|
| 2026 |
-
|
| 2027 |
-
</ul>
|
| 2028 |
-
|
| 2029 |
-
<input type="hidden" value="<?php echo isset( $media[$answer_id] ) ? $media[$answer_id]->_id : ''; ?>" id="hMC<?php echo $answer_id; ?>" name="media[<?php echo $answer_id; ?>]">
|
| 2030 |
-
<input type="hidden" value="<?php echo isset( $mediaType[$answer_id] ) ? $mediaType[$answer_id] : ''; ?>" id="hMT<?php echo $answer_id; ?>" name="mediaType[<?php echo $answer_id; ?>]">
|
| 2031 |
-
|
| 2032 |
-
</td>
|
| 2033 |
-
</tr>
|
| 2034 |
-
</table>
|
| 2035 |
-
|
| 2036 |
-
|
| 2037 |
-
</li>
|
| 2038 |
-
|
| 2039 |
-
<?php
|
| 2040 |
-
endforeach;
|
| 2041 |
-
|
| 2042 |
-
while ( 3 - $a > 0 ) :
|
| 2043 |
-
$a++;
|
| 2044 |
-
?>
|
| 2045 |
-
|
| 2046 |
-
<li>
|
| 2047 |
-
<table class="answer">
|
| 2048 |
-
|
| 2049 |
-
<tr>
|
| 2050 |
-
<th>
|
| 2051 |
-
<span class="handle" title="<?php echo esc_attr( __( 'click and drag to reorder' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-reorder.png" alt="click and drag to reorder" width="6" height="9" /></span>
|
| 2052 |
-
</th>
|
| 2053 |
-
<td class="answer-input">
|
| 2054 |
-
<input type="text" autocomplete="off" placeholder="<?php echo esc_attr( __( 'Enter an answer here', 'polldaddy' ) ); ?>" value="" tabindex="2" size="30" name="answer[new<?php echo $a; ?>]" />
|
| 2055 |
-
</td>
|
| 2056 |
-
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width:55px !important;"' : '';?>>
|
| 2057 |
-
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
| 2058 |
-
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"></li>
|
| 2059 |
-
<?php
|
| 2060 |
-
if ( !isset( $_GET['iframe'] ) ) : ?>
|
| 2061 |
-
<li><a title="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" class="thickbox media image" id="add_poll_image<?php echo $a; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" src="images/media-button-image.gif"></a></a></li>
|
| 2062 |
-
<li><a title="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" class="thickbox media video" id="add_poll_video<?php echo $a; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" src="images/media-button-video.gif"></a></a></li>
|
| 2063 |
-
<li><a title="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" class="thickbox media audio" id="add_poll_audio<?php echo $a; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" src="images/media-button-music.gif"></a></li>
|
| 2064 |
-
<?php endif; ?>
|
| 2065 |
-
<li><a href="#" class="delete-answer delete" title="<?php echo esc_attr( __( 'delete this answer' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-clear-search.png" width="16" height="16" /></a></li>
|
| 2066 |
-
</ul>
|
| 2067 |
-
|
| 2068 |
-
<input type="hidden" value="" id="hMC<?php echo $a; ?>" name="media[<?php echo $a; ?>]">
|
| 2069 |
-
<input type="hidden" value="" id="hMT<?php echo $a; ?>" name="mediaType[<?php echo $a; ?>]">
|
| 2070 |
-
|
| 2071 |
-
</td>
|
| 2072 |
-
</tr>
|
| 2073 |
-
|
| 2074 |
-
|
| 2075 |
-
</table>
|
| 2076 |
-
|
| 2077 |
-
|
| 2078 |
-
|
| 2079 |
-
|
| 2080 |
-
|
| 2081 |
-
</li>
|
| 2082 |
-
|
| 2083 |
-
<?php
|
| 2084 |
-
endwhile;
|
| 2085 |
-
?>
|
| 2086 |
-
|
| 2087 |
-
</ul>
|
| 2088 |
-
|
| 2089 |
-
<p id="add-answer-holder" class="<?php echo $this->base_url; ?>">
|
| 2090 |
-
<button class="button"><?php echo esc_html( __( 'Add New Answer', 'polldaddy' ) ); ?></button>
|
| 2091 |
-
</p>
|
| 2092 |
-
|
| 2093 |
-
</div>
|
| 2094 |
-
</div>
|
| 2095 |
-
|
| 2096 |
-
<div class="hidden-links"><div class="delete-media-link"><?php echo $delete_media_link;?></div></div>
|
| 2097 |
-
|
| 2098 |
-
<div id="design" class="postbox">
|
| 2099 |
-
|
| 2100 |
-
<?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID );
|
| 2101 |
-
|
| 2102 |
-
$iframe_view = false;
|
| 2103 |
-
if ( isset( $_GET['iframe'] ) )
|
| 2104 |
-
$iframe_view = true;
|
| 2105 |
-
|
| 2106 |
-
$options = array(
|
| 2107 |
-
101 => __( 'Aluminum Narrow', 'polldaddy' ),
|
| 2108 |
-
102 => __( 'Aluminum Medium', 'polldaddy' ),
|
| 2109 |
-
103 => __( 'Aluminum Wide', 'polldaddy' ),
|
| 2110 |
-
104 => __( 'Plain White Narrow', 'polldaddy' ),
|
| 2111 |
-
105 => __( 'Plain White Medium', 'polldaddy' ),
|
| 2112 |
-
106 => __( 'Plain White Wide', 'polldaddy' ),
|
| 2113 |
-
107 => __( 'Plain Black Narrow', 'polldaddy' ),
|
| 2114 |
-
108 => __( 'Plain Black Medium', 'polldaddy' ),
|
| 2115 |
-
109 => __( 'Plain Black Wide', 'polldaddy' ),
|
| 2116 |
-
110 => __( 'Paper Narrow', 'polldaddy' ),
|
| 2117 |
-
111 => __( 'Paper Medium', 'polldaddy' ),
|
| 2118 |
-
112 => __( 'Paper Wide', 'polldaddy' ),
|
| 2119 |
-
113 => __( 'Skull Dark Narrow', 'polldaddy' ),
|
| 2120 |
-
114 => __( 'Skull Dark Medium', 'polldaddy' ),
|
| 2121 |
-
115 => __( 'Skull Dark Wide', 'polldaddy' ),
|
| 2122 |
-
116 => __( 'Skull Light Narrow', 'polldaddy' ),
|
| 2123 |
-
117 => __( 'Skull Light Medium', 'polldaddy' ),
|
| 2124 |
-
118 => __( 'Skull Light Wide', 'polldaddy' ),
|
| 2125 |
-
157 => __( 'Micro', 'polldaddy' ),
|
| 2126 |
-
119 => __( 'Plastic White Narrow', 'polldaddy' ),
|
| 2127 |
-
120 => __( 'Plastic White Medium', 'polldaddy' ),
|
| 2128 |
-
121 => __( 'Plastic White Wide', 'polldaddy' ),
|
| 2129 |
-
122 => __( 'Plastic Grey Narrow', 'polldaddy' ),
|
| 2130 |
-
123 => __( 'Plastic Grey Medium', 'polldaddy' ),
|
| 2131 |
-
124 => __( 'Plastic Grey Wide', 'polldaddy' ),
|
| 2132 |
-
125 => __( 'Plastic Black Narrow', 'polldaddy' ),
|
| 2133 |
-
126 => __( 'Plastic Black Medium', 'polldaddy' ),
|
| 2134 |
-
127 => __( 'Plastic Black Wide', 'polldaddy' ),
|
| 2135 |
-
128 => __( 'Manga Narrow', 'polldaddy' ),
|
| 2136 |
-
129 => __( 'Manga Medium', 'polldaddy' ),
|
| 2137 |
-
130 => __( 'Manga Wide', 'polldaddy' ),
|
| 2138 |
-
131 => __( 'Tech Dark Narrow', 'polldaddy' ),
|
| 2139 |
-
132 => __( 'Tech Dark Medium', 'polldaddy' ),
|
| 2140 |
-
133 => __( 'Tech Dark Wide', 'polldaddy' ),
|
| 2141 |
-
134 => __( 'Tech Grey Narrow', 'polldaddy' ),
|
| 2142 |
-
135 => __( 'Tech Grey Medium', 'polldaddy' ),
|
| 2143 |
-
136 => __( 'Tech Grey Wide', 'polldaddy' ),
|
| 2144 |
-
137 => __( 'Tech Light Narrow', 'polldaddy' ),
|
| 2145 |
-
138 => __( 'Tech Light Medium', 'polldaddy' ),
|
| 2146 |
-
139 => __( 'Tech Light Wide', 'polldaddy' ),
|
| 2147 |
-
140 => __( 'Working Male Narrow', 'polldaddy' ),
|
| 2148 |
-
141 => __( 'Working Male Medium', 'polldaddy' ),
|
| 2149 |
-
142 => __( 'Working Male Wide', 'polldaddy' ),
|
| 2150 |
-
143 => __( 'Working Female Narrow', 'polldaddy' ),
|
| 2151 |
-
144 => __( 'Working Female Medium', 'polldaddy' ),
|
| 2152 |
-
145 => __( 'Working Female Wide', 'polldaddy' ),
|
| 2153 |
-
146 => __( 'Thinking Male Narrow', 'polldaddy' ),
|
| 2154 |
-
147 => __( 'Thinking Male Medium', 'polldaddy' ),
|
| 2155 |
-
148 => __( 'Thinking Male Wide', 'polldaddy' ),
|
| 2156 |
-
149 => __( 'Thinking Female Narrow', 'polldaddy' ),
|
| 2157 |
-
150 => __( 'Thinking Female Medium', 'polldaddy' ),
|
| 2158 |
-
151 => __( 'Thinking Female Wide', 'polldaddy' ),
|
| 2159 |
-
152 => __( 'Sunset Narrow', 'polldaddy' ),
|
| 2160 |
-
153 => __( 'Sunset Medium', 'polldaddy' ),
|
| 2161 |
-
154 => __( 'Sunset Wide', 'polldaddy' ),
|
| 2162 |
-
155 => __( 'Music Medium', 'polldaddy' ),
|
| 2163 |
-
156 => __( 'Music Wide', 'polldaddy' )
|
| 2164 |
-
);
|
| 2165 |
-
|
| 2166 |
-
$polldaddy->reset();
|
| 2167 |
-
$styles = $polldaddy->get_styles();
|
| 2168 |
-
|
| 2169 |
-
$show_custom = false;
|
| 2170 |
-
if ( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ) {
|
| 2171 |
-
foreach ( (array) $styles->style as $style ) {
|
| 2172 |
-
$options[ (int) $style->_id ] = $style->title;
|
| 2173 |
-
}
|
| 2174 |
-
$show_custom = true;
|
| 2175 |
-
}
|
| 2176 |
-
|
| 2177 |
-
if ( $style_ID > 18 ) {
|
| 2178 |
-
$standard_style_ID = 0;
|
| 2179 |
-
$custom_style_ID = $style_ID;
|
| 2180 |
-
}
|
| 2181 |
-
else {
|
| 2182 |
-
$standard_style_ID = $style_ID;
|
| 2183 |
-
$custom_style_ID = 0;
|
| 2184 |
-
}
|
| 2185 |
-
?>
|
| 2186 |
-
<h3><?php _e( 'Poll Style', 'polldaddy' ); ?></h3>
|
| 2187 |
-
<input type="hidden" name="styleID" id="styleID" value="<?php echo $style_ID ?>">
|
| 2188 |
-
<div class="inside">
|
| 2189 |
-
|
| 2190 |
-
<ul class="pd-tabs">
|
| 2191 |
-
<li class="selected" id="pd-styles"><a href="#"><?php _e( 'Polldaddy Styles', 'polldaddy' ); ?></a><input type="checkbox" style="display:none;" id="regular"/></li>
|
| 2192 |
-
<?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
|
| 2193 |
-
<li id="pd-custom-styles" <?php echo $hide; ?>><a href="#"><?php _e( 'Custom Styles', 'polldaddy' ); ?></a><input type="checkbox" style="display:none;" id="custom"/></li>
|
| 2194 |
-
|
| 2195 |
-
</ul>
|
| 2196 |
-
|
| 2197 |
-
<div class="pd-tab-panel show" id="pd-styles-panel">
|
| 2198 |
-
|
| 2199 |
-
|
| 2200 |
-
<?php if ( $iframe_view ) { ?>
|
| 2201 |
-
<div id="design_standard" style="padding:0px;padding-top:10px;">
|
| 2202 |
-
<div class="hide-if-no-js">
|
| 2203 |
-
<table class="pollStyle">
|
| 2204 |
-
<thead>
|
| 2205 |
-
<tr>
|
| 2206 |
-
<th>
|
| 2207 |
-
<div style="display:none;">
|
| 2208 |
-
<input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
|
| 2209 |
-
</div>
|
| 2210 |
-
</th>
|
| 2211 |
-
</tr>
|
| 2212 |
-
</thead>
|
| 2213 |
-
<tr>
|
| 2214 |
-
<td class="selector" style="width:120px;">
|
| 2215 |
-
<table class="st_selector">
|
| 2216 |
-
<tr>
|
| 2217 |
-
<td class="dir_left" style="padding:0px;width:30px;">
|
| 2218 |
-
<a href="javascript:pd_move('prev');" style="display: block;font-size: 3.2em;text-decoration: none;">«</a>
|
| 2219 |
-
</td>
|
| 2220 |
-
<td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
|
| 2221 |
-
<td class="dir_right" style="padding:0px;width:30px;">
|
| 2222 |
-
<a href="javascript:pd_move('next');" style="display: block;padding-left:20px;font-size: 3.2em;text-decoration: none;">»</a>
|
| 2223 |
-
</td>
|
| 2224 |
-
</tr>
|
| 2225 |
-
<tr>
|
| 2226 |
-
<td></td>
|
| 2227 |
-
<td class="counter">
|
| 2228 |
-
<div id="st_number"></div>
|
| 2229 |
-
</td>
|
| 2230 |
-
<td></td>
|
| 2231 |
-
</tr>
|
| 2232 |
-
<tr>
|
| 2233 |
-
<td></td>
|
| 2234 |
-
<td class="title">
|
| 2235 |
-
<div id="st_name"></div>
|
| 2236 |
-
</td>
|
| 2237 |
-
<td></td>
|
| 2238 |
-
</tr>
|
| 2239 |
-
<tr>
|
| 2240 |
-
<td></td>
|
| 2241 |
-
<td>
|
| 2242 |
-
<div id="st_sizes"></div>
|
| 2243 |
-
</td>
|
| 2244 |
-
<td></td>
|
| 2245 |
-
</tr>
|
| 2246 |
-
<tr>
|
| 2247 |
-
<td colspan="3">
|
| 2248 |
-
<div style="width:230px;" id="st_description"></div>
|
| 2249 |
-
</td>
|
| 2250 |
-
</tr>
|
| 2251 |
-
</table>
|
| 2252 |
-
</td>
|
| 2253 |
-
</tr>
|
| 2254 |
-
</table>
|
| 2255 |
-
</div>
|
| 2256 |
-
|
| 2257 |
-
<p class="empty-if-js" id="no-js-styleID">
|
| 2258 |
-
<select id="styleID" name="styleID">
|
| 2259 |
-
|
| 2260 |
-
<?php foreach ( $options as $styleID => $label ) :
|
| 2261 |
-
$selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
|
| 2262 |
-
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo esc_html( $label ); ?></option>
|
| 2263 |
-
<?php endforeach; ?>
|
| 2264 |
-
|
| 2265 |
-
</select>
|
| 2266 |
-
</p>
|
| 2267 |
-
</div>
|
| 2268 |
-
<?php } else {?>
|
| 2269 |
-
|
| 2270 |
-
<div class="design_standard">
|
| 2271 |
-
<div class="hide-if-no-js">
|
| 2272 |
-
<table class="pollStyle">
|
| 2273 |
-
<thead>
|
| 2274 |
-
<tr style="display:none;">
|
| 2275 |
-
<th class="cb">
|
| 2276 |
-
|
| 2277 |
-
<input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
|
| 2278 |
-
<label for="skin" onclick="javascript:pd_build_styles( 0 );"><?php _e( 'Polldaddy Style', 'polldaddy' ); ?></label>
|
| 2279 |
-
|
| 2280 |
-
<?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
|
| 2281 |
-
|
| 2282 |
-
<input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style(_$('customSelect').value);" <?php echo $disabled; ?> />
|
| 2283 |
-
|
| 2284 |
-
<label onclick="javascript:pd_change_style(_$('customSelect').value);"><?php _e( 'Custom Style', 'polldaddy' ); ?></label>
|
| 2285 |
-
|
| 2286 |
-
<th>
|
| 2287 |
-
</tr>
|
| 2288 |
-
</thead>
|
| 2289 |
-
<tbody>
|
| 2290 |
-
<tr>
|
| 2291 |
-
<td style="text-align:center">
|
| 2292 |
-
<table class="st_selector" style="margin:20px auto;">
|
| 2293 |
-
<tr>
|
| 2294 |
-
<td class="dir_left">
|
| 2295 |
-
<a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">«</a>
|
| 2296 |
-
</td>
|
| 2297 |
-
<td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
|
| 2298 |
-
<td class="dir_right">
|
| 2299 |
-
<a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">»</a>
|
| 2300 |
-
</td>
|
| 2301 |
-
</tr>
|
| 2302 |
-
<tr>
|
| 2303 |
-
<td></td>
|
| 2304 |
-
<td class="counter">
|
| 2305 |
-
<div id="st_number"></div>
|
| 2306 |
-
</td>
|
| 2307 |
-
<td></td>
|
| 2308 |
-
</tr>
|
| 2309 |
-
<tr>
|
| 2310 |
-
<td></td>
|
| 2311 |
-
<td class="title">
|
| 2312 |
-
<div id="st_name"></div>
|
| 2313 |
-
</td>
|
| 2314 |
-
<td></td>
|
| 2315 |
-
</tr>
|
| 2316 |
-
<tr>
|
| 2317 |
-
<td></td>
|
| 2318 |
-
<td>
|
| 2319 |
-
<div id="st_sizes"></div>
|
| 2320 |
-
</td>
|
| 2321 |
-
<td></td>
|
| 2322 |
-
</tr>
|
| 2323 |
-
<tr>
|
| 2324 |
-
<td colspan="3">
|
| 2325 |
-
<div id="st_description"></div>
|
| 2326 |
-
</td>
|
| 2327 |
-
</tr>
|
| 2328 |
-
</table>
|
| 2329 |
-
</td>
|
| 2330 |
-
|
| 2331 |
-
</tr>
|
| 2332 |
-
</tbody>
|
| 2333 |
-
</table>
|
| 2334 |
-
</div>
|
| 2335 |
-
<p class="empty-if-js" id="no-js-styleID">
|
| 2336 |
-
<select id="styleID" name="styleID">
|
| 2337 |
-
|
| 2338 |
-
<?php foreach ( $options as $styleID => $label ) :
|
| 2339 |
-
$selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
|
| 2340 |
-
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo esc_html( $label ); ?></option>
|
| 2341 |
-
<?php endforeach; ?>
|
| 2342 |
-
|
| 2343 |
-
</select>
|
| 2344 |
-
</p>
|
| 2345 |
-
</div>
|
| 2346 |
-
<?php } ?>
|
| 2347 |
-
|
| 2348 |
-
|
| 2349 |
-
|
| 2350 |
-
|
| 2351 |
-
</div>
|
| 2352 |
-
|
| 2353 |
-
|
| 2354 |
-
<div class="pd-tab-panel" id="pd-custom-styles-panel">
|
| 2355 |
-
<div style="padding:20px;">
|
| 2356 |
-
<?php if ( $show_custom ) : ?>
|
| 2357 |
-
<p><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'list-styles', 'poll' => false, 'style' => false, 'message' => false, 'preload' => false ) ) );?>" class="add-new-h2">All Styles</a></p>
|
| 2358 |
-
<select id="customSelect" name="customSelect" onchange="javascript:pd_change_style(this.value);">
|
| 2359 |
-
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
| 2360 |
-
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style…', 'polldaddy' ); ?></option>
|
| 2361 |
-
<?php foreach ( (array)$styles->style as $style ) :
|
| 2362 |
-
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
| 2363 |
-
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo esc_html( $style->title ); ?></option>
|
| 2364 |
-
<?php endforeach; ?>
|
| 2365 |
-
</select>
|
| 2366 |
-
<div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.', 'polldaddy' ); ?></div>
|
| 2367 |
-
<?php else : ?>
|
| 2368 |
-
<p><?php _e( 'You currently have no custom styles created.', 'polldaddy' ); ?> <a href="/wp-admin/edit.php?page=polls&action=create-style" class="add-new-h2"><?php _e( 'New Style', 'polldaddy');?></a></p>
|
| 2369 |
-
<p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
|
| 2370 |
-
<?php endif; ?>
|
| 2371 |
-
</div>
|
| 2372 |
-
|
| 2373 |
-
|
| 2374 |
-
|
| 2375 |
-
|
| 2376 |
-
</div>
|
| 2377 |
-
|
| 2378 |
-
|
| 2379 |
-
|
| 2380 |
-
|
| 2381 |
-
<script language="javascript">
|
| 2382 |
-
jQuery( document ).ready(function(){
|
| 2383 |
-
plugin = new Plugin( {
|
| 2384 |
-
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 2385 |
-
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 2386 |
-
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 2387 |
-
new_answer_test: '<?php echo esc_attr( __( 'Enter an answer here', 'polldaddy' ) ); ?>',
|
| 2388 |
-
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 2389 |
-
reorder_answer_title: '<?php echo esc_attr( __( 'click and drag to reorder', 'polldaddy' ) ); ?>',
|
| 2390 |
-
add_image_title: '<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>',
|
| 2391 |
-
add_audio_title: '<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>',
|
| 2392 |
-
add_video_title: '<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>',
|
| 2393 |
-
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 2394 |
-
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>',
|
| 2395 |
-
base_url: '<?php echo esc_attr( $this->base_url ); ?>'
|
| 2396 |
-
} );
|
| 2397 |
-
});
|
| 2398 |
-
</script>
|
| 2399 |
-
<script language="javascript">
|
| 2400 |
-
current_pos = 0;
|
| 2401 |
-
|
| 2402 |
-
for( var key in styles_array ) {
|
| 2403 |
-
var name = styles_array[key].name;
|
| 2404 |
-
|
| 2405 |
-
switch( name ){
|
| 2406 |
-
case 'Aluminum':
|
| 2407 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Aluminum', 'polldaddy' ) ); ?>';
|
| 2408 |
-
break;
|
| 2409 |
-
case 'Plain White':
|
| 2410 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Plain White', 'polldaddy' ) ); ?>';
|
| 2411 |
-
break;
|
| 2412 |
-
case 'Plain Black':
|
| 2413 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Plain Black', 'polldaddy' ) ); ?>';
|
| 2414 |
-
break;
|
| 2415 |
-
case 'Paper':
|
| 2416 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Paper', 'polldaddy' ) ); ?>';
|
| 2417 |
-
break;
|
| 2418 |
-
case 'Skull Dark':
|
| 2419 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Skull Dark', 'polldaddy' ) ); ?>';
|
| 2420 |
-
break;
|
| 2421 |
-
case 'Skull Light':
|
| 2422 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Skull Light', 'polldaddy' ) ); ?>';
|
| 2423 |
-
break;
|
| 2424 |
-
case 'Micro':
|
| 2425 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Micro', 'polldaddy' ) ); ?>';
|
| 2426 |
-
styles_array[key].n_desc = '<?php echo esc_attr( __( 'Width 150px, the micro style is useful when space is tight.', 'polldaddy' ) ); ?>';
|
| 2427 |
-
break;
|
| 2428 |
-
case 'Plastic White':
|
| 2429 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Plastic White', 'polldaddy' ) ); ?>';
|
| 2430 |
-
break;
|
| 2431 |
-
case 'Plastic Grey':
|
| 2432 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Plastic Grey', 'polldaddy' ) ); ?>';
|
| 2433 |
-
break;
|
| 2434 |
-
case 'Plastic Black':
|
| 2435 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Plastic Black', 'polldaddy' ) ); ?>';
|
| 2436 |
-
break;
|
| 2437 |
-
case 'Manga':
|
| 2438 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Manga', 'polldaddy' ) ); ?>';
|
| 2439 |
-
break;
|
| 2440 |
-
case 'Tech Dark':
|
| 2441 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Tech Dark', 'polldaddy' ) ); ?>';
|
| 2442 |
-
break;
|
| 2443 |
-
case 'Tech Grey':
|
| 2444 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Tech Grey', 'polldaddy' ) ); ?>';
|
| 2445 |
-
break;
|
| 2446 |
-
case 'Tech Light':
|
| 2447 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Tech Light', 'polldaddy' ) ); ?>';
|
| 2448 |
-
break;
|
| 2449 |
-
case 'Working Male':
|
| 2450 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Working Male', 'polldaddy' ) ); ?>';
|
| 2451 |
-
break;
|
| 2452 |
-
case 'Working Female':
|
| 2453 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Working Female', 'polldaddy' ) ); ?>';
|
| 2454 |
-
break;
|
| 2455 |
-
case 'Thinking Male':
|
| 2456 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Thinking Male', 'polldaddy' ) ); ?>';
|
| 2457 |
-
break;
|
| 2458 |
-
case 'Thinking Female':
|
| 2459 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Thinking Female', 'polldaddy' ) ); ?>';
|
| 2460 |
-
break;
|
| 2461 |
-
case 'Sunset':
|
| 2462 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Sunset', 'polldaddy' ) ); ?>';
|
| 2463 |
-
break;
|
| 2464 |
-
case 'Music':
|
| 2465 |
-
styles_array[key].name = '<?php echo esc_attr( __( 'Music', 'polldaddy' ) ); ?>';
|
| 2466 |
-
break;
|
| 2467 |
-
}
|
| 2468 |
-
}
|
| 2469 |
-
pd_map = {
|
| 2470 |
-
wide : '<?php echo esc_attr( __( 'Wide', 'polldaddy' ) ); ?>',
|
| 2471 |
-
medium : '<?php echo esc_attr( __( 'Medium', 'polldaddy' ) ); ?>',
|
| 2472 |
-
narrow : '<?php echo esc_attr( __( 'Narrow', 'polldaddy' ) ); ?>',
|
| 2473 |
-
style_desc_wide : '<?php echo esc_attr( __( 'Width: 630px, the wide style is good for blog posts.', 'polldaddy' ) ); ?>',
|
| 2474 |
-
style_desc_medium : '<?php echo esc_attr( __( 'Width: 300px, the medium style is good for general use.', 'polldaddy' ) ); ?>',
|
| 2475 |
-
style_desc_narrow : '<?php echo esc_attr( __( 'Width 150px, the narrow style is good for sidebars etc.', 'polldaddy' ) ); ?>',
|
| 2476 |
-
style_desc_micro : '<?php echo esc_attr( __( 'Width 150px, the micro style is useful when space is tight.', 'polldaddy' ) ); ?>',
|
| 2477 |
-
image_path : '<?php echo plugins_url( 'img', __FILE__ );?>'
|
| 2478 |
-
}
|
| 2479 |
-
pd_build_styles( current_pos );
|
| 2480 |
-
<?php if ( $style_ID > 0 && $style_ID <= 1000 ) { ?>
|
| 2481 |
-
pd_pick_style( <?php echo $style_ID ?> );
|
| 2482 |
-
<?php }else { ?>
|
| 2483 |
-
pd_change_style( <?php echo $style_ID ?> );
|
| 2484 |
-
<?php } ?>
|
| 2485 |
-
</script>
|
| 2486 |
-
</div>
|
| 2487 |
-
|
| 2488 |
-
</div>
|
| 2489 |
-
|
| 2490 |
-
</div>
|
| 2491 |
-
</div></div>
|
| 2492 |
-
</form>
|
| 2493 |
-
<br class="clear" />
|
| 2494 |
-
|
| 2495 |
-
<?php
|
| 2496 |
-
}
|
| 2497 |
-
|
| 2498 |
-
function poll_results_page( $poll_id ) {
|
| 2499 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 2500 |
-
$polldaddy->reset();
|
| 2501 |
-
|
| 2502 |
-
$results = $polldaddy->get_poll_results( $poll_id );
|
| 2503 |
-
$poll = $polldaddy->get_poll( $poll_id );
|
| 2504 |
-
|
| 2505 |
-
?>
|
| 2506 |
-
<h3 style="line-height:21px;"><?php echo $poll->question; ?></h3>
|
| 2507 |
-
<table class="poll-results widefat">
|
| 2508 |
-
<thead>
|
| 2509 |
-
<tr>
|
| 2510 |
-
<th scope="col" class="column-title" style="width:40%;"><?php _e( 'Answer', 'polldaddy' ); ?></th>
|
| 2511 |
-
<th scope="col" class="column-vote" style="width:10%;text-align:center;"><?php _e( 'Votes', 'polldaddy' ); ?></th>
|
| 2512 |
-
<th scope="col" class="column-vote" style="width:10%;text-align:center;"><?php _e( 'Percent', 'polldaddy' ); ?></th>
|
| 2513 |
-
<th scope="col" class="column-vote" style="width:40%;"> </th>
|
| 2514 |
-
</tr>
|
| 2515 |
-
</thead>
|
| 2516 |
-
<tbody>
|
| 2517 |
-
|
| 2518 |
-
<?php
|
| 2519 |
-
$class = '';
|
| 2520 |
-
foreach ( $results->answers as $answer ) :
|
| 2521 |
-
$answer->text = trim( strip_tags( $answer->text ) );
|
| 2522 |
-
if ( strlen( $answer->text ) == 0 ) {
|
| 2523 |
-
$answer->text = '-- empty HTML tag --';
|
| 2524 |
-
}
|
| 2525 |
-
|
| 2526 |
-
$class = $class ? '' : ' class="alternate"';
|
| 2527 |
-
$content = $results->others && 'Other answer…' === $answer->text ? sprintf( __( 'Other (<a href="%s">see below</a>)', 'polldaddy' ), '#other-answers-results' ) : esc_html( $answer->text );
|
| 2528 |
-
|
| 2529 |
-
?>
|
| 2530 |
-
|
| 2531 |
-
<tr<?php echo $class; ?>>
|
| 2532 |
-
<th scope="row" style="vertical-align:bottom" class="column-title"><?php echo $content; ?></th>
|
| 2533 |
-
<td class="column-vote" style="text-align:center;vertical-align:middle;">
|
| 2534 |
-
<?php echo number_format_i18n( $answer->_total ); ?>
|
| 2535 |
-
</td>
|
| 2536 |
-
<td style="text-align:center;vertical-align:middle;">
|
| 2537 |
-
<?php echo number_format_i18n( $answer->_percent ); ?>%
|
| 2538 |
-
</td>
|
| 2539 |
-
<td style="vertical-align:middle;">
|
| 2540 |
-
<span class="result-bar" style="width: <?php echo number_format( $answer->_percent, 2 ); ?>%;"> </span>
|
| 2541 |
-
</td>
|
| 2542 |
-
</tr>
|
| 2543 |
-
<?php
|
| 2544 |
-
endforeach;
|
| 2545 |
-
?>
|
| 2546 |
-
|
| 2547 |
-
</tbody>
|
| 2548 |
-
</table>
|
| 2549 |
-
|
| 2550 |
-
<?php
|
| 2551 |
-
|
| 2552 |
-
if ( !$results->others )
|
| 2553 |
-
return;
|
| 2554 |
-
?>
|
| 2555 |
-
|
| 2556 |
-
<table id="other-answers-results" class="poll-others widefat">
|
| 2557 |
-
<thead>
|
| 2558 |
-
<tr>
|
| 2559 |
-
<th scope="col" class="column-title"><?php _e( 'Other Answer', 'polldaddy' ); ?></th>
|
| 2560 |
-
<th scope="col" class="column-vote"><?php _e( 'Votes', 'polldaddy' ); ?></th>
|
| 2561 |
-
</tr>
|
| 2562 |
-
</thead>
|
| 2563 |
-
<tbody>
|
| 2564 |
-
|
| 2565 |
-
<?php
|
| 2566 |
-
$class = '';
|
| 2567 |
-
$others = array_count_values( $results->others );
|
| 2568 |
-
arsort( $others );
|
| 2569 |
-
foreach ( $others as $other => $freq ) :
|
| 2570 |
-
$class = $class ? '' : ' class="alternate"';
|
| 2571 |
-
?>
|
| 2572 |
-
|
| 2573 |
-
<tr<?php echo $class; ?>>
|
| 2574 |
-
<th scope="row" class="column-title"><?php echo esc_html( $other ); ?></th>
|
| 2575 |
-
<td class="column-vote"><?php echo number_format_i18n( $freq ); ?></td>
|
| 2576 |
-
</tr>
|
| 2577 |
-
<?php
|
| 2578 |
-
endforeach;
|
| 2579 |
-
?>
|
| 2580 |
-
|
| 2581 |
-
</tbody>
|
| 2582 |
-
</table>
|
| 2583 |
-
|
| 2584 |
-
<?php
|
| 2585 |
-
}
|
| 2586 |
-
|
| 2587 |
-
function styles_table() {
|
| 2588 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 2589 |
-
$polldaddy->reset();
|
| 2590 |
-
|
| 2591 |
-
$styles_object = $polldaddy->get_styles();
|
| 2592 |
-
|
| 2593 |
-
$this->parse_errors( $polldaddy );
|
| 2594 |
-
$this->print_errors();
|
| 2595 |
-
$styles = & $styles_object->style;
|
| 2596 |
-
$class = '';
|
| 2597 |
-
$styles_exist = false;
|
| 2598 |
-
|
| 2599 |
-
foreach ( (array)$styles as $style ) :
|
| 2600 |
-
if ( (int) $style->_type == 1 ):
|
| 2601 |
-
$styles_exist = true;
|
| 2602 |
-
break;
|
| 2603 |
-
endif;
|
| 2604 |
-
endforeach;
|
| 2605 |
-
?>
|
| 2606 |
-
|
| 2607 |
-
<form method="post" action="">
|
| 2608 |
-
<div class="tablenav">
|
| 2609 |
-
<div class="alignleft">
|
| 2610 |
-
<select name="action">
|
| 2611 |
-
<option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
|
| 2612 |
-
<option value="delete-style"><?php _e( 'Delete', 'polldaddy' ); ?></option>
|
| 2613 |
-
</select>
|
| 2614 |
-
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
|
| 2615 |
-
<?php wp_nonce_field( 'action-style_bulk' ); ?>
|
| 2616 |
-
</div>
|
| 2617 |
-
<div class="tablenav-pages"></div>
|
| 2618 |
-
</div>
|
| 2619 |
-
|
| 2620 |
-
<table class="widefat">
|
| 2621 |
-
<thead>
|
| 2622 |
-
<tr>
|
| 2623 |
-
<th id="cb" class="manage-column column-cb check-column" scope="col"><input type="checkbox" /></th>
|
| 2624 |
-
<th id="title" class="manage-column column-title" scope="col"><?php _e( 'Style', 'polldaddy' ); ?></th>
|
| 2625 |
-
<th id="date" class="manage-column column-date" scope="col"><?php _e( 'Last Modified', 'polldaddy' ); ?></th>
|
| 2626 |
-
</tr>
|
| 2627 |
-
</thead>
|
| 2628 |
-
<tbody>
|
| 2629 |
-
|
| 2630 |
-
<?php
|
| 2631 |
-
if ( $styles_exist ) :
|
| 2632 |
-
foreach ( $styles as $style ) :
|
| 2633 |
-
if ( (int) $style->_type == 1 ):
|
| 2634 |
-
$style_id = (int) $style->_id;
|
| 2635 |
-
|
| 2636 |
-
$class = $class ? '' : ' class="alternate"';
|
| 2637 |
-
$edit_link = esc_url( add_query_arg( array( 'action' => 'edit-style', 'style' => $style_id, 'message' => false ) ) );
|
| 2638 |
-
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-style', 'style' => $style_id, 'message' => false ) ), "delete-style_$style_id" ) );
|
| 2639 |
-
list( $style_time ) = explode( '.', $style->date );
|
| 2640 |
-
$style_time = strtotime( $style_time );
|
| 2641 |
-
?>
|
| 2642 |
-
|
| 2643 |
-
<tr<?php echo $class; ?>>
|
| 2644 |
-
<th class="check-column" scope="row"><input type="checkbox" value="<?php echo (int) $style_id; ?>" name="style[]" /></th>
|
| 2645 |
-
<td class="post-title column-title">
|
| 2646 |
-
<?php if ( $edit_link ) : ?>
|
| 2647 |
-
<strong><a class="row-title" href="<?php echo $edit_link; ?>"><?php echo esc_html( $style->title ); ?></a></strong>
|
| 2648 |
-
<div class="row-actions">
|
| 2649 |
-
<span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a> | </span>
|
| 2650 |
-
<?php else : ?>
|
| 2651 |
-
<strong><?php echo esc_html( $style->title ); ?></strong>
|
| 2652 |
-
<?php endif; ?>
|
| 2653 |
-
|
| 2654 |
-
<span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
|
| 2655 |
-
</div>
|
| 2656 |
-
</td>
|
| 2657 |
-
<td class="date column-date"><abbr title="<?php echo date( __( 'Y/m/d g:i:s A', 'polldaddy' ), $style_time ); ?>"><?php echo date( __( 'Y/m/d', 'polldaddy' ), $style_time ); ?></abbr></td>
|
| 2658 |
-
</tr>
|
| 2659 |
-
|
| 2660 |
-
<?php
|
| 2661 |
-
endif;
|
| 2662 |
-
endforeach;
|
| 2663 |
-
else : // $styles
|
| 2664 |
-
?>
|
| 2665 |
-
|
| 2666 |
-
<tr>
|
| 2667 |
-
<td colspan="4" id="empty-set">
|
| 2668 |
-
|
| 2669 |
-
<h3 style="margin-bottom:0px;"><?php _e( 'You haven\'t used our fancy style editor to create any custom styles!', 'polldaddy');?> </h3>
|
| 2670 |
-
<p style="margin-bottom:20px;"><?php _e( 'Why don\'t you go ahead and get started on that?', 'polldaddy' ); ?></p>
|
| 2671 |
-
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'create-style' ) ) ); ?>" class="button-primary"><?php _e( 'Create a Custom Style Now', 'polldaddy' ); ?></a>
|
| 2672 |
-
|
| 2673 |
-
</td>
|
| 2674 |
-
</tr>
|
| 2675 |
-
<?php endif; // $styles ?>
|
| 2676 |
-
|
| 2677 |
-
</tbody>
|
| 2678 |
-
</table>
|
| 2679 |
-
</form>
|
| 2680 |
-
<div class="tablenav">
|
| 2681 |
-
<div class="tablenav-pages"></div>
|
| 2682 |
-
</div>
|
| 2683 |
-
<br class="clear" />
|
| 2684 |
-
|
| 2685 |
-
<?php
|
| 2686 |
-
}
|
| 2687 |
-
|
| 2688 |
-
function style_edit_form( $style_id = 105 ) {
|
| 2689 |
-
$style_id = (int) $style_id;
|
| 2690 |
-
|
| 2691 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 2692 |
-
$polldaddy->reset();
|
| 2693 |
-
|
| 2694 |
-
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 2695 |
-
|
| 2696 |
-
if ( $style_id ) {
|
| 2697 |
-
$style = $polldaddy->get_style( $style_id );
|
| 2698 |
-
$this->parse_errors( $polldaddy );
|
| 2699 |
-
} else {
|
| 2700 |
-
$style = polldaddy_style( array(), null, false );
|
| 2701 |
-
}
|
| 2702 |
-
|
| 2703 |
-
$style->css = trim( urldecode( $style->css ) );
|
| 2704 |
-
|
| 2705 |
-
$direction = 'ltr';
|
| 2706 |
-
if ( in_array( $style->_direction, array( 'ltr', 'rtl') ) )
|
| 2707 |
-
$direction = $style->_direction;
|
| 2708 |
-
|
| 2709 |
-
if ( $start = stripos( $style->css, '<data>' ) )
|
| 2710 |
-
$style->css = substr( $style->css, $start );
|
| 2711 |
-
|
| 2712 |
-
$style->css = addslashes( $style->css );
|
| 2713 |
-
|
| 2714 |
-
$preload_style_id = 0;
|
| 2715 |
-
$preload_style = null;
|
| 2716 |
-
|
| 2717 |
-
if ( isset ( $_REQUEST['preload'] ) ) {
|
| 2718 |
-
$preload_style_id = (int) $_REQUEST['preload'];
|
| 2719 |
-
|
| 2720 |
-
if ( $preload_style_id > 1000 || $preload_style_id < 100 )
|
| 2721 |
-
$preload_style_id = 0;
|
| 2722 |
-
|
| 2723 |
-
if ( $preload_style_id > 0 ) {
|
| 2724 |
-
$polldaddy->reset();
|
| 2725 |
-
$preload_style = $polldaddy->get_style( $preload_style_id );
|
| 2726 |
-
$this->parse_errors( $polldaddy );
|
| 2727 |
-
}
|
| 2728 |
-
|
| 2729 |
-
$preload_style->css = trim( urldecode( $preload_style->css ) );
|
| 2730 |
-
|
| 2731 |
-
if ( $start = stripos( $preload_style->css, '<data>' ) )
|
| 2732 |
-
$preload_style->css = substr( $preload_style->css, $start );
|
| 2733 |
-
|
| 2734 |
-
$style->css = addslashes( $preload_style->css );
|
| 2735 |
-
}
|
| 2736 |
-
|
| 2737 |
-
$this->print_errors();
|
| 2738 |
-
|
| 2739 |
-
echo '<script language="javascript">var CSSXMLString = "' . $style->css .'";</script>';
|
| 2740 |
-
?>
|
| 2741 |
-
|
| 2742 |
-
<form action="" method="post">
|
| 2743 |
-
<div id="poststuff">
|
| 2744 |
-
<div id="post-body">
|
| 2745 |
-
<br/>
|
| 2746 |
-
<table>
|
| 2747 |
-
<tr>
|
| 2748 |
-
<td class="pd-editor-label">
|
| 2749 |
-
<label class="CSSE_title_label"><?php _e( 'Style Name', 'polldaddy' ); ?></label>
|
| 2750 |
-
</td>
|
| 2751 |
-
<td>
|
| 2752 |
-
<div id="titlediv" style="margin:0px;">
|
| 2753 |
-
<div id="titlewrap">
|
| 2754 |
-
<input type="text" autocomplete="off" value="<?php echo $style_id > 1000 ? $style->title : ''; ?>" tabindex="1" style="width:25em;" name="style-title" />
|
| 2755 |
-
</div>
|
| 2756 |
-
</div>
|
| 2757 |
-
</td>
|
| 2758 |
-
</tr>
|
| 2759 |
-
<tr>
|
| 2760 |
-
<td class="pd-editor-label">
|
| 2761 |
-
<label class="CSSE_title_label"><?php _e( 'Preload Basic Style', 'polldaddy' ); ?></label>
|
| 2762 |
-
</td>
|
| 2763 |
-
<td>
|
| 2764 |
-
<div class="CSSE_preload">
|
| 2765 |
-
<select id="preload_value">
|
| 2766 |
-
<option value="0"></option>
|
| 2767 |
-
<option value="102"><?php _e( 'Aluminum', 'polldaddy' ); ?></option>
|
| 2768 |
-
<option value="105"><?php _e( 'Plain White', 'polldaddy' ); ?></option>
|
| 2769 |
-
<option value="108"><?php _e( 'Plain Black', 'polldaddy' ); ?></option>
|
| 2770 |
-
<option value="111"><?php _e( 'Paper', 'polldaddy' ); ?></option>
|
| 2771 |
-
<option value="114"><?php _e( 'Skull Dark', 'polldaddy' ); ?></option>
|
| 2772 |
-
<option value="117"><?php _e( 'Skull Light', 'polldaddy' ); ?></option>
|
| 2773 |
-
<option value="157"><?php _e( 'Micro', 'polldaddy' ); ?></option>
|
| 2774 |
-
</select>
|
| 2775 |
-
<a tabindex="4" id="style-preload" href="javascript:preload_style();" class="button"><?php echo esc_attr( __( 'Load Style', 'polldaddy' ) ); ?></a>
|
| 2776 |
-
</div>
|
| 2777 |
-
</td>
|
| 2778 |
-
</tr>
|
| 2779 |
-
<tr>
|
| 2780 |
-
<td class="pd-editor-label">
|
| 2781 |
-
<label class="CSSE_title_label"><?php _e( 'Text Direction', 'polldaddy' ); ?></label>
|
| 2782 |
-
</td>
|
| 2783 |
-
<td>
|
| 2784 |
-
<div class="CSSE_rtl_ltr">
|
| 2785 |
-
<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>
|
| 2786 |
-
<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>
|
| 2787 |
-
</div>
|
| 2788 |
-
</td>
|
| 2789 |
-
</tr>
|
| 2790 |
-
</table>
|
| 2791 |
-
|
| 2792 |
-
<h3><?php _e( 'Style Editor', 'polldaddy' ); ?></h3>
|
| 2793 |
-
|
| 2794 |
-
<table>
|
| 2795 |
-
<tr>
|
| 2796 |
-
<td class="pd-editor-label"><label for="styleName"><?php _e( 'Select a template part to edit:' ); ?></label></td>
|
| 2797 |
-
<td>
|
| 2798 |
-
<select id="styleName" onchange="renderStyleEdit(this.value);">
|
| 2799 |
-
<option value="pds-box" selected="selected"><?php _e( 'Poll Box', 'polldaddy' ); ?></option>
|
| 2800 |
-
<option value="pds-question-top"><?php _e( 'Question', 'polldaddy' ); ?></option>
|
| 2801 |
-
<option value="pds-answer-group"><?php _e( 'Answer Group', 'polldaddy' ); ?></option>
|
| 2802 |
-
<option value="pds-answer-input"><?php _e( 'Answer Check', 'polldaddy' ); ?></option>
|
| 2803 |
-
<option value="pds-answer"><?php _e( 'Answers', 'polldaddy' ); ?></option>
|
| 2804 |
-
<option value="pds-textfield"><?php _e( 'Other Input', 'polldaddy' ); ?></option>
|
| 2805 |
-
<option value="pds-vote-button"><?php _e( 'Vote Button', 'polldaddy' ); ?></option>
|
| 2806 |
-
<option value="pds-link"><?php _e( 'Links', 'polldaddy' ); ?></option>
|
| 2807 |
-
<option value="pds-feedback-group"><?php _e( 'Feedback Group', 'polldaddy' ); ?></option>
|
| 2808 |
-
<option value="pds-feedback-result"><?php _e( 'Results Group', 'polldaddy' ); ?></option>
|
| 2809 |
-
<option value="pds-feedback-per"><?php _e( 'Results Percent', 'polldaddy' ); ?></option>
|
| 2810 |
-
<option value="pds-feedback-votes"><?php _e( 'Results Votes', 'polldaddy' ); ?></option>
|
| 2811 |
-
<option value="pds-answer-text"><?php _e( 'Results Text', 'polldaddy' ); ?></option>
|
| 2812 |
-
<option value="pds-answer-feedback"><?php _e( 'Results Background', 'polldaddy' ); ?></option>
|
| 2813 |
-
<option value="pds-answer-feedback-bar"><?php _e( 'Results Bar', 'polldaddy' ); ?></option>
|
| 2814 |
-
<option value="pds-totalvotes-inner"><?php _e( 'Total Votes', 'polldaddy' ); ?></option>
|
| 2815 |
-
</select>
|
| 2816 |
-
|
| 2817 |
-
</td>
|
| 2818 |
-
</tr>
|
| 2819 |
-
|
| 2820 |
-
</table>
|
| 2821 |
-
|
| 2822 |
-
|
| 2823 |
-
<table width="100%">
|
| 2824 |
-
<tr>
|
| 2825 |
-
<td valign="top">
|
| 2826 |
-
<table class="CSSE_main">
|
| 2827 |
-
<tr>
|
| 2828 |
-
<td class="CSSE_main_l" valign="top">
|
| 2829 |
-
<div class="off" id="D_Font">
|
| 2830 |
-
<a href="javascript:CSSE_changeView('Font');" id="A_Font" class="Aoff"><?php _e( 'Font', 'polldaddy' ); ?></a>
|
| 2831 |
-
</div>
|
| 2832 |
-
<div class="on" id="D_Background">
|
| 2833 |
-
<a href="javascript:CSSE_changeView('Background');" id="A_Background" class="Aon"><?php _e( 'Background', 'polldaddy' ); ?></a>
|
| 2834 |
-
</div>
|
| 2835 |
-
<div class="off" id="D_Border">
|
| 2836 |
-
<a href="javascript:CSSE_changeView('Border');" id="A_Border" class="Aoff"><?php _e( 'Border', 'polldaddy' ); ?></a>
|
| 2837 |
-
</div>
|
| 2838 |
-
<div class="off" id="D_Margin">
|
| 2839 |
-
<a href="javascript:CSSE_changeView('Margin');" id="A_Margin" class="Aoff"><?php _e( 'Margin', 'polldaddy' ); ?></a>
|
| 2840 |
-
</div>
|
| 2841 |
-
<div class="off" id="D_Padding">
|
| 2842 |
-
<a href="javascript:CSSE_changeView('Padding');" id="A_Padding" class="Aoff"><?php _e( 'Padding', 'polldaddy' ); ?></a>
|
| 2843 |
-
</div>
|
| 2844 |
-
<div class="off" id="D_Scale">
|
| 2845 |
-
<a href="javascript:CSSE_changeView('Scale');" id="A_Scale" class="Aoff"><?php _e( 'Width', 'polldaddy' ); ?></a>
|
| 2846 |
-
</div>
|
| 2847 |
-
<div class="off" id="D_Height">
|
| 2848 |
-
<a href="javascript:CSSE_changeView('Height');" id="A_Height" class="Aoff"><?php _e( 'Height', 'polldaddy' ); ?></a>
|
| 2849 |
-
</div>
|
| 2850 |
-
<div class="off" id="D_Position">
|
| 2851 |
-
<a href="javascript:CSSE_changeView('Position');" id="A_Position" class="Aoff"><?php _e( 'Position', 'polldaddy' ); ?></a>
|
| 2852 |
-
</div>
|
| 2853 |
-
</td>
|
| 2854 |
-
<td class="CSSE_main_r" valign="top">
|
| 2855 |
-
<table class="CSSE_sub">
|
| 2856 |
-
<tr>
|
| 2857 |
-
<td class="top"/>
|
| 2858 |
-
</tr>
|
| 2859 |
-
<tr>
|
| 2860 |
-
<td class="mid">
|
| 2861 |
-
<!-- Font Table -->
|
| 2862 |
-
<table class="CSSE_edit" id="editFont" style="display:none;">
|
| 2863 |
-
<tr>
|
| 2864 |
-
<td width="85"><?php _e( 'Font Size', 'polldaddy' ); ?>:</td>
|
| 2865 |
-
<td>
|
| 2866 |
-
<select id="font-size" onchange="bind(this);">
|
| 2867 |
-
<option value="6px">6px</option>
|
| 2868 |
-
<option value="8px">8px</option>
|
| 2869 |
-
<option value="9px">9px</option>
|
| 2870 |
-
<option value="10px">10px</option>
|
| 2871 |
-
<option value="11px">11px</option>
|
| 2872 |
-
<option value="12px">12px</option>
|
| 2873 |
-
<option value="13px">13px</option>
|
| 2874 |
-
<option value="14px">14px</option>
|
| 2875 |
-
<option value="15px">15px</option>
|
| 2876 |
-
<option value="16px">16px</option>
|
| 2877 |
-
<option value="18px">18px</option>
|
| 2878 |
-
<option value="20px">20px</option>
|
| 2879 |
-
<option value="24px">24px</option>
|
| 2880 |
-
<option value="30px">30px</option>
|
| 2881 |
-
<option value="36px">36px</option>
|
| 2882 |
-
</select>
|
| 2883 |
-
</td>
|
| 2884 |
-
</tr>
|
| 2885 |
-
<tr>
|
| 2886 |
-
<td><?php _e( 'Font Size', 'polldaddy' ); ?></td>
|
| 2887 |
-
<td>
|
| 2888 |
-
<select id="font-family" onchange="bind(this);">
|
| 2889 |
-
<option value="Arial">Arial</option>
|
| 2890 |
-
<option value="Comic Sans MS">Comic Sans MS</option>
|
| 2891 |
-
<option value="Courier">Courier</option>
|
| 2892 |
-
<option value="Georgia">Georgia</option>
|
| 2893 |
-
<option value="Lucida Grande">Lucida Grande</option>
|
| 2894 |
-
<option value="Trebuchet MS">Trebuchet MS</option>
|
| 2895 |
-
<option value="Times">Times</option>
|
| 2896 |
-
<option value="Verdana">Verdana</option>
|
| 2897 |
-
</select>
|
| 2898 |
-
</td>
|
| 2899 |
-
</tr>
|
| 2900 |
-
<tr>
|
| 2901 |
-
<td><?php _e( 'Color', 'polldaddy' ); ?> (#hex):</td>
|
| 2902 |
-
<td>
|
| 2903 |
-
<input type="text" maxlength="11" id="color" class="elmColor jscolor-picker" onblur="bind(this);" style="float:left;"/>
|
| 2904 |
-
</td>
|
| 2905 |
-
</tr>
|
| 2906 |
-
<tr>
|
| 2907 |
-
<td><?php _e( 'Bold', 'polldaddy' ); ?>:</td>
|
| 2908 |
-
<td>
|
| 2909 |
-
<input type="checkbox" id="font-weight" value="bold" onclick="bind(this);"/>
|
| 2910 |
-
</td>
|
| 2911 |
-
</tr>
|
| 2912 |
-
<tr>
|
| 2913 |
-
<td><?php _e( 'Italic', 'polldaddy' ); ?>:</td>
|
| 2914 |
-
<td>
|
| 2915 |
-
<input type="checkbox" id="font-style" value="italic" onclick="bind(this);"/>
|
| 2916 |
-
</td>
|
| 2917 |
-
</tr>
|
| 2918 |
-
<tr>
|
| 2919 |
-
<td><?php _e( 'Underline', 'polldaddy' ); ?>:</td>
|
| 2920 |
-
<td>
|
| 2921 |
-
<input type="checkbox" id="text-decoration" value="underline" onclick="bind(this);"/>
|
| 2922 |
-
</td>
|
| 2923 |
-
</tr>
|
| 2924 |
-
<tr>
|
| 2925 |
-
<td><?php _e( 'Line Height', 'polldaddy' ); ?>:</td>
|
| 2926 |
-
<td>
|
| 2927 |
-
<select id="line-height" onchange="bind(this);">
|
| 2928 |
-
<option value="6px">6px</option>
|
| 2929 |
-
<option value="8px">8px</option>
|
| 2930 |
-
<option value="9px">9px</option>
|
| 2931 |
-
<option value="10px">10px</option>
|
| 2932 |
-
<option value="11px">11px</option>
|
| 2933 |
-
<option value="12px">12px</option>
|
| 2934 |
-
<option value="13px">13px</option>
|
| 2935 |
-
<option value="14px">14px</option>
|
| 2936 |
-
<option value="15px">15px</option>
|
| 2937 |
-
<option value="16px">16px</option>
|
| 2938 |
-
<option value="18px">18px</option>
|
| 2939 |
-
<option value="20px">20px</option>
|
| 2940 |
-
<option value="24px">24px</option>
|
| 2941 |
-
<option value="30px">30px</option>
|
| 2942 |
-
<option value="36px">36px</option>
|
| 2943 |
-
</select>
|
| 2944 |
-
</td>
|
| 2945 |
-
</tr>
|
| 2946 |
-
<tr>
|
| 2947 |
-
<td><?php _e( 'Align', 'polldaddy' ); ?>:</td>
|
| 2948 |
-
<td>
|
| 2949 |
-
<select id="text-align" onchange="bind(this);">
|
| 2950 |
-
<option value="left"><?php _e( 'Left', 'polldaddy' ); ?></option>
|
| 2951 |
-
<option value="center"><?php _e( 'Center', 'polldaddy' ); ?></option>
|
| 2952 |
-
<option value="right"><?php _e( 'Right', 'polldaddy' ); ?></option>
|
| 2953 |
-
</select>
|
| 2954 |
-
</td>
|
| 2955 |
-
</tr>
|
| 2956 |
-
</table>
|
| 2957 |
-
<!-- Background Table -->
|
| 2958 |
-
<table class="CSSE_edit" id="editBackground" style="display:none;">
|
| 2959 |
-
<tr>
|
| 2960 |
-
<td width="85"><?php _e( 'Color', 'polldaddy' ); ?> (#hex):</td>
|
| 2961 |
-
<td>
|
| 2962 |
-
<input type="text" maxlength="11" id="background-color" class="elmColor jscolor-picker" onblur="bind(this);"/>
|
| 2963 |
-
</td>
|
| 2964 |
-
</tr>
|
| 2965 |
-
<tr>
|
| 2966 |
-
<td><?php _e( 'Image URL', 'polldaddy' ); ?>: <a href="http://support.polldaddy.com/custom-poll-styles/" class="noteLink" title="<?php _e( 'Click here for more information', 'polldaddy' ); ?>">(?)</a></td>
|
| 2967 |
-
<td>
|
| 2968 |
-
<input type="text" id="background-image" onblur="bind(this);"/>
|
| 2969 |
-
</td>
|
| 2970 |
-
</tr>
|
| 2971 |
-
<tr>
|
| 2972 |
-
<td><?php _e( 'Image Repeat', 'polldaddy' ); ?>:</td>
|
| 2973 |
-
<td>
|
| 2974 |
-
<select id="background-repeat" onchange="bind(this);">
|
| 2975 |
-
<option value="repeat"><?php _e( 'repeat', 'polldaddy' ); ?></option>
|
| 2976 |
-
<option value="no-repeat"><?php _e( 'no-repeat', 'polldaddy' ); ?></option>
|
| 2977 |
-
<option value="repeat-x"><?php _e( 'repeat-x', 'polldaddy' ); ?></option>
|
| 2978 |
-
<option value="repeat-y"><?php _e( 'repeat-y', 'polldaddy' ); ?></option>
|
| 2979 |
-
</select>
|
| 2980 |
-
</td>
|
| 2981 |
-
</tr>
|
| 2982 |
-
<tr>
|
| 2983 |
-
<td><?php _e( 'Image Position', 'polldaddy' ); ?>:</td>
|
| 2984 |
-
<td>
|
| 2985 |
-
<select id="background-position" onchange="bind(this);">
|
| 2986 |
-
<option value="left top"><?php _e( 'left top', 'polldaddy' ); ?></option>
|
| 2987 |
-
<option value="left center"><?php _e( 'left center', 'polldaddy' ); ?></option>
|
| 2988 |
-
<option value="left bottom"><?php _e( 'left bottom', 'polldaddy' ); ?></option>
|
| 2989 |
-
<option value="center top"><?php _e( 'center top', 'polldaddy' ); ?></option>
|
| 2990 |
-
<option value="center center"><?php _e( 'center center', 'polldaddy' ); ?></option>
|
| 2991 |
-
<option value="center bottom"><?php _e( 'center bottom', 'polldaddy' ); ?></option>
|
| 2992 |
-
<option value="right top"><?php _e( 'right top', 'polldaddy' ); ?></option>
|
| 2993 |
-
<option value="right center"><?php _e( 'right center', 'polldaddy' ); ?></option>
|
| 2994 |
-
<option value="right bottom"><?php _e( 'right bottom', 'polldaddy' ); ?></option>
|
| 2995 |
-
</select>
|
| 2996 |
-
</td>
|
| 2997 |
-
</tr>
|
| 2998 |
-
</table>
|
| 2999 |
-
<!-- Border Table -->
|
| 3000 |
-
<table class="CSSE_edit" id="editBorder" style="display:none;">
|
| 3001 |
-
<tr>
|
| 3002 |
-
<td width="85"><?php _e( 'Width', 'polldaddy' ); ?>:</td>
|
| 3003 |
-
<td>
|
| 3004 |
-
<select id="border-width" onchange="bind(this);">
|
| 3005 |
-
<option value="0px">0px</option>
|
| 3006 |
-
<option value="1px">1px</option>
|
| 3007 |
-
<option value="2px">2px</option>
|
| 3008 |
-
<option value="3px">3px</option>
|
| 3009 |
-
<option value="4px">4px</option>
|
| 3010 |
-
<option value="5px">5px</option>
|
| 3011 |
-
<option value="6px">6px</option>
|
| 3012 |
-
<option value="7px">7px</option>
|
| 3013 |
-
<option value="8px">8px</option>
|
| 3014 |
-
<option value="9px">9px</option>
|
| 3015 |
-
<option value="10px">10px</option>
|
| 3016 |
-
<option value="11px">11px</option>
|
| 3017 |
-
<option value="12px">12px</option>
|
| 3018 |
-
<option value="13px">13px</option>
|
| 3019 |
-
<option value="14px">14px</option>
|
| 3020 |
-
<option value="15px">15px</option>
|
| 3021 |
-
<option value="16px">16px</option>
|
| 3022 |
-
<option value="17px">17px</option>
|
| 3023 |
-
<option value="18px">18px</option>
|
| 3024 |
-
<option value="19px">19px</option>
|
| 3025 |
-
<option value="20px">20px</option>
|
| 3026 |
-
<option value="21px">21px</option>
|
| 3027 |
-
<option value="22px">22px</option>
|
| 3028 |
-
<option value="23px">23px</option>
|
| 3029 |
-
<option value="24px">24px</option>
|
| 3030 |
-
<option value="25px">25px</option>
|
| 3031 |
-
<option value="26px">26px</option>
|
| 3032 |
-
<option value="27px">27px</option>
|
| 3033 |
-
<option value="28px">28px</option>
|
| 3034 |
-
<option value="29px">29px</option>
|
| 3035 |
-
<option value="30px">30px</option>
|
| 3036 |
-
</select>
|
| 3037 |
-
</td>
|
| 3038 |
-
</tr>
|
| 3039 |
-
<tr>
|
| 3040 |
-
<td><?php _e( 'Style', 'polldaddy' ); ?>:</td>
|
| 3041 |
-
<td>
|
| 3042 |
-
<select id="border-style" onchange="bind(this);">
|
| 3043 |
-
<option value="none"><?php _e( 'none', 'polldaddy' ); ?></option>
|
| 3044 |
-
<option value="solid"><?php _e( 'solid', 'polldaddy' ); ?></option>
|
| 3045 |
-
<option value="dotted"><?php _e( 'dotted', 'polldaddy' ); ?></option>
|
| 3046 |
-
<option value="dashed"><?php _e( 'dashed', 'polldaddy' ); ?></option>
|
| 3047 |
-
<option value="double"><?php _e( 'double', 'polldaddy' ); ?></option>
|
| 3048 |
-
<option value="groove"><?php _e( 'groove', 'polldaddy' ); ?></option>
|
| 3049 |
-
<option value="inset"><?php _e( 'inset', 'polldaddy' ); ?></option>
|
| 3050 |
-
<option value="outset"><?php _e( 'outset', 'polldaddy' ); ?></option>
|
| 3051 |
-
<option value="ridge"><?php _e( 'ridge', 'polldaddy' ); ?></option>
|
| 3052 |
-
<option value="hidden"><?php _e( 'hidden', 'polldaddy' ); ?></option>
|
| 3053 |
-
</select>
|
| 3054 |
-
</td>
|
| 3055 |
-
</tr>
|
| 3056 |
-
<tr>
|
| 3057 |
-
<td><?php _e( 'Color', 'polldaddy' ); ?> (#hex):</td>
|
| 3058 |
-
<td>
|
| 3059 |
-
<input type="text" maxlength="11" class="elmColor jscolor-picker" id="border-color" onblur="bind(this);"/>
|
| 3060 |
-
</td>
|
| 3061 |
-
</tr>
|
| 3062 |
-
<tr>
|
| 3063 |
-
<td width="85"><?php _e( 'Rounded Corners', 'polldaddy' ); ?>:</td>
|
| 3064 |
-
<td>
|
| 3065 |
-
<select id="border-radius" onchange="bind(this);">
|
| 3066 |
-
<option value="0px">0px</option>
|
| 3067 |
-
<option value="1px">1px</option>
|
| 3068 |
-
<option value="2px">2px</option>
|
| 3069 |
-
<option value="3px">3px</option>
|
| 3070 |
-
<option value="4px">4px</option>
|
| 3071 |
-
<option value="5px">5px</option>
|
| 3072 |
-
<option value="6px">6px</option>
|
| 3073 |
-
<option value="7px">7px</option>
|
| 3074 |
-
<option value="8px">8px</option>
|
| 3075 |
-
<option value="9px">9px</option>
|
| 3076 |
-
<option value="10px">10px</option>
|
| 3077 |
-
<option value="11px">11px</option>
|
| 3078 |
-
<option value="12px">12px</option>
|
| 3079 |
-
<option value="13px">13px</option>
|
| 3080 |
-
<option value="14px">14px</option>
|
| 3081 |
-
<option value="15px">15px</option>
|
| 3082 |
-
<option value="16px">16px</option>
|
| 3083 |
-
<option value="17px">17px</option>
|
| 3084 |
-
<option value="18px">18px</option>
|
| 3085 |
-
<option value="19px">19px</option>
|
| 3086 |
-
<option value="20px">20px</option>
|
| 3087 |
-
<option value="21px">21px</option>
|
| 3088 |
-
<option value="22px">22px</option>
|
| 3089 |
-
<option value="23px">23px</option>
|
| 3090 |
-
<option value="24px">24px</option>
|
| 3091 |
-
<option value="25px">25px</option>
|
| 3092 |
-
<option value="26px">26px</option>
|
| 3093 |
-
<option value="27px">27px</option>
|
| 3094 |
-
<option value="28px">28px</option>
|
| 3095 |
-
<option value="29px">29px</option>
|
| 3096 |
-
<option value="30px">30px</option>
|
| 3097 |
-
</select>
|
| 3098 |
-
<br/>
|
| 3099 |
-
<?php _e( 'Not supported in Internet Explorer.', 'polldaddy' ); ?>
|
| 3100 |
-
</td>
|
| 3101 |
-
</tr>
|
| 3102 |
-
</table>
|
| 3103 |
-
<!-- Margin Table -->
|
| 3104 |
-
<table class="CSSE_edit" id="editMargin" style="display:none;">
|
| 3105 |
-
<tr>
|
| 3106 |
-
<td width="85"><?php _e( 'Top', 'polldaddy' ); ?>: </td>
|
| 3107 |
-
<td>
|
| 3108 |
-
<select id="margin-top" onchange="bind(this);">
|
| 3109 |
-
<option value="0px">0px</option>
|
| 3110 |
-
<option value="1px">1px</option>
|
| 3111 |
-
<option value="2px">2px</option>
|
| 3112 |
-
<option value="3px">3px</option>
|
| 3113 |
-
<option value="4px">4px</option>
|
| 3114 |
-
<option value="5px">5px</option>
|
| 3115 |
-
<option value="6px">6px</option>
|
| 3116 |
-
<option value="7px">7px</option>
|
| 3117 |
-
<option value="8px">8px</option>
|
| 3118 |
-
<option value="9px">9px</option>
|
| 3119 |
-
<option value="10px">10px</option>
|
| 3120 |
-
<option value="11px">11px</option>
|
| 3121 |
-
<option value="12px">12px</option>
|
| 3122 |
-
<option value="13px">13px</option>
|
| 3123 |
-
<option value="14px">14px</option>
|
| 3124 |
-
<option value="15px">15px</option>
|
| 3125 |
-
<option value="16px">16px</option>
|
| 3126 |
-
<option value="17px">17px</option>
|
| 3127 |
-
<option value="18px">18px</option>
|
| 3128 |
-
<option value="19px">19px</option>
|
| 3129 |
-
<option value="20px">20px</option>
|
| 3130 |
-
<option value="21px">21px</option>
|
| 3131 |
-
<option value="22px">22px</option>
|
| 3132 |
-
<option value="23px">23px</option>
|
| 3133 |
-
<option value="24px">24px</option>
|
| 3134 |
-
<option value="25px">25px</option>
|
| 3135 |
-
<option value="26px">26px</option>
|
| 3136 |
-
<option value="27px">27px</option>
|
| 3137 |
-
<option value="28px">28px</option>
|
| 3138 |
-
<option value="29px">29px</option>
|
| 3139 |
-
<option value="30px">30px</option>
|
| 3140 |
-
</select>
|
| 3141 |
-
</td>
|
| 3142 |
-
</tr>
|
| 3143 |
-
<tr>
|
| 3144 |
-
<td><?php _e( 'Right', 'polldaddy' ); ?>:</td>
|
| 3145 |
-
<td>
|
| 3146 |
-
<select id="margin-right" onchange="bind(this);">
|
| 3147 |
-
<option value="0px">0px</option>
|
| 3148 |
-
<option value="1px">1px</option>
|
| 3149 |
-
<option value="2px">2px</option>
|
| 3150 |
-
<option value="3px">3px</option>
|
| 3151 |
-
<option value="4px">4px</option>
|
| 3152 |
-
<option value="5px">5px</option>
|
| 3153 |
-
<option value="6px">6px</option>
|
| 3154 |
-
<option value="7px">7px</option>
|
| 3155 |
-
<option value="8px">8px</option>
|
| 3156 |
-
<option value="9px">9px</option>
|
| 3157 |
-
<option value="10px">10px</option>
|
| 3158 |
-
<option value="11px">11px</option>
|
| 3159 |
-
<option value="12px">12px</option>
|
| 3160 |
-
<option value="13px">13px</option>
|
| 3161 |
-
<option value="14px">14px</option>
|
| 3162 |
-
<option value="15px">15px</option>
|
| 3163 |
-
<option value="16px">16px</option>
|
| 3164 |
-
<option value="17px">17px</option>
|
| 3165 |
-
<option value="18px">18px</option>
|
| 3166 |
-
<option value="19px">19px</option>
|
| 3167 |
-
<option value="20px">20px</option>
|
| 3168 |
-
<option value="21px">21px</option>
|
| 3169 |
-
<option value="22px">22px</option>
|
| 3170 |
-
<option value="23px">23px</option>
|
| 3171 |
-
<option value="24px">24px</option>
|
| 3172 |
-
<option value="25px">25px</option>
|
| 3173 |
-
<option value="26px">26px</option>
|
| 3174 |
-
<option value="27px">27px</option>
|
| 3175 |
-
<option value="28px">28px</option>
|
| 3176 |
-
<option value="29px">29px</option>
|
| 3177 |
-
<option value="30px">30px</option>
|
| 3178 |
-
</select>
|
| 3179 |
-
</td>
|
| 3180 |
-
</tr>
|
| 3181 |
-
<tr>
|
| 3182 |
-
<td><?php _e( 'Bottom', 'polldaddy' ); ?>:</td>
|
| 3183 |
-
<td>
|
| 3184 |
-
<select id="margin-bottom" onchange="bind(this);">
|
| 3185 |
-
<option value="0px">0px</option>
|
| 3186 |
-
<option value="1px">1px</option>
|
| 3187 |
-
<option value="2px">2px</option>
|
| 3188 |
-
<option value="3px">3px</option>
|
| 3189 |
-
<option value="4px">4px</option>
|
| 3190 |
-
<option value="5px">5px</option>
|
| 3191 |
-
<option value="6px">6px</option>
|
| 3192 |
-
<option value="7px">7px</option>
|
| 3193 |
-
<option value="8px">8px</option>
|
| 3194 |
-
<option value="9px">9px</option>
|
| 3195 |
-
<option value="10px">10px</option>
|
| 3196 |
-
<option value="11px">11px</option>
|
| 3197 |
-
<option value="12px">12px</option>
|
| 3198 |
-
<option value="13px">13px</option>
|
| 3199 |
-
<option value="14px">14px</option>
|
| 3200 |
-
<option value="15px">15px</option>
|
| 3201 |
-
<option value="16px">16px</option>
|
| 3202 |
-
<option value="17px">17px</option>
|
| 3203 |
-
<option value="18px">18px</option>
|
| 3204 |
-
<option value="19px">19px</option>
|
| 3205 |
-
<option value="20px">20px</option>
|
| 3206 |
-
<option value="21px">21px</option>
|
| 3207 |
-
<option value="22px">22px</option>
|
| 3208 |
-
<option value="23px">23px</option>
|
| 3209 |
-
<option value="24px">24px</option>
|
| 3210 |
-
<option value="25px">25px</option>
|
| 3211 |
-
<option value="26px">26px</option>
|
| 3212 |
-
<option value="27px">27px</option>
|
| 3213 |
-
<option value="28px">28px</option>
|
| 3214 |
-
<option value="29px">29px</option>
|
| 3215 |
-
<option value="30px">30px</option>
|
| 3216 |
-
</select>
|
| 3217 |
-
</td>
|
| 3218 |
-
</tr>
|
| 3219 |
-
<tr>
|
| 3220 |
-
<td><?php _e( 'Left', 'polldaddy' ); ?>:</td>
|
| 3221 |
-
<td>
|
| 3222 |
-
<select id="margin-left" onchange="bind(this);">
|
| 3223 |
-
<option value="0px">0px</option>
|
| 3224 |
-
<option value="1px">1px</option>
|
| 3225 |
-
<option value="2px">2px</option>
|
| 3226 |
-
<option value="3px">3px</option>
|
| 3227 |
-
<option value="4px">4px</option>
|
| 3228 |
-
<option value="5px">5px</option>
|
| 3229 |
-
<option value="6px">6px</option>
|
| 3230 |
-
<option value="7px">7px</option>
|
| 3231 |
-
<option value="8px">8px</option>
|
| 3232 |
-
<option value="9px">9px</option>
|
| 3233 |
-
<option value="10px">10px</option>
|
| 3234 |
-
<option value="11px">11px</option>
|
| 3235 |
-
<option value="12px">12px</option>
|
| 3236 |
-
<option value="13px">13px</option>
|
| 3237 |
-
<option value="14px">14px</option>
|
| 3238 |
-
<option value="15px">15px</option>
|
| 3239 |
-
<option value="16px">16px</option>
|
| 3240 |
-
<option value="17px">17px</option>
|
| 3241 |
-
<option value="18px">18px</option>
|
| 3242 |
-
<option value="19px">19px</option>
|
| 3243 |
-
<option value="20px">20px</option>
|
| 3244 |
-
<option value="21px">21px</option>
|
| 3245 |
-
<option value="22px">22px</option>
|
| 3246 |
-
<option value="23px">23px</option>
|
| 3247 |
-
<option value="24px">24px</option>
|
| 3248 |
-
<option value="25px">25px</option>
|
| 3249 |
-
<option value="26px">26px</option>
|
| 3250 |
-
<option value="27px">27px</option>
|
| 3251 |
-
<option value="28px">28px</option>
|
| 3252 |
-
<option value="29px">29px</option>
|
| 3253 |
-
<option value="30px">30px</option>
|
| 3254 |
-
</select>
|
| 3255 |
-
</td>
|
| 3256 |
-
</tr>
|
| 3257 |
-
</table>
|
| 3258 |
-
<!-- Padding Table -->
|
| 3259 |
-
<table class="CSSE_edit" id="editPadding" style="display:none;">
|
| 3260 |
-
<tr>
|
| 3261 |
-
<td width="85"><?php _e( 'Top', 'polldaddy' ); ?>:</td>
|
| 3262 |
-
<td>
|
| 3263 |
-
<select id="padding-top" onchange="bind(this);">
|
| 3264 |
-
<option value="0px">0px</option>
|
| 3265 |
-
<option value="1px">1px</option>
|
| 3266 |
-
<option value="2px">2px</option>
|
| 3267 |
-
<option value="3px">3px</option>
|
| 3268 |
-
<option value="4px">4px</option>
|
| 3269 |
-
<option value="5px">5px</option>
|
| 3270 |
-
<option value="6px">6px</option>
|
| 3271 |
-
<option value="7px">7px</option>
|
| 3272 |
-
<option value="8px">8px</option>
|
| 3273 |
-
<option value="9px">9px</option>
|
| 3274 |
-
<option value="10px">10px</option>
|
| 3275 |
-
<option value="11px">11px</option>
|
| 3276 |
-
<option value="12px">12px</option>
|
| 3277 |
-
<option value="13px">13px</option>
|
| 3278 |
-
<option value="14px">14px</option>
|
| 3279 |
-
<option value="15px">15px</option>
|
| 3280 |
-
<option value="16px">16px</option>
|
| 3281 |
-
<option value="17px">17px</option>
|
| 3282 |
-
<option value="18px">18px</option>
|
| 3283 |
-
<option value="19px">19px</option>
|
| 3284 |
-
<option value="20px">20px</option>
|
| 3285 |
-
<option value="21px">21px</option>
|
| 3286 |
-
<option value="22px">22px</option>
|
| 3287 |
-
<option value="23px">23px</option>
|
| 3288 |
-
<option value="24px">24px</option>
|
| 3289 |
-
<option value="25px">25px</option>
|
| 3290 |
-
<option value="26px">26px</option>
|
| 3291 |
-
<option value="27px">27px</option>
|
| 3292 |
-
<option value="28px">28px</option>
|
| 3293 |
-
<option value="29px">29px</option>
|
| 3294 |
-
<option value="30px">30px</option>
|
| 3295 |
-
</select>
|
| 3296 |
-
</td>
|
| 3297 |
-
</tr>
|
| 3298 |
-
<tr>
|
| 3299 |
-
<td><?php _e( 'Right', 'polldaddy' ); ?>:</td>
|
| 3300 |
-
<td>
|
| 3301 |
-
<select id="padding-right" onchange="bind(this);">
|
| 3302 |
-
<option value="0px">0px</option>
|
| 3303 |
-
<option value="1px">1px</option>
|
| 3304 |
-
<option value="2px">2px</option>
|
| 3305 |
-
<option value="3px">3px</option>
|
| 3306 |
-
<option value="4px">4px</option>
|
| 3307 |
-
<option value="5px">5px</option>
|
| 3308 |
-
<option value="6px">6px</option>
|
| 3309 |
-
<option value="7px">7px</option>
|
| 3310 |
-
<option value="8px">8px</option>
|
| 3311 |
-
<option value="9px">9px</option>
|
| 3312 |
-
<option value="10px">10px</option>
|
| 3313 |
-
<option value="11px">11px</option>
|
| 3314 |
-
<option value="12px">12px</option>
|
| 3315 |
-
<option value="13px">13px</option>
|
| 3316 |
-
<option value="14px">14px</option>
|
| 3317 |
-
<option value="15px">15px</option>
|
| 3318 |
-
<option value="16px">16px</option>
|
| 3319 |
-
<option value="17px">17px</option>
|
| 3320 |
-
<option value="18px">18px</option>
|
| 3321 |
-
<option value="19px">19px</option>
|
| 3322 |
-
<option value="20px">20px</option>
|
| 3323 |
-
<option value="21px">21px</option>
|
| 3324 |
-
<option value="22px">22px</option>
|
| 3325 |
-
<option value="23px">23px</option>
|
| 3326 |
-
<option value="24px">24px</option>
|
| 3327 |
-
<option value="25px">25px</option>
|
| 3328 |
-
<option value="26px">26px</option>
|
| 3329 |
-
<option value="27px">27px</option>
|
| 3330 |
-
<option value="28px">28px</option>
|
| 3331 |
-
<option value="29px">29px</option>
|
| 3332 |
-
<option value="30px">30px</option>
|
| 3333 |
-
</select>
|
| 3334 |
-
</td>
|
| 3335 |
-
</tr>
|
| 3336 |
-
<tr>
|
| 3337 |
-
<td><?php _e( 'Bottom', 'polldaddy' ); ?>:</td>
|
| 3338 |
-
<td>
|
| 3339 |
-
<select id="padding-bottom" onchange="bind(this);">
|
| 3340 |
-
<option value="0px">0px</option>
|
| 3341 |
-
<option value="1px">1px</option>
|
| 3342 |
-
<option value="2px">2px</option>
|
| 3343 |
-
<option value="3px">3px</option>
|
| 3344 |
-
<option value="4px">4px</option>
|
| 3345 |
-
<option value="5px">5px</option>
|
| 3346 |
-
<option value="6px">6px</option>
|
| 3347 |
-
<option value="7px">7px</option>
|
| 3348 |
-
<option value="8px">8px</option>
|
| 3349 |
-
<option value="9px">9px</option>
|
| 3350 |
-
<option value="10px">10px</option>
|
| 3351 |
-
<option value="11px">11px</option>
|
| 3352 |
-
<option value="12px">12px</option>
|
| 3353 |
-
<option value="13px">13px</option>
|
| 3354 |
-
<option value="14px">14px</option>
|
| 3355 |
-
<option value="15px">15px</option>
|
| 3356 |
-
<option value="16px">16px</option>
|
| 3357 |
-
<option value="17px">17px</option>
|
| 3358 |
-
<option value="18px">18px</option>
|
| 3359 |
-
<option value="19px">19px</option>
|
| 3360 |
-
<option value="20px">20px</option>
|
| 3361 |
-
<option value="21px">21px</option>
|
| 3362 |
-
<option value="22px">22px</option>
|
| 3363 |
-
<option value="23px">23px</option>
|
| 3364 |
-
<option value="24px">24px</option>
|
| 3365 |
-
<option value="25px">25px</option>
|
| 3366 |
-
<option value="26px">26px</option>
|
| 3367 |
-
<option value="27px">27px</option>
|
| 3368 |
-
<option value="28px">28px</option>
|
| 3369 |
-
<option value="29px">29px</option>
|
| 3370 |
-
<option value="30px">30px</option>
|
| 3371 |
-
</select>
|
| 3372 |
-
</td>
|
| 3373 |
-
</tr>
|
| 3374 |
-
<tr>
|
| 3375 |
-
<td><?php _e( 'Left', 'polldaddy' ); ?>:</td>
|
| 3376 |
-
<td>
|
| 3377 |
-
<select id="padding-left" onchange="bind(this);">
|
| 3378 |
-
<option value="0px">0px</option>
|
| 3379 |
-
<option value="1px">1px</option>
|
| 3380 |
-
<option value="2px">2px</option>
|
| 3381 |
-
<option value="3px">3px</option>
|
| 3382 |
-
<option value="4px">4px</option>
|
| 3383 |
-
<option value="5px">5px</option>
|
| 3384 |
-
<option value="6px">6px</option>
|
| 3385 |
-
<option value="7px">7px</option>
|
| 3386 |
-
<option value="8px">8px</option>
|
| 3387 |
-
<option value="9px">9px</option>
|
| 3388 |
-
<option value="10px">10px</option>
|
| 3389 |
-
<option value="11px">11px</option>
|
| 3390 |
-
<option value="12px">12px</option>
|
| 3391 |
-
<option value="13px">13px</option>
|
| 3392 |
-
<option value="14px">14px</option>
|
| 3393 |
-
<option value="15px">15px</option>
|
| 3394 |
-
<option value="16px">16px</option>
|
| 3395 |
-
<option value="17px">17px</option>
|
| 3396 |
-
<option value="18px">18px</option>
|
| 3397 |
-
<option value="19px">19px</option>
|
| 3398 |
-
<option value="20px">20px</option>
|
| 3399 |
-
<option value="21px">21px</option>
|
| 3400 |
-
<option value="22px">22px</option>
|
| 3401 |
-
<option value="23px">23px</option>
|
| 3402 |
-
<option value="24px">24px</option>
|
| 3403 |
-
<option value="25px">25px</option>
|
| 3404 |
-
<option value="26px">26px</option>
|
| 3405 |
-
<option value="27px">27px</option>
|
| 3406 |
-
<option value="28px">28px</option>
|
| 3407 |
-
<option value="29px">29px</option>
|
| 3408 |
-
<option value="30px">30px</option>
|
| 3409 |
-
</select>
|
| 3410 |
-
</td>
|
| 3411 |
-
</tr>
|
| 3412 |
-
</table>
|
| 3413 |
-
<!-- Scale Table -->
|
| 3414 |
-
<table class="CSSE_edit" id="editScale" style="display:none;">
|
| 3415 |
-
<tr>
|
| 3416 |
-
<td width="85"><?php _e( 'Width', 'polldaddy' ); ?> (px): <a href="http://support.polldaddy.com/custom-poll-styles/" class="noteLink" title="<?php _e( 'Click here for more information', 'polldaddy' ); ?>">(?)</a></td>
|
| 3417 |
-
<td>
|
| 3418 |
-
<input type="text" maxlength="4" class="elmColor" id="width" onblur="bind(this);"/>
|
| 3419 |
-
</td>
|
| 3420 |
-
</tr>
|
| 3421 |
-
<tr>
|
| 3422 |
-
<td width="85"></td>
|
| 3423 |
-
<td>
|
| 3424 |
-
<?php _e( 'If you change the width of the<br/> poll you may also need to change<br/> the width of your answers.', 'polldaddy' ); ?>
|
| 3425 |
-
</td>
|
| 3426 |
-
</tr>
|
| 3427 |
-
</table>
|
| 3428 |
-
|
| 3429 |
-
<!-- Height Table -->
|
| 3430 |
-
<table class="CSSE_edit" id="editHeight" style="display:none;">
|
| 3431 |
-
<tr>
|
| 3432 |
-
<td width="85"><?php _e( 'Height', 'polldaddy' ); ?> (px):</td>
|
| 3433 |
-
<td>
|
| 3434 |
-
<input type="text" maxlength="4" class="elmColor" id="height" onblur="bind(this);"/>
|
| 3435 |
-
</td>
|
| 3436 |
-
</tr>
|
| 3437 |
-
</table>
|
| 3438 |
-
|
| 3439 |
-
<table class="CSSE_edit" id="editPosition" style="display:none;">
|
| 3440 |
-
<tr>
|
| 3441 |
-
<td width="85"><?php _e( 'Position', 'polldaddy' ); ?> (px):</td>
|
| 3442 |
-
<td>
|
| 3443 |
-
<select class="set-width" id="float" onchange="bind(this);">
|
| 3444 |
-
<option value="left">Left</option>
|
| 3445 |
-
<option value="right">Right</option>
|
| 3446 |
-
</select>
|
| 3447 |
-
<input type="hidden" id="position" />
|
| 3448 |
-
<input type="hidden" id="direction" />
|
| 3449 |
-
</td>
|
| 3450 |
-
</tr>
|
| 3451 |
-
</table>
|
| 3452 |
-
</td>
|
| 3453 |
-
</tr>
|
| 3454 |
-
<tr>
|
| 3455 |
-
<td class="btm"/>
|
| 3456 |
-
</tr>
|
| 3457 |
-
</table>
|
| 3458 |
-
</td>
|
| 3459 |
-
</tr>
|
| 3460 |
-
</table>
|
| 3461 |
-
</td>
|
| 3462 |
-
<td width="10"> </td>
|
| 3463 |
-
<td valign="top">
|
| 3464 |
-
<div style="overflow-x:auto;">
|
| 3465 |
-
<!-- POLL XHTML START -->
|
| 3466 |
-
<div class="pds-box" id="pds-box">
|
| 3467 |
-
<div class="pds-box-outer">
|
| 3468 |
-
<div class="pds-box-inner">
|
| 3469 |
-
<div class="pds-box-top">
|
| 3470 |
-
<div class="pds-question">
|
| 3471 |
-
<div class="pds-question-outer">
|
| 3472 |
-
<div class="pds-question-inner">
|
| 3473 |
-
<div class="pds-question-top" id="pds-question-top"><?php _e( 'Do you mostly use the internet at work, in school or at home?', 'polldaddy' ); ?></div>
|
| 3474 |
-
</div>
|
| 3475 |
-
</div>
|
| 3476 |
-
</div>
|
| 3477 |
-
<div>
|
| 3478 |
-
<!-- divAnswers -->
|
| 3479 |
-
<div id="divAnswers">
|
| 3480 |
-
<span id="pds-answer143974">
|
| 3481 |
-
|
| 3482 |
-
<span class="pds-answer-group" id="pds-answer-group">
|
| 3483 |
-
<span class="pds-answer-input" id="pds-answer-input">
|
| 3484 |
-
<input type="radio" name="PDI_answer" value="1" id="p1" class="pds-checkbox"/>
|
| 3485 |
-
</span>
|
| 3486 |
-
<label for="p1" class="pds-answer" id="pds-answer"><span class="pds-answer-span"><?php _e( 'I use it in school.', 'polldaddy' ); ?></span></label>
|
| 3487 |
-
<span class="pds-clear"></span>
|
| 3488 |
-
</span>
|
| 3489 |
-
|
| 3490 |
-
<span class="pds-answer-group" id="pds-answer-group1">
|
| 3491 |
-
<span class="pds-answer-input" id="pds-answer-input1">
|
| 3492 |
-
<input type="radio" name="PDI_answer" value="2" id="p2" class="pds-checkbox"/>
|
| 3493 |
-
</span>
|
| 3494 |
-
<label for="p2" class="pds-answer" id="pds-answer1"><span class="pds-answer-span"><?php _e( 'I use it at home.', 'polldaddy' ); ?></span></label>
|
| 3495 |
-
<span class="pds-clear"></span>
|
| 3496 |
-
</span>
|
| 3497 |
-
|
| 3498 |
-
<span class="pds-answer-group" id="pds-answer-group2">
|
| 3499 |
-
<span class="pds-answer-input" id="pds-answer-input2">
|
| 3500 |
-
<input type="radio" name="PDI_answer" value="3" id="p3" class="pds-checkbox"/>
|
| 3501 |
-
</span>
|
| 3502 |
-
<label for="p3" class="pds-answer" id="pds-answer2"><span class="pds-answer-span"><?php _e( 'I use it every where I go, at work and home and anywhere else that I can!', 'polldaddy' ); ?></span></label>
|
| 3503 |
-
<span class="pds-clear"></span>
|
| 3504 |
-
</span>
|
| 3505 |
-
|
| 3506 |
-
<span class="pds-answer-group" id="pds-answer-group3">
|
| 3507 |
-
<span class="pds-answer-input" id="pds-answer-input3">
|
| 3508 |
-
<input type="radio" name="PDI_answer" value="4" id="p4" class="pds-checkbox"/>
|
| 3509 |
-
</span>
|
| 3510 |
-
<label for="p4" class="pds-answer" id="pds-answer3"><span class="pds-answer-span"><?php _e( 'Other', 'polldaddy' ); ?>:</span></label>
|
| 3511 |
-
<span class="pds-clear"></span>
|
| 3512 |
-
<span class="pds-answer-other">
|
| 3513 |
-
<input type="text" name="PDI_OtherText1761982" id="pds-textfield" maxlength="80" class="pds-textfield"/>
|
| 3514 |
-
</span>
|
| 3515 |
-
<span class="pds-clear"></span>
|
| 3516 |
-
</span>
|
| 3517 |
-
|
| 3518 |
-
</span>
|
| 3519 |
-
<br/>
|
| 3520 |
-
<div class="pds-vote" id="pds-links">
|
| 3521 |
-
<div class="pds-votebutton-outer">
|
| 3522 |
-
<a href="javascript:renderStyleEdit('pds-answer-feedback');" id="pds-vote-button" style="display:block;float:left;" class="pds-vote-button"><span><?php _e( 'Vote', 'polldaddy' ); ?></span></a>
|
| 3523 |
-
<span class="pds-links">
|
| 3524 |
-
<div style="padding: 0px 0px 0px 15px; float:left;"><a href="javascript:renderStyleEdit('pds-answer-feedback');" class="pds-link" id="pds-link"><?php _e( 'View Results', 'polldaddy' ); ?></a></div>
|
| 3525 |
-
<span class="pds-clear"></span>
|
| 3526 |
-
</span>
|
| 3527 |
-
<span class="pds-clear"></span>
|
| 3528 |
-
</div>
|
| 3529 |
-
</div>
|
| 3530 |
-
|
| 3531 |
-
</div>
|
| 3532 |
-
<!-- End divAnswers -->
|
| 3533 |
-
<!-- divResults -->
|
| 3534 |
-
<div id="divResults">
|
| 3535 |
-
|
| 3536 |
-
<div class="pds-feedback-group" id="pds-feedback-group" >
|
| 3537 |
-
<label class="pds-feedback-label" id="pds-feedback-label">
|
| 3538 |
-
<span class="pds-answer-text" id="pds-answer-text"><?php _e( 'I use it in school!', 'polldaddy' ); ?></span>
|
| 3539 |
-
<span class="pds-feedback-result" id="pds-feedback-result">
|
| 3540 |
-
<span class="pds-feedback-per" id="pds-feedback-per"> 46%</span> <span class="pds-feedback-votes" id="pds-feedback-votes"> <?php printf( __( '(%d votes)', 'polldaddy' ), 620 ); ?></span>
|
| 3541 |
-
</span>
|
| 3542 |
-
</label>
|
| 3543 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3544 |
-
<div class="pds-answer-feedback" id="pds-answer-feedback">
|
| 3545 |
-
<div style="width:46%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar"></div>
|
| 3546 |
-
</div>
|
| 3547 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3548 |
-
</div>
|
| 3549 |
-
|
| 3550 |
-
<div class="pds-feedback-group" id="pds-feedback-group1">
|
| 3551 |
-
<label class="pds-feedback-label" id="pds-feedback-label1">
|
| 3552 |
-
<span class="pds-answer-text" id="pds-answer-text1"><?php _e( 'I use it at home.', 'polldaddy' ); ?></span>
|
| 3553 |
-
<span class="pds-feedback-result" id="pds-feedback-result1">
|
| 3554 |
-
<span class="pds-feedback-per" id="pds-feedback-per1"> 30%</span> <span class="pds-feedback-votes" id="pds-feedback-votes1"> <?php printf( __( '(%d votes)', 'polldaddy' ), 400 ); ?></span>
|
| 3555 |
-
</span>
|
| 3556 |
-
</label>
|
| 3557 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3558 |
-
<div class="pds-answer-feedback" id="pds-answer-feedback1">
|
| 3559 |
-
<div style="width:30%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar1"></div>
|
| 3560 |
-
</div>
|
| 3561 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3562 |
-
</div>
|
| 3563 |
-
|
| 3564 |
-
<div class="pds-feedback-group" id="pds-feedback-group2">
|
| 3565 |
-
<label class="pds-feedback-label" id="pds-feedback-label2">
|
| 3566 |
-
<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>
|
| 3567 |
-
<span class="pds-feedback-result" id="pds-feedback-result2">
|
| 3568 |
-
<span class="pds-feedback-per" id="pds-feedback-per2"> 16%</span> <span class="pds-feedback-votes" id="pds-feedback-votes2"> <?php printf( __( '(%d votes)', 'polldaddy' ), 220 ); ?></span>
|
| 3569 |
-
</span>
|
| 3570 |
-
</label>
|
| 3571 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3572 |
-
<div class="pds-answer-feedback" id="pds-answer-feedback2">
|
| 3573 |
-
<div style="width:16%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar2"></div>
|
| 3574 |
-
</div>
|
| 3575 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3576 |
-
</div>
|
| 3577 |
-
|
| 3578 |
-
<div class="pds-feedback-group" id="pds-feedback-group3">
|
| 3579 |
-
<label class="pds-feedback-label" id="pds-feedback-label3">
|
| 3580 |
-
<span class="pds-answer-text" id="pds-answer-text3"><?php _e( 'Other', 'polldaddy' ); ?></span>
|
| 3581 |
-
<span class="pds-feedback-result" id="pds-feedback-result3">
|
| 3582 |
-
<span class="pds-feedback-per" id="pds-feedback-per3"> 8%</span> <span class="pds-feedback-votes" id="pds-feedback-votes3"> <?php printf( __( '(%d votes)', 'polldaddy' ), 110 ); ?></span>
|
| 3583 |
-
</span>
|
| 3584 |
-
</label>
|
| 3585 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3586 |
-
<div class="pds-answer-feedback" id="pds-answer-feedback3">
|
| 3587 |
-
<div style="width:8%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar3"></div>
|
| 3588 |
-
</div>
|
| 3589 |
-
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3590 |
-
</div>
|
| 3591 |
-
|
| 3592 |
-
</div>
|
| 3593 |
-
<!-- End divResults -->
|
| 3594 |
-
<span class="pds-clear"></span>
|
| 3595 |
-
<div style="height: 10px;"></div>
|
| 3596 |
-
<div id="pds-totalvotes-inner"><?php _e( 'Total Votes', 'polldaddy' ); ?>: <strong>1,350</strong></div>
|
| 3597 |
-
</div>
|
| 3598 |
-
<div class="pds-vote" id="pds-links-back">
|
| 3599 |
-
<div class="pds-totalvotes-outer">
|
| 3600 |
-
<span class="pds-links-back">
|
| 3601 |
-
<br/>
|
| 3602 |
-
<a href="javascript:" class="pds-link" id="pds-link1"><?php _e( 'Comments', 'polldaddy' ); ?> <strong>(19)</strong></a>
|
| 3603 |
-
<xsl:text> </xsl:text>
|
| 3604 |
-
<a href="javascript:renderStyleEdit('pds-box');" class="pds-link" id="pds-link2"><?php _e( 'Return To Poll', 'polldaddy' ); ?></a>
|
| 3605 |
-
<span class="pds-clear"></span>
|
| 3606 |
-
</span>
|
| 3607 |
-
<span class="pds-clear"></span>
|
| 3608 |
-
</div>
|
| 3609 |
-
</div>
|
| 3610 |
-
</div>
|
| 3611 |
-
</div>
|
| 3612 |
-
</div>
|
| 3613 |
-
</div>
|
| 3614 |
-
<!-- POLL XHTML END -->
|
| 3615 |
-
</div>
|
| 3616 |
-
</td>
|
| 3617 |
-
</tr>
|
| 3618 |
-
</table>
|
| 3619 |
-
<div id="editBox"></div>
|
| 3620 |
-
<p class="pds-clear"></p>
|
| 3621 |
-
<p>
|
| 3622 |
-
<?php wp_nonce_field( $style_id > 1000 ? "edit-style$style_id" : 'create-style' ); ?>
|
| 3623 |
-
<input type="hidden" name="action" value="<?php echo $style_id > 1000 ? 'edit-style' : 'create-style'; ?>" />
|
| 3624 |
-
<input type="hidden" class="polldaddy-style-id" name="style" value="<?php echo $style_id; ?>" />
|
| 3625 |
-
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Save Style', 'polldaddy' ) ); ?>" />
|
| 3626 |
-
<?php if ( $style_id > 1000 ) { ?>
|
| 3627 |
-
<input name="updatePollCheck" id="updatePollCheck" type="checkbox"> <label for="updatePollCheck"><?php _e( 'Check this box if you wish to update the polls that use this style.', 'polldaddy' ); ?></label>
|
| 3628 |
-
<?php } ?>
|
| 3629 |
-
</p>
|
| 3630 |
-
</div>
|
| 3631 |
-
</div>
|
| 3632 |
-
<textarea id="S_www" name="CSSXML" style="display:none;width: 1000px; height: 500px;" rows="10" cols="10"> </textarea>
|
| 3633 |
-
</form>
|
| 3634 |
-
<script language="javascript">
|
| 3635 |
-
jQuery( document ).ready(function(){
|
| 3636 |
-
plugin = new Plugin( {
|
| 3637 |
-
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 3638 |
-
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 3639 |
-
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 3640 |
-
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 3641 |
-
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 3642 |
-
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 3643 |
-
} );
|
| 3644 |
-
});
|
| 3645 |
-
pd_map = {
|
| 3646 |
-
thankyou : '<?php echo esc_attr( __( 'Thank you for voting!', 'polldaddy' ) ); ?>',
|
| 3647 |
-
question : '<?php echo esc_attr( __( 'Do you mostly use the internet at work, in school or at home?', 'polldaddy' ) ); ?>'
|
| 3648 |
-
}
|
| 3649 |
-
</script>
|
| 3650 |
-
<script type="text/javascript" language="javascript">window.onload = function() {
|
| 3651 |
-
var CSSXML;
|
| 3652 |
-
loadStyle();
|
| 3653 |
-
showResults( false );
|
| 3654 |
-
renderStyleEdit( _$('styleName').value );
|
| 3655 |
-
}</script>
|
| 3656 |
-
<br class="clear" />
|
| 3657 |
-
|
| 3658 |
-
<?php
|
| 3659 |
-
}
|
| 3660 |
-
|
| 3661 |
-
function rating_settings() {
|
| 3662 |
-
global $action, $rating;
|
| 3663 |
-
$rich_snippets = $show_posts = $show_posts_index = $show_pages = $show_comments = $pos_posts = $pos_posts_index = $pos_pages = $pos_comments = 0;
|
| 3664 |
-
$show_settings = $rating_updated = ( $action == 'update-rating' ? true : false );
|
| 3665 |
-
$error = false;
|
| 3666 |
-
|
| 3667 |
-
$settings_style = 'display: none;';
|
| 3668 |
-
if ( $show_settings )
|
| 3669 |
-
$settings_style = 'display: block;';
|
| 3670 |
-
|
| 3671 |
-
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 3672 |
-
$report_type = 'posts';
|
| 3673 |
-
$updated = false;
|
| 3674 |
-
|
| 3675 |
-
if ( isset( $rating ) ) {
|
| 3676 |
-
switch ( $rating ) {
|
| 3677 |
-
case 'pages':
|
| 3678 |
-
$report_type = 'pages';
|
| 3679 |
-
$rating_id = (int) get_option( 'pd-rating-pages-id' );
|
| 3680 |
-
break;
|
| 3681 |
-
case 'comments':
|
| 3682 |
-
$report_type = 'comments';
|
| 3683 |
-
$rating_id = (int) get_option( 'pd-rating-comments-id' );
|
| 3684 |
-
break;
|
| 3685 |
-
case 'posts':
|
| 3686 |
-
$report_type = 'posts';
|
| 3687 |
-
$rating_id = (int) get_option( 'pd-rating-posts-id' );
|
| 3688 |
-
break;
|
| 3689 |
-
}//end switch
|
| 3690 |
-
}
|
| 3691 |
-
|
| 3692 |
-
$new_type = 0;
|
| 3693 |
-
if ( $report_type == 'comments' )
|
| 3694 |
-
$new_type = 1;
|
| 3695 |
-
|
| 3696 |
-
$blog_name = get_option( 'blogname' );
|
| 3697 |
-
|
| 3698 |
-
if ( empty( $blog_name ) )
|
| 3699 |
-
$blog_name = 'WordPress Blog';
|
| 3700 |
-
$blog_name .= ' - ' . $report_type;
|
| 3701 |
-
|
| 3702 |
-
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) )
|
| 3703 |
-
return false;
|
| 3704 |
-
|
| 3705 |
-
if ( $this->rating_user_code == '' )
|
| 3706 |
-
die();
|
| 3707 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 3708 |
-
$polldaddy->reset();
|
| 3709 |
-
|
| 3710 |
-
$error = false;
|
| 3711 |
-
$rating_errors = array();
|
| 3712 |
-
if ( empty( $rating_id ) ) {
|
| 3713 |
-
$pd_rating = $polldaddy->create_rating( $blog_name , $new_type );
|
| 3714 |
-
if ( !empty( $pd_rating ) ) {
|
| 3715 |
-
$rating_id = (int) $pd_rating->_id;
|
| 3716 |
-
update_option ( 'pd-rating-' . $report_type . '-id', $rating_id );
|
| 3717 |
-
update_option ( 'pd-rating-' . $report_type, 0 );
|
| 3718 |
-
} else {
|
| 3719 |
-
$rating_errors[] = $polldaddy->errors;
|
| 3720 |
-
}
|
| 3721 |
-
} else
|
| 3722 |
-
$pd_rating = $polldaddy->get_rating( $rating_id );
|
| 3723 |
-
|
| 3724 |
-
if ( empty( $pd_rating ) || (int) $pd_rating->_id == 0 ) {
|
| 3725 |
-
|
| 3726 |
-
$this->log( 'rating_settings: unable to get rating id - '.$rating_id );
|
| 3727 |
-
|
| 3728 |
-
if ( $polldaddy->errors ) {
|
| 3729 |
-
if ( array_key_exists( 4, $polldaddy->errors ) ) { //Obsolete key
|
| 3730 |
-
$this->log( 'rating_settings: obsolete key - '.$this->rating_user_code );
|
| 3731 |
-
$this->rating_user_code = '';
|
| 3732 |
-
update_option( 'pd-rating-usercode', '' );
|
| 3733 |
-
$this->set_api_user_code(); // get latest key
|
| 3734 |
-
|
| 3735 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 3736 |
-
$polldaddy->reset();
|
| 3737 |
-
$pd_rating = $polldaddy->get_rating( $rating_id ); //see it exists
|
| 3738 |
-
$rating_errors[] = $polldaddy->errors;
|
| 3739 |
-
|
| 3740 |
-
if ( empty( $pd_rating ) || (int) $pd_rating->_id == 0 ) { //if not then create a rating for blog
|
| 3741 |
-
$polldaddy->reset();
|
| 3742 |
-
$pd_rating = $polldaddy->create_rating( $blog_name , $new_type );
|
| 3743 |
-
$rating_errors[] = $polldaddy->errors;
|
| 3744 |
-
}
|
| 3745 |
-
} elseif ( isset( $polldaddy->errors[ -1 ] ) && $polldaddy->errors[ -1 ] == "Can't connect" ) {
|
| 3746 |
-
$this->contact_support_message( __( 'Could not connect to the Polldaddy API' ), $rating_errors );
|
| 3747 |
-
$error = true;
|
| 3748 |
-
} elseif ( isset( $polldaddy->errors[ -1 ] ) && $polldaddy->errors[ -1 ] == "Invalid API URL" ) {
|
| 3749 |
-
$this->contact_support_message( __( 'The API URL is incorrect' ), $rating_errors );
|
| 3750 |
-
$error = true;
|
| 3751 |
-
} elseif ( isset( $polldaddy->errors[ -2 ] ) && $polldaddy->errors[ -2 ] == "No Data" ) {
|
| 3752 |
-
$this->contact_support_message( __( 'Your API request did not return any data' ), $rating_errors );
|
| 3753 |
-
$error = true;
|
| 3754 |
-
}
|
| 3755 |
-
}
|
| 3756 |
-
|
| 3757 |
-
if ( $error == false && empty( $pd_rating ) ) { //something's up!
|
| 3758 |
-
$this->contact_support_message( __( 'There was an error creating your rating widget' ), $rating_errors );
|
| 3759 |
-
$error = true;
|
| 3760 |
-
} else {
|
| 3761 |
-
$rating_id = (int) $pd_rating->_id;
|
| 3762 |
-
update_option ( 'pd-rating-' . $report_type . '-id', $rating_id );
|
| 3763 |
-
update_option ( 'pd-rating-' . $report_type, 0 );
|
| 3764 |
-
|
| 3765 |
-
switch ( $report_type ) {
|
| 3766 |
-
case 'posts':
|
| 3767 |
-
$show_posts = 0;
|
| 3768 |
-
break;
|
| 3769 |
-
case 'pages':
|
| 3770 |
-
$show_pages = 0;
|
| 3771 |
-
break;
|
| 3772 |
-
case 'comments':
|
| 3773 |
-
$show_comments = 0;
|
| 3774 |
-
break;
|
| 3775 |
-
}//end switch
|
| 3776 |
-
}
|
| 3777 |
-
}
|
| 3778 |
-
|
| 3779 |
-
if ( isset( $_POST[ 'pd_rating_action_type' ] ) ) {
|
| 3780 |
-
check_admin_referer( 'action-rating_settings_' . $_POST[ 'pd_rating_action_type' ] );
|
| 3781 |
-
|
| 3782 |
-
switch ( $_POST[ 'pd_rating_action_type' ] ) {
|
| 3783 |
-
case 'posts' :
|
| 3784 |
-
if ( isset( $_POST[ 'pd_rich_snippets' ] ) && (int) $_POST[ 'pd_rich_snippets' ] == 1 )
|
| 3785 |
-
$rich_snippets = 1;
|
| 3786 |
-
|
| 3787 |
-
update_option( 'pd-rich-snippets', $rich_snippets );
|
| 3788 |
-
|
| 3789 |
-
if ( isset( $_POST[ 'pd_show_posts' ] ) && (int) $_POST[ 'pd_show_posts' ] == 1 )
|
| 3790 |
-
$show_posts = get_option( 'pd-rating-posts-id' );
|
| 3791 |
-
|
| 3792 |
-
update_option( 'pd-rating-posts', $show_posts );
|
| 3793 |
-
|
| 3794 |
-
if ( isset( $_POST[ 'pd_show_posts_index' ] ) && (int) $_POST[ 'pd_show_posts_index' ] == 1 )
|
| 3795 |
-
$show_posts_index = get_option( 'pd-rating-posts-id' );
|
| 3796 |
-
|
| 3797 |
-
update_option( 'pd-rating-posts-index', $show_posts_index );
|
| 3798 |
-
|
| 3799 |
-
if ( isset( $_POST[ 'posts_pos' ] ) && (int) $_POST[ 'posts_pos' ] == 1 )
|
| 3800 |
-
$pos_posts = 1;
|
| 3801 |
-
|
| 3802 |
-
update_option( 'pd-rating-posts-pos', $pos_posts );
|
| 3803 |
-
|
| 3804 |
-
if ( isset( $_POST[ 'posts_index_pos' ] ) && (int) $_POST[ 'posts_index_pos' ] == 1 )
|
| 3805 |
-
$pos_posts_index = 1;
|
| 3806 |
-
|
| 3807 |
-
update_option( 'pd-rating-posts-index-pos', $pos_posts_index );
|
| 3808 |
-
$rating_updated = true;
|
| 3809 |
-
break;
|
| 3810 |
-
|
| 3811 |
-
case 'pages';
|
| 3812 |
-
if ( isset( $_POST[ 'pd_show_pages' ] ) && (int) $_POST[ 'pd_show_pages' ] == 1 )
|
| 3813 |
-
$show_pages = get_option( 'pd-rating-pages-id' );
|
| 3814 |
-
|
| 3815 |
-
update_option( 'pd-rating-pages', $show_pages );
|
| 3816 |
-
|
| 3817 |
-
if ( isset( $_POST[ 'pages_pos' ] ) && (int) $_POST[ 'pages_pos' ] == 1 )
|
| 3818 |
-
$pos_pages = 1;
|
| 3819 |
-
|
| 3820 |
-
update_option( 'pd-rating-pages-pos', $pos_pages );
|
| 3821 |
-
$rating_updated = true;
|
| 3822 |
-
break;
|
| 3823 |
-
|
| 3824 |
-
case 'comments':
|
| 3825 |
-
if ( isset( $_POST[ 'pd_show_comments' ] ) && (int) $_POST[ 'pd_show_comments' ] == 1 )
|
| 3826 |
-
$show_comments = get_option( 'pd-rating-comments-id' );
|
| 3827 |
-
|
| 3828 |
-
update_option( 'pd-rating-comments', $show_comments );
|
| 3829 |
-
|
| 3830 |
-
if ( isset( $_POST[ 'comments_pos' ] ) && (int) $_POST[ 'comments_pos' ] == 1 )
|
| 3831 |
-
$pos_comments = 1;
|
| 3832 |
-
|
| 3833 |
-
update_option( 'pd-rating-comments-pos', $pos_comments );
|
| 3834 |
-
|
| 3835 |
-
$rating_updated = true;
|
| 3836 |
-
break;
|
| 3837 |
-
}//end switch
|
| 3838 |
-
}
|
| 3839 |
-
|
| 3840 |
-
$rich_snippets = (int) get_option( 'pd-rich-snippets', 1 );
|
| 3841 |
-
$show_posts = (int) get_option( 'pd-rating-posts' );
|
| 3842 |
-
$show_pages = (int) get_option( 'pd-rating-pages' );
|
| 3843 |
-
$show_comments = (int) get_option( 'pd-rating-comments' );
|
| 3844 |
-
$show_posts_index = (int) get_option( 'pd-rating-posts-index' );
|
| 3845 |
-
|
| 3846 |
-
$pos_posts = (int) get_option( 'pd-rating-posts-pos' );
|
| 3847 |
-
$pos_pages = (int) get_option( 'pd-rating-pages-pos' );
|
| 3848 |
-
$pos_comments = (int) get_option( 'pd-rating-comments-pos' );
|
| 3849 |
-
$pos_posts_index = (int) get_option( 'pd-rating-posts-index-pos' );
|
| 3850 |
-
|
| 3851 |
-
if ( !empty( $pd_rating ) ) {
|
| 3852 |
-
$settings_text = $pd_rating->settings;
|
| 3853 |
-
$settings = json_decode( $settings_text );
|
| 3854 |
-
|
| 3855 |
-
$popup_disabled = ( isset( $settings->popup ) && $settings->popup == 'off' );
|
| 3856 |
-
|
| 3857 |
-
$rating_type = 0;
|
| 3858 |
-
|
| 3859 |
-
if ( $settings->type == 'stars' )
|
| 3860 |
-
$rating_type = 0;
|
| 3861 |
-
else
|
| 3862 |
-
$rating_type = 1;
|
| 3863 |
-
|
| 3864 |
-
if ( empty( $settings->font_color ) )
|
| 3865 |
-
$settings->font_color = '#000000';
|
| 3866 |
-
}?>
|
| 3867 |
-
<div class="wrap">
|
| 3868 |
-
<div class="icon32" id="icon-options-general"><br/></div>
|
| 3869 |
-
<h2>
|
| 3870 |
-
<?php _e( 'Rating Settings', 'polldaddy' ); ?>
|
| 3871 |
-
</h2>
|
| 3872 |
-
<?php if ( $rating_updated )
|
| 3873 |
-
echo '<div class="updated"><p>'.__( 'Rating updated', 'polldaddy' ).'</p></div>';
|
| 3874 |
-
|
| 3875 |
-
if ( !$error ) { ?>
|
| 3876 |
-
<div id="side-sortables">
|
| 3877 |
-
<div id="categorydiv" class="categorydiv">
|
| 3878 |
-
<ul id="category-tabs" class="category-tabs wp-tab-bar"><?php
|
| 3879 |
-
$this_class = '';
|
| 3880 |
-
$posts_link = esc_url( add_query_arg( array( 'rating' => 'posts', 'message' => false ) ) );
|
| 3881 |
-
$pages_link = esc_url( add_query_arg( array( 'rating' => 'pages', 'message' => false ) ) );
|
| 3882 |
-
$comments_link = esc_url( add_query_arg( array( 'rating' => 'comments', 'message' => false ) ) );
|
| 3883 |
-
if ( $report_type == 'posts' )
|
| 3884 |
-
$this_class = ' class="tabs"';?>
|
| 3885 |
-
<li <?php echo $this_class; ?>><a tabindex="3" href="<?php echo $posts_link; ?>"><?php _e( 'Posts', 'polldaddy' );?></a></li><?php
|
| 3886 |
-
$this_class = '';
|
| 3887 |
-
if ( $report_type == 'pages' )
|
| 3888 |
-
$this_class = ' class="tabs"'; ?>
|
| 3889 |
-
<li <?php echo $this_class; ?>><a tabindex="3" href="<?php echo $pages_link; ?>"><?php _e( 'Pages', 'polldaddy' );?></a></li><?php
|
| 3890 |
-
$this_class = '';
|
| 3891 |
-
if ( $report_type == 'comments' )
|
| 3892 |
-
$this_class = ' class="tabs"'; ?>
|
| 3893 |
-
<li <?php echo $this_class; ?>><a href="<?php echo $comments_link; ?>"><?php _e( 'Comments', 'polldaddy' );?></a></li>
|
| 3894 |
-
</ul>
|
| 3895 |
-
<div class="tabs-panel" id="categories-all" style="background: #FFFFFF;height: auto; overflow: visible;max-height:500px;">
|
| 3896 |
-
<form action="" method="post">
|
| 3897 |
-
<input type="hidden" name="pd_rating_action_type" value="<?php echo $report_type; ?>" />
|
| 3898 |
-
<?php wp_nonce_field( 'action-rating_settings_' . $report_type ); ?>
|
| 3899 |
-
<table class="form-table" style="width: normal;">
|
| 3900 |
-
<tbody>
|
| 3901 |
-
<?php if ( $report_type == 'posts' ) { ?>
|
| 3902 |
-
<tr valign="top">
|
| 3903 |
-
<th scope="row"><label><?php _e( 'Rich Snippets in Search Results', 'polldaddy' );?></label></th>
|
| 3904 |
-
<td>
|
| 3905 |
-
<label><input type="checkbox" name="pd_rich_snippets" id="pd_rich_snippets" <?php if ( $rich_snippets == 1 ) echo ' checked="checked" '; ?> value="1" /> <?php printf( __( 'Display rich snippets in search results using post and page ratings (<a href="%s">documentation</a> and <a href="">page tester</a>)', 'polldaddy' ), 'https://support.google.com/webmasters/answer/99170', 'http://www.google.com/webmasters/tools/richsnippets' );?></label>
|
| 3906 |
-
<p><?php _e( 'Once activated, it may take several weeks before the snippets show up in Google search results.', 'polldaddy' );?></p>
|
| 3907 |
-
</td>
|
| 3908 |
-
</tr>
|
| 3909 |
-
<tr valign="top">
|
| 3910 |
-
<th scope="row"><label><?php _e( 'Show Ratings on', 'polldaddy' );?></label></th>
|
| 3911 |
-
<td>
|
| 3912 |
-
<label><input type="checkbox" name="pd_show_posts_index" id="pd_show_posts_index" <?php if ( $show_posts_index > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Front Page, Archive Pages, and Search Results', 'polldaddy' );?></label>
|
| 3913 |
-
<br><label><input type="checkbox" name="pd_show_posts" id="pd_show_posts" <?php if ( $show_posts > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Posts', 'polldaddy' );?></label>
|
| 3914 |
-
</td>
|
| 3915 |
-
</tr>
|
| 3916 |
-
<tr valign="top">
|
| 3917 |
-
<th scope="row"><label><?php _e( 'Position Front Page, Archive Pages, and Search Results Ratings', 'polldaddy' );?></label></th>
|
| 3918 |
-
<td>
|
| 3919 |
-
<select name="posts_index_pos"><?php
|
| 3920 |
-
$select = array( __( 'Above each blog post', 'polldaddy' ) => '0', __( 'Below each blog post', 'polldaddy' ) => '1' );
|
| 3921 |
-
foreach ( $select as $option => $value ) :
|
| 3922 |
-
$selected = '';
|
| 3923 |
-
if ( $value == $pos_posts_index )
|
| 3924 |
-
$selected = ' selected="selected"';
|
| 3925 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3926 |
-
endforeach;?>
|
| 3927 |
-
</select>
|
| 3928 |
-
</td>
|
| 3929 |
-
</tr>
|
| 3930 |
-
<tr valign="top">
|
| 3931 |
-
<th scope="row"><label><?php _e( 'Position Post Ratings', 'polldaddy' );?></label></th>
|
| 3932 |
-
<td>
|
| 3933 |
-
<select name="posts_pos"><?php
|
| 3934 |
-
$select = array( __( 'Above each blog post', 'polldaddy' ) => '0', __( 'Below each blog post', 'polldaddy' ) => '1' );
|
| 3935 |
-
foreach ( $select as $option => $value ) :
|
| 3936 |
-
$selected = '';
|
| 3937 |
-
if ( $value == $pos_posts )
|
| 3938 |
-
$selected = ' selected="selected"';
|
| 3939 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3940 |
-
endforeach;?>
|
| 3941 |
-
</select>
|
| 3942 |
-
</td>
|
| 3943 |
-
</tr><?php
|
| 3944 |
-
}
|
| 3945 |
-
if ( $report_type == 'pages' ) {?>
|
| 3946 |
-
<tr valign="top">
|
| 3947 |
-
<th scope="row"><label><?php _e( 'Show Ratings on', 'polldaddy' );?></label></th>
|
| 3948 |
-
<td>
|
| 3949 |
-
<label><input type="checkbox" name="pd_show_pages" id="pd_show_pages" <?php if ( $show_pages > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Pages', 'polldaddy' );?></label>
|
| 3950 |
-
</td>
|
| 3951 |
-
</tr>
|
| 3952 |
-
<tr valign="top">
|
| 3953 |
-
<th scope="row"><label><?php _e( 'Position Page Ratings', 'polldaddy' );?></label></th>
|
| 3954 |
-
<td>
|
| 3955 |
-
<select name="pages_pos"><?php
|
| 3956 |
-
$select = array( __( 'Above each blog page', 'polldaddy' ) => '0', __( 'Below each blog page', 'polldaddy' ) => '1' );
|
| 3957 |
-
foreach ( $select as $option => $value ) :
|
| 3958 |
-
$selected = '';
|
| 3959 |
-
if ( $value == $pos_pages )
|
| 3960 |
-
$selected = ' selected="selected"';
|
| 3961 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3962 |
-
endforeach;?>
|
| 3963 |
-
</select>
|
| 3964 |
-
</td>
|
| 3965 |
-
</tr><?php
|
| 3966 |
-
}
|
| 3967 |
-
if ( $report_type == 'comments' ) {?>
|
| 3968 |
-
<tr valign="top">
|
| 3969 |
-
<th scope="row"><label><?php _e( 'Show Ratings on', 'polldaddy' );?></label></th>
|
| 3970 |
-
<td>
|
| 3971 |
-
<label><input type="checkbox" name="pd_show_comments" id="pd_show_comments" <?php if ( $show_comments > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Comments', 'polldaddy' );?></label>
|
| 3972 |
-
</td>
|
| 3973 |
-
</tr>
|
| 3974 |
-
<tr valign="top">
|
| 3975 |
-
<th scope="row"><label><?php _e( 'Position Comment Ratings', 'polldaddy' );?></label></th>
|
| 3976 |
-
<td>
|
| 3977 |
-
<select name="comments_pos"><?php
|
| 3978 |
-
$select = array( __( 'Above each comment', 'polldaddy' ) => '0', __( 'Below each comment', 'polldaddy' ) => '1' );
|
| 3979 |
-
foreach ( $select as $option => $value ) :
|
| 3980 |
-
$selected = '';
|
| 3981 |
-
if ( $value == $pos_comments )
|
| 3982 |
-
$selected = ' selected="selected"';
|
| 3983 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3984 |
-
endforeach;?>
|
| 3985 |
-
</select>
|
| 3986 |
-
</td>
|
| 3987 |
-
</tr><?php
|
| 3988 |
-
} ?>
|
| 3989 |
-
<tr valign="top">
|
| 3990 |
-
<td height="30"><input class="button-primary" type="submit" value="<?php esc_attr_e( 'Save Changes', 'polldaddy' );?>" name="Submit" /></td>
|
| 3991 |
-
</tr>
|
| 3992 |
-
</tbody>
|
| 3993 |
-
</table>
|
| 3994 |
-
</form>
|
| 3995 |
-
<?php // check for previous settings
|
| 3996 |
-
$previous_settings = get_option( 'polldaddy_settings' );
|
| 3997 |
-
if ( get_option( 'pd-rating-posts-id' ) && get_option( 'pd-rating-posts-id' ) != $previous_settings[ 'pd-rating-posts-id' ] ) {
|
| 3998 |
-
echo "<p>" . sprintf( __( "Previous settings for ratings on this site discovered. You can restore them on the <a href='%s'>poll settings page</a> if your site is missing ratings after resetting your connection settings.", 'polldaddy' ), "options-general.php?page=polls&action=options" ) . "</p>";
|
| 3999 |
-
}
|
| 4000 |
-
?>
|
| 4001 |
-
</div>
|
| 4002 |
-
|
| 4003 |
-
<div style="padding:20px 0px 0px 0px"><?php
|
| 4004 |
-
if ( $report_type == 'posts' ) {
|
| 4005 |
-
if ( $show_posts > 0 || $show_posts_index > 0 )
|
| 4006 |
-
$show_settings = true;
|
| 4007 |
-
}
|
| 4008 |
-
if ( $report_type == 'pages' && $show_pages > 0 )
|
| 4009 |
-
$show_settings = true;
|
| 4010 |
-
if ( $report_type == 'comments' && $show_comments > 0 )
|
| 4011 |
-
$show_settings = true;
|
| 4012 |
-
if ( $show_settings == true )
|
| 4013 |
-
echo '<a href="javascript:" onclick="show_settings();">'.__( 'Advanced Settings', 'polldaddy' ).'</a>';?></div>
|
| 4014 |
-
</div>
|
| 4015 |
-
</div>
|
| 4016 |
-
|
| 4017 |
-
<?php if ( $show_settings == true ) { ?>
|
| 4018 |
-
<br />
|
| 4019 |
-
<form method="post" action="">
|
| 4020 |
-
<div id="poststuff" style="<?php echo $settings_style; ?>">
|
| 4021 |
-
<div class="has-sidebar has-right-sidebar">
|
| 4022 |
-
<div class="inner-sidebar-ratings">
|
| 4023 |
-
<div id="submitdiv" class="postbox ">
|
| 4024 |
-
<h3 class="hndle"><span><?php _e( 'Save Advanced Settings', 'polldaddy' );?></span></h3>
|
| 4025 |
-
|
| 4026 |
-
<div class="inside">
|
| 4027 |
-
<div class="submitbox" id="submitpost">
|
| 4028 |
-
<div id="minor-publishing" style="padding:10px;">
|
| 4029 |
-
<input type="submit" name="save_menu" id="save_menu_header" class="button button-primary menu-save" value="<?php echo esc_attr( __( 'Save Changes', 'polldaddy' ) );?>">
|
| 4030 |
-
<input type="hidden" name="type" value="<?php echo $report_type; ?>" />
|
| 4031 |
-
<input type="hidden" name="rating_id" value="<?php echo $rating_id; ?>" />
|
| 4032 |
-
<input type="hidden" name="action" value="update-rating" />
|
| 4033 |
-
</div>
|
| 4034 |
-
</div>
|
| 4035 |
-
</div>
|
| 4036 |
-
</div>
|
| 4037 |
-
<div class="postbox">
|
| 4038 |
-
<h3><?php _e( 'Preview', 'polldaddy' );?></h3>
|
| 4039 |
-
<div class="inside">
|
| 4040 |
-
<p><?php _e( 'This is a demo of what your rating widget will look like', 'polldaddy' ); ?>.</p>
|
| 4041 |
-
<p>
|
| 4042 |
-
<div id="pd_rating_holder_1"></div>
|
| 4043 |
-
</p>
|
| 4044 |
-
</div>
|
| 4045 |
-
</div>
|
| 4046 |
-
<div class="postbox">
|
| 4047 |
-
<h3><?php _e( 'Customize Labels', 'polldaddy' );?></h3>
|
| 4048 |
-
<div class="inside">
|
| 4049 |
-
<table width="99.5%">
|
| 4050 |
-
<tr>
|
| 4051 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Vote', 'polldaddy' );?></p></td>
|
| 4052 |
-
</tr>
|
| 4053 |
-
<tr>
|
| 4054 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_vote" id="text_vote" value="<?php echo empty( $settings->text_vote ) ? 'Vote' : esc_html( $settings->text_vote ); ?>" maxlength="20" />
|
| 4055 |
-
</tr>
|
| 4056 |
-
<tr>
|
| 4057 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Votes', 'polldaddy' );?></p></td>
|
| 4058 |
-
</tr>
|
| 4059 |
-
<tr>
|
| 4060 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_votes" id="text_votes" value="<?php echo empty( $settings->text_votes ) ? 'Votes' : esc_html( $settings->text_votes ); ?>" maxlength="20" />
|
| 4061 |
-
</tr>
|
| 4062 |
-
<tr>
|
| 4063 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Rate This', 'polldaddy' );?></p></td>
|
| 4064 |
-
</tr>
|
| 4065 |
-
<tr>
|
| 4066 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rate_this" id="text_rate_this" value="<?php echo empty( $settings->text_rate_this ) ? 'Rate This' : esc_html( $settings->text_rate_this ); ?>" maxlength="20" />
|
| 4067 |
-
</tr>
|
| 4068 |
-
<tr>
|
| 4069 |
-
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d star', 'polldaddy' ), 1 );?></p></td>
|
| 4070 |
-
</tr>
|
| 4071 |
-
<tr>
|
| 4072 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_1_star" id="text_1_star" value="<?php echo empty( $settings->text_1_star ) ? '1 star' : esc_html( $settings->text_1_star ); ?>" maxlength="20" />
|
| 4073 |
-
</tr>
|
| 4074 |
-
<tr>
|
| 4075 |
-
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 2 );?></p></td>
|
| 4076 |
-
</tr>
|
| 4077 |
-
<tr>
|
| 4078 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_2_star" id="text_2_star" value="<?php echo empty( $settings->text_2_star ) ? '2 stars' : esc_html( $settings->text_2_star ); ?>" maxlength="20" />
|
| 4079 |
-
</tr>
|
| 4080 |
-
<tr>
|
| 4081 |
-
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 3 );?></p></td>
|
| 4082 |
-
</tr>
|
| 4083 |
-
<tr>
|
| 4084 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_3_star" id="text_3_star" value="<?php echo empty( $settings->text_3_star ) ? '3 stars' : esc_html( $settings->text_3_star ); ?>" maxlength="20" />
|
| 4085 |
-
</tr>
|
| 4086 |
-
<tr>
|
| 4087 |
-
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 4 );?></p></td>
|
| 4088 |
-
</tr>
|
| 4089 |
-
<tr>
|
| 4090 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_4_star" id="text_4_star" value="<?php echo empty( $settings->text_4_star ) ? '4 stars' : esc_html( $settings->text_4_star ); ?>" maxlength="20" />
|
| 4091 |
-
</tr>
|
| 4092 |
-
<tr>
|
| 4093 |
-
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 5 );?></p></td>
|
| 4094 |
-
</tr>
|
| 4095 |
-
<tr>
|
| 4096 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_5_star" id="text_5_star" value="<?php echo empty( $settings->text_5_star ) ? '5 stars' : esc_html( $settings->text_5_star ); ?>" maxlength="20" />
|
| 4097 |
-
</tr>
|
| 4098 |
-
<tr>
|
| 4099 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Thank You', 'polldaddy' );?></p></td>
|
| 4100 |
-
</tr>
|
| 4101 |
-
<tr>
|
| 4102 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_thank_you" id="text_thank_you" value="<?php echo empty( $settings->text_thank_you ) ? 'Thank You' : esc_html( $settings->text_thank_you ); ?>" maxlength="20" />
|
| 4103 |
-
</tr>
|
| 4104 |
-
<tr>
|
| 4105 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Rate Up', 'polldaddy' );?></p></td>
|
| 4106 |
-
</tr>
|
| 4107 |
-
<tr>
|
| 4108 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rate_up" id="text_rate_up" value="<?php echo empty( $settings->text_rate_up ) ? 'Rate Up' : esc_html( $settings->text_rate_up ); ?>" maxlength="20" />
|
| 4109 |
-
</tr>
|
| 4110 |
-
<tr>
|
| 4111 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Rate Down', 'polldaddy' );?></p></td>
|
| 4112 |
-
</tr>
|
| 4113 |
-
<tr>
|
| 4114 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rate_down" id="text_rate_down" value="<?php echo empty( $settings->text_rate_down ) ? 'Rate Down' : esc_html( $settings->text_rate_down ); ?>" maxlength="20" />
|
| 4115 |
-
</tr>
|
| 4116 |
-
<tr>
|
| 4117 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Most Popular Content', 'polldaddy' );?></p></td>
|
| 4118 |
-
</tr>
|
| 4119 |
-
<tr>
|
| 4120 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_popcontent" id="text_popcontent" value="<?php echo empty( $settings->text_popcontent ) ? 'Most Popular Content' : esc_html( $settings->text_popcontent ); ?>" maxlength="20" />
|
| 4121 |
-
</tr>
|
| 4122 |
-
<tr>
|
| 4123 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Close', 'polldaddy' );?></p></td>
|
| 4124 |
-
</tr>
|
| 4125 |
-
<tr>
|
| 4126 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_close" id="text_close" value="<?php echo empty( $settings->text_close ) ? 'Close' : esc_html( $settings->text_close ); ?>" maxlength="20" />
|
| 4127 |
-
</tr>
|
| 4128 |
-
<tr>
|
| 4129 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'All', 'polldaddy' );?></p></td>
|
| 4130 |
-
</tr>
|
| 4131 |
-
<tr>
|
| 4132 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_all" id="text_all" value="<?php echo empty( $settings->text_all ) ? 'All' : esc_html( $settings->text_all ); ?>" maxlength="20" />
|
| 4133 |
-
</tr>
|
| 4134 |
-
<tr>
|
| 4135 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Today', 'polldaddy' );?></p></td>
|
| 4136 |
-
</tr>
|
| 4137 |
-
<tr>
|
| 4138 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_today" id="text_today" value="<?php echo empty( $settings->text_today ) ? 'Today' : esc_html( $settings->text_today ); ?>" maxlength="20" />
|
| 4139 |
-
</tr>
|
| 4140 |
-
<tr>
|
| 4141 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'This Week', 'polldaddy' );?></p></td>
|
| 4142 |
-
</tr>
|
| 4143 |
-
<tr>
|
| 4144 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_thisweek" id="text_thisweek" value="<?php echo empty( $settings->text_thisweek ) ? 'This Week' : esc_html( $settings->text_thisweek ); ?>" maxlength="20" />
|
| 4145 |
-
</tr>
|
| 4146 |
-
<tr>
|
| 4147 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'This Month', 'polldaddy' );?></p></td>
|
| 4148 |
-
</tr>
|
| 4149 |
-
<tr>
|
| 4150 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_thismonth" id="text_thismonth" value="<?php echo empty( $settings->text_thismonth ) ? 'This Month' : esc_html( $settings->text_thismonth ); ?>" maxlength="20" />
|
| 4151 |
-
</tr>
|
| 4152 |
-
<tr>
|
| 4153 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'Rated', 'polldaddy' );?></p></td>
|
| 4154 |
-
</tr>
|
| 4155 |
-
<tr>
|
| 4156 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rated" id="text_rated" value="<?php echo empty( $settings->text_rated ) ? 'Rated' : esc_html( $settings->text_rated ); ?>" maxlength="20" />
|
| 4157 |
-
</tr>
|
| 4158 |
-
<tr>
|
| 4159 |
-
<td><p style="margin-bottom: 0px;"><?php _e( 'There are no rated items for this period', 'polldaddy' );?></p></td>
|
| 4160 |
-
</tr>
|
| 4161 |
-
<tr>
|
| 4162 |
-
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_noratings" id="text_noratings" value="<?php echo empty( $settings->text_noratings ) ? 'There are no rated items for this period' : esc_html( $settings->text_noratings ); ?>" maxlength="50" />
|
| 4163 |
-
</tr>
|
| 4164 |
-
</table>
|
| 4165 |
-
</div>
|
| 4166 |
-
</div>
|
| 4167 |
-
</div>
|
| 4168 |
-
<div id="post-body-content" class="has-sidebar-content">
|
| 4169 |
-
<div class="postbox">
|
| 4170 |
-
<h3><?php _e( 'Rating Type', 'polldaddy' );?></h3>
|
| 4171 |
-
<div class="inside">
|
| 4172 |
-
<p><?php _e( 'Here you can choose how you want your rating to display. The 5 star rating is the most commonly used. The Nero rating is useful for keeping it simple.', 'polldaddy' ); ?></p>
|
| 4173 |
-
<ul>
|
| 4174 |
-
<li style="display: inline;margin-right: 10px;">
|
| 4175 |
-
<label for="stars"><?php
|
| 4176 |
-
$checked = '';
|
| 4177 |
-
if ( $settings->type == 'stars' )
|
| 4178 |
-
$checked = ' checked="checked"';?>
|
| 4179 |
-
<input type="radio" onchange="pd_change_type( 0 );" <?php echo $checked; ?> value="stars" id="stars" name="rating_type" />
|
| 4180 |
-
<?php printf( __( '%d Star Rating', 'polldaddy' ), 5 );?>
|
| 4181 |
-
</label>
|
| 4182 |
-
</li>
|
| 4183 |
-
<li style="display: inline;">
|
| 4184 |
-
<label><?php
|
| 4185 |
-
$checked = '';
|
| 4186 |
-
if ( $settings->type == 'nero' )
|
| 4187 |
-
$checked = ' checked="checked"';?>
|
| 4188 |
-
<input type="radio" onchange="pd_change_type( 1 );" <?php echo $checked; ?> value="nero" id="nero" name="rating_type" />
|
| 4189 |
-
<?php _e( 'Nero Rating', 'polldaddy' );?>
|
| 4190 |
-
</label>
|
| 4191 |
-
</li>
|
| 4192 |
-
</ul>
|
| 4193 |
-
</div>
|
| 4194 |
-
</div>
|
| 4195 |
-
<div class="postbox">
|
| 4196 |
-
<h3><?php _e( 'Rating Style', 'polldaddy' );?></h3>
|
| 4197 |
-
<div class="inside">
|
| 4198 |
-
<table>
|
| 4199 |
-
<tr>
|
| 4200 |
-
<td height="30" width="100" id="editor_star_size_text"><?php _e( 'Star Size', 'polldaddy' );?></td>
|
| 4201 |
-
<td>
|
| 4202 |
-
<select name="size" id="size" onchange="pd_bind(this);"><?php
|
| 4203 |
-
$select = array( __( 'Small', 'polldaddy' )." (16px)" => "sml", __( 'Medium', 'polldaddy' )." (20px)" => "med", __( 'Large', 'polldaddy' )." (24px)" => "lrg" );
|
| 4204 |
-
foreach ( $select as $option => $value ) :
|
| 4205 |
-
$selected = '';
|
| 4206 |
-
if ( $settings->size == $value )
|
| 4207 |
-
$selected = ' selected="selected"';
|
| 4208 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4209 |
-
endforeach;?>
|
| 4210 |
-
</select>
|
| 4211 |
-
</td>
|
| 4212 |
-
</tr>
|
| 4213 |
-
<tr>
|
| 4214 |
-
<td height="30" id="editor_star_color_text"><?php echo 'bubu'; _e( 'Star Color', 'polldaddy' );?></td>
|
| 4215 |
-
<td>
|
| 4216 |
-
<select name="star_color" id="star_color" onchange="pd_bind(this);" style="display: none;"><?php
|
| 4217 |
-
$select = array( __( 'Yellow', 'polldaddy' ) => "yellow", __( 'Red', 'polldaddy' ) => "red", __( 'Blue', 'polldaddy' ) => "blue", __( 'Green', 'polldaddy' ) => "green", __( 'Grey', 'polldaddy' ) => "grey" );
|
| 4218 |
-
foreach ( $select as $option => $value ) :
|
| 4219 |
-
$selected = '';
|
| 4220 |
-
if ( $settings->star_color == $value )
|
| 4221 |
-
$selected = ' selected="selected"';
|
| 4222 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4223 |
-
endforeach;?>
|
| 4224 |
-
</select>
|
| 4225 |
-
<select name="nero_style" id="nero_style" onchange="pd_bind(this);" style="display: none;"><?php
|
| 4226 |
-
$select = array( __( 'Hand', 'polldaddy' ) => "hand" );
|
| 4227 |
-
foreach ( $select as $option => $value ) :
|
| 4228 |
-
$selected = '';
|
| 4229 |
-
if ( $settings->star_color == $value )
|
| 4230 |
-
$selected = ' selected="selected"';
|
| 4231 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4232 |
-
endforeach;?>
|
| 4233 |
-
</select>
|
| 4234 |
-
</td>
|
| 4235 |
-
</tr>
|
| 4236 |
-
<tr>
|
| 4237 |
-
<td height="30"><?php _e( 'Custom Image', 'polldaddy' );?></td>
|
| 4238 |
-
<td><input type="text" onblur="pd_bind(this);" name="custom_star" id="custom_star" value="<?php echo esc_url( $settings->custom_star ); ?>" maxlength="200" />
|
| 4239 |
-
</tr>
|
| 4240 |
-
</table>
|
| 4241 |
-
</div>
|
| 4242 |
-
</div>
|
| 4243 |
-
<div class="postbox">
|
| 4244 |
-
<h3><?php _e( 'Text Layout & Font', 'polldaddy' );?></h3>
|
| 4245 |
-
<div class="inside">
|
| 4246 |
-
<table>
|
| 4247 |
-
<tr>
|
| 4248 |
-
<td width="100" height="30"><?php _e( 'Align', 'polldaddy' );?></td>
|
| 4249 |
-
<td>
|
| 4250 |
-
<select id="font_align" onchange="pd_bind(this);" name="font_align"><?php
|
| 4251 |
-
$select = array( __( 'Left', 'polldaddy' ) => "left", __( 'Center', 'polldaddy' ) => "center", __( 'Right', 'polldaddy' ) => "right" );
|
| 4252 |
-
foreach ( $select as $option => $value ):
|
| 4253 |
-
$selected = '';
|
| 4254 |
-
if ( $settings->font_align == $value )
|
| 4255 |
-
$selected = ' selected="selected"';
|
| 4256 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 4257 |
-
endforeach;?>
|
| 4258 |
-
</select>
|
| 4259 |
-
</td>
|
| 4260 |
-
</tr>
|
| 4261 |
-
<tr>
|
| 4262 |
-
<td height="30"><?php _e( 'Position', 'polldaddy' );?></td>
|
| 4263 |
-
<td>
|
| 4264 |
-
<select name="font_position" onchange="pd_bind(this);" id="font_position"><?php
|
| 4265 |
-
$select = array( __( 'Top', 'polldaddy' ) => "top", __( 'Right', 'polldaddy' ) => "right", __( 'Bottom', 'polldaddy' ) => "bottom" );
|
| 4266 |
-
foreach ( $select as $option => $value ) :
|
| 4267 |
-
$selected = '';
|
| 4268 |
-
if ( $settings->font_position == $value )
|
| 4269 |
-
$selected = ' selected="selected"';
|
| 4270 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 4271 |
-
endforeach;?>
|
| 4272 |
-
</select>
|
| 4273 |
-
</td>
|
| 4274 |
-
</tr>
|
| 4275 |
-
<tr>
|
| 4276 |
-
<td height="30"><?php _e( 'Font', 'polldaddy' );?></td>
|
| 4277 |
-
<td>
|
| 4278 |
-
<select name="font_family" id="font_family" onchange="pd_bind(this);"><?php
|
| 4279 |
-
$select = array( __( 'Inherit', 'polldaddy' ) => "", "Arial" => "arial", "Comic Sans MS" => "comic sans ms", "Courier" => "courier", "Georgia" => "georgia", "Lucida Grande" => "lucida grande", "Tahoma" => "tahoma", "Times" => "times", "Trebuchet MS" => "trebuchet ms", "Verdana" => "verdana" );
|
| 4280 |
-
foreach ( $select as $option => $value ) :
|
| 4281 |
-
$selected = '';
|
| 4282 |
-
if ( $settings->font_family == $value )
|
| 4283 |
-
$selected = ' selected="selected"';
|
| 4284 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 4285 |
-
endforeach;?>
|
| 4286 |
-
</select>
|
| 4287 |
-
</td>
|
| 4288 |
-
</tr>
|
| 4289 |
-
<tr>
|
| 4290 |
-
<td height="30"><?php _e( 'Color', 'polldaddy' );?></td>
|
| 4291 |
-
<td><input type="text" onblur="pd_bind(this);" class="elmColor jscolor-picker" name="font_color" id="font_color" value="<?php echo esc_html( $settings->font_color ); ?>" maxlength="11" autocomplete="off"/>
|
| 4292 |
-
</td>
|
| 4293 |
-
</tr>
|
| 4294 |
-
<tr>
|
| 4295 |
-
<td><?php _e( 'Size', 'polldaddy' );?></td>
|
| 4296 |
-
<td>
|
| 4297 |
-
<select name="font_size" id="font_size" onchange="pd_bind(this);"><?php
|
| 4298 |
-
$select = array( __( 'Inherit', 'polldaddy' ) => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
|
| 4299 |
-
foreach ( $select as $option => $value ) :
|
| 4300 |
-
$selected = '';
|
| 4301 |
-
if ( $settings->font_size == $value )
|
| 4302 |
-
$selected = ' selected="selected"';
|
| 4303 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4304 |
-
endforeach;?>
|
| 4305 |
-
</select>
|
| 4306 |
-
</td>
|
| 4307 |
-
</tr>
|
| 4308 |
-
<tr>
|
| 4309 |
-
<td height="30"><?php _e( 'Line Height', 'polldaddy' );?></td>
|
| 4310 |
-
<td>
|
| 4311 |
-
<select name="font_line_height" id="font_line_height" onchange="pd_bind(this);"><?php
|
| 4312 |
-
$select = array( __( 'Inherit', 'polldaddy' ) => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
|
| 4313 |
-
foreach ( $select as $option => $value ) :
|
| 4314 |
-
$selected = '';
|
| 4315 |
-
if ( $settings->font_line_height == $value )
|
| 4316 |
-
$selected = ' selected="selected"';
|
| 4317 |
-
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4318 |
-
endforeach; ?>
|
| 4319 |
-
</select>
|
| 4320 |
-
</td>
|
| 4321 |
-
</tr>
|
| 4322 |
-
<tr>
|
| 4323 |
-
<td height="30"><?php _e( 'Bold', 'polldaddy' );?></td>
|
| 4324 |
-
<td><?php
|
| 4325 |
-
$checked = '';
|
| 4326 |
-
if ( $settings->font_bold == 'bold' )
|
| 4327 |
-
$checked = ' checked="checked"';?>
|
| 4328 |
-
<input type="checkbox" name="font_bold" onclick="pd_bind(this);" id="font_bold" value="bold" <?php echo $checked; ?> />
|
| 4329 |
-
</td>
|
| 4330 |
-
</tr>
|
| 4331 |
-
<tr>
|
| 4332 |
-
<td height="30"><?php _e( 'Italic', 'polldaddy' );?></td><?php
|
| 4333 |
-
$checked = '';
|
| 4334 |
-
if ( $settings->font_italic == 'italic' )
|
| 4335 |
-
$checked = ' checked="checked"';?>
|
| 4336 |
-
<td><input type="checkbox" name="font_italic" onclick="pd_bind(this);" id="font_italic" value="italic" <?php echo $checked; ?>/></td>
|
| 4337 |
-
</tr>
|
| 4338 |
-
</table>
|
| 4339 |
-
</div>
|
| 4340 |
-
</div>
|
| 4341 |
-
<?php
|
| 4342 |
-
if ( $this->is_admin ) { ?>
|
| 4343 |
-
<div class="postbox">
|
| 4344 |
-
<h3><?php _e( 'Extra Settings', 'polldaddy' );?></h3>
|
| 4345 |
-
<div class="inside">
|
| 4346 |
-
<table>
|
| 4347 |
-
<tr>
|
| 4348 |
-
<td width="100" height="30"><?php _e( 'Results Popup', 'polldaddy' );?></td>
|
| 4349 |
-
<td>
|
| 4350 |
-
<input type="checkbox" onchange="pd_bind(this);" value="on" name="polldaddy-rating-popup" id="polldaddy-rating-popup" <?php echo !$popup_disabled ? 'checked="checked"' : ''; ?> />
|
| 4351 |
-
</td>
|
| 4352 |
-
<td>
|
| 4353 |
-
<span class="description">
|
| 4354 |
-
<label for="polldaddy-rating-popup"><?php _e( 'Uncheck this box to disable the results popup', 'polldaddy' ); ?></label>
|
| 4355 |
-
</span>
|
| 4356 |
-
</td>
|
| 4357 |
-
</tr><?php
|
| 4358 |
-
if ( $report_type == 'posts' ) {
|
| 4359 |
-
$exclude_post_ids = esc_html( get_option( 'pd-rating-exclude-post-ids' ) ); ?>
|
| 4360 |
-
<tr>
|
| 4361 |
-
<td width="100" height="30"><?php _e( 'Rating ID', 'polldaddy' );?></td>
|
| 4362 |
-
<td>
|
| 4363 |
-
<input type="text" name="polldaddy-post-rating-id" id="polldaddy-post-rating-id" value="<?php echo $rating_id; ?>" />
|
| 4364 |
-
</td>
|
| 4365 |
-
<td>
|
| 4366 |
-
<span class="description">
|
| 4367 |
-
<label for="polldaddy-post-rating-id"><?php _e( 'This is the rating ID used in posts', 'polldaddy' ); ?></label>
|
| 4368 |
-
</span>
|
| 4369 |
-
</td>
|
| 4370 |
-
</tr>
|
| 4371 |
-
<tr>
|
| 4372 |
-
<td width="100" height="30"><?php _e( 'Exclude Posts', 'polldaddy' );?></td>
|
| 4373 |
-
<td>
|
| 4374 |
-
<input type="text" name="exclude-post-ids" id="exclude-post-ids" value="<?php echo $exclude_post_ids; ?>" />
|
| 4375 |
-
</td>
|
| 4376 |
-
<td>
|
| 4377 |
-
<span class="description">
|
| 4378 |
-
<label for="exclude-post-ids"><?php _e( 'Enter the Post IDs where you want to exclude ratings from. Please use a comma-delimited list, eg. 1,2,3', 'polldaddy' ); ?></label>
|
| 4379 |
-
</span>
|
| 4380 |
-
</td>
|
| 4381 |
-
</tr><?php
|
| 4382 |
-
} elseif ( $report_type == 'pages' ) {
|
| 4383 |
-
$exclude_page_ids = esc_html( get_option( 'pd-rating-exclude-page-ids' ) ); ?>
|
| 4384 |
-
<tr>
|
| 4385 |
-
<td width="100" height="30"><?php _e( 'Rating ID', 'polldaddy' );?></td>
|
| 4386 |
-
<td>
|
| 4387 |
-
<input type="text" name="polldaddy-page-rating-id" id="polldaddy-page-rating-id" value="<?php echo $rating_id; ?>" />
|
| 4388 |
-
</td>
|
| 4389 |
-
<td>
|
| 4390 |
-
<span class="description">
|
| 4391 |
-
<label for="polldaddy-page-rating-id"><?php _e( 'This is the rating ID used in pages', 'polldaddy' ); ?></label>
|
| 4392 |
-
</span>
|
| 4393 |
-
</td>
|
| 4394 |
-
</tr>
|
| 4395 |
-
<tr>
|
| 4396 |
-
<td width="100" height="30"><?php _e( 'Exclude Pages', 'polldaddy' );?></td>
|
| 4397 |
-
<td>
|
| 4398 |
-
<input type="text" name="exclude-page-ids" id="exclude-page-ids" value="<?php echo $exclude_page_ids; ?>" />
|
| 4399 |
-
</td>
|
| 4400 |
-
<td>
|
| 4401 |
-
<span class="description">
|
| 4402 |
-
<label for="exclude-page-ids"><?php _e( 'Enter the Page IDs where you want to exclude ratings from. Please use a comma-delimited list, eg. 1,2,3', 'polldaddy' ); ?></label>
|
| 4403 |
-
</span>
|
| 4404 |
-
</td>
|
| 4405 |
-
</tr><?php
|
| 4406 |
-
} elseif ( $report_type == 'comments' ) { ?>
|
| 4407 |
-
<tr>
|
| 4408 |
-
<td width="100" height="30"><?php _e( 'Rating ID', 'polldaddy' );?></td>
|
| 4409 |
-
<td>
|
| 4410 |
-
<input type="text" name="polldaddy-comment-rating-id" id="polldaddy-comment-rating-id" value="<?php echo $rating_id; ?>" />
|
| 4411 |
-
</td>
|
| 4412 |
-
<td>
|
| 4413 |
-
<span class="description">
|
| 4414 |
-
<label for="polldaddy-comment-rating-id"><?php _e( 'This is the rating ID used in comments', 'polldaddy' ); ?></label>
|
| 4415 |
-
</span>
|
| 4416 |
-
</td>
|
| 4417 |
-
</tr><?php
|
| 4418 |
-
} ?>
|
| 4419 |
-
</table>
|
| 4420 |
-
</div>
|
| 4421 |
-
</div>
|
| 4422 |
-
<?php } ?>
|
| 4423 |
-
</div>
|
| 4424 |
-
</div>
|
| 4425 |
-
</form>
|
| 4426 |
-
<script language="javascript">
|
| 4427 |
-
jQuery( document ).ready(function(){
|
| 4428 |
-
plugin = new Plugin( {
|
| 4429 |
-
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 4430 |
-
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 4431 |
-
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 4432 |
-
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 4433 |
-
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 4434 |
-
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 4435 |
-
} );
|
| 4436 |
-
});
|
| 4437 |
-
pd_map = { image_path : '<?php echo plugins_url( 'img', __FILE__ );?>' };
|
| 4438 |
-
</script>
|
| 4439 |
-
<script type="text/javascript">
|
| 4440 |
-
PDRTJS_settings = <?php echo $settings_text; ?>;
|
| 4441 |
-
PDRTJS_settings.id = "1";
|
| 4442 |
-
PDRTJS_settings.unique_id = "xxx";
|
| 4443 |
-
PDRTJS_settings.title = "";
|
| 4444 |
-
PDRTJS_settings.override = "<?php echo esc_attr( $rating_id ); ?>";
|
| 4445 |
-
PDRTJS_settings.permalink = "";
|
| 4446 |
-
PDRTJS_1 = new PDRTJS_RATING( PDRTJS_settings );
|
| 4447 |
-
pd_change_type( <?php echo $rating_type?> );
|
| 4448 |
-
</script><?php
|
| 4449 |
-
} ?>
|
| 4450 |
-
</div><?php
|
| 4451 |
-
} // from if !error ?>
|
| 4452 |
-
</div><?php
|
| 4453 |
-
}
|
| 4454 |
-
|
| 4455 |
-
function update_rating() {
|
| 4456 |
-
$rating_type = 0;
|
| 4457 |
-
$rating_id = 0;
|
| 4458 |
-
$new_rating_id = 0;
|
| 4459 |
-
$type = 'post';
|
| 4460 |
-
$set = null;
|
| 4461 |
-
|
| 4462 |
-
if ( isset( $_REQUEST['rating_id'] ) )
|
| 4463 |
-
$rating_id = (int) $_REQUEST['rating_id'];
|
| 4464 |
-
|
| 4465 |
-
if ( isset( $_REQUEST['polldaddy-post-rating-id'] ) ) {
|
| 4466 |
-
$new_rating_id = (int) $_REQUEST['polldaddy-post-rating-id'];
|
| 4467 |
-
$type = 'posts';
|
| 4468 |
-
}
|
| 4469 |
-
elseif ( isset( $_REQUEST['polldaddy-page-rating-id'] ) ) {
|
| 4470 |
-
$new_rating_id = (int) $_REQUEST['polldaddy-page-rating-id'];
|
| 4471 |
-
$type = 'pages';
|
| 4472 |
-
}
|
| 4473 |
-
elseif ( isset( $_REQUEST['polldaddy-comment-rating-id'] ) ) {
|
| 4474 |
-
$new_rating_id = (int) $_REQUEST['polldaddy-comment-rating-id'];
|
| 4475 |
-
$type = 'comments';
|
| 4476 |
-
} else {
|
| 4477 |
-
$new_rating_id = $rating_id;
|
| 4478 |
-
}
|
| 4479 |
-
|
| 4480 |
-
if ( $rating_id > 0 && $rating_id == $new_rating_id ) {
|
| 4481 |
-
if ( isset( $_REQUEST['rating_type'] ) && $_REQUEST['rating_type'] == 'stars' ) {
|
| 4482 |
-
$set->type = 'stars';
|
| 4483 |
-
$rating_type = 0;
|
| 4484 |
-
if ( isset( $_REQUEST['star_color'] ) )
|
| 4485 |
-
$set->star_color = esc_attr( $_REQUEST['star_color'] );
|
| 4486 |
-
} else {
|
| 4487 |
-
$set->type = 'nero';
|
| 4488 |
-
$rating_type = 1;
|
| 4489 |
-
if ( isset( $_REQUEST['nero_style'] ) )
|
| 4490 |
-
$set->star_color = esc_attr( $_REQUEST['nero_style'] );
|
| 4491 |
-
}
|
| 4492 |
-
|
| 4493 |
-
$set->size = esc_html( $_REQUEST['size'], 1 );
|
| 4494 |
-
$set->custom_star = esc_html( esc_url( $_REQUEST['custom_star'] ) , 1 );
|
| 4495 |
-
$set->font_align = esc_html( $_REQUEST['font_align'], 1 );
|
| 4496 |
-
$set->font_position = esc_html( $_REQUEST['font_position'], 1 );
|
| 4497 |
-
$set->font_family = esc_html( $_REQUEST['font_family'], 1 );
|
| 4498 |
-
$set->font_size = esc_html( $_REQUEST['font_size'], 1 );
|
| 4499 |
-
$set->font_line_height = esc_html( $_REQUEST['font_line_height'], 1 );
|
| 4500 |
-
|
| 4501 |
-
if ( isset( $_REQUEST['font_bold'] ) && $_REQUEST['font_bold'] == 'bold' )
|
| 4502 |
-
$set->font_bold = 'bold';
|
| 4503 |
-
else
|
| 4504 |
-
$set->font_bold = 'normal';
|
| 4505 |
-
|
| 4506 |
-
if ( isset( $_REQUEST['font_italic'] ) && $_REQUEST['font_italic'] == 'italic' )
|
| 4507 |
-
$set->font_italic = 'italic';
|
| 4508 |
-
else
|
| 4509 |
-
$set->font_italic = 'normal';
|
| 4510 |
-
|
| 4511 |
-
$set->text_vote = rawurlencode( stripslashes( esc_html( $_REQUEST['text_vote'], 1 ) ) );
|
| 4512 |
-
$set->text_votes = rawurlencode( stripslashes( esc_html( $_REQUEST['text_votes'], 1 ) ) );
|
| 4513 |
-
$set->text_rate_this = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rate_this'], 1 ) ) );
|
| 4514 |
-
$set->text_1_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_1_star'], 1 ) ) );
|
| 4515 |
-
$set->text_2_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_2_star'], 1 ) ) );
|
| 4516 |
-
$set->text_3_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_3_star'], 1 ) ) );
|
| 4517 |
-
$set->text_4_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_4_star'], 1 ) ) );
|
| 4518 |
-
$set->text_5_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_5_star'], 1 ) ) );
|
| 4519 |
-
$set->text_thank_you = rawurlencode( stripslashes( esc_html( $_REQUEST['text_thank_you'], 1 ) ) );
|
| 4520 |
-
$set->text_rate_up = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rate_up'], 1 ) ) );
|
| 4521 |
-
$set->text_rate_down = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rate_down'], 1 ) ) );
|
| 4522 |
-
$set->font_color = rawurlencode( stripslashes( esc_html( $_REQUEST['font_color'], 1 ) ) );
|
| 4523 |
-
|
| 4524 |
-
$set->text_popcontent= rawurlencode( stripslashes( esc_html( $_REQUEST['text_popcontent'], 1 ) ) );
|
| 4525 |
-
$set->text_close = rawurlencode( stripslashes( esc_html( $_REQUEST['text_close'], 1 ) ) );
|
| 4526 |
-
$set->text_all = rawurlencode( stripslashes( esc_html( $_REQUEST['text_all'], 1 ) ) );
|
| 4527 |
-
$set->text_today = rawurlencode( stripslashes( esc_html( $_REQUEST['text_today'], 1 ) ) );
|
| 4528 |
-
$set->text_thisweek = rawurlencode( stripslashes( esc_html( $_REQUEST['text_thisweek'], 1 ) ) );
|
| 4529 |
-
$set->text_thismonth = rawurlencode( stripslashes( esc_html( $_REQUEST['text_thismonth'], 1 ) ) );
|
| 4530 |
-
$set->text_rated = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rated'], 1 ) ) );
|
| 4531 |
-
$set->text_noratings = rawurlencode( stripslashes( esc_html( $_REQUEST['text_noratings'], 1 ) ) );
|
| 4532 |
-
|
| 4533 |
-
$set->popup = 'off';
|
| 4534 |
-
if ( isset( $_REQUEST['polldaddy-rating-popup'] ) )
|
| 4535 |
-
$set->popup = ( $_REQUEST['polldaddy-rating-popup'] == 'on' ? 'on' : 'off' );
|
| 4536 |
-
|
| 4537 |
-
$settings_text = json_encode( $set );
|
| 4538 |
-
|
| 4539 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 4540 |
-
$polldaddy->reset();
|
| 4541 |
-
$rating = $polldaddy->update_rating( $rating_id, $settings_text, $rating_type );
|
| 4542 |
-
} elseif ( $this->is_admin && $new_rating_id > 0 ) {
|
| 4543 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 4544 |
-
$pd_rating = $polldaddy->get_rating( $new_rating_id );
|
| 4545 |
-
if ( false !== $pd_rating ) {
|
| 4546 |
-
switch ( $type ) {
|
| 4547 |
-
case 'pages':
|
| 4548 |
-
update_option( 'pd-rating-pages-id', $new_rating_id );
|
| 4549 |
-
if ( (int) get_option( 'pd-rating-pages' ) > 0 )
|
| 4550 |
-
update_option( 'pd-rating-pages', $new_rating_id );
|
| 4551 |
-
break;
|
| 4552 |
-
case 'comments':
|
| 4553 |
-
update_option( 'pd-rating-comments-id', $new_rating_id );
|
| 4554 |
-
if ( (int) get_option( 'pd-rating-comments' ) > 0 )
|
| 4555 |
-
update_option( 'pd-rating-comments', $new_rating_id );
|
| 4556 |
-
break;
|
| 4557 |
-
case 'posts':
|
| 4558 |
-
update_option( 'pd-rating-posts-id', $new_rating_id );
|
| 4559 |
-
if ( (int) get_option( 'pd-rating-posts' ) > 0 )
|
| 4560 |
-
update_option( 'pd-rating-posts', $new_rating_id );
|
| 4561 |
-
}
|
| 4562 |
-
}
|
| 4563 |
-
}
|
| 4564 |
-
|
| 4565 |
-
if ( $this->is_admin ) {
|
| 4566 |
-
if ( $type=='posts' && isset( $_REQUEST['exclude-post-ids'] ) ) {
|
| 4567 |
-
$exclude_post_ids = $_REQUEST['exclude-post-ids'];
|
| 4568 |
-
if ( empty( $exclude_post_ids ) ) {
|
| 4569 |
-
update_option( 'pd-rating-exclude-post-ids', '' );
|
| 4570 |
-
} else {
|
| 4571 |
-
$post_ids = array();
|
| 4572 |
-
$ids = explode( ',', $exclude_post_ids );
|
| 4573 |
-
if ( !empty( $ids ) ) {
|
| 4574 |
-
foreach ( (array) $ids as $id ) {
|
| 4575 |
-
if ( (int) $id > 0 )
|
| 4576 |
-
$post_ids[] = (int) $id;
|
| 4577 |
-
}
|
| 4578 |
-
}
|
| 4579 |
-
if ( !empty( $post_ids ) ) {
|
| 4580 |
-
$exclude_post_ids = implode( ',', $post_ids );
|
| 4581 |
-
update_option( 'pd-rating-exclude-post-ids', $exclude_post_ids );
|
| 4582 |
-
}
|
| 4583 |
-
}
|
| 4584 |
-
}
|
| 4585 |
-
|
| 4586 |
-
if ( $type=='pages' && isset( $_REQUEST['exclude-page-ids'] ) ) {
|
| 4587 |
-
$exclude_page_ids = $_REQUEST['exclude-page-ids'];
|
| 4588 |
-
if ( empty( $exclude_page_ids ) ) {
|
| 4589 |
-
update_option( 'pd-rating-exclude-page-ids', '' );
|
| 4590 |
-
} else {
|
| 4591 |
-
$page_ids = array();
|
| 4592 |
-
$ids = explode( ',', $exclude_page_ids );
|
| 4593 |
-
if ( !empty( $ids ) ) {
|
| 4594 |
-
foreach ( (array) $ids as $id ) {
|
| 4595 |
-
if ( (int) $id > 0 )
|
| 4596 |
-
$page_ids[] = (int) $id;
|
| 4597 |
-
}
|
| 4598 |
-
}
|
| 4599 |
-
if ( !empty( $page_ids ) ) {
|
| 4600 |
-
$exclude_page_ids = implode( ',', $page_ids );
|
| 4601 |
-
update_option( 'pd-rating-exclude-page-ids', $exclude_page_ids );
|
| 4602 |
-
}
|
| 4603 |
-
}
|
| 4604 |
-
}
|
| 4605 |
-
}
|
| 4606 |
-
}
|
| 4607 |
-
function rating_reports() {
|
| 4608 |
-
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) || WP_POLLDADDY__PARTNERGUID == false )
|
| 4609 |
-
return false;
|
| 4610 |
-
|
| 4611 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 4612 |
-
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 4613 |
-
|
| 4614 |
-
$report_type = 'posts';
|
| 4615 |
-
$period = '7';
|
| 4616 |
-
$show_rating = 0;
|
| 4617 |
-
|
| 4618 |
-
if ( isset( $_REQUEST['change-report-to'] ) ) {
|
| 4619 |
-
switch ( $_REQUEST['change-report-to'] ) {
|
| 4620 |
-
case 'pages':
|
| 4621 |
-
$report_type = 'pages';
|
| 4622 |
-
$rating_id = (int) get_option( 'pd-rating-pages-id' );
|
| 4623 |
-
break;
|
| 4624 |
-
|
| 4625 |
-
case 'comments':
|
| 4626 |
-
$report_type = 'comments';
|
| 4627 |
-
$rating_id = get_option( 'pd-rating-comments-id' );
|
| 4628 |
-
break;
|
| 4629 |
-
|
| 4630 |
-
case 'posts':
|
| 4631 |
-
$report_type = 'posts';
|
| 4632 |
-
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 4633 |
-
break;
|
| 4634 |
-
}//end switch
|
| 4635 |
-
}
|
| 4636 |
-
|
| 4637 |
-
if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] ) {
|
| 4638 |
-
switch ( $_REQUEST['filter'] ) {
|
| 4639 |
-
case '1':
|
| 4640 |
-
$period = '1';
|
| 4641 |
-
break;
|
| 4642 |
-
|
| 4643 |
-
case '7':
|
| 4644 |
-
$period = '7';
|
| 4645 |
-
break;
|
| 4646 |
-
|
| 4647 |
-
case '31':
|
| 4648 |
-
$period = '31';
|
| 4649 |
-
break;
|
| 4650 |
-
|
| 4651 |
-
case '90':
|
| 4652 |
-
$period = '90';
|
| 4653 |
-
break;
|
| 4654 |
-
|
| 4655 |
-
case '365':
|
| 4656 |
-
$period = '365';
|
| 4657 |
-
break;
|
| 4658 |
-
|
| 4659 |
-
case 'all':
|
| 4660 |
-
$period = 'all';
|
| 4661 |
-
break;
|
| 4662 |
-
}//end switch
|
| 4663 |
-
}
|
| 4664 |
-
|
| 4665 |
-
$page_size = 15;
|
| 4666 |
-
$current_page = 1;
|
| 4667 |
-
|
| 4668 |
-
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'change-report' ) {
|
| 4669 |
-
$current_page = 1;
|
| 4670 |
-
} else {
|
| 4671 |
-
if ( isset( $_REQUEST['paged'] ) ) {
|
| 4672 |
-
$current_page = (int) $_REQUEST['paged'];
|
| 4673 |
-
if ( $current_page == 0 )
|
| 4674 |
-
$current_page = 1;
|
| 4675 |
-
}
|
| 4676 |
-
}
|
| 4677 |
-
|
| 4678 |
-
$start = ( $current_page * $page_size ) - $page_size;
|
| 4679 |
-
$end = $page_size;
|
| 4680 |
-
|
| 4681 |
-
$response = $polldaddy->get_rating_results( $rating_id, $period, $start, $end );
|
| 4682 |
-
|
| 4683 |
-
$total = $total_pages = 0;
|
| 4684 |
-
$ratings = null;
|
| 4685 |
-
|
| 4686 |
-
if ( !empty( $response ) ) {
|
| 4687 |
-
$ratings = $response->rating;
|
| 4688 |
-
$total = (int) $response->_total;
|
| 4689 |
-
$total_pages = ceil( $total / $page_size );
|
| 4690 |
-
}
|
| 4691 |
-
|
| 4692 |
-
$page_links = paginate_links( array(
|
| 4693 |
-
'base' => add_query_arg( array ( 'paged' => '%#%', 'change-report-to' => $report_type, 'filter' => $period ) ),
|
| 4694 |
-
'format' => '',
|
| 4695 |
-
'prev_text' => __( '«', 'polldaddy' ),
|
| 4696 |
-
'next_text' => __( '»', 'polldaddy' ),
|
| 4697 |
-
'total' => $total_pages,
|
| 4698 |
-
'current' => $current_page,
|
| 4699 |
-
'prev_text' => '«',
|
| 4700 |
-
'next_text' => '»'
|
| 4701 |
-
) );
|
| 4702 |
-
?>
|
| 4703 |
-
<div class="wrap">
|
| 4704 |
-
<?php if ( $this->is_admin ) : ?>
|
| 4705 |
-
<h2 id="polldaddy-header"><?php printf( __( 'Rating Results <a href="%s" class="add-new-h2">Settings</a>', 'polldaddy' ), esc_url( 'options-general.php?page=ratings&action=options' ) ); ?></h2>
|
| 4706 |
-
<?php else : ?>
|
| 4707 |
-
<h2 id="polldaddy-header"><?php _e( 'Rating Results', 'polldaddy' ); ?></h2>
|
| 4708 |
-
<?php endif; ?>
|
| 4709 |
-
<div class="clear"></div>
|
| 4710 |
-
<form method="post" action="">
|
| 4711 |
-
<div class="tablenav">
|
| 4712 |
-
<div class="alignleft actions">
|
| 4713 |
-
<?php if ( $this->is_editor ) { ?>
|
| 4714 |
-
<select name="action">
|
| 4715 |
-
<option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
|
| 4716 |
-
<option value="delete"><?php _e( 'Delete', 'polldaddy' ); ?></option>
|
| 4717 |
-
</select>
|
| 4718 |
-
<input type="hidden" name="id" id="id" value="<?php echo (int) $rating_id; ?>" />
|
| 4719 |
-
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
|
| 4720 |
-
<?php wp_nonce_field( 'action-rating_bulk' ); ?>
|
| 4721 |
-
<?php } ?>
|
| 4722 |
-
<select name="change-report-to"><?php
|
| 4723 |
-
$select = array( __( 'Posts', 'polldaddy' ) => "posts", __( 'Pages', 'polldaddy' ) => "pages", __( 'Comments', 'polldaddy' ) => "comments" );
|
| 4724 |
-
foreach ( $select as $option => $value ) :
|
| 4725 |
-
$selected = '';
|
| 4726 |
-
if ( $value == $report_type )
|
| 4727 |
-
$selected = ' selected="selected"';?>
|
| 4728 |
-
<option value="<?php echo $value; ?>" <?php echo $selected; ?>><?php echo $option; ?></option>
|
| 4729 |
-
<?php endforeach; ?>
|
| 4730 |
-
</select>
|
| 4731 |
-
<select name="filter"><?php
|
| 4732 |
-
$select = array( __( 'Last 24 hours', 'polldaddy' ) => "1", __( 'Last 7 days', 'polldaddy' ) => "7", __( 'Last 31 days', 'polldaddy' ) => "31", __( 'Last 3 months', 'polldaddy' ) => "90", __( 'Last 12 months', 'polldaddy' ) => "365", __( 'All time', 'polldaddy' ) => "all" );
|
| 4733 |
-
foreach ( $select as $option => $value ) :
|
| 4734 |
-
$selected = '';
|
| 4735 |
-
if ( $value == $period )
|
| 4736 |
-
$selected = ' selected="selected"';?>
|
| 4737 |
-
<option value="<?php echo $value; ?>" <?php echo $selected; ?>><?php echo $option; ?></option>
|
| 4738 |
-
<?php endforeach; ?>
|
| 4739 |
-
</select>
|
| 4740 |
-
<input class="button-secondary action" type="submit" value="<?php _e( 'Filter', 'polldaddy' );?>" />
|
| 4741 |
-
<?php if ( in_array( $period, array( 1, 7 ) ) ) : ?>
|
| 4742 |
-
<label><?php _e( '* The results are cached and are updated every hour' ); ?></label>
|
| 4743 |
-
<?php elseif ( $period == 31 ) : ?>
|
| 4744 |
-
<label><?php _e( '* The results are cached and are updated every day' ); ?></label>
|
| 4745 |
-
<?php else : ?>
|
| 4746 |
-
<label><?php _e( '* The results are cached and are updated every 3 days' ); ?></label>
|
| 4747 |
-
<?php endif; ?>
|
| 4748 |
-
</div>
|
| 4749 |
-
<div class="alignright">
|
| 4750 |
-
<div class="tablenav-pages">
|
| 4751 |
-
<?php echo $page_links; ?>
|
| 4752 |
-
</div>
|
| 4753 |
-
</div>
|
| 4754 |
-
</div>
|
| 4755 |
-
|
| 4756 |
-
<table class="widefat"><?php
|
| 4757 |
-
if ( empty( $ratings ) ) { ?>
|
| 4758 |
-
<tbody>
|
| 4759 |
-
<tr>
|
| 4760 |
-
<td colspan="4"><?php printf( __( 'No ratings have been collected for your %s yet.', 'polldaddy' ), $report_type ); ?></td>
|
| 4761 |
-
</tr>
|
| 4762 |
-
</tbody><?php
|
| 4763 |
-
} else {
|
| 4764 |
-
polldaddy_update_ratings_cache( $ratings );
|
| 4765 |
-
?>
|
| 4766 |
-
<thead>
|
| 4767 |
-
<tr>
|
| 4768 |
-
<?php if ( $this->is_editor ) { ?>
|
| 4769 |
-
<th scope="col" class="manage-column column-cb check-column" id="cb"><input type="checkbox"></th>
|
| 4770 |
-
<?php } else { ?>
|
| 4771 |
-
<th scope="col" class="manage-column column-cb check-column" id="cb"></th>
|
| 4772 |
-
<?php } ?>
|
| 4773 |
-
<th scope="col" class="manage-column column-title" id="title"><?php _e( 'Title', 'polldaddy' );?></th>
|
| 4774 |
-
<th scope="col" class="manage-column column-id" id="id"><?php _e( 'Unique ID', 'polldaddy' );?></th>
|
| 4775 |
-
<th scope="col" class="manage-column column-date" id="date"><?php _e( 'Start Date', 'polldaddy' );?></th>
|
| 4776 |
-
<th scope="col" class="manage-column column-vote num" id="votes"><?php _e( 'Votes', 'polldaddy' );?></th>
|
| 4777 |
-
<th scope="col" class="manage-column column-rating num" id="rating"><?php _e( 'Average Rating', 'polldaddy' );?></th>
|
| 4778 |
-
</tr>
|
| 4779 |
-
</thead>
|
| 4780 |
-
<tbody><?php
|
| 4781 |
-
$alt_counter = 0;
|
| 4782 |
-
$alt = '';
|
| 4783 |
-
|
| 4784 |
-
foreach ( $ratings as $rating ) :
|
| 4785 |
-
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $rating_id, 'rating' => $rating->uid, 'change-report-to' => $report_type, 'message' => false ) ), "delete-rating_$rating->uid" ) );
|
| 4786 |
-
$alt_counter++;?>
|
| 4787 |
-
<tr <?php echo ( $alt_counter & 1 ) ? ' class="alternate"' : ''; ?>>
|
| 4788 |
-
<th class="check-column" scope="row"><input type="checkbox" value="<?php echo esc_html( $rating->uid ); ?>" name="rating[]" /></th>
|
| 4789 |
-
<td class="post-title column-title">
|
| 4790 |
-
<strong><a href="<?php echo esc_url( $rating->permalink ); ?>"><?php echo strlen( esc_html( $rating->title ) ) > 75 ? substr( esc_html( $rating->title ), 0, 72 ) . '&hellip' : esc_html( $rating->title ); ?></a></strong>
|
| 4791 |
-
<div class="row-actions">
|
| 4792 |
-
<?php if ( $this->is_editor && $delete_link ) { ?>
|
| 4793 |
-
<span class="delete"><a class="delete-rating delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
|
| 4794 |
-
<?php } ?>
|
| 4795 |
-
</div>
|
| 4796 |
-
</td>
|
| 4797 |
-
<td class="column-id">
|
| 4798 |
-
<?php echo esc_html( $rating->uid ); ?>
|
| 4799 |
-
</td>
|
| 4800 |
-
<td class="date column-date">
|
| 4801 |
-
<abbr title="<?php echo date( __( 'Y/m/d g:i:s A', 'polldaddy' ), $rating->date ); ?>"><?php echo str_replace( '-', '/', substr( esc_html( $rating->date ), 0, 10 ) ); ?></abbr>
|
| 4802 |
-
</td>
|
| 4803 |
-
<td class="column-vote num"><?php echo number_format( $rating->_votes ); ?></td>
|
| 4804 |
-
<td class="column-rating num"><table width="100%"><tr align="center"><td style="border:none;"><?php
|
| 4805 |
-
if ( $rating->_type == 0 ) {
|
| 4806 |
-
$avg_rating = $this->round( $rating->average_rating, 0.5 );?>
|
| 4807 |
-
<div style="width:100px"><?php
|
| 4808 |
-
$image_pos = '';
|
| 4809 |
-
|
| 4810 |
-
for ( $c = 1; $c <= 5; $c++ ) :
|
| 4811 |
-
if ( $avg_rating > 0 ) {
|
| 4812 |
-
if ( $avg_rating < $c )
|
| 4813 |
-
$image_pos = 'bottom left';
|
| 4814 |
-
if ( $avg_rating == ( $c - 1 + 0.5 ) )
|
| 4815 |
-
$image_pos = 'center left';
|
| 4816 |
-
} ?>
|
| 4817 |
-
<div style="width: 20px; height: 20px; background: url(<?php echo plugins_url( 'img/star-yellow-med.png', __FILE__ ); ?>) <?php echo $image_pos; ?>; float: left;"></div><?php
|
| 4818 |
-
endfor; ?>
|
| 4819 |
-
<br class="clear" />
|
| 4820 |
-
</div><?php
|
| 4821 |
-
} else { ?>
|
| 4822 |
-
<div>
|
| 4823 |
-
<div style="margin: 0px 0px 0px 20px; background: transparent url(<?php echo plugins_url( 'img/rate-graph-up.png', __FILE__ ); ?>); width: 20px; height: 20px; float: left;"></div>
|
| 4824 |
-
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total1 );?></div>
|
| 4825 |
-
<div style="margin: 0px; background: transparent url(<?php echo plugins_url( 'img/rate-graph-dn.png', __FILE__ ); ?>); width: 20px; height: 20px; float: left;"></div>
|
| 4826 |
-
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total2 );?></div>
|
| 4827 |
-
<br class="clear" />
|
| 4828 |
-
</div><?php
|
| 4829 |
-
} ?>
|
| 4830 |
-
</td></tr></table>
|
| 4831 |
-
</td>
|
| 4832 |
-
</tr><?php
|
| 4833 |
-
endforeach;
|
| 4834 |
-
?>
|
| 4835 |
-
</tbody><?php
|
| 4836 |
-
} ?>
|
| 4837 |
-
</table>
|
| 4838 |
-
<div class="tablenav">
|
| 4839 |
-
<div class="alignright">
|
| 4840 |
-
<div class="tablenav-pages">
|
| 4841 |
-
<?php echo $page_links; ?>
|
| 4842 |
-
</div>
|
| 4843 |
-
</div>
|
| 4844 |
-
</div>
|
| 4845 |
-
</form>
|
| 4846 |
-
</div>
|
| 4847 |
-
<p></p>
|
| 4848 |
-
<script language="javascript">
|
| 4849 |
-
jQuery( document ).ready(function(){
|
| 4850 |
-
plugin = new Plugin( {
|
| 4851 |
-
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 4852 |
-
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 4853 |
-
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 4854 |
-
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 4855 |
-
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 4856 |
-
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 4857 |
-
} );
|
| 4858 |
-
});
|
| 4859 |
-
</script><?php
|
| 4860 |
-
}
|
| 4861 |
-
|
| 4862 |
-
function plugin_options() {
|
| 4863 |
-
if ( isset( $_POST['polldaddy_email'] ) ) {
|
| 4864 |
-
$account_email = false;
|
| 4865 |
-
} else {
|
| 4866 |
-
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 4867 |
-
$account = $polldaddy->get_account();
|
| 4868 |
-
|
| 4869 |
-
if ( !empty( $account ) )
|
| 4870 |
-
$account_email = esc_attr( $account->email );
|
| 4871 |
-
|
| 4872 |
-
$polldaddy->reset();
|
| 4873 |
-
$poll = $polldaddy->get_poll( 1 );
|
| 4874 |
-
|
| 4875 |
-
$options = array(
|
| 4876 |
-
101 => __( 'Aluminum Narrow', 'polldaddy' ),
|
| 4877 |
-
102 => __( 'Aluminum Medium', 'polldaddy' ),
|
| 4878 |
-
103 => __( 'Aluminum Wide', 'polldaddy' ),
|
| 4879 |
-
104 => __( 'Plain White Narrow', 'polldaddy' ),
|
| 4880 |
-
105 => __( 'Plain White Medium', 'polldaddy' ),
|
| 4881 |
-
106 => __( 'Plain White Wide', 'polldaddy' ),
|
| 4882 |
-
107 => __( 'Plain Black Narrow', 'polldaddy' ),
|
| 4883 |
-
108 => __( 'Plain Black Medium', 'polldaddy' ),
|
| 4884 |
-
109 => __( 'Plain Black Wide', 'polldaddy' ),
|
| 4885 |
-
110 => __( 'Paper Narrow', 'polldaddy' ),
|
| 4886 |
-
111 => __( 'Paper Medium', 'polldaddy' ),
|
| 4887 |
-
112 => __( 'Paper Wide', 'polldaddy' ),
|
| 4888 |
-
113 => __( 'Skull Dark Narrow', 'polldaddy' ),
|
| 4889 |
-
114 => __( 'Skull Dark Medium', 'polldaddy' ),
|
| 4890 |
-
115 => __( 'Skull Dark Wide', 'polldaddy' ),
|
| 4891 |
-
116 => __( 'Skull Light Narrow', 'polldaddy' ),
|
| 4892 |
-
117 => __( 'Skull Light Medium', 'polldaddy' ),
|
| 4893 |
-
118 => __( 'Skull Light Wide', 'polldaddy' ),
|
| 4894 |
-
157 => __( 'Micro', 'polldaddy' ),
|
| 4895 |
-
119 => __( 'Plastic White Narrow', 'polldaddy' ),
|
| 4896 |
-
120 => __( 'Plastic White Medium', 'polldaddy' ),
|
| 4897 |
-
121 => __( 'Plastic White Wide', 'polldaddy' ),
|
| 4898 |
-
122 => __( 'Plastic Grey Narrow', 'polldaddy' ),
|
| 4899 |
-
123 => __( 'Plastic Grey Medium', 'polldaddy' ),
|
| 4900 |
-
124 => __( 'Plastic Grey Wide', 'polldaddy' ),
|
| 4901 |
-
125 => __( 'Plastic Black Narrow', 'polldaddy' ),
|
| 4902 |
-
126 => __( 'Plastic Black Medium', 'polldaddy' ),
|
| 4903 |
-
127 => __( 'Plastic Black Wide', 'polldaddy' ),
|
| 4904 |
-
128 => __( 'Manga Narrow', 'polldaddy' ),
|
| 4905 |
-
129 => __( 'Manga Medium', 'polldaddy' ),
|
| 4906 |
-
130 => __( 'Manga Wide', 'polldaddy' ),
|
| 4907 |
-
131 => __( 'Tech Dark Narrow', 'polldaddy' ),
|
| 4908 |
-
132 => __( 'Tech Dark Medium', 'polldaddy' ),
|
| 4909 |
-
133 => __( 'Tech Dark Wide', 'polldaddy' ),
|
| 4910 |
-
134 => __( 'Tech Grey Narrow', 'polldaddy' ),
|
| 4911 |
-
135 => __( 'Tech Grey Medium', 'polldaddy' ),
|
| 4912 |
-
136 => __( 'Tech Grey Wide', 'polldaddy' ),
|
| 4913 |
-
137 => __( 'Tech Light Narrow', 'polldaddy' ),
|
| 4914 |
-
138 => __( 'Tech Light Medium', 'polldaddy' ),
|
| 4915 |
-
139 => __( 'Tech Light Wide', 'polldaddy' ),
|
| 4916 |
-
140 => __( 'Working Male Narrow', 'polldaddy' ),
|
| 4917 |
-
141 => __( 'Working Male Medium', 'polldaddy' ),
|
| 4918 |
-
142 => __( 'Working Male Wide', 'polldaddy' ),
|
| 4919 |
-
143 => __( 'Working Female Narrow', 'polldaddy' ),
|
| 4920 |
-
144 => __( 'Working Female Medium', 'polldaddy' ),
|
| 4921 |
-
145 => __( 'Working Female Wide', 'polldaddy' ),
|
| 4922 |
-
146 => __( 'Thinking Male Narrow', 'polldaddy' ),
|
| 4923 |
-
147 => __( 'Thinking Male Medium', 'polldaddy' ),
|
| 4924 |
-
148 => __( 'Thinking Male Wide', 'polldaddy' ),
|
| 4925 |
-
149 => __( 'Thinking Female Narrow', 'polldaddy' ),
|
| 4926 |
-
150 => __( 'Thinking Female Medium', 'polldaddy' ),
|
| 4927 |
-
151 => __( 'Thinking Female Wide', 'polldaddy' ),
|
| 4928 |
-
152 => __( 'Sunset Narrow', 'polldaddy' ),
|
| 4929 |
-
153 => __( 'Sunset Medium', 'polldaddy' ),
|
| 4930 |
-
154 => __( 'Sunset Wide', 'polldaddy' ),
|
| 4931 |
-
155 => __( 'Music Medium', 'polldaddy' ),
|
| 4932 |
-
156 => __( 'Music Wide', 'polldaddy' )
|
| 4933 |
-
);
|
| 4934 |
-
|
| 4935 |
-
$polldaddy->reset();
|
| 4936 |
-
$styles = $polldaddy->get_styles();
|
| 4937 |
-
|
| 4938 |
-
if ( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ) {
|
| 4939 |
-
foreach ( (array) $styles->style as $style ) {
|
| 4940 |
-
$options[ (int) $style->_id ] = $style->title;
|
| 4941 |
-
}
|
| 4942 |
-
}
|
| 4943 |
-
}
|
| 4944 |
-
$this->print_errors();
|
| 4945 |
-
?>
|
| 4946 |
-
<div id="options-page" class="wrap">
|
| 4947 |
-
<div class="icon32" id="icon-options-general"><br/></div>
|
| 4948 |
-
<h2>
|
| 4949 |
-
<?php _e( 'Poll Settings', 'polldaddy' ); ?>
|
| 4950 |
-
</h2>
|
| 4951 |
-
<?php if ( $this->is_admin || $this->multiple_accounts ) { ?>
|
| 4952 |
-
<h3>
|
| 4953 |
-
<?php _e( 'Polldaddy Account Info', 'polldaddy' ); ?>
|
| 4954 |
-
</h3>
|
| 4955 |
-
<p><?php _e( '<em>Polldaddy</em> and <em>WordPress.com</em> are now connected using <a href="http://en.support.wordpress.com/wpcc-faq/">WordPress.com Connect</a>. If you have a WordPress.com account you can use it to login to <a href="http://polldaddy.com/">Polldaddy.com</a>. Click on the Polldaddy "sign in" button, authorize the connection and create your new Polldaddy account.', 'polldaddy' ); ?></p>
|
| 4956 |
-
<p><?php _e( 'Login to the Polldaddy website and scroll to the end of your <a href="http://polldaddy.com/account/#apikey">account page</a> to create or retrieve an API key.', 'polldaddy' ); ?></p>
|
| 4957 |
-
<?php if ( isset( $account_email ) && $account_email != false ) { ?>
|
| 4958 |
-
<p><?php printf( __( 'Your account is currently linked to this API key: <strong>%s</strong>', 'polldaddy' ), WP_POLLDADDY__PARTNERGUID ); ?></p>
|
| 4959 |
-
<br />
|
| 4960 |
-
<h3><?php _e( 'Link to a different Polldaddy account', 'polldaddy' ); ?></h3>
|
| 4961 |
-
<?php } else { ?>
|
| 4962 |
-
<br />
|
| 4963 |
-
<h3><?php _e( 'Link to your Polldaddy account', 'polldaddy' ); ?></h3>
|
| 4964 |
-
<?php } ?>
|
| 4965 |
-
<form action="" method="post">
|
| 4966 |
-
<table class="form-table">
|
| 4967 |
-
<tbody>
|
| 4968 |
-
<tr class="form-field form-required">
|
| 4969 |
-
<th valign="top" scope="row">
|
| 4970 |
-
<label for="polldaddy-key">
|
| 4971 |
-
<?php _e( 'Polldaddy.com API Key', 'polldaddy' ); ?>
|
| 4972 |
-
</label>
|
| 4973 |
-
</th>
|
| 4974 |
-
<td>
|
| 4975 |
-
<input type="text" name="polldaddy_key" id="polldaddy-key" aria-required="true" size="20" value="<?php if ( isset( $_POST[ 'polldaddy_key' ] ) ) echo esc_attr( $_POST[ 'polldaddy_key' ] ); ?>" />
|
| 4976 |
-
</td>
|
| 4977 |
-
</tr>
|
| 4978 |
-
</tbody>
|
| 4979 |
-
</table>
|
| 4980 |
-
<p class="submit">
|
| 4981 |
-
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 4982 |
-
<input type="hidden" name="action" value="import-account" />
|
| 4983 |
-
<input type="hidden" name="account" value="import" />
|
| 4984 |
-
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Link Account', 'polldaddy' ) ); ?>" />
|
| 4985 |
-
</p>
|
| 4986 |
-
</form>
|
| 4987 |
-
|
| 4988 |
-
<?php
|
| 4989 |
-
} ?>
|
| 4990 |
-
<?php
|
| 4991 |
-
// if not connected to a Polldaddy account can't save defaults so don't show the form.
|
| 4992 |
-
if ( false == is_object( $poll ) ) {
|
| 4993 |
-
echo "</div>";
|
| 4994 |
-
} else {
|
| 4995 |
-
?>
|
| 4996 |
-
<h3>
|
| 4997 |
-
<?php _e( 'General Settings', 'polldaddy' ); ?>
|
| 4998 |
-
</h3>
|
| 4999 |
-
<form action="" method="post">
|
| 5000 |
-
<table class="form-table">
|
| 5001 |
-
<tbody>
|
| 5002 |
-
<tr valign="top">
|
| 5003 |
-
<th valign="top" scope="row">
|
| 5004 |
-
<label>
|
| 5005 |
-
<?php _e( 'Default poll settings', 'polldaddy' ); ?>
|
| 5006 |
-
</label>
|
| 5007 |
-
</th>
|
| 5008 |
-
<td>
|
| 5009 |
-
<fieldset>
|
| 5010 |
-
<legend class="screen-reader-text"><span>poll-defaults</span></legend><?php
|
| 5011 |
-
foreach ( array( 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), 'multipleChoice' => __( 'Multiple choice', 'polldaddy' ), 'sharing' => __( 'Sharing', 'polldaddy' ) ) as $option => $label ) :
|
| 5012 |
-
$checked = 'yes' === $poll->$option ? ' checked="checked"' : '';
|
| 5013 |
-
?>
|
| 5014 |
-
<label for="<?php echo $option; ?>"><input type="checkbox"<?php echo $checked; ?> value="1" id="<?php echo $option; ?>" name="<?php echo $option; ?>" /> <?php echo esc_html( $label ); ?></label><br />
|
| 5015 |
-
|
| 5016 |
-
<?php endforeach; ?>
|
| 5017 |
-
<br class="clear" />
|
| 5018 |
-
<br class="clear" />
|
| 5019 |
-
<div class="field">
|
| 5020 |
-
<label for="resultsType" class="pd-label">
|
| 5021 |
-
<?php _e( 'Results Display', 'polldaddy' ); ?></label>
|
| 5022 |
-
<select id="resultsType" name="resultsType">
|
| 5023 |
-
<option <?php echo $poll->resultsType == 'show' ? 'selected="selected"':''; ?> value="show"><?php _e( 'Show', 'polldaddy' ); ?></option>
|
| 5024 |
-
<option <?php echo $poll->resultsType == 'hide' ? 'selected="selected"':''; ?> value="hide"><?php _e( 'Hide', 'polldaddy' ); ?></option>
|
| 5025 |
-
<option <?php echo $poll->resultsType == 'percent' ? 'selected="selected"':''; ?> value="percent"><?php _e( 'Percentages', 'polldaddy' ); ?></option>
|
| 5026 |
-
</select>
|
| 5027 |
-
</div>
|
| 5028 |
-
<br class="clear" />
|
| 5029 |
-
<div class="field">
|
| 5030 |
-
<label for="styleID" class="pd-label">
|
| 5031 |
-
<?php _e( 'Poll style', 'polldaddy' ); ?></label>
|
| 5032 |
-
<select id="styleID" name="styleID"><?php
|
| 5033 |
-
foreach ( (array) $options as $styleID => $label ) :
|
| 5034 |
-
$selected = $styleID == $poll->styleID ? ' selected="selected"' : ''; ?>
|
| 5035 |
-
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo esc_html( $label ); ?></option><?php
|
| 5036 |
-
endforeach;?>
|
| 5037 |
-
</select>
|
| 5038 |
-
</div>
|
| 5039 |
-
</div>
|
| 5040 |
-
<br class="clear" />
|
| 5041 |
-
<div class="field">
|
| 5042 |
-
<label for="blockRepeatVotersType" class="pd-label">
|
| 5043 |
-
<?php _e( 'Repeat Voting', 'polldaddy' ); ?></label>
|
| 5044 |
-
<select id="poll-block-repeat" name="blockRepeatVotersType">
|
| 5045 |
-
<option <?php echo $poll->blockRepeatVotersType == 'off' ? 'selected="selected"':''; ?> value="off"><?php _e( 'Off', 'polldaddy' ); ?></option>
|
| 5046 |
-
<option <?php echo $poll->blockRepeatVotersType == 'cookie' ? 'selected="selected"':''; ?> value="cookie"><?php _e( 'Cookie', 'polldaddy' ); ?></option>
|
| 5047 |
-
<option <?php echo $poll->blockRepeatVotersType == 'cookieip' ? 'selected="selected"':''; ?> value="cookieip"><?php _e( 'Cookie & IP address', 'polldaddy' ); ?></option>
|
| 5048 |
-
</select>
|
| 5049 |
-
</div>
|
| 5050 |
-
<br class="clear" />
|
| 5051 |
-
<div class="field">
|
| 5052 |
-
|
| 5053 |
-
<label for="blockExpiration" class="pd-label"><?php _e( 'Block expiration limit', 'polldaddy' ); ?></label>
|
| 5054 |
-
|
| 5055 |
-
|
| 5056 |
-
<select id="blockExpiration" name="blockExpiration">
|
| 5057 |
-
<option value="3600" <?php echo $poll->blockExpiration == 3600 ? 'selected="selected"':''; ?>><?php printf( __( '%d hour', 'polldaddy' ), 1 ); ?></option>
|
| 5058 |
-
<option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 3 ); ?></option>
|
| 5059 |
-
<option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 6 ); ?></option>
|
| 5060 |
-
<option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 12 ); ?></option>
|
| 5061 |
-
<option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d day', 'polldaddy' ), 1 ); ?></option>
|
| 5062 |
-
<option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d week', 'polldaddy' ), 1 ); ?></option>
|
| 5063 |
-
</select>
|
| 5064 |
-
</div>
|
| 5065 |
-
</div>
|
| 5066 |
-
<br class="clear" />
|
| 5067 |
-
</fieldset>
|
| 5068 |
-
</td>
|
| 5069 |
-
</tr>
|
| 5070 |
-
<?php $this->plugin_options_add(); ?>
|
| 5071 |
-
</tbody>
|
| 5072 |
-
</table>
|
| 5073 |
-
<p class="submit">
|
| 5074 |
-
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 5075 |
-
<input type="hidden" name="action" value="update-options" />
|
| 5076 |
-
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Save Options', 'polldaddy' ) ); ?>" />
|
| 5077 |
-
</p>
|
| 5078 |
-
</form>
|
| 5079 |
-
</div>
|
| 5080 |
-
<?php
|
| 5081 |
-
} // is_object( $poll )
|
| 5082 |
-
global $current_user;
|
| 5083 |
-
$fields = array( 'polldaddy_api_key', 'pd-rating-comments', 'pd-rating-comments-id', 'pd-rating-comments-pos', 'pd-rating-exclude-post-ids', 'pd-rating-pages', 'pd-rating-pages-id', 'pd-rating-posts', 'pd-rating-posts-id', 'pd-rating-posts-index', 'pd-rating-posts-index-id', 'pd-rating-posts-index-pos', 'pd-rating-posts-pos', 'pd-rating-title-filter', 'pd-rating-usercode', 'pd-rich-snippets', 'pd-usercode-' . $current_user->ID );
|
| 5084 |
-
$show_reset_form = false;
|
| 5085 |
-
foreach( $fields as $field ) {
|
| 5086 |
-
$value = get_option( $field );
|
| 5087 |
-
if ( $value != false )
|
| 5088 |
-
$show_reset_form = true;
|
| 5089 |
-
$settings[ $field ] = $value;
|
| 5090 |
-
}
|
| 5091 |
-
if ( $show_reset_form ) {
|
| 5092 |
-
echo "<h3>" . __( 'Reset Connection Settings', 'polldaddy' ) . "</h3>";
|
| 5093 |
-
echo "<p>" . __( 'If you are experiencing problems connecting to the Polldaddy website resetting your connection settings may help. A backup will be made. After resetting, link your account again with the same API key.', 'polldaddy' ) . "</p>";
|
| 5094 |
-
echo "<p>" . __( 'The following settings will be reset:', 'polldaddy' ) . "</p>";
|
| 5095 |
-
echo "<table>";
|
| 5096 |
-
foreach( $settings as $key => $value ) {
|
| 5097 |
-
if ( $value != '' ) {
|
| 5098 |
-
if ( strpos( $key, 'usercode' ) )
|
| 5099 |
-
$value = "***********" . substr( $value, -4 );
|
| 5100 |
-
elseif ( in_array( $key, array( 'pd-rating-pages-id', 'pd-rating-comments-id', 'pd-rating-posts-id' ) ) )
|
| 5101 |
-
$value = "$value (<a href='http://polldaddy.com/ratings/{$value}/edit/'>" . __( 'Edit', 'polldaddy' ) . "</a>)";
|
| 5102 |
-
echo "<tr><th style='text-align: right'>$key:</th><td>$value</td></tr>\n";
|
| 5103 |
-
}
|
| 5104 |
-
}
|
| 5105 |
-
echo "</table>";
|
| 5106 |
-
echo "<p>" . __( "* The usercode is like a password, keep it secret.", 'polldaddy' ) . "</p>";
|
| 5107 |
-
?>
|
| 5108 |
-
<form action="" method="post">
|
| 5109 |
-
<p class="submit">
|
| 5110 |
-
<?php wp_nonce_field( 'polldaddy-reset' . $current_user->ID ); ?>
|
| 5111 |
-
<input type="hidden" name="action" value="reset-account" />
|
| 5112 |
-
<input type="hidden" name="account" value="import" />
|
| 5113 |
-
<p><input type="checkbox" name="email" value="1" /> <?php _e( 'Send me an email with the connection settings for future reference' ); ?></p>
|
| 5114 |
-
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Reset', 'polldaddy' ) ); ?>" />
|
| 5115 |
-
</p>
|
| 5116 |
-
</form>
|
| 5117 |
-
<br />
|
| 5118 |
-
<?php
|
| 5119 |
-
}
|
| 5120 |
-
$previous_settings = get_option( 'polldaddy_settings' );
|
| 5121 |
-
if ( is_array( $previous_settings ) && !empty( $previous_settings ) ) {
|
| 5122 |
-
echo "<h3>" . __( 'Restore Previous Settings', 'polldaddy' ) . "</h3>";
|
| 5123 |
-
echo "<p>" . __( 'The connection settings for this site were reset but a backup was made. The following settings can be restored:', 'polldaddy' ) . "</p>";
|
| 5124 |
-
echo "<table>";
|
| 5125 |
-
foreach( $previous_settings as $key => $value ) {
|
| 5126 |
-
if ( $value != '' ) {
|
| 5127 |
-
if ( strpos( $key, 'usercode' ) )
|
| 5128 |
-
$value = "***********" . substr( $value, -4 );
|
| 5129 |
-
elseif ( in_array( $key, array( 'pd-rating-pages-id', 'pd-rating-comments-id', 'pd-rating-posts-id' ) ) )
|
| 5130 |
-
$value = "$value (<a href='http://polldaddy.com/ratings/{$value}/edit/'>" . __( 'Edit', 'polldaddy' ) . "</a>)";
|
| 5131 |
-
echo "<tr><th style='text-align: right'>$key:</th><td>$value</td></tr>\n";
|
| 5132 |
-
}
|
| 5133 |
-
}
|
| 5134 |
-
echo "</table>";
|
| 5135 |
-
echo "<p>" . __( "* The usercode is like a password, keep it secret.", 'polldaddy' ) . "</p>";
|
| 5136 |
-
?>
|
| 5137 |
-
<form action="" method="post">
|
| 5138 |
-
<p class="submit">
|
| 5139 |
-
<?php wp_nonce_field( 'polldaddy-restore' . $current_user->ID ); ?>
|
| 5140 |
-
<input type="hidden" name="action" value="restore-account" />
|
| 5141 |
-
<input type="hidden" name="account" value="import" />
|
| 5142 |
-
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Restore', 'polldaddy' ) ); ?>" />
|
| 5143 |
-
</p>
|
| 5144 |
-
</form>
|
| 5145 |
-
<br />
|
| 5146 |
-
<?php
|
| 5147 |
-
if ( $show_reset_form && isset( $settings[ 'pd-rating-posts-id' ] ) && $settings[ 'pd-rating-posts-id' ] != $previous_settings[ 'pd-rating-posts-id' ] ) {
|
| 5148 |
-
echo "<h3>" . __( 'Restore Ratings Settings', 'polldaddy' ) . "</h3>";
|
| 5149 |
-
echo "<p>" . __( 'Different rating settings detected. If you are missing ratings on your posts, pages or comments you can restore the original rating settings by clicking the button below.', 'polldaddy' ) . "</p>";
|
| 5150 |
-
echo "<p>" . __( 'This tells the plugin to look for this data in a different rating in your Polldaddy account.', 'polldaddy' ) . "</p>";
|
| 5151 |
-
?>
|
| 5152 |
-
<form action="" method="post">
|
| 5153 |
-
<p class="submit">
|
| 5154 |
-
<?php wp_nonce_field( 'polldaddy-restore-ratings' . $current_user->ID ); ?>
|
| 5155 |
-
<input type="hidden" name="action" value="restore-ratings" />
|
| 5156 |
-
<input type="hidden" name="account" value="import" />
|
| 5157 |
-
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Restore Ratings Only', 'polldaddy' ) ); ?>" />
|
| 5158 |
-
</p>
|
| 5159 |
-
</form>
|
| 5160 |
-
<br />
|
| 5161 |
-
<?php
|
| 5162 |
-
}
|
| 5163 |
-
}
|
| 5164 |
-
}
|
| 5165 |
-
|
| 5166 |
-
function plugin_options_add() {}
|
| 5167 |
-
|
| 5168 |
-
function round( $number, $increments ) {
|
| 5169 |
-
$increments = 1 / $increments;
|
| 5170 |
-
return round( $number * $increments ) / $increments;
|
| 5171 |
-
}
|
| 5172 |
-
|
| 5173 |
-
function signup() {
|
| 5174 |
-
return $this->api_key_page();
|
| 5175 |
-
}
|
| 5176 |
-
|
| 5177 |
-
function can_edit( &$poll ) {
|
| 5178 |
-
if ( empty( $poll->_owner ) ) {
|
| 5179 |
-
$this->log( 'can_edit: poll owner is empty.' );
|
| 5180 |
-
return true;
|
| 5181 |
-
}
|
| 5182 |
-
|
| 5183 |
-
if ( $this->id == $poll->_owner ) {
|
| 5184 |
-
$this->log( 'can_edit: poll owner equals id.' );
|
| 5185 |
-
return true;
|
| 5186 |
-
}
|
| 5187 |
-
|
| 5188 |
-
if ( $poll->parentID == (int) $GLOBALS['blog_id'] && current_user_can( 'edit_others_posts' ) ) {
|
| 5189 |
-
$this->log( 'can_edit: poll was created on this blog and current user can edit_others_posts' );
|
| 5190 |
-
return true;
|
| 5191 |
-
}
|
| 5192 |
-
|
| 5193 |
-
//check to see if poll owner is a member of this blog
|
| 5194 |
-
if ( function_exists( 'get_users' ) ) {
|
| 5195 |
-
$user = get_users( array( 'include' => $poll->_owner ) );
|
| 5196 |
-
if ( empty( $user ) ) {
|
| 5197 |
-
$this->log( 'can_edit: poll owner is not a member of this blog.' );
|
| 5198 |
-
return false;
|
| 5199 |
-
}
|
| 5200 |
-
}
|
| 5201 |
-
|
| 5202 |
-
if ( false == (bool) current_user_can( 'edit_others_posts' ) )
|
| 5203 |
-
$this->log( 'can_edit: current user cannot edit_others_posts.' );
|
| 5204 |
-
|
| 5205 |
-
return (bool) current_user_can( 'edit_others_posts' );
|
| 5206 |
-
}
|
| 5207 |
-
|
| 5208 |
-
function log( $message ) {}
|
| 5209 |
-
|
| 5210 |
-
function contact_support_message( $message, $errors ) {
|
| 5211 |
-
global $current_user;
|
| 5212 |
-
echo '<div class="error" id="polldaddy">';
|
| 5213 |
-
echo '<h1>' . $message . '</h1>';
|
| 5214 |
-
echo '<p>' . __( "There are a few things you can do:" );
|
| 5215 |
-
echo "<ul><ol>" . __( "Press reload on your browser and reload this page. There may have been a temporary problem communicating with Polldaddy.com", "polldaddy" ) . "</ol>";
|
| 5216 |
-
echo "<ol>" . sprintf( __( "Go to the <a href='%s'>poll settings page</a>, scroll to the end of the page and reset your connection settings. Link your account again with the same API key.", "polldaddy" ), 'options-general.php?page=polls&action=options' ) . "</ol>";
|
| 5217 |
-
echo "<ol>" . sprintf( __( 'Contact <a href="%1$s" %2$s>Polldaddy support</a> and tell them your rating usercode is %3$s', 'polldaddy' ), 'http://polldaddy.com/feedback/', 'target="_blank"', $this->rating_user_code ) . '<br />' . __( 'Also include the following information when contacting support to help us resolve your problem as quickly as possible:', 'polldaddy' ) . '';
|
| 5218 |
-
echo "<ul><li> API Key: " . get_option( 'polldaddy_api_key' ) . "</li>";
|
| 5219 |
-
echo "<li> ID Usercode: " . get_option( 'pd-usercode-' . $current_user->ID ) . "</li>";
|
| 5220 |
-
echo "<li> pd-rating-usercode: " . get_option( 'pd-rating-usercode' ) . "</li>";
|
| 5221 |
-
echo "<li> pd-rating-posts-id: " . get_option( 'pd-rating-posts-id' ) . "</li>";
|
| 5222 |
-
echo "<li> Errors: " . print_r( $errors, 1 ) . "</li></ul>";
|
| 5223 |
-
echo "</ol></ul></div>";
|
| 5224 |
-
}
|
| 5225 |
-
}
|
| 5226 |
-
|
| 5227 |
-
require dirname( __FILE__ ).'/rating.php';
|
| 5228 |
-
require dirname( __FILE__ ).'/ajax.php';
|
| 5229 |
-
require dirname( __FILE__ ).'/popups.php';
|
| 5230 |
-
require dirname( __FILE__ ).'/polldaddy-org.php';
|
| 5231 |
-
|
| 5232 |
-
$GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Plugin Name: Polldaddy Polls & Ratings
|
| 5 |
+
* 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://polldaddy.com/
|
| 9 |
+
* Version: 2.0.35
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
// To hardcode your Polldaddy PartnerGUID (API Key), add the (uncommented) line below with the PartnerGUID to your `wp-config.php`
|
| 13 |
+
// define( 'WP_POLLDADDY__PARTNERGUID', '12345…' );
|
| 14 |
+
|
| 15 |
+
class WP_Polldaddy {
|
| 16 |
+
var $errors;
|
| 17 |
+
var $base_url;
|
| 18 |
+
var $is_admin;
|
| 19 |
+
var $is_author;
|
| 20 |
+
var $scheme;
|
| 21 |
+
var $version;
|
| 22 |
+
var $polldaddy_client_class;
|
| 23 |
+
var $polldaddy_clients;
|
| 24 |
+
var $id;
|
| 25 |
+
var $multiple_accounts;
|
| 26 |
+
var $user_code;
|
| 27 |
+
var $rating_user_code;
|
| 28 |
+
var $has_feedback_menu;
|
| 29 |
+
|
| 30 |
+
function __construct() {
|
| 31 |
+
global $current_user;
|
| 32 |
+
$this->log( 'Created WP_Polldaddy Object: constructor' );
|
| 33 |
+
$this->errors = new WP_Error;
|
| 34 |
+
$this->scheme = 'https';
|
| 35 |
+
$this->version = '2.0.22';
|
| 36 |
+
$this->multiple_accounts = true;
|
| 37 |
+
$this->polldaddy_client_class = 'api_client';
|
| 38 |
+
$this->polldaddy_clients = array();
|
| 39 |
+
$this->is_admin = (bool) current_user_can( 'manage_options' );
|
| 40 |
+
$this->is_author = (bool) current_user_can( 'edit_posts' );
|
| 41 |
+
$this->is_editor = (bool) current_user_can( 'delete_others_pages' );
|
| 42 |
+
$this->user_code = null;
|
| 43 |
+
$this->rating_user_code = null;
|
| 44 |
+
$this->id = ($current_user instanceof WP_User) ? intval( $current_user->ID ): 0;
|
| 45 |
+
$this->has_feedback_menu = false;
|
| 46 |
+
|
| 47 |
+
if ( class_exists( 'Jetpack' ) ) {
|
| 48 |
+
if ( method_exists( 'Jetpack', 'is_active' ) && Jetpack::is_active() ) {
|
| 49 |
+
$jetpack_active_modules = get_option('jetpack_active_modules');
|
| 50 |
+
if ( $jetpack_active_modules && in_array( 'contact-form', $jetpack_active_modules ) )
|
| 51 |
+
$this->has_feedback_menu = true;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if ( class_exists( 'Jetpack_Sync' ) && defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '4.1', '<' ) ) {
|
| 55 |
+
Jetpack_Sync::sync_options( __FILE__, 'polldaddy_api_key' );
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
add_filter( 'jetpack_options_whitelist', array( $this, 'add_to_jetpack_options_whitelist' ) );
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Add the polldaddy option to the Jetpack options management whitelist.
|
| 64 |
+
*
|
| 65 |
+
* @param array $options The list of whitelisted option names.
|
| 66 |
+
* @return array The updated whitelist
|
| 67 |
+
*/
|
| 68 |
+
public static function add_to_jetpack_options_whitelist( $options ) {
|
| 69 |
+
$options[] = 'polldaddy_api_key';
|
| 70 |
+
return $options;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
function &get_client( $api_key, $userCode = null ) {
|
| 74 |
+
if ( isset( $this->polldaddy_clients[$api_key] ) ) {
|
| 75 |
+
if ( !is_null( $userCode ) )
|
| 76 |
+
$this->polldaddy_clients[$api_key]->userCode = $userCode;
|
| 77 |
+
return $this->polldaddy_clients[$api_key];
|
| 78 |
+
}
|
| 79 |
+
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
| 80 |
+
$this->polldaddy_clients[$api_key] = $this->config_client( new $this->polldaddy_client_class( $api_key, $userCode ) );
|
| 81 |
+
return $this->polldaddy_clients[$api_key];
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
function config_client( $client ) {
|
| 85 |
+
|
| 86 |
+
return $client;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
function admin_menu() {
|
| 90 |
+
add_action( 'wp_enqueue_scripts', array( &$this, 'register_polldaddy_styles' ) );
|
| 91 |
+
add_action( 'admin_head', array( &$this, 'do_admin_css' ) );
|
| 92 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'menu_alter' ) );
|
| 93 |
+
|
| 94 |
+
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) ) {
|
| 95 |
+
$guid = get_option( 'polldaddy_api_key' );
|
| 96 |
+
if ( !$guid || !is_string( $guid ) )
|
| 97 |
+
$guid = false;
|
| 98 |
+
define( 'WP_POLLDADDY__PARTNERGUID', $guid );
|
| 99 |
+
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
$capability = 'edit_posts';
|
| 103 |
+
$function = array( &$this, 'management_page' );
|
| 104 |
+
|
| 105 |
+
$hook = add_menu_page( __( 'Feedback', 'polldaddy' ), __( 'Feedback', 'polldaddy' ), $capability, 'feedback', $function, 'div' );
|
| 106 |
+
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
| 107 |
+
|
| 108 |
+
foreach( array( 'polls' => __( 'Polls', 'polldaddy' ), 'ratings' => __( 'Ratings', 'polldaddy' ) ) as $menu_slug => $page_title ) {
|
| 109 |
+
$menu_title = $page_title;
|
| 110 |
+
|
| 111 |
+
$hook = add_menu_page( $menu_title, $menu_title, $capability, $menu_slug, $function, 'div' );
|
| 112 |
+
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
| 113 |
+
|
| 114 |
+
add_submenu_page( 'feedback', $page_title, $page_title, $capability, $menu_slug, $function );
|
| 115 |
+
add_options_page( $page_title, $page_title, $menu_slug == 'ratings' ? 'manage_options' : $capability, $menu_slug.'&action=options', $function );
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
remove_submenu_page( 'feedback', 'feedback' );
|
| 119 |
+
remove_menu_page( 'polls' );
|
| 120 |
+
remove_menu_page( 'ratings' );
|
| 121 |
+
|
| 122 |
+
if ( $this->has_feedback_menu ) {
|
| 123 |
+
add_submenu_page( 'feedback', __( 'Feedback', 'polldaddy' ), __( 'Feedback', 'polldaddy' ), 'edit_posts', 'edit.php?post_type=feedback' );
|
| 124 |
+
remove_menu_page( 'edit.php?post_type=feedback' );
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
function do_admin_css() {
|
| 131 |
+
wp_register_style( 'polldaddy-icons', plugins_url( 'css/polldaddy-icons.css', __FILE__ ) );
|
| 132 |
+
wp_enqueue_style( 'polldaddy-icons' );
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
function menu_alter() {
|
| 136 |
+
// Make sure we're working off a clean version.
|
| 137 |
+
include( ABSPATH . WPINC . '/version.php' );
|
| 138 |
+
if ( version_compare( $wp_version, '3.8', '>=' ) ) {
|
| 139 |
+
wp_enqueue_style( 'polldaddy-icons' );
|
| 140 |
+
$css = "
|
| 141 |
+
#toplevel_page_feedback .wp-menu-image:before {
|
| 142 |
+
font-family: 'polldaddy' !important;
|
| 143 |
+
content: '\\0061';
|
| 144 |
+
}
|
| 145 |
+
#toplevel_page_feedback .wp-menu-image {
|
| 146 |
+
background-repeat: no-repeat;
|
| 147 |
+
}
|
| 148 |
+
#menu-posts-feedback .wp-menu-image:before {
|
| 149 |
+
font-family: dashicons !important;
|
| 150 |
+
content: '\\f175';
|
| 151 |
+
}
|
| 152 |
+
#adminmenu #menu-posts-feedback div.wp-menu-image {
|
| 153 |
+
background: none !important;
|
| 154 |
+
background-repeat: no-repeat;
|
| 155 |
+
}";
|
| 156 |
+
} else {
|
| 157 |
+
$css = "
|
| 158 |
+
#toplevel_page_polldaddy .wp-menu-image {
|
| 159 |
+
background: url( " . plugins_url( 'img/polldaddy.png', __FILE__ ) . " ) 0 90% no-repeat;
|
| 160 |
+
}
|
| 161 |
+
/* Retina Polldaddy Menu Icon */
|
| 162 |
+
@media only screen and (-moz-min-device-pixel-ratio: 1.5),
|
| 163 |
+
only screen and (-o-min-device-pixel-ratio: 3/2),
|
| 164 |
+
only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
| 165 |
+
only screen and (min-device-pixel-ratio: 1.5) {
|
| 166 |
+
#toplevel_page_polldaddy .wp-menu-image {
|
| 167 |
+
background: url( " . plugins_url( 'polldaddy@2x.png', __FILE__ ) . " ) 0 90% no-repeat;
|
| 168 |
+
background-size:30px 64px;
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
#toplevel_page_polldaddy.current .wp-menu-image,
|
| 172 |
+
#toplevel_page_polldaddy.wp-has-current-submenu .wp-menu-image,
|
| 173 |
+
#toplevel_page_polldaddy:hover .wp-menu-image {
|
| 174 |
+
background-position: top left;
|
| 175 |
+
}";
|
| 176 |
+
}
|
| 177 |
+
wp_add_inline_style( 'wp-admin', $css );
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
function api_key_page_load() {
|
| 181 |
+
|
| 182 |
+
if ( 'post' != strtolower( $_SERVER['REQUEST_METHOD'] ) || empty( $_POST['action'] ) || 'account' != $_POST['action'] )
|
| 183 |
+
return false;
|
| 184 |
+
|
| 185 |
+
check_admin_referer( 'polldaddy-account' );
|
| 186 |
+
|
| 187 |
+
$polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
|
| 188 |
+
$polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
|
| 189 |
+
|
| 190 |
+
if ( !$polldaddy_email )
|
| 191 |
+
$this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
|
| 192 |
+
|
| 193 |
+
if ( !$polldaddy_password )
|
| 194 |
+
$this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
|
| 195 |
+
|
| 196 |
+
if ( $this->errors->get_error_codes() )
|
| 197 |
+
return false;
|
| 198 |
+
|
| 199 |
+
$details = array(
|
| 200 |
+
'uName' => get_bloginfo( 'name' ),
|
| 201 |
+
'uEmail' => $polldaddy_email,
|
| 202 |
+
'uPass' => $polldaddy_password,
|
| 203 |
+
'partner_userid' => $this->id
|
| 204 |
+
);
|
| 205 |
+
if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
|
| 206 |
+
$polldaddy_api_key = wp_remote_post( $this->scheme . '://api.polldaddy.com/key.php', array(
|
| 207 |
+
'body' => $details
|
| 208 |
+
) );
|
| 209 |
+
if ( is_wp_error( $polldaddy_api_key ) ) {
|
| 210 |
+
$this->errors = $polldaddy_api_key;
|
| 211 |
+
return false;
|
| 212 |
+
}
|
| 213 |
+
$polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
|
| 214 |
+
} else {
|
| 215 |
+
$fp = fsockopen(
|
| 216 |
+
'api.polldaddy.com',
|
| 217 |
+
80,
|
| 218 |
+
$err_num,
|
| 219 |
+
$err_str,
|
| 220 |
+
3
|
| 221 |
+
);
|
| 222 |
+
|
| 223 |
+
if ( !$fp ) {
|
| 224 |
+
$this->errors->add( 'connect', __( "Can't connect to Polldaddy.com", 'polldaddy' ) );
|
| 225 |
+
return false;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
if ( function_exists( 'stream_set_timeout' ) )
|
| 229 |
+
stream_set_timeout( $fp, 3 );
|
| 230 |
+
|
| 231 |
+
global $wp_version;
|
| 232 |
+
|
| 233 |
+
$request_body = http_build_query( $details, null, '&' );
|
| 234 |
+
|
| 235 |
+
$request = "POST /key.php HTTP/1.0\r\n";
|
| 236 |
+
$request .= "Host: api.polldaddy.com\r\n";
|
| 237 |
+
$request .= "User-agent: WordPress/$wp_version\r\n";
|
| 238 |
+
$request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ) . "\r\n";
|
| 239 |
+
$request .= 'Content-Length: ' . strlen( $request_body ) . "\r\n";
|
| 240 |
+
|
| 241 |
+
fwrite( $fp, "$request\r\n$request_body" );
|
| 242 |
+
|
| 243 |
+
$response = '';
|
| 244 |
+
while ( !feof( $fp ) )
|
| 245 |
+
$response .= fread( $fp, 4096 );
|
| 246 |
+
fclose( $fp );
|
| 247 |
+
list( $headers, $polldaddy_api_key ) = explode( "\r\n\r\n", $response, 2 );
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
if ( !$polldaddy_api_key ) {
|
| 251 |
+
$this->errors->add( 'polldaddy_password', __( 'Invalid Account', 'polldaddy' ) );
|
| 252 |
+
return false;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 256 |
+
|
| 257 |
+
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 258 |
+
$polldaddy->reset();
|
| 259 |
+
if ( !$polldaddy->get_usercode( $this->id ) ) {
|
| 260 |
+
$this->parse_errors( $polldaddy );
|
| 261 |
+
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?', 'polldaddy' ) );
|
| 262 |
+
return false;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
return true;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
function parse_errors( &$polldaddy ) {
|
| 269 |
+
if ( $polldaddy->errors )
|
| 270 |
+
foreach ( $polldaddy->errors as $code => $error )
|
| 271 |
+
$this->errors->add( $code, $error );
|
| 272 |
+
|
| 273 |
+
if ( isset( $this->errors->errors[4] ) ) {
|
| 274 |
+
//need to get latest usercode
|
| 275 |
+
update_option( 'pd-usercode-'.$this->id, '' );
|
| 276 |
+
$this->set_api_user_code();
|
| 277 |
+
}
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
function print_errors() {
|
| 281 |
+
if ( !$error_codes = $this->errors->get_error_codes() )
|
| 282 |
+
return;
|
| 283 |
+
?>
|
| 284 |
+
|
| 285 |
+
<div class="error" id="polldaddy-error">
|
| 286 |
+
|
| 287 |
+
<?php
|
| 288 |
+
|
| 289 |
+
foreach ( $error_codes as $error_code ) :
|
| 290 |
+
foreach ( $this->errors->get_error_messages( $error_code ) as $error_message ) :
|
| 291 |
+
?>
|
| 292 |
+
|
| 293 |
+
<p><?php echo $this->errors->get_error_data( $error_code ) ? $error_message : esc_html( $error_message ); ?></p>
|
| 294 |
+
|
| 295 |
+
<?php
|
| 296 |
+
endforeach;
|
| 297 |
+
endforeach;
|
| 298 |
+
|
| 299 |
+
$this->errors = new WP_Error;
|
| 300 |
+
?>
|
| 301 |
+
|
| 302 |
+
</div>
|
| 303 |
+
<br class="clear" />
|
| 304 |
+
|
| 305 |
+
<?php
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
function api_key_page() {
|
| 309 |
+
$this->print_errors();
|
| 310 |
+
?>
|
| 311 |
+
|
| 312 |
+
<div class="wrap">
|
| 313 |
+
<h2 id="polldaddy-header"><?php _e( 'Polldaddy', 'polldaddy' ); ?></h2>
|
| 314 |
+
|
| 315 |
+
<p><?php printf( __( 'Before you can use the Polldaddy plugin, you need to enter your <a href="%s">Polldaddy.com</a> account details.', 'polldaddy' ), 'http://polldaddy.com/' ); ?></p>
|
| 316 |
+
|
| 317 |
+
<form action="" method="post">
|
| 318 |
+
<table class="form-table">
|
| 319 |
+
<tbody>
|
| 320 |
+
<tr class="form-field form-required">
|
| 321 |
+
<th valign="top" scope="row">
|
| 322 |
+
<label for="polldaddy-email"><?php _e( 'Polldaddy Email Address', 'polldaddy' ); ?></label>
|
| 323 |
+
</th>
|
| 324 |
+
<td>
|
| 325 |
+
<input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" />
|
| 326 |
+
</td>
|
| 327 |
+
</tr>
|
| 328 |
+
<tr class="form-field form-required">
|
| 329 |
+
<th valign="top" scope="row">
|
| 330 |
+
<label for="polldaddy-password"><?php _e( 'Polldaddy Password', 'polldaddy' ); ?></label>
|
| 331 |
+
</th>
|
| 332 |
+
<td>
|
| 333 |
+
<input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
|
| 334 |
+
</td>
|
| 335 |
+
</tr>
|
| 336 |
+
</tbody>
|
| 337 |
+
</table>
|
| 338 |
+
<p class="submit">
|
| 339 |
+
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 340 |
+
<input type="hidden" name="action" value="account" />
|
| 341 |
+
<input type="hidden" name="account" value="import" />
|
| 342 |
+
<input class="button-secondary" type="submit" value="<?php echo esc_attr( __( 'Submit', 'polldaddy' ) ); ?>" />
|
| 343 |
+
</p>
|
| 344 |
+
</form>
|
| 345 |
+
</div>
|
| 346 |
+
|
| 347 |
+
<?php
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
function media_buttons() {
|
| 351 |
+
$title = __( 'Add Poll', 'polldaddy' );
|
| 352 |
+
echo " <a href='admin.php?page=polls&iframe&TB_iframe=true' onclick='return false;' id='add_poll' class='button thickbox' title='" . esc_attr( $title ) . "'><img src='{$this->base_url}img/polldaddy@2x.png' width='15' height='15' alt='" . esc_attr( $title ) . "' style='margin: -2px 0 0 -1px; padding: 0 2px 0 0; vertical-align: middle;' /> " . esc_html( $title ) . "</a>";
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
function set_api_user_code() {
|
| 356 |
+
|
| 357 |
+
$this->user_code = get_option( 'pd-usercode-'.$this->id );
|
| 358 |
+
|
| 359 |
+
if ( empty( $this->user_code ) ) {
|
| 360 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
|
| 361 |
+
$polldaddy->reset();
|
| 362 |
+
|
| 363 |
+
$this->user_code = $polldaddy->get_usercode( $this->id );
|
| 364 |
+
|
| 365 |
+
if ( !empty( $this->user_code ) ) {
|
| 366 |
+
update_option( 'pd-usercode-'.$this->id, $this->user_code );
|
| 367 |
+
} elseif ( get_option( 'polldaddy_api_key' ) ) {
|
| 368 |
+
$this->contact_support_message( 'There was a problem linking your account', $polldaddy->errors );
|
| 369 |
+
}
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
function management_page_load() {
|
| 374 |
+
|
| 375 |
+
wp_reset_vars( array( 'page', 'action', 'poll', 'style', 'rating', 'id' ) );
|
| 376 |
+
global $plugin_page, $page, $action, $poll, $style, $rating, $id, $wp_locale;
|
| 377 |
+
|
| 378 |
+
$this->set_api_user_code();
|
| 379 |
+
|
| 380 |
+
if ( empty( $this->user_code ) && $page == 'polls' ) {
|
| 381 |
+
// one last try to get the user code automatically if possible
|
| 382 |
+
$this->user_code = apply_filters_ref_array( 'polldaddy_get_user_code', array( $this->user_code, &$this ) );
|
| 383 |
+
if ( false == $this->user_code && $action != 'restore-account' )
|
| 384 |
+
$action = 'signup';
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
| 388 |
+
|
| 389 |
+
wp_enqueue_script( 'polls', "{$this->base_url}js/polldaddy.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-form' ), $this->version );
|
| 390 |
+
wp_enqueue_script( 'polls-common', "{$this->base_url}js/common.js", array(), $this->version );
|
| 391 |
+
|
| 392 |
+
if ( $page == 'polls' ) {
|
| 393 |
+
if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
|
| 394 |
+
$action = '';
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
switch ( $action ) {
|
| 398 |
+
case 'edit' :
|
| 399 |
+
case 'edit-poll' :
|
| 400 |
+
case 'create-poll' :
|
| 401 |
+
case 'add-media' :
|
| 402 |
+
wp_enqueue_script( 'media-upload', array(), $this->version );
|
| 403 |
+
wp_enqueue_script( 'polls-style', "{$this->base_url}js/poll-style-picker.js", array( 'polls', 'polls-common' ), $this->version );
|
| 404 |
+
|
| 405 |
+
if ( $action == 'create-poll' )
|
| 406 |
+
$plugin_page = 'polls&action=create-poll';
|
| 407 |
+
|
| 408 |
+
break;
|
| 409 |
+
case 'edit-style' :
|
| 410 |
+
case 'create-style' :
|
| 411 |
+
wp_enqueue_script( 'polls-style', "{$this->base_url}js/style-editor.js", array( 'polls', 'polls-common' ), $this->version );
|
| 412 |
+
wp_enqueue_script( 'polls-style-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 413 |
+
wp_enqueue_style( 'polls', "{$this->base_url}css/style-editor.css", array(), $this->version );
|
| 414 |
+
$plugin_page = 'polls&action=list-styles';
|
| 415 |
+
break;
|
| 416 |
+
case 'list-styles' :
|
| 417 |
+
$plugin_page = 'polls&action=list-styles';
|
| 418 |
+
break;
|
| 419 |
+
case 'options' :
|
| 420 |
+
case 'update-options' :
|
| 421 |
+
case 'import-account' :
|
| 422 |
+
case 'reset-account' :
|
| 423 |
+
case 'restore-account' :
|
| 424 |
+
$plugin_page = 'polls&action=options';
|
| 425 |
+
break;
|
| 426 |
+
}//end switch
|
| 427 |
+
} elseif ( $page == 'ratings' ) {
|
| 428 |
+
switch ( $action ) {
|
| 429 |
+
case 'update-rating' :
|
| 430 |
+
case 'options':
|
| 431 |
+
$plugin_page = 'ratings&action=options';
|
| 432 |
+
wp_enqueue_script( 'rating-text-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 433 |
+
wp_enqueue_script( 'ratings', "{$this->base_url}js/rating.js", array(), $this->version );
|
| 434 |
+
wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
|
| 435 |
+
'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
|
| 436 |
+
'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
|
| 437 |
+
break;
|
| 438 |
+
default :
|
| 439 |
+
if ( empty( $action ) )
|
| 440 |
+
$action = 'reports';
|
| 441 |
+
$plugin_page = 'ratings&action=reports';
|
| 442 |
+
}//end switch
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
wp_enqueue_style( 'polldaddy', "{$this->base_url}css/polldaddy.css", array(), $this->version );
|
| 446 |
+
wp_enqueue_script( 'admin-forms' );
|
| 447 |
+
add_thickbox();
|
| 448 |
+
|
| 449 |
+
if ( isset( $_GET['iframe'] ) ) {
|
| 450 |
+
add_action( 'admin_head', array( &$this, 'hide_admin_menu' ) );
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
if ( isset( $wp_locale->text_direction ) && 'rtl' == $wp_locale->text_direction )
|
| 454 |
+
wp_enqueue_style( 'polls-rtl', "{$this->base_url}css/polldaddy-rtl.css", array( 'global', 'wp-admin' ), $this->version );
|
| 455 |
+
add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
|
| 456 |
+
|
| 457 |
+
add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
|
| 458 |
+
|
| 459 |
+
$query_args = array();
|
| 460 |
+
$args = array();
|
| 461 |
+
|
| 462 |
+
$allowedtags = array(
|
| 463 |
+
'a' => array(
|
| 464 |
+
'href' => array(),
|
| 465 |
+
'title' => array(),
|
| 466 |
+
'target' => array() ),
|
| 467 |
+
'img' => array(
|
| 468 |
+
'alt' => array(),
|
| 469 |
+
'align' => array(),
|
| 470 |
+
'border' => array(),
|
| 471 |
+
'class' => array(),
|
| 472 |
+
'height' => array(),
|
| 473 |
+
'hspace' => array(),
|
| 474 |
+
'longdesc' => array(),
|
| 475 |
+
'vspace' => array(),
|
| 476 |
+
'src' => array(),
|
| 477 |
+
'width' => array() ),
|
| 478 |
+
'abbr' => array( 'title' => array() ),
|
| 479 |
+
'acronym' => array( 'title' => array() ),
|
| 480 |
+
'blockquote' => array( 'cite' => array() ),
|
| 481 |
+
'q' => array( 'cite' => array() ),
|
| 482 |
+
'b' => array(),
|
| 483 |
+
'cite' => array(),
|
| 484 |
+
'em' => array(),
|
| 485 |
+
'i' => array(),
|
| 486 |
+
'strike' => array(),
|
| 487 |
+
'strong' => array()
|
| 488 |
+
);
|
| 489 |
+
|
| 490 |
+
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 491 |
+
|
| 492 |
+
if ( $page == 'polls' ) {
|
| 493 |
+
switch ( $action ) {
|
| 494 |
+
case 'reset-account' : // reset everything
|
| 495 |
+
global $current_user;
|
| 496 |
+
check_admin_referer( 'polldaddy-reset' . $this->id );
|
| 497 |
+
$fields = array( 'polldaddy_api_key', 'pd-rating-comments', 'pd-rating-comments-id', 'pd-rating-comments-pos', 'pd-rating-exclude-post-ids', 'pd-rating-pages', 'pd-rating-pages-id', 'pd-rating-posts', 'pd-rating-posts-id', 'pd-rating-posts-index', 'pd-rating-posts-index-id', 'pd-rating-posts-index-pos', 'pd-rating-posts-pos', 'pd-rating-title-filter', 'pd-rating-usercode', 'pd-rich-snippets', 'pd-usercode-' . $current_user->ID );
|
| 498 |
+
$msg = __( "You have just reset your Polldaddy connection settings." ) . "\n\n";
|
| 499 |
+
foreach( $fields as $field ) {
|
| 500 |
+
$value = get_option( $field );
|
| 501 |
+
if ( $value != false ) {
|
| 502 |
+
$settings[ $field ] = $value;
|
| 503 |
+
$msg .= "$field: $value\n";
|
| 504 |
+
delete_option( $field );
|
| 505 |
+
}
|
| 506 |
+
}
|
| 507 |
+
if ( isset( $_POST[ 'email' ] ) )
|
| 508 |
+
wp_mail( $current_user->user_email, "Polldaddy Settings", $msg );
|
| 509 |
+
update_option( 'polldaddy_settings', $settings );
|
| 510 |
+
break;
|
| 511 |
+
case 'restore-account' : // restore everything
|
| 512 |
+
global $current_user;
|
| 513 |
+
check_admin_referer( 'polldaddy-restore' . $this->id );
|
| 514 |
+
$previous_settings = get_option( 'polldaddy_settings' );
|
| 515 |
+
foreach( $previous_settings as $key => $value )
|
| 516 |
+
update_option( $key, $value );
|
| 517 |
+
delete_option( 'polldaddy_settings' );
|
| 518 |
+
break;
|
| 519 |
+
case 'restore-ratings' : // restore ratings
|
| 520 |
+
global $current_user;
|
| 521 |
+
check_admin_referer( 'polldaddy-restore-ratings' . $this->id );
|
| 522 |
+
$previous_settings = get_option( 'polldaddy_settings' );
|
| 523 |
+
$fields = array( 'pd-rating-comments', 'pd-rating-comments-id', 'pd-rating-comments-pos', 'pd-rating-exclude-post-ids', 'pd-rating-pages', 'pd-rating-pages-id', 'pd-rating-posts', 'pd-rating-posts-id', 'pd-rating-posts-index', 'pd-rating-posts-index-id', 'pd-rating-posts-index-pos', 'pd-rating-posts-pos', 'pd-rating-title-filter' );
|
| 524 |
+
foreach( $fields as $key ) {
|
| 525 |
+
if ( isset( $previous_settings[ $key ] ) )
|
| 526 |
+
update_option( $key, $previous_settings[ $key ] );
|
| 527 |
+
}
|
| 528 |
+
break;
|
| 529 |
+
case 'signup' : // sign up for first time
|
| 530 |
+
case 'account' : // reauthenticate
|
| 531 |
+
case 'import-account' : // reauthenticate
|
| 532 |
+
if ( !$is_POST )
|
| 533 |
+
return;
|
| 534 |
+
|
| 535 |
+
check_admin_referer( 'polldaddy-account' );
|
| 536 |
+
|
| 537 |
+
$this->user_code = '';
|
| 538 |
+
update_option( 'pd-usercode-'.$this->id, '' );
|
| 539 |
+
|
| 540 |
+
if ( $new_args = $this->management_page_load_signup() )
|
| 541 |
+
$query_args = array_merge( $query_args, $new_args );
|
| 542 |
+
|
| 543 |
+
if ( $this->errors->get_error_codes() )
|
| 544 |
+
return false;
|
| 545 |
+
|
| 546 |
+
$query_args['message'] = 'imported-account';
|
| 547 |
+
|
| 548 |
+
wp_reset_vars( array( 'action' ) );
|
| 549 |
+
if ( !empty( $_GET['reaction'] ) )
|
| 550 |
+
$query_args['action'] = $_GET['reaction'];
|
| 551 |
+
elseif ( !empty( $_GET['action'] ) && 'account' == $_GET['action'] )
|
| 552 |
+
$query_args['action'] = $_GET['action'];
|
| 553 |
+
else
|
| 554 |
+
$query_args['action'] = false;
|
| 555 |
+
if ( $action == 'import-account' )
|
| 556 |
+
$query_args[ 'action' ] = 'options'; // make sure we redirect back to the right page.
|
| 557 |
+
break;
|
| 558 |
+
|
| 559 |
+
case 'delete' :
|
| 560 |
+
if ( empty( $poll ) )
|
| 561 |
+
return;
|
| 562 |
+
|
| 563 |
+
if ( is_array( $poll ) )
|
| 564 |
+
check_admin_referer( 'action-poll_bulk' );
|
| 565 |
+
else
|
| 566 |
+
check_admin_referer( "delete-poll_$poll" );
|
| 567 |
+
|
| 568 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 569 |
+
|
| 570 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
| 571 |
+
$polldaddy->reset();
|
| 572 |
+
$poll_object = $polldaddy->get_poll( $poll_id );
|
| 573 |
+
|
| 574 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
| 575 |
+
$this->errors->add( 'permission', __( 'You are not allowed to delete this poll.', 'polldaddy' ) );
|
| 576 |
+
return false;
|
| 577 |
+
}
|
| 578 |
+
|
| 579 |
+
// Send Poll Author credentials
|
| 580 |
+
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 581 |
+
$polldaddy->reset();
|
| 582 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 583 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 584 |
+
}
|
| 585 |
+
$polldaddy->userCode = $userCode;
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
$polldaddy->reset();
|
| 589 |
+
$polldaddy->delete_poll( $poll_id );
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
$query_args['message'] = 'deleted';
|
| 593 |
+
$query_args['deleted'] = count( (array) $poll );
|
| 594 |
+
break;
|
| 595 |
+
case 'open' :
|
| 596 |
+
if ( empty( $poll ) )
|
| 597 |
+
return;
|
| 598 |
+
|
| 599 |
+
if ( is_array( $poll ) )
|
| 600 |
+
check_admin_referer( 'action-poll_bulk' );
|
| 601 |
+
else
|
| 602 |
+
check_admin_referer( "open-poll_$poll" );
|
| 603 |
+
|
| 604 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 605 |
+
|
| 606 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
| 607 |
+
$polldaddy->reset();
|
| 608 |
+
$poll_object = $polldaddy->get_poll( $poll_id );
|
| 609 |
+
|
| 610 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
| 611 |
+
$this->errors->add( 'permission', __( 'You are not allowed to open this poll.', 'polldaddy' ) );
|
| 612 |
+
return false;
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
// Send Poll Author credentials
|
| 616 |
+
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 617 |
+
$polldaddy->reset();
|
| 618 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 619 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 620 |
+
}
|
| 621 |
+
$polldaddy->userCode = $userCode;
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
$polldaddy->reset();
|
| 625 |
+
$polldaddy->open_poll( $poll_id );
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
$query_args['message'] = 'opened';
|
| 629 |
+
$query_args['opened'] = count( (array) $poll );
|
| 630 |
+
break;
|
| 631 |
+
case 'close' :
|
| 632 |
+
if ( empty( $poll ) )
|
| 633 |
+
return;
|
| 634 |
+
|
| 635 |
+
if ( is_array( $poll ) )
|
| 636 |
+
check_admin_referer( 'action-poll_bulk' );
|
| 637 |
+
else
|
| 638 |
+
check_admin_referer( "close-poll_$poll" );
|
| 639 |
+
|
| 640 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 641 |
+
|
| 642 |
+
foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
|
| 643 |
+
$polldaddy->reset();
|
| 644 |
+
$poll_object = $polldaddy->get_poll( $poll_id );
|
| 645 |
+
|
| 646 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
| 647 |
+
$this->errors->add( 'permission', __( 'You are not allowed to close this poll.', 'polldaddy' ) );
|
| 648 |
+
return false;
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
// Send Poll Author credentials
|
| 652 |
+
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 653 |
+
$polldaddy->reset();
|
| 654 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 655 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 656 |
+
}
|
| 657 |
+
$polldaddy->userCode = $userCode;
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
$polldaddy->reset();
|
| 661 |
+
$polldaddy->close_poll( $poll_id );
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
$query_args['message'] = 'closed';
|
| 665 |
+
$query_args['closed'] = count( (array) $poll );
|
| 666 |
+
break;
|
| 667 |
+
case 'edit-poll' : // TODO: use polldaddy_poll
|
| 668 |
+
if ( !$is_POST || !$poll = (int) $poll )
|
| 669 |
+
return;
|
| 670 |
+
|
| 671 |
+
check_admin_referer( "edit-poll_$poll" );
|
| 672 |
+
|
| 673 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 674 |
+
$polldaddy->reset();
|
| 675 |
+
|
| 676 |
+
$poll_object = $polldaddy->get_poll( $poll );
|
| 677 |
+
$this->parse_errors( $polldaddy );
|
| 678 |
+
|
| 679 |
+
if ( !$this->can_edit( $poll_object ) ) {
|
| 680 |
+
$this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
|
| 681 |
+
return false;
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
// Send Poll Author credentials
|
| 685 |
+
if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
|
| 686 |
+
$polldaddy->reset();
|
| 687 |
+
if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
|
| 688 |
+
$this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
|
| 689 |
+
}
|
| 690 |
+
$this->parse_errors( $polldaddy );
|
| 691 |
+
$polldaddy->userCode = $userCode;
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
if ( !$poll_object )
|
| 695 |
+
$this->errors->add( 'GetPoll', __( 'Poll not found', 'polldaddy' ) );
|
| 696 |
+
|
| 697 |
+
if ( $this->errors->get_error_codes() )
|
| 698 |
+
return false;
|
| 699 |
+
|
| 700 |
+
$media = $mediaType = array();
|
| 701 |
+
if ( isset( $_POST['media'] ) ) {
|
| 702 |
+
$media = $_POST['media'];
|
| 703 |
+
unset( $_POST['media'] );
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
if ( isset( $_POST['mediaType'] ) ) {
|
| 707 |
+
$mediaType = $_POST['mediaType'];
|
| 708 |
+
unset( $_POST['mediaType'] );
|
| 709 |
+
}
|
| 710 |
+
|
| 711 |
+
$poll_data = get_object_vars( $poll_object );
|
| 712 |
+
foreach ( $poll_data as $key => $value )
|
| 713 |
+
if ( '_' === $key[0] )
|
| 714 |
+
unset( $poll_data[$key] );
|
| 715 |
+
|
| 716 |
+
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
| 717 |
+
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
| 718 |
+
$poll_data[$option] = 'yes';
|
| 719 |
+
else
|
| 720 |
+
$poll_data[$option] = 'no';
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
$blocks = array( 'off', 'cookie', 'cookieip' );
|
| 724 |
+
if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
|
| 725 |
+
$poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
| 726 |
+
|
| 727 |
+
$results = array( 'show', 'percent', 'hide' );
|
| 728 |
+
if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
|
| 729 |
+
$poll_data['resultsType'] = $_POST['resultsType'];
|
| 730 |
+
$poll_data['question'] = stripslashes( $_POST['question'] );
|
| 731 |
+
|
| 732 |
+
$comments = array( 'off', 'allow', 'moderate' );
|
| 733 |
+
if ( isset( $_POST['comments'] ) && in_array( $_POST['comments'], $comments ) )
|
| 734 |
+
$poll_data['comments'] = $_POST['comments'];
|
| 735 |
+
|
| 736 |
+
if ( empty( $_POST['answer'] ) || !is_array( $_POST['answer'] ) )
|
| 737 |
+
$this->errors->add( 'answer', __( 'Invalid answers', 'polldaddy' ) );
|
| 738 |
+
|
| 739 |
+
$answers = array();
|
| 740 |
+
foreach ( $_POST['answer'] as $answer_id => $answer ) {
|
| 741 |
+
$answer = stripslashes( trim( $answer ) );
|
| 742 |
+
|
| 743 |
+
if ( strlen( $answer ) > 0 ) {
|
| 744 |
+
$answer = wp_kses( $answer, $allowedtags );
|
| 745 |
+
|
| 746 |
+
$args['text'] = (string) $answer;
|
| 747 |
+
|
| 748 |
+
$answer_id = str_replace('new', '', $answer_id );
|
| 749 |
+
$mc = '';
|
| 750 |
+
$mt = 0;
|
| 751 |
+
|
| 752 |
+
if ( isset( $media[$answer_id] ) )
|
| 753 |
+
$mc = esc_html( $media[$answer_id] );
|
| 754 |
+
|
| 755 |
+
if ( isset( $mediaType[$answer_id] ) )
|
| 756 |
+
$mt = intval( $mediaType[$answer_id] );
|
| 757 |
+
|
| 758 |
+
$args['mediaType'] = $mt;
|
| 759 |
+
$args['mediaCode'] = $mc;
|
| 760 |
+
|
| 761 |
+
if ( $answer_id > 1000 )
|
| 762 |
+
$answer = polldaddy_poll_answer( $args, $answer_id );
|
| 763 |
+
else
|
| 764 |
+
$answer = polldaddy_poll_answer( $args );
|
| 765 |
+
|
| 766 |
+
if ( isset( $answer ) && is_a( $answer, 'Polldaddy_Poll_Answer' ) )
|
| 767 |
+
$answers[] = $answer;
|
| 768 |
+
}
|
| 769 |
+
}
|
| 770 |
+
|
| 771 |
+
if ( 2 > count( $answers ) )
|
| 772 |
+
$this->errors->add( 'answer', __( 'You must include at least 2 answers', 'polldaddy' ) );
|
| 773 |
+
|
| 774 |
+
if ( $this->errors->get_error_codes() )
|
| 775 |
+
return false;
|
| 776 |
+
|
| 777 |
+
$poll_data['answers'] = $answers;
|
| 778 |
+
|
| 779 |
+
$poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
|
| 780 |
+
|
| 781 |
+
if ( isset ( $_POST['styleID'] ) ) {
|
| 782 |
+
if ( $_POST['styleID'] == 'x' ) {
|
| 783 |
+
$this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
|
| 784 |
+
return false;
|
| 785 |
+
}
|
| 786 |
+
}
|
| 787 |
+
$poll_data['styleID'] = (int) $_POST['styleID'];
|
| 788 |
+
$poll_data['choices'] = (int) $_POST['choices'];
|
| 789 |
+
|
| 790 |
+
if ( $poll_data['blockRepeatVotersType'] == 'cookie' ) {
|
| 791 |
+
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 792 |
+
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 793 |
+
} elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ) {
|
| 794 |
+
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 795 |
+
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
if ( isset( $media[999999999] ) )
|
| 799 |
+
$poll_data['mediaCode'] = esc_html( $media[999999999] );
|
| 800 |
+
|
| 801 |
+
if ( isset( $mediaType[999999999] ) )
|
| 802 |
+
$poll_data['mediaType'] = intval( $mediaType[999999999] );
|
| 803 |
+
|
| 804 |
+
if( isset( $GLOBALS['blog_id'] ) )
|
| 805 |
+
$poll_data['parentID'] = (int) $GLOBALS['blog_id'];
|
| 806 |
+
|
| 807 |
+
$polldaddy->reset();
|
| 808 |
+
|
| 809 |
+
$update_response = $polldaddy->update_poll( $poll, $poll_data );
|
| 810 |
+
$this->parse_errors( $polldaddy );
|
| 811 |
+
|
| 812 |
+
if ( !$update_response )
|
| 813 |
+
$this->errors->add( 'UpdatePoll', __( 'Poll could not be updated', 'polldaddy' ) );
|
| 814 |
+
|
| 815 |
+
if ( $this->errors->get_error_codes() )
|
| 816 |
+
return false;
|
| 817 |
+
|
| 818 |
+
$query_args['message'] = 'updated';
|
| 819 |
+
if ( isset( $_POST['iframe'] ) )
|
| 820 |
+
$query_args['iframe'] = '';
|
| 821 |
+
break;
|
| 822 |
+
case 'create-poll' :
|
| 823 |
+
if ( !$is_POST )
|
| 824 |
+
return;
|
| 825 |
+
|
| 826 |
+
check_admin_referer( 'create-poll' );
|
| 827 |
+
|
| 828 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 829 |
+
$polldaddy->reset();
|
| 830 |
+
|
| 831 |
+
$media = $mediaType = array();
|
| 832 |
+
if ( isset( $_POST['media'] ) ) {
|
| 833 |
+
$media = $_POST['media'];
|
| 834 |
+
unset( $_POST['media'] );
|
| 835 |
+
}
|
| 836 |
+
|
| 837 |
+
if ( isset( $_POST['mediaType'] ) ) {
|
| 838 |
+
$mediaType = $_POST['mediaType'];
|
| 839 |
+
unset( $_POST['mediaType'] );
|
| 840 |
+
}
|
| 841 |
+
|
| 842 |
+
$answers = array();
|
| 843 |
+
foreach ( $_POST['answer'] as $answer_id => $answer ) {
|
| 844 |
+
$answer = stripslashes( trim( $answer ) );
|
| 845 |
+
|
| 846 |
+
if ( strlen( $answer ) > 0 ) {
|
| 847 |
+
$answer = wp_kses( $answer, $allowedtags );
|
| 848 |
+
|
| 849 |
+
$args['text'] = (string) $answer;
|
| 850 |
+
|
| 851 |
+
$answer_id = (int) str_replace('new', '', $answer_id );
|
| 852 |
+
$mc = '';
|
| 853 |
+
$mt = 0;
|
| 854 |
+
|
| 855 |
+
if ( isset( $media[$answer_id] ) )
|
| 856 |
+
$mc = esc_html( $media[$answer_id] );
|
| 857 |
+
|
| 858 |
+
if ( isset( $mediaType[$answer_id] ) )
|
| 859 |
+
$mt = intval( $mediaType[$answer_id] );
|
| 860 |
+
|
| 861 |
+
$args['mediaType'] = $mt;
|
| 862 |
+
$args['mediaCode'] = $mc;
|
| 863 |
+
|
| 864 |
+
$answer = polldaddy_poll_answer( $args );
|
| 865 |
+
|
| 866 |
+
if ( isset( $answer ) && is_a( $answer, 'Polldaddy_Poll_Answer' ) )
|
| 867 |
+
$answers[] = $answer;
|
| 868 |
+
}
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
+
if ( !$answers )
|
| 872 |
+
return false;
|
| 873 |
+
|
| 874 |
+
$poll_data = _polldaddy_poll_defaults();
|
| 875 |
+
|
| 876 |
+
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
| 877 |
+
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
| 878 |
+
$poll_data[$option] = 'yes';
|
| 879 |
+
else
|
| 880 |
+
$poll_data[$option] = 'no';
|
| 881 |
+
}
|
| 882 |
+
|
| 883 |
+
$blocks = array( 'off', 'cookie', 'cookieip' );
|
| 884 |
+
if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
|
| 885 |
+
$poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
| 886 |
+
|
| 887 |
+
$results = array( 'show', 'percent', 'hide' );
|
| 888 |
+
if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
|
| 889 |
+
$poll_data['resultsType'] = $_POST['resultsType'];
|
| 890 |
+
|
| 891 |
+
$comments = array( 'off', 'allow', 'moderate' );
|
| 892 |
+
if ( isset( $_POST['comments'] ) && in_array( $_POST['comments'], $comments ) )
|
| 893 |
+
$poll_data['comments'] = $_POST['comments'];
|
| 894 |
+
|
| 895 |
+
$poll_data['answers'] = $answers;
|
| 896 |
+
|
| 897 |
+
$poll_data['question'] = stripslashes( $_POST['question'] );
|
| 898 |
+
$poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
|
| 899 |
+
|
| 900 |
+
if ( isset ( $_POST['styleID'] ) ) {
|
| 901 |
+
if ( $_POST['styleID'] == 'x' ) {
|
| 902 |
+
$this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
|
| 903 |
+
return false;
|
| 904 |
+
}
|
| 905 |
+
}
|
| 906 |
+
$poll_data['styleID'] = (int) $_POST['styleID'];
|
| 907 |
+
$poll_data['choices'] = (int) $_POST['choices'];
|
| 908 |
+
|
| 909 |
+
if ( $poll_data['blockRepeatVotersType'] == 'cookie' ) {
|
| 910 |
+
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 911 |
+
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 912 |
+
} elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ) {
|
| 913 |
+
if ( isset( $_POST['cookieip_expiration'] ) )
|
| 914 |
+
$poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
if ( isset( $media[999999999] ) )
|
| 918 |
+
$poll_data['mediaCode'] = esc_html( $media[999999999] );
|
| 919 |
+
|
| 920 |
+
if ( isset( $mediaType[999999999] ) )
|
| 921 |
+
$poll_data['mediaType'] = intval( $mediaType[999999999] );
|
| 922 |
+
|
| 923 |
+
$poll = $polldaddy->create_poll( $poll_data );
|
| 924 |
+
$this->parse_errors( $polldaddy );
|
| 925 |
+
|
| 926 |
+
if ( !$poll || empty( $poll->_id ) )
|
| 927 |
+
$this->errors->add( 'CreatePoll', __( 'Poll could not be created', 'polldaddy' ) );
|
| 928 |
+
|
| 929 |
+
if ( $this->errors->get_error_codes() )
|
| 930 |
+
return false;
|
| 931 |
+
|
| 932 |
+
$query_args['message'] = 'created';
|
| 933 |
+
$query_args['action'] = 'edit-poll';
|
| 934 |
+
$query_args['poll'] = $poll->_id;
|
| 935 |
+
if ( isset( $_POST['iframe'] ) )
|
| 936 |
+
$query_args['iframe'] = '';
|
| 937 |
+
break;
|
| 938 |
+
case 'delete-style' :
|
| 939 |
+
if ( empty( $style ) )
|
| 940 |
+
return;
|
| 941 |
+
|
| 942 |
+
if ( is_array( $style ) )
|
| 943 |
+
check_admin_referer( 'action-style_bulk' );
|
| 944 |
+
else
|
| 945 |
+
check_admin_referer( "delete-style_$style" );
|
| 946 |
+
|
| 947 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 948 |
+
|
| 949 |
+
foreach ( (array) $_REQUEST['style'] as $style_id ) {
|
| 950 |
+
$polldaddy->reset();
|
| 951 |
+
$polldaddy->delete_style( $style_id );
|
| 952 |
+
}
|
| 953 |
+
|
| 954 |
+
$query_args['message'] = 'deleted-style';
|
| 955 |
+
$query_args['deleted'] = count( (array) $style );
|
| 956 |
+
break;
|
| 957 |
+
case 'edit-style' :
|
| 958 |
+
if ( !$is_POST || !$style = (int) $style )
|
| 959 |
+
return;
|
| 960 |
+
|
| 961 |
+
check_admin_referer( "edit-style$style" );
|
| 962 |
+
|
| 963 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 964 |
+
$polldaddy->reset();
|
| 965 |
+
|
| 966 |
+
$style_data = _polldaddy_style_defaults();
|
| 967 |
+
|
| 968 |
+
if ( isset( $_POST['style-title'] ) )
|
| 969 |
+
$style_data['title'] = stripslashes( trim( (string) $_POST['style-title'] ) );
|
| 970 |
+
|
| 971 |
+
if ( isset( $_POST['CSSXML'] ) )
|
| 972 |
+
$style_data['css'] = urlencode( stripslashes( trim( (string) $_POST['CSSXML'] ) ) );
|
| 973 |
+
|
| 974 |
+
if ( isset( $_REQUEST['updatePollCheck'] ) && $_REQUEST['updatePollCheck'] == 'on' )
|
| 975 |
+
$style_data['retro'] = 1;
|
| 976 |
+
|
| 977 |
+
$update_response = $polldaddy->update_style( $style, $style_data );
|
| 978 |
+
|
| 979 |
+
$this->parse_errors( $polldaddy );
|
| 980 |
+
|
| 981 |
+
if ( !$update_response )
|
| 982 |
+
$this->errors->add( 'UpdateStyle', __( 'Style could not be updated', 'polldaddy' ) );
|
| 983 |
+
|
| 984 |
+
if ( $this->errors->get_error_codes() )
|
| 985 |
+
return false;
|
| 986 |
+
|
| 987 |
+
$query_args['message'] = 'updated-style';
|
| 988 |
+
if ( isset( $_POST['iframe'] ) )
|
| 989 |
+
$query_args['iframe'] = '';
|
| 990 |
+
break;
|
| 991 |
+
case 'create-style' :
|
| 992 |
+
if ( !$is_POST )
|
| 993 |
+
return;
|
| 994 |
+
|
| 995 |
+
check_admin_referer( 'create-style' );
|
| 996 |
+
|
| 997 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 998 |
+
$polldaddy->reset();
|
| 999 |
+
|
| 1000 |
+
$style_data = _polldaddy_style_defaults();
|
| 1001 |
+
|
| 1002 |
+
if ( isset( $_POST['style-title'] ) )
|
| 1003 |
+
$style_data['title'] = stripslashes( strip_tags( trim( (string) $_POST['style-title'] ) ) );
|
| 1004 |
+
|
| 1005 |
+
if ( isset( $_POST['CSSXML'] ) )
|
| 1006 |
+
$style_data['css'] = urlencode( stripslashes( trim( (string) $_POST['CSSXML'] ) ) );
|
| 1007 |
+
|
| 1008 |
+
$style = $polldaddy->create_style( $style_data );
|
| 1009 |
+
$this->parse_errors( $polldaddy );
|
| 1010 |
+
|
| 1011 |
+
if ( !$style || empty( $style->_id ) )
|
| 1012 |
+
$this->errors->add( 'CreateStyle', __( 'Style could not be created', 'polldaddy' ) );
|
| 1013 |
+
|
| 1014 |
+
if ( $this->errors->get_error_codes() )
|
| 1015 |
+
return false;
|
| 1016 |
+
|
| 1017 |
+
$query_args['message'] = 'created-style';
|
| 1018 |
+
$query_args['action'] = 'edit-style';
|
| 1019 |
+
$query_args['style'] = $style->_id;
|
| 1020 |
+
if ( isset( $_POST['iframe'] ) )
|
| 1021 |
+
$query_args['iframe'] = '';
|
| 1022 |
+
break;
|
| 1023 |
+
case 'update-options' :
|
| 1024 |
+
if ( !$is_POST )
|
| 1025 |
+
return;
|
| 1026 |
+
|
| 1027 |
+
check_admin_referer( 'polldaddy-account' );
|
| 1028 |
+
|
| 1029 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1030 |
+
$polldaddy->reset();
|
| 1031 |
+
|
| 1032 |
+
$poll_defaults = _polldaddy_poll_defaults();
|
| 1033 |
+
|
| 1034 |
+
$user_defaults = array();
|
| 1035 |
+
|
| 1036 |
+
foreach ( array( "multipleChoice", "randomiseAnswers", "otherAnswer", "sharing", "resultsType", "styleID", "blockRepeatVotersType", "blockExpiration" ) as $option ) {
|
| 1037 |
+
if ( isset( $poll_defaults[$option] ) && $poll_defaults[$option] )
|
| 1038 |
+
$user_defaults[$option] = $poll_defaults[$option];
|
| 1039 |
+
}
|
| 1040 |
+
|
| 1041 |
+
foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
|
| 1042 |
+
if ( isset( $_POST[$option] ) && $_POST[$option] )
|
| 1043 |
+
$user_defaults[$option] = 'yes';
|
| 1044 |
+
else
|
| 1045 |
+
$user_defaults[$option] = 'no';
|
| 1046 |
+
}
|
| 1047 |
+
|
| 1048 |
+
$results = array( 'show', 'percent', 'hide' );
|
| 1049 |
+
if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
|
| 1050 |
+
$user_defaults['resultsType'] = $_POST['resultsType'];
|
| 1051 |
+
|
| 1052 |
+
if ( isset ( $_POST['styleID'] ) ) {
|
| 1053 |
+
$user_defaults['styleID'] = (int) $_POST['styleID'];
|
| 1054 |
+
}
|
| 1055 |
+
|
| 1056 |
+
$blocks = array( 'off', 'cookie', 'cookieip' );
|
| 1057 |
+
if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
|
| 1058 |
+
$user_defaults['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
|
| 1059 |
+
|
| 1060 |
+
if ( isset( $_POST['blockExpiration'] ) )
|
| 1061 |
+
$user_defaults['blockExpiration'] = (int) $_POST['blockExpiration'];
|
| 1062 |
+
|
| 1063 |
+
$polldaddy->update_poll_defaults( 0, $user_defaults );
|
| 1064 |
+
|
| 1065 |
+
$this->parse_errors( $polldaddy );
|
| 1066 |
+
if ( $this->errors->get_error_codes() )
|
| 1067 |
+
return false;
|
| 1068 |
+
|
| 1069 |
+
$query_args['message'] = 'updated-options';
|
| 1070 |
+
break;
|
| 1071 |
+
default :
|
| 1072 |
+
return;
|
| 1073 |
+
}//end switch
|
| 1074 |
+
} elseif ( $page == 'ratings' ) {
|
| 1075 |
+
|
| 1076 |
+
switch ( $action ) {
|
| 1077 |
+
case 'delete' :
|
| 1078 |
+
if ( empty( $id ) )
|
| 1079 |
+
return;
|
| 1080 |
+
if ( empty( $rating ) )
|
| 1081 |
+
return;
|
| 1082 |
+
|
| 1083 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 1084 |
+
|
| 1085 |
+
if ( is_array( $rating ) ) {
|
| 1086 |
+
check_admin_referer( 'action-rating_bulk' );
|
| 1087 |
+
|
| 1088 |
+
foreach ( $rating as $key => $value ) {
|
| 1089 |
+
$polldaddy->reset();
|
| 1090 |
+
$polldaddy->delete_rating_result( $id, $value );
|
| 1091 |
+
}
|
| 1092 |
+
} else {
|
| 1093 |
+
check_admin_referer( "delete-rating_$rating" );
|
| 1094 |
+
|
| 1095 |
+
$polldaddy->delete_rating_result( $id, $rating );
|
| 1096 |
+
}
|
| 1097 |
+
|
| 1098 |
+
if ( isset( $_REQUEST['filter'] ) )
|
| 1099 |
+
$query_args['filter'] = $_REQUEST['filter'];
|
| 1100 |
+
if ( isset( $_REQUEST['change-report-to'] ) )
|
| 1101 |
+
$query_args['change-report-to'] = $_REQUEST['change-report-to'];
|
| 1102 |
+
$query_args['message'] = 'deleted-rating';
|
| 1103 |
+
$query_args['deleted'] = count( (array) $rating );
|
| 1104 |
+
break;
|
| 1105 |
+
default :
|
| 1106 |
+
return;
|
| 1107 |
+
}//end switch
|
| 1108 |
+
}
|
| 1109 |
+
|
| 1110 |
+
wp_safe_redirect( add_query_arg( $query_args, wp_get_referer() ) );
|
| 1111 |
+
exit;
|
| 1112 |
+
}
|
| 1113 |
+
|
| 1114 |
+
function hide_admin_menu() {
|
| 1115 |
+
echo '<style>#adminmenuback,#adminmenuwrap,#screen-meta-links,#footer{display:none;visibility:hidden;}#wpcontent{margin-left:10px;}</style>';
|
| 1116 |
+
}
|
| 1117 |
+
|
| 1118 |
+
function management_page_load_signup() {
|
| 1119 |
+
|
| 1120 |
+
switch ( $_POST['account'] ) {
|
| 1121 |
+
case 'import' :
|
| 1122 |
+
return array( $this->import_account() );
|
| 1123 |
+
break;
|
| 1124 |
+
default :
|
| 1125 |
+
return;
|
| 1126 |
+
}//end switch
|
| 1127 |
+
}
|
| 1128 |
+
|
| 1129 |
+
function import_account() {
|
| 1130 |
+
if ( isset( $_POST[ 'polldaddy_key' ] ) ) {
|
| 1131 |
+
$polldaddy_api_key = trim( stripslashes( $_POST[ 'polldaddy_key' ] ) );
|
| 1132 |
+
$polldaddy = $this->get_client( $polldaddy_api_key );
|
| 1133 |
+
$polldaddy->reset();
|
| 1134 |
+
if ( !$polldaddy->get_usercode( $this->id ) ) {
|
| 1135 |
+
$this->parse_errors( $polldaddy );
|
| 1136 |
+
$this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Is your API code correct?', 'polldaddy' ) );
|
| 1137 |
+
return false;
|
| 1138 |
+
}
|
| 1139 |
+
update_option( 'polldaddy_api_key', $polldaddy_api_key );
|
| 1140 |
+
} else {
|
| 1141 |
+
$this->user_code = false;
|
| 1142 |
+
$this->errors->add( 'import-account', __( 'Account could not be imported. Did you enter the correct API key?', 'polldaddy' ) );
|
| 1143 |
+
return false;
|
| 1144 |
+
}
|
| 1145 |
+
}
|
| 1146 |
+
|
| 1147 |
+
function admin_body_class( $class ) {
|
| 1148 |
+
if ( isset( $_GET['iframe'] ) )
|
| 1149 |
+
$class .= 'poll-preview-iframe ';
|
| 1150 |
+
if ( isset( $_GET['TB_iframe'] ) )
|
| 1151 |
+
$class .= 'poll-preview-iframe-editor ';
|
| 1152 |
+
return $class;
|
| 1153 |
+
}
|
| 1154 |
+
|
| 1155 |
+
function management_page_notices( $message = false ) {
|
| 1156 |
+
|
| 1157 |
+
switch ( (string) @$_GET['message'] ) {
|
| 1158 |
+
case 'deleted' :
|
| 1159 |
+
$deleted = (int) $_GET['deleted'];
|
| 1160 |
+
if ( 1 == $deleted )
|
| 1161 |
+
$message = __( 'Poll deleted.', 'polldaddy' );
|
| 1162 |
+
else
|
| 1163 |
+
$message = sprintf( _n( '%s Poll Deleted.', '%s Polls Deleted.', $deleted, 'polldaddy' ), number_format_i18n( $deleted ) );
|
| 1164 |
+
break;
|
| 1165 |
+
case 'opened' :
|
| 1166 |
+
$opened = (int) $_GET['opened'];
|
| 1167 |
+
if ( 1 == $opened )
|
| 1168 |
+
$message = __( 'Poll opened.', 'polldaddy' );
|
| 1169 |
+
else
|
| 1170 |
+
$message = sprintf( _n( '%s Poll Opened.', '%s Polls Opened.', $opened, 'polldaddy' ), number_format_i18n( $opened ) );
|
| 1171 |
+
break;
|
| 1172 |
+
case 'closed' :
|
| 1173 |
+
$closed = (int) $_GET['closed'];
|
| 1174 |
+
if ( 1 == $closed )
|
| 1175 |
+
$message = __( 'Poll closed.', 'polldaddy' );
|
| 1176 |
+
else
|
| 1177 |
+
$message = sprintf( _n( '%s Poll Closed.', '%s Polls Closed.', $closed, 'polldaddy' ), number_format_i18n( $closed ) );
|
| 1178 |
+
break;
|
| 1179 |
+
case 'updated' :
|
| 1180 |
+
$message = __( 'Poll updated.', 'polldaddy' );
|
| 1181 |
+
break;
|
| 1182 |
+
case 'created' :
|
| 1183 |
+
$message = __( 'Poll created.', 'polldaddy' );
|
| 1184 |
+
if ( isset( $_GET['iframe'] ) )
|
| 1185 |
+
$message .= ' <input type="button" class="button polldaddy-send-to-editor" value="' . esc_attr( __( 'Embed in Post', 'polldaddy' ) ) . '" />';
|
| 1186 |
+
break;
|
| 1187 |
+
case 'updated-style' :
|
| 1188 |
+
$message = __( 'Custom Style updated.', 'polldaddy' );
|
| 1189 |
+
break;
|
| 1190 |
+
case 'created-style' :
|
| 1191 |
+
$message = __( 'Custom Style created.', 'polldaddy' );
|
| 1192 |
+
break;
|
| 1193 |
+
case 'deleted-style' :
|
| 1194 |
+
$deleted = (int) $_GET['deleted'];
|
| 1195 |
+
if ( 1 == $deleted )
|
| 1196 |
+
$message = __( 'Custom Style deleted.', 'polldaddy' );
|
| 1197 |
+
else
|
| 1198 |
+
$message = sprintf( _n( '%s Style Deleted.', '%s Custom Styles Deleted.', $deleted, 'polldaddy' ), number_format_i18n( $deleted ) );
|
| 1199 |
+
break;
|
| 1200 |
+
case 'imported-account' :
|
| 1201 |
+
$message = __( 'Account Linked.', 'polldaddy' );
|
| 1202 |
+
break;
|
| 1203 |
+
case 'updated-options' :
|
| 1204 |
+
$message = __( 'Options Updated.', 'polldaddy' );
|
| 1205 |
+
break;
|
| 1206 |
+
case 'deleted-rating' :
|
| 1207 |
+
$deleted = (int) $_GET['deleted'];
|
| 1208 |
+
if ( 1 == $deleted )
|
| 1209 |
+
$message = __( 'Rating deleted.', 'polldaddy' );
|
| 1210 |
+
else
|
| 1211 |
+
$message = sprintf( _n( '%s Rating Deleted.', '%s Ratings Deleted.', $deleted, 'polldaddy' ), number_format_i18n( $deleted ) );
|
| 1212 |
+
break;
|
| 1213 |
+
}//end switch
|
| 1214 |
+
|
| 1215 |
+
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 1216 |
+
|
| 1217 |
+
if ( $is_POST ) {
|
| 1218 |
+
switch ( $GLOBALS['action'] ) {
|
| 1219 |
+
case 'create-poll' :
|
| 1220 |
+
$message = __( 'Error: An error has occurred; Poll not created.', 'polldaddy' );
|
| 1221 |
+
break;
|
| 1222 |
+
case 'edit-poll' :
|
| 1223 |
+
$message = __( 'Error: An error has occurred; Poll not updated.', 'polldaddy' );
|
| 1224 |
+
break;
|
| 1225 |
+
case 'account' :
|
| 1226 |
+
if ( 'import' == $_POST['account'] )
|
| 1227 |
+
$message = __( 'Error: An error has occurred; Account could not be imported. Perhaps your email address or password is incorrect?', 'polldaddy' );
|
| 1228 |
+
else
|
| 1229 |
+
$message = __( 'Error: An error has occurred; Account could not be created.', 'polldaddy' );
|
| 1230 |
+
break;
|
| 1231 |
+
}//end switch
|
| 1232 |
+
}
|
| 1233 |
+
|
| 1234 |
+
if ( !$message )
|
| 1235 |
+
return;
|
| 1236 |
+
?>
|
| 1237 |
+
<div class='updated'><p><?php echo $message; ?></p></div>
|
| 1238 |
+
<?php
|
| 1239 |
+
$this->print_errors();
|
| 1240 |
+
}
|
| 1241 |
+
|
| 1242 |
+
function management_page() {
|
| 1243 |
+
|
| 1244 |
+
global $page, $action, $poll, $style, $rating;
|
| 1245 |
+
$poll = (int) $poll;
|
| 1246 |
+
$style = (int) $style;
|
| 1247 |
+
$rating = esc_html( $rating );
|
| 1248 |
+
?>
|
| 1249 |
+
|
| 1250 |
+
<div class="wrap" id="manage-polls">
|
| 1251 |
+
|
| 1252 |
+
<?php
|
| 1253 |
+
if ( $page == 'polls' ) {
|
| 1254 |
+
if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
|
| 1255 |
+
$action = '';
|
| 1256 |
+
}
|
| 1257 |
+
switch ( $action ) {
|
| 1258 |
+
case 'preview' :
|
| 1259 |
+
if ( isset( $_GET['iframe'] ) ):
|
| 1260 |
+
if ( !isset( $_GET['popup'] ) ) { ?>
|
| 1261 |
+
<h2 id="poll-list-header"><?php _e( 'Polldaddy Polls', 'polldaddy' ); ?></h2>
|
| 1262 |
+
<?php
|
| 1263 |
+
} else { ?>
|
| 1264 |
+
<h2 id="poll-list-header"><?php printf( __( 'Preview Poll <a href="%s" class="add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
|
| 1265 |
+
<?php
|
| 1266 |
+
}
|
| 1267 |
+
endif;
|
| 1268 |
+
|
| 1269 |
+
echo do_shortcode( "[polldaddy poll=$poll cb=1]" );
|
| 1270 |
+
|
| 1271 |
+
wp_print_scripts( 'polldaddy-poll-js' );
|
| 1272 |
+
break;
|
| 1273 |
+
case 'results' :
|
| 1274 |
+
?>
|
| 1275 |
+
|
| 1276 |
+
<h2 id="poll-list-header"><?php printf( __( 'Poll Results <a href="%s" class="add-new-h2">All Polls</a> <a href="%s" class="add-new-h2">Edit Poll</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ), esc_url( add_query_arg( array( 'action' => 'edit-poll', 'poll' => $poll, 'message' => false ) ) ) ); ?></h2>
|
| 1277 |
+
|
| 1278 |
+
<?php
|
| 1279 |
+
$this->poll_results_page( $poll );
|
| 1280 |
+
break;
|
| 1281 |
+
case 'edit' :
|
| 1282 |
+
case 'edit-poll' :
|
| 1283 |
+
?>
|
| 1284 |
+
|
| 1285 |
+
<h2 id="poll-list-header"><?php printf( __( 'Edit Poll <a href="%s" class="add-new-h2">All Polls</a> <a href="%s" class="add-new-h2">View Results</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ), esc_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll, 'message' => false ) ) ) ); ?></h2>
|
| 1286 |
+
|
| 1287 |
+
<?php
|
| 1288 |
+
|
| 1289 |
+
$this->poll_edit_form( $poll );
|
| 1290 |
+
break;
|
| 1291 |
+
case 'create-poll' :
|
| 1292 |
+
?>
|
| 1293 |
+
|
| 1294 |
+
<h2 id="poll-list-header"><?php printf( __( 'Add New Poll <a href="%s" class="add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
|
| 1295 |
+
|
| 1296 |
+
<?php
|
| 1297 |
+
$this->poll_edit_form();
|
| 1298 |
+
break;
|
| 1299 |
+
case 'list-styles' :
|
| 1300 |
+
?>
|
| 1301 |
+
|
| 1302 |
+
<h2 id="polldaddy-header"><?php
|
| 1303 |
+
if ( $this->is_author )
|
| 1304 |
+
printf( __( 'Custom Styles <a href="%s" class="add-new-h2">Add New</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'create-style', 'poll' => false, 'message' => false ) ) ) );
|
| 1305 |
+
else
|
| 1306 |
+
_e( 'Custom Styles', 'polldaddy' ); ?></h2>
|
| 1307 |
+
|
| 1308 |
+
<?php
|
| 1309 |
+
$this->styles_table();
|
| 1310 |
+
break;
|
| 1311 |
+
case 'edit-style' :
|
| 1312 |
+
?>
|
| 1313 |
+
|
| 1314 |
+
<h2 id="polldaddy-header"><?php printf( __( 'Edit Style <a href="%s" class="add-new-h2">List Styles</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
|
| 1315 |
+
|
| 1316 |
+
<?php
|
| 1317 |
+
|
| 1318 |
+
$this->style_edit_form( $style );
|
| 1319 |
+
break;
|
| 1320 |
+
case 'create-style' :
|
| 1321 |
+
?>
|
| 1322 |
+
|
| 1323 |
+
<h2 id="polldaddy-header"><?php printf( __( 'Create Style <a href="%s" class="add-new-h2">List Styles</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
|
| 1324 |
+
|
| 1325 |
+
<?php
|
| 1326 |
+
$this->style_edit_form();
|
| 1327 |
+
break;
|
| 1328 |
+
case 'options' :
|
| 1329 |
+
case 'import-account' :
|
| 1330 |
+
case 'update-options' :
|
| 1331 |
+
$this->plugin_options();
|
| 1332 |
+
break;
|
| 1333 |
+
default :
|
| 1334 |
+
|
| 1335 |
+
?>
|
| 1336 |
+
|
| 1337 |
+
<h2 id="poll-list-header"><?php
|
| 1338 |
+
if ( $this->is_author )
|
| 1339 |
+
printf( __( 'Polldaddy Polls <a href="%s" class="add-new-h2">Add New</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'create-poll', 'poll' => false, 'message' => false ) ) ) );
|
| 1340 |
+
else
|
| 1341 |
+
_e( 'Polldaddy Polls ', 'polldaddy' );
|
| 1342 |
+
?></h2><?php
|
| 1343 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1344 |
+
$account = $polldaddy->get_account();
|
| 1345 |
+
if ( !empty( $account ) )
|
| 1346 |
+
$account_email = esc_attr( $account->email );
|
| 1347 |
+
if ( isset( $account_email ) && current_user_can( 'manage_options' ) ) {
|
| 1348 |
+
echo "<p>" . sprintf( __( 'Linked to WordPress.com Account: <strong>%s</strong> (<a target="_blank" href="options-general.php?page=polls&action=options">Settings</a> / <a target="_blank" href="http://polldaddy.com/dashboard/">Polldaddy.com</a>)', 'polldaddy' ), $account_email ) . "</p>";
|
| 1349 |
+
}
|
| 1350 |
+
|
| 1351 |
+
if ( !isset( $_GET['view'] ) )
|
| 1352 |
+
$this->polls_table( 'user' );
|
| 1353 |
+
else
|
| 1354 |
+
$this->polls_table( 'blog' );
|
| 1355 |
+
|
| 1356 |
+
}//end switch
|
| 1357 |
+
} elseif ( $page == 'ratings' ) {
|
| 1358 |
+
if ( !$this->is_admin && !in_array( $action, array( 'delete', 'reports' ) ) ) {//check user privileges has access to action
|
| 1359 |
+
$action = 'reports';
|
| 1360 |
+
}
|
| 1361 |
+
|
| 1362 |
+
switch ( $action ) {
|
| 1363 |
+
case 'delete' :
|
| 1364 |
+
case 'reports' :
|
| 1365 |
+
$this->rating_reports();
|
| 1366 |
+
break;
|
| 1367 |
+
case 'update-rating' :
|
| 1368 |
+
$this->update_rating();
|
| 1369 |
+
$this->rating_settings();
|
| 1370 |
+
break;
|
| 1371 |
+
default :
|
| 1372 |
+
$this->rating_settings();
|
| 1373 |
+
}//end switch
|
| 1374 |
+
}
|
| 1375 |
+
?>
|
| 1376 |
+
|
| 1377 |
+
</div>
|
| 1378 |
+
|
| 1379 |
+
<?php
|
| 1380 |
+
|
| 1381 |
+
}
|
| 1382 |
+
|
| 1383 |
+
function polls_table( $view = 'user' ) {
|
| 1384 |
+
$page = 1;
|
| 1385 |
+
if ( isset( $_GET['paged'] ) )
|
| 1386 |
+
$page = absint( $_GET['paged'] );
|
| 1387 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1388 |
+
$polldaddy->reset();
|
| 1389 |
+
|
| 1390 |
+
if ( 'user' == $view )
|
| 1391 |
+
$polls_object = $polldaddy->get_polls( ( $page - 1 ) * 10 + 1, $page * 10 );
|
| 1392 |
+
else
|
| 1393 |
+
$polls_object = $polldaddy->get_polls_by_parent_id( ( $page - 1 ) * 10 + 1, $page * 10 );
|
| 1394 |
+
|
| 1395 |
+
$this->parse_errors( $polldaddy );
|
| 1396 |
+
if ( in_array( 'API Key Not Found, 890', $polldaddy->errors ) )
|
| 1397 |
+
return false;
|
| 1398 |
+
$this->print_errors();
|
| 1399 |
+
$polls = & $polls_object->poll;
|
| 1400 |
+
if ( isset( $polls_object->_total ) )
|
| 1401 |
+
$total_polls = $polls_object->_total;
|
| 1402 |
+
else
|
| 1403 |
+
$total_polls = count( $polls );
|
| 1404 |
+
$class = '';
|
| 1405 |
+
|
| 1406 |
+
$page_links = paginate_links( array(
|
| 1407 |
+
'base' => add_query_arg( 'paged', '%#%' ),
|
| 1408 |
+
'format' => '',
|
| 1409 |
+
'total' => ceil( $total_polls / 10 ),
|
| 1410 |
+
'current' => $page,
|
| 1411 |
+
'prev_text' => '«',
|
| 1412 |
+
'next_text' => '»'
|
| 1413 |
+
) );
|
| 1414 |
+
|
| 1415 |
+
|
| 1416 |
+
?>
|
| 1417 |
+
<form method="post" action="">
|
| 1418 |
+
<input type="hidden" name="iframe" id="iframe1" value="<?php echo isset( $_GET['iframe'] ) ? 1: 0;?>">
|
| 1419 |
+
<div class="tablenav">
|
| 1420 |
+
|
| 1421 |
+
<?php if ( $this->is_author ) { ?>
|
| 1422 |
+
<div class="alignleft actions">
|
| 1423 |
+
<select name="action">
|
| 1424 |
+
<option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
|
| 1425 |
+
<option value="delete"><?php _e( 'Delete', 'polldaddy' ); ?></option>
|
| 1426 |
+
<option value="close"><?php _e( 'Close', 'polldaddy' ); ?></option>
|
| 1427 |
+
<option value="open"><?php _e( 'Open', 'polldaddy' ); ?></option>
|
| 1428 |
+
</select>
|
| 1429 |
+
|
| 1430 |
+
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
|
| 1431 |
+
<?php wp_nonce_field( 'action-poll_bulk' ); ?>
|
| 1432 |
+
</div>
|
| 1433 |
+
<div class="alignleft actions">
|
| 1434 |
+
<select name="filter" id="filter-options" style="margin-left:15px;">
|
| 1435 |
+
<option <?php if ( ! isset( $_GET['view'] ) || $_GET['view'] !== 'blog' ): ?> selected="selected" <?php endif; ?> value=""><?php _e( 'View All Polls', 'polldaddy' ); ?></option>
|
| 1436 |
+
<option <?php if ( isset( $_GET['view'] ) && $_GET['view'] === 'blog' ): ?> selected="selected" <?php endif; ?> value="blog"><?php _e( 'This Blog\'s Polls', 'polldaddy' ); ?></option>
|
| 1437 |
+
</select>
|
| 1438 |
+
<input class="button-secondary action" type="button" id="filter-polls" name="dofilter" value="<?php _e( 'Filter', 'polldaddy' ); ?>" />
|
| 1439 |
+
|
| 1440 |
+
|
| 1441 |
+
</div>
|
| 1442 |
+
|
| 1443 |
+
|
| 1444 |
+
<div class="tablenav-pages"><?php echo $page_links; ?></div>
|
| 1445 |
+
</div>
|
| 1446 |
+
|
| 1447 |
+
<?php } ?>
|
| 1448 |
+
<table class="widefat">
|
| 1449 |
+
<thead>
|
| 1450 |
+
<tr>
|
| 1451 |
+
<th id="cb" class="manage-column column-cb check-column" scope="col"><?php if ( $this->is_author ) { ?><input type="checkbox" /><?php } ?></th>
|
| 1452 |
+
<th id="title" class="manage-column column-title" scope="col"><?php _e( 'Poll', 'polldaddy' ); ?></th>
|
| 1453 |
+
<th id="votes" class="manage-column column-vote num" scope="col"> </th>
|
| 1454 |
+
</tr>
|
| 1455 |
+
</thead>
|
| 1456 |
+
<tbody>
|
| 1457 |
+
|
| 1458 |
+
<?php
|
| 1459 |
+
if ( $polls ) :
|
| 1460 |
+
foreach ( $polls as $poll ) :
|
| 1461 |
+
$poll_id = (int) $poll->_id;
|
| 1462 |
+
|
| 1463 |
+
$poll->___content = trim( strip_tags( $poll->___content ) );
|
| 1464 |
+
if ( strlen( $poll->___content ) == 0 ) {
|
| 1465 |
+
$poll->___content = '-- empty HTML tag --';
|
| 1466 |
+
}
|
| 1467 |
+
|
| 1468 |
+
$poll_closed = (int) $poll->_closed;
|
| 1469 |
+
|
| 1470 |
+
if ( $this->is_author and $this->can_edit( $poll ) ) {
|
| 1471 |
+
$edit_link = esc_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll_id, 'message' => false ) ) );
|
| 1472 |
+
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'poll' => $poll_id, 'message' => false ) ), "delete-poll_$poll_id" ) );
|
| 1473 |
+
$open_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'open', 'poll' => $poll_id, 'message' => false ) ), "open-poll_$poll_id" ) );
|
| 1474 |
+
$close_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'close', 'poll' => $poll_id, 'message' => false ) ), "close-poll_$poll_id" ) );
|
| 1475 |
+
}
|
| 1476 |
+
else {
|
| 1477 |
+
$edit_link = false;
|
| 1478 |
+
$delete_link = false;
|
| 1479 |
+
$open_link = false;
|
| 1480 |
+
$close_link = false;
|
| 1481 |
+
}
|
| 1482 |
+
|
| 1483 |
+
$class = $class ? '' : ' class="alternate"';
|
| 1484 |
+
$results_link = esc_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll_id, 'message' => false ) ) );
|
| 1485 |
+
$preview = array( 'action' => 'preview', 'poll' => $poll_id, 'message' => false );
|
| 1486 |
+
|
| 1487 |
+
if ( isset( $_GET['iframe'] ) ) {
|
| 1488 |
+
$preview[ 'popup' ] = 1;
|
| 1489 |
+
}
|
| 1490 |
+
|
| 1491 |
+
$preview_link = esc_url( add_query_arg( $preview ) );
|
| 1492 |
+
|
| 1493 |
+
list( $poll_time ) = explode( '.', $poll->_created );
|
| 1494 |
+
$poll_time = strtotime( $poll_time );
|
| 1495 |
+
?>
|
| 1496 |
+
<tr<?php echo $class; ?>>
|
| 1497 |
+
<th class="check-column" scope="row"><?php if ( $this->is_author and $this->can_edit( $poll ) ) { ?><input type="checkbox" value="<?php echo (int) $poll_id; ?>" name="poll[]" /><?php } ?></th>
|
| 1498 |
+
<td class="post-title column-title" style="padding-top:7px;">
|
| 1499 |
+
<?php if ( $edit_link ) { ?>
|
| 1500 |
+
<a class="row-title" style="display:block;" href="<?php echo $edit_link; ?>"><strong><?php echo esc_html( $poll->___content ); ?></strong></a>
|
| 1501 |
+
|
| 1502 |
+
<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>
|
| 1503 |
+
|
| 1504 |
+
<div class="row-actions">
|
| 1505 |
+
<span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a></span><span> | </span>
|
| 1506 |
+
<?php } else { ?>
|
| 1507 |
+
<strong><?php echo esc_html( $poll->___content ); ?></strong>
|
| 1508 |
+
<div class="row-actions">
|
| 1509 |
+
|
| 1510 |
+
<?php } ?>
|
| 1511 |
+
|
| 1512 |
+
<?php if ( !isset( $_GET['iframe'] ) ):?>
|
| 1513 |
+
<span class="shortcode"><a href="javascript:void(0);" class="polldaddy-show-shortcode"><?php _e( 'Embed & Link', 'polldaddy' ); ?></a></span>
|
| 1514 |
+
<?php else: ?>
|
| 1515 |
+
<input type="hidden" class="polldaddy-poll-id" value="<?php echo $poll_id; ?>" />
|
| 1516 |
+
<span><a href="javascript:void(0);" class="polldaddy-send-to-editor"><?php _e( 'Embed in Post', 'polldaddy' ); ?></a></span>
|
| 1517 |
+
<?php endif; ?>
|
| 1518 |
+
|
| 1519 |
+
|
| 1520 |
+
<?php
|
| 1521 |
+
if ( $poll_closed == 2 ) {
|
| 1522 |
+
if ( $open_link ) { ?>
|
| 1523 |
+
<span> | </span><span class="open"><a class="open-poll" href="<?php echo $open_link; ?>"><?php _e( 'Open', 'polldaddy' ); ?></a></span>
|
| 1524 |
+
<?php } } else {
|
| 1525 |
+
if ( $close_link ) { ?>
|
| 1526 |
+
<span> | </span><span class="close"><a class="close-poll" href="<?php echo $close_link; ?>"><?php _e( 'Close', 'polldaddy' ); ?></a></span>
|
| 1527 |
+
<?php } }
|
| 1528 |
+
if ( !isset( $_GET['iframe'] ) ): ?>
|
| 1529 |
+
<span> | </span><span class="view"><a class="thickbox" href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a></span>
|
| 1530 |
+
<?php else: ?>
|
| 1531 |
+
<span> | </span><span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a></span>
|
| 1532 |
+
<?php endif;
|
| 1533 |
+
if ( $delete_link ) { ?>
|
| 1534 |
+
<span> | </span><span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
|
| 1535 |
+
<?php }
|
| 1536 |
+
if ( $poll->_responses > 0 ):?>
|
| 1537 |
+
<span> | </span><span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results', 'polldaddy' ); ?></a></span>
|
| 1538 |
+
<?php endif; ?>
|
| 1539 |
+
|
| 1540 |
+
<?php $this->poll_table_add_option( $poll_id ); ?>
|
| 1541 |
+
</div>
|
| 1542 |
+
</td>
|
| 1543 |
+
<td class="poll-votes column-vote num"><?php echo number_format_i18n( $poll->_responses ); ?><span class="votes-label"><?php _e( 'votes', 'polldaddy' ); ?></span></td>
|
| 1544 |
+
</tr>
|
| 1545 |
+
<tr class="polldaddy-shortcode-row <?php if ( $class ): ?> alternate <?php endif; ?>" style="display: none;">
|
| 1546 |
+
<td colspan="4" style="padding:10px 0px 10px 20px;">
|
| 1547 |
+
|
| 1548 |
+
<a style="display:block;font-size:12px;font-weight:bold;" href="<?php echo $edit_link; ?>"><?php echo esc_html( $poll->___content ); ?></a>
|
| 1549 |
+
|
| 1550 |
+
<div class="pd-embed-col">
|
| 1551 |
+
<h4 style="color:#666;font-weight:normal;"><?php _e( 'WordPress Shortcode', 'polldaddy' ); ?></h4>
|
| 1552 |
+
<input type="text" readonly="readonly" style="width: 175px;" onclick="this.select();" value="[polldaddy poll=<?php echo (int) $poll_id; ?>]"/>
|
| 1553 |
+
</div>
|
| 1554 |
+
|
| 1555 |
+
<div class="pd-embed-col">
|
| 1556 |
+
<h4 style="color:#666;font-weight:normal;"><?php _e( 'Short URL (Good for Twitter etc.)', 'polldaddy' ); ?></h4>
|
| 1557 |
+
<input type="text" readonly="readonly" style="width: 175px;" onclick="this.select();" value="http://poll.fm/<?php echo base_convert( $poll_id, 10, 36 ); ?>"/>
|
| 1558 |
+
|
| 1559 |
+
</div>
|
| 1560 |
+
|
| 1561 |
+
<div class="pd-embed-col">
|
| 1562 |
+
<h4 style="color:#666;font-weight:normal;"><?php _e( 'Facebook URL', 'polldaddy' ); ?></h4>
|
| 1563 |
+
<input type="text" readonly="readonly" style="width: 175px;" onclick="this.select();" value="http://poll.fm/f/<?php echo base_convert( $poll_id, 10, 36 ); ?>"/>
|
| 1564 |
+
</div>
|
| 1565 |
+
|
| 1566 |
+
<br class="clearing" />
|
| 1567 |
+
|
| 1568 |
+
|
| 1569 |
+
<h4 style="padding-top:10px;color:#666;font-weight:normal;"><?php _e( 'JavaScript', 'polldaddy' ); ?></h4>
|
| 1570 |
+
<pre class="hardbreak" style="max-width:542px;text-wrap:word-wrap;margin-bottom:20px;"><script type="text/javascript" language="javascript"
|
| 1571 |
+
src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></script>
|
| 1572 |
+
<noscript>
|
| 1573 |
+
<a href="http://polldaddy.com/poll/<?php echo (int) $poll_id; ?>/"><?php echo trim( strip_tags( $poll->___content ) ); ?></a><br/>
|
| 1574 |
+
<span style="font:9px;">(<a href="http://www.polldaddy.com">polls</a>)</span>
|
| 1575 |
+
</noscript></pre>
|
| 1576 |
+
<p class="submit" style="clear:both;padding:0px;">
|
| 1577 |
+
<a href="#" class="button pd-embed-done"><?php _e( 'Done', 'polldaddy' ); ?></a>
|
| 1578 |
+
</p>
|
| 1579 |
+
|
| 1580 |
+
</td>
|
| 1581 |
+
</tr>
|
| 1582 |
+
|
| 1583 |
+
<?php
|
| 1584 |
+
endforeach;
|
| 1585 |
+
elseif ( $total_polls ) : // $polls
|
| 1586 |
+
?>
|
| 1587 |
+
|
| 1588 |
+
<tr>
|
| 1589 |
+
<td colspan="4"><?php printf( __( 'What are you doing here? <a href="%s">Go back</a>.', 'polldaddy' ), esc_url( add_query_arg( 'paged', false ) ) ); ?></td>
|
| 1590 |
+
</tr>
|
| 1591 |
+
|
| 1592 |
+
<?php
|
| 1593 |
+
else : // $polls
|
| 1594 |
+
?>
|
| 1595 |
+
|
| 1596 |
+
<tr>
|
| 1597 |
+
<td colspan="4" id="empty-set"><?php
|
| 1598 |
+
if ( $this->is_author ) { ?>
|
| 1599 |
+
|
| 1600 |
+
<h3 style="margin-bottom:0px;"><?php _e( 'You haven\'t created any polls for this blog.', 'polldaddy');?> </h3>
|
| 1601 |
+
<p style="margin-bottom:20px;"><?php _e( 'Why don\'t you go ahead and get started on that?', 'polldaddy' ); ?></p>
|
| 1602 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'create-poll' ) ) ); ?>" class="button-primary"><?php _e( 'Create a Poll Now', 'polldaddy' ); ?></a>
|
| 1603 |
+
|
| 1604 |
+
<?php
|
| 1605 |
+
} else { ?>
|
| 1606 |
+
|
| 1607 |
+
<p id="no-polls"><?php _e( 'No one has created any polls for this blog.', 'polldaddy' ); ?></p>
|
| 1608 |
+
|
| 1609 |
+
<?php }
|
| 1610 |
+
?></td>
|
| 1611 |
+
</tr>
|
| 1612 |
+
<?php endif; // $polls ?>
|
| 1613 |
+
|
| 1614 |
+
</tbody>
|
| 1615 |
+
</table>
|
| 1616 |
+
|
| 1617 |
+
|
| 1618 |
+
|
| 1619 |
+
|
| 1620 |
+
|
| 1621 |
+
|
| 1622 |
+
<?php $this->poll_table_extra(); ?>
|
| 1623 |
+
</form>
|
| 1624 |
+
<div class="tablenav" <?php if ( $page_links == '' ) { ?> style="display:none;" <?php } ?> >
|
| 1625 |
+
<div class="tablenav-pages"><?php echo $page_links; ?></div>
|
| 1626 |
+
</div>
|
| 1627 |
+
|
| 1628 |
+
|
| 1629 |
+
|
| 1630 |
+
|
| 1631 |
+
<script type="text/javascript">
|
| 1632 |
+
jQuery( document ).ready(function(){
|
| 1633 |
+
plugin = new Plugin( {
|
| 1634 |
+
delete_rating: '<?php echo esc_js( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 1635 |
+
delete_poll: '<?php echo esc_js( __( 'Are you sure you want to delete the poll %s?', 'polldaddy' ) ); ?>',
|
| 1636 |
+
delete_answer: '<?php echo esc_js( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 1637 |
+
delete_answer_title: '<?php echo esc_js( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 1638 |
+
standard_styles: '<?php echo esc_js( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 1639 |
+
custom_styles: '<?php echo esc_js( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 1640 |
+
} );
|
| 1641 |
+
|
| 1642 |
+
jQuery( '#filter-polls' ).click( function(){
|
| 1643 |
+
|
| 1644 |
+
|
| 1645 |
+
if( jQuery( '#filter-options' ).val() == 'blog' ){
|
| 1646 |
+
window.location = '<?php echo add_query_arg( array( 'page' => 'polls', 'view' => 'blog' ), admin_url( 'admin.php' ) ); ?>';
|
| 1647 |
+
} else {
|
| 1648 |
+
window.location = '<?php echo add_query_arg( array( 'page' => 'polls' ), admin_url( 'admin.php' ) ); ?>';
|
| 1649 |
+
}
|
| 1650 |
+
|
| 1651 |
+
|
| 1652 |
+
|
| 1653 |
+
} );
|
| 1654 |
+
|
| 1655 |
+
|
| 1656 |
+
});
|
| 1657 |
+
</script>
|
| 1658 |
+
|
| 1659 |
+
<?php
|
| 1660 |
+
}
|
| 1661 |
+
|
| 1662 |
+
function poll_table_add_option() {}
|
| 1663 |
+
|
| 1664 |
+
function poll_table_extra() {}
|
| 1665 |
+
|
| 1666 |
+
function poll_edit_form( $poll_id = 1 ) {
|
| 1667 |
+
$poll_id = (int) $poll_id;
|
| 1668 |
+
|
| 1669 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 1670 |
+
$polldaddy->reset();
|
| 1671 |
+
|
| 1672 |
+
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 1673 |
+
|
| 1674 |
+
if ( $poll_id ) {
|
| 1675 |
+
$poll = $polldaddy->get_poll( $poll_id );
|
| 1676 |
+
$this->parse_errors( $polldaddy );
|
| 1677 |
+
|
| 1678 |
+
if ( !$this->can_edit( $poll ) ) {
|
| 1679 |
+
$this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
|
| 1680 |
+
}
|
| 1681 |
+
|
| 1682 |
+
if ( $poll_id == 1 ) {
|
| 1683 |
+
$poll->answers = array();
|
| 1684 |
+
$poll_id = 0;
|
| 1685 |
+
}
|
| 1686 |
+
|
| 1687 |
+
} else {
|
| 1688 |
+
$poll = polldaddy_poll( array(), null, false );
|
| 1689 |
+
}
|
| 1690 |
+
|
| 1691 |
+
$question = $is_POST ? esc_attr( stripslashes( $_POST['question'] ) ) : esc_attr( $poll->question );
|
| 1692 |
+
|
| 1693 |
+
$answers = $media = $mediaType = array();
|
| 1694 |
+
if ( $is_POST ) {
|
| 1695 |
+
if ( isset( $_POST['mediaType'] ) )
|
| 1696 |
+
$mediaType = $_POST['mediaType'];
|
| 1697 |
+
|
| 1698 |
+
if ( isset( $_POST['media'] ) ) {
|
| 1699 |
+
$mc = $_POST['media'];
|
| 1700 |
+
|
| 1701 |
+
foreach ( $mc as $key => $value ) {
|
| 1702 |
+
if ( $mediaType[$key] == 1 ) {
|
| 1703 |
+
$media[$key] = $polldaddy->get_media( $value );
|
| 1704 |
+
}
|
| 1705 |
+
}
|
| 1706 |
+
}
|
| 1707 |
+
|
| 1708 |
+
if ( isset( $_POST['answer'] ) )
|
| 1709 |
+
foreach ( $_POST['answer'] as $answer_id => $answer )
|
| 1710 |
+
$answers[esc_attr($answer_id)] = esc_attr( stripslashes($answer) );
|
| 1711 |
+
} elseif ( isset( $poll->answers->answer ) ) {
|
| 1712 |
+
foreach ( $poll->answers->answer as $answer ) {
|
| 1713 |
+
$answers[(int) $answer->_id] = esc_attr( $answer->text );
|
| 1714 |
+
|
| 1715 |
+
if ( $answer->mediaType == 1 && !empty( $answer->mediaCode ) ) {
|
| 1716 |
+
$polldaddy->reset();
|
| 1717 |
+
$media[$answer->_id] = $polldaddy->get_media( $answer->mediaCode );
|
| 1718 |
+
$mediaType[$answer->_id] = 1;
|
| 1719 |
+
}
|
| 1720 |
+
elseif ( $answer->mediaType == 2 ) {
|
| 1721 |
+
$mediaType[$answer->_id] = 2;
|
| 1722 |
+
}
|
| 1723 |
+
}
|
| 1724 |
+
|
| 1725 |
+
if ( isset( $poll->mediaCode ) && isset( $poll->mediaType ) ) {
|
| 1726 |
+
if ( $poll->mediaType == 1 && !empty( $poll->mediaCode ) ) {
|
| 1727 |
+
$polldaddy->reset();
|
| 1728 |
+
$media[999999999] = $polldaddy->get_media( $poll->mediaCode );
|
| 1729 |
+
$mediaType[999999999] = 1;
|
| 1730 |
+
}
|
| 1731 |
+
elseif ( $poll->mediaType == 2 ) {
|
| 1732 |
+
$mediaType[999999999] = 2;
|
| 1733 |
+
}
|
| 1734 |
+
}
|
| 1735 |
+
}
|
| 1736 |
+
$this->print_errors();
|
| 1737 |
+
|
| 1738 |
+
$delete_media_link = '<a href="#" class="delete-media delete hidden" title="' . esc_attr( __( 'delete this image' ) ) . '"><img src="' . $this->base_url . 'img/icon-clear-search.png" width="16" height="16" /></a>';
|
| 1739 |
+
?>
|
| 1740 |
+
|
| 1741 |
+
<form enctype="multipart/form-data" name="send-media" action="admin-ajax.php" method="post">
|
| 1742 |
+
<?php wp_nonce_field( 'send-media' ); ?>
|
| 1743 |
+
<input type="hidden" value="" name="action">
|
| 1744 |
+
<input type="hidden" value="<?php echo $this->user_code; ?>" name="uc">
|
| 1745 |
+
<input type="hidden" value="" name="attach-id">
|
| 1746 |
+
<input type="hidden" value="" name="media-id">
|
| 1747 |
+
<input type="hidden" value="" name="url">
|
| 1748 |
+
</form>
|
| 1749 |
+
|
| 1750 |
+
<form name="add-answer" action="admin-ajax.php" method="post">
|
| 1751 |
+
<?php wp_nonce_field( 'add-answer' ); ?>
|
| 1752 |
+
<input type="hidden" value="" name="action">
|
| 1753 |
+
<input type="hidden" value="" name="aa">
|
| 1754 |
+
<input type="hidden" value="" name="src">
|
| 1755 |
+
<input type="hidden" value="<?php echo isset( $_GET['iframe'] ) ? '1': '0';?>" name="popup">
|
| 1756 |
+
</form>
|
| 1757 |
+
|
| 1758 |
+
<form action="" method="post">
|
| 1759 |
+
<div id="poststuff"><div id="post-body" class="has-sidebar has-right-sidebar">
|
| 1760 |
+
|
| 1761 |
+
<div class="inner-sidebar" id="side-info-column">
|
| 1762 |
+
<div id="submitdiv" class="postbox">
|
| 1763 |
+
<h3><?php _e( 'Save', 'polldaddy' ); ?></h3>
|
| 1764 |
+
<div class="inside">
|
| 1765 |
+
<div class="minor-publishing">
|
| 1766 |
+
|
| 1767 |
+
<ul id="answer-options">
|
| 1768 |
+
|
| 1769 |
+
<?php
|
| 1770 |
+
foreach ( array( 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), 'multipleChoice' => __( 'Multiple choice', 'polldaddy' ), 'sharing' => __( 'Sharing', 'polldaddy' ) ) as $option => $label ) :
|
| 1771 |
+
if ( $is_POST )
|
| 1772 |
+
$checked = 'yes' === $_POST[$option] ? ' checked="checked"' : '';
|
| 1773 |
+
else
|
| 1774 |
+
$checked = 'yes' === $poll->$option ? ' checked="checked"' : '';
|
| 1775 |
+
?>
|
| 1776 |
+
|
| 1777 |
+
<li>
|
| 1778 |
+
<label for="<?php echo $option; ?>"><input type="checkbox"<?php echo $checked; ?> value="yes" id="<?php echo $option; ?>" name="<?php echo $option; ?>" /> <?php echo esc_html( $label ); ?></label>
|
| 1779 |
+
</li>
|
| 1780 |
+
|
| 1781 |
+
<?php endforeach; ?>
|
| 1782 |
+
|
| 1783 |
+
</ul>
|
| 1784 |
+
<?php
|
| 1785 |
+
if ( $is_POST )
|
| 1786 |
+
$style = 'yes' === $_POST['multipleChoice'] ? 'display:block;' : 'display:none;';
|
| 1787 |
+
else
|
| 1788 |
+
$style = 'yes' === $poll->multipleChoice ? 'display:block;' : 'display:none;';
|
| 1789 |
+
?>
|
| 1790 |
+
<div id="numberChoices" name="numberChoices" style="padding-left:15px;<?php echo $style; ?>">
|
| 1791 |
+
<p><?php _e( 'Number of choices', 'polldaddy' ) ?>: <select name="choices" id="choices"><option value="0"><?php _e( 'No Limit', 'polldaddy' ) ?></option>
|
| 1792 |
+
<?php
|
| 1793 |
+
if ( $is_POST )
|
| 1794 |
+
$choices = (int) $_POST['choices'];
|
| 1795 |
+
else
|
| 1796 |
+
$choices = (int) $poll->choices;
|
| 1797 |
+
|
| 1798 |
+
$a = count( $answers ) - 1;
|
| 1799 |
+
|
| 1800 |
+
if ( $a > 1 ) :
|
| 1801 |
+
for ( $i=2; $i<=$a; $i++ ) :
|
| 1802 |
+
$selected = $i == $choices ? 'selected="selected"' : '';
|
| 1803 |
+
printf( "<option value='%d' %s>%d</option>", $i, $selected, $i );
|
| 1804 |
+
endfor;
|
| 1805 |
+
endif; ?>
|
| 1806 |
+
</select>
|
| 1807 |
+
</p>
|
| 1808 |
+
</div>
|
| 1809 |
+
</div>
|
| 1810 |
+
|
| 1811 |
+
|
| 1812 |
+
|
| 1813 |
+
<div id="major-publishing-actions">
|
| 1814 |
+
|
| 1815 |
+
|
| 1816 |
+
|
| 1817 |
+
|
| 1818 |
+
|
| 1819 |
+
|
| 1820 |
+
|
| 1821 |
+
<p id="publishing-action">
|
| 1822 |
+
|
| 1823 |
+
|
| 1824 |
+
|
| 1825 |
+
<?php wp_nonce_field( $poll_id ? "edit-poll_$poll_id" : 'create-poll' ); ?>
|
| 1826 |
+
<input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?>" />
|
| 1827 |
+
<input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?>" />
|
| 1828 |
+
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Save Poll', 'polldaddy' ) ); ?>" />
|
| 1829 |
+
|
| 1830 |
+
<?php if ( isset( $_GET['iframe'] ) && $poll_id ) : ?>
|
| 1831 |
+
<div id="delete-action">
|
| 1832 |
+
<input type="button" class="button polldaddy-send-to-editor" style="margin-top:8px;" value="<?php echo esc_attr( __( 'Embed in Post', 'polldaddy' ) ); ?>" />
|
| 1833 |
+
</div>
|
| 1834 |
+
<?php endif; ?>
|
| 1835 |
+
|
| 1836 |
+
</p>
|
| 1837 |
+
<br class="clear" />
|
| 1838 |
+
</div>
|
| 1839 |
+
</div>
|
| 1840 |
+
</div>
|
| 1841 |
+
|
| 1842 |
+
<div class="postbox">
|
| 1843 |
+
<h3><?php _e( 'Results Display', 'polldaddy' ); ?></h3>
|
| 1844 |
+
<div class="inside">
|
| 1845 |
+
<ul class="poll-options">
|
| 1846 |
+
|
| 1847 |
+
<?php
|
| 1848 |
+
foreach ( array( 'show' => __( 'Show results to voters', 'polldaddy' ), 'percent' => __( 'Only show percentages', 'polldaddy' ), 'hide' => __( 'Hide all results', 'polldaddy' ) ) as $value => $label ) :
|
| 1849 |
+
if ( $is_POST )
|
| 1850 |
+
$checked = $value === $_POST['resultsType'] ? ' checked="checked"' : '';
|
| 1851 |
+
else
|
| 1852 |
+
$checked = $value === $poll->resultsType ? ' checked="checked"' : '';
|
| 1853 |
+
?>
|
| 1854 |
+
|
| 1855 |
+
<li>
|
| 1856 |
+
<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 esc_html( $label ); ?></label>
|
| 1857 |
+
</li>
|
| 1858 |
+
|
| 1859 |
+
<?php endforeach; ?>
|
| 1860 |
+
|
| 1861 |
+
</ul>
|
| 1862 |
+
</div>
|
| 1863 |
+
</div>
|
| 1864 |
+
|
| 1865 |
+
<div class="postbox">
|
| 1866 |
+
<h3><?php _e( 'Repeat Voting', 'polldaddy' ); ?></h3>
|
| 1867 |
+
<div class="inside">
|
| 1868 |
+
<ul class="poll-options">
|
| 1869 |
+
|
| 1870 |
+
<?php
|
| 1871 |
+
foreach ( array( 'off' => __( "Don't block repeat voters", 'polldaddy' ), 'cookie' => __( 'Block by cookie (recommended)', 'polldaddy' ), 'cookieip' => __( 'Block by cookie and by IP address', 'polldaddy' ) ) as $value => $label ) :
|
| 1872 |
+
if ( $is_POST )
|
| 1873 |
+
$checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : '';
|
| 1874 |
+
else
|
| 1875 |
+
$checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : '';
|
| 1876 |
+
?>
|
| 1877 |
+
|
| 1878 |
+
<li>
|
| 1879 |
+
<label for="blockRepeatVotersType-<?php echo $value; ?>"><input class="block-repeat" type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?>" /> <?php echo esc_html( $label ); ?></label>
|
| 1880 |
+
</li>
|
| 1881 |
+
|
| 1882 |
+
<?php endforeach; ?>
|
| 1883 |
+
|
| 1884 |
+
</ul>
|
| 1885 |
+
|
| 1886 |
+
<?php
|
| 1887 |
+
if ( $poll->blockExpiration == 0 || $poll->blockExpiration > 604800 )
|
| 1888 |
+
$poll->blockExpiration = 604800;
|
| 1889 |
+
?>
|
| 1890 |
+
<span style="margin:6px 6px 8px;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?>" id="cookieip_expiration_label"><label><?php _e( 'Expires: ', 'polldaddy' ); ?></label></span>
|
| 1891 |
+
<select id="cookieip_expiration" name="cookieip_expiration" style="width: auto;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?>">
|
| 1892 |
+
<option value="3600" <?php echo (int) $poll->blockExpiration == 3600 ? 'selected' : ''; ?>><?php printf( __( '%d hour', 'polldaddy' ), 1 ); ?></option>
|
| 1893 |
+
<option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 3 ); ?></option>
|
| 1894 |
+
<option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 6 ); ?></option>
|
| 1895 |
+
<option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 12 ); ?></option>
|
| 1896 |
+
<option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected' : ''; ?>><?php printf( __( '%d day', 'polldaddy' ), 1 ); ?></option>
|
| 1897 |
+
<option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected' : ''; ?>><?php printf( __( '%d week', 'polldaddy' ), 1 ); ?></option>
|
| 1898 |
+
</select>
|
| 1899 |
+
<p><?php _e( 'Note: Blocking by cookie and IP address can be problematic for some voters.', 'polldaddy' ); ?></p>
|
| 1900 |
+
</div>
|
| 1901 |
+
</div>
|
| 1902 |
+
|
| 1903 |
+
<div class="postbox">
|
| 1904 |
+
<h3><?php _e( 'Comments', 'polldaddy' ); ?></h3>
|
| 1905 |
+
<div class="inside">
|
| 1906 |
+
<ul class="poll-options">
|
| 1907 |
+
|
| 1908 |
+
<?php
|
| 1909 |
+
foreach ( array( 'allow' => __( "Allow comments", 'polldaddy' ), 'moderate' => __( 'Moderate first', 'polldaddy' ), 'off' => __( 'No comments', 'polldaddy' ) ) as $value => $label ) :
|
| 1910 |
+
if ( $is_POST )
|
| 1911 |
+
$checked = $value === $_POST['comments'] ? ' checked="checked"' : '';
|
| 1912 |
+
else
|
| 1913 |
+
$checked = $value === $poll->comments->___content ? ' checked="checked"' : '';
|
| 1914 |
+
?>
|
| 1915 |
+
|
| 1916 |
+
<li>
|
| 1917 |
+
<label for="comments-<?php echo $value; ?>"><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="comments" id="comments-<?php echo $value; ?>" /> <?php echo esc_html( $label ); ?></label>
|
| 1918 |
+
</li>
|
| 1919 |
+
|
| 1920 |
+
<?php endforeach; ?>
|
| 1921 |
+
|
| 1922 |
+
</ul>
|
| 1923 |
+
</div>
|
| 1924 |
+
</div>
|
| 1925 |
+
</div>
|
| 1926 |
+
|
| 1927 |
+
|
| 1928 |
+
<div id="post-body-content" class="has-sidebar-content">
|
| 1929 |
+
|
| 1930 |
+
<div id="titlediv" style="margin-top:0px;">
|
| 1931 |
+
<div id="titlewrap">
|
| 1932 |
+
|
| 1933 |
+
<table class="question">
|
| 1934 |
+
|
| 1935 |
+
<tr>
|
| 1936 |
+
<td class="question-input">
|
| 1937 |
+
<input type="text" autocomplete="off" id="title" placeholder="<?php _e( 'Enter Question Here', 'polldaddy' ); ?>" value="<?php echo $question; ?>" tabindex="1" size="30" name="question" />
|
| 1938 |
+
</td>
|
| 1939 |
+
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
| 1940 |
+
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
| 1941 |
+
<?php if ( isset( $mediaType[999999999] ) && $mediaType[999999999] == 2 ) { ?>
|
| 1942 |
+
<li class="media-preview image-added" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo $this->base_url; ?>img/icon-report-ip-analysis.png" alt="Video Embed"><?php echo $delete_media_link;?></li>
|
| 1943 |
+
<?php } else {
|
| 1944 |
+
$url = '';
|
| 1945 |
+
if ( isset($media[999999999]) ) {
|
| 1946 |
+
$url = urldecode( $media[999999999]->img_small );
|
| 1947 |
+
|
| 1948 |
+
if ( is_ssl() )
|
| 1949 |
+
$url = preg_replace( '/http\:/', 'https:', $url );
|
| 1950 |
+
}?>
|
| 1951 |
+
<li class="media-preview <?php echo !empty( $url ) ? 'image-added' : ''; ?>" style="width: 20px; height: 16px; padding-left: 5px;"><?php echo $url; ?><?php echo $delete_media_link;?></li>
|
| 1952 |
+
<?php }
|
| 1953 |
+
|
| 1954 |
+
if ( !isset( $_GET['iframe'] ) ) : ?>
|
| 1955 |
+
<li><a title="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" class="thickbox media image" id="add_poll_image999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" src="images/media-button-image.gif"></a></li>
|
| 1956 |
+
<li><a title="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" class="thickbox media video" id="add_poll_video999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" src="images/media-button-video.gif"></a></li>
|
| 1957 |
+
<li><a title="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" class="thickbox media audio" id="add_poll_audio999999999" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" src="images/media-button-music.gif"></a></li>
|
| 1958 |
+
<?php endif; ?>
|
| 1959 |
+
</ul>
|
| 1960 |
+
|
| 1961 |
+
<input type="hidden" value="<?php echo isset( $media[999999999] ) ? $media[999999999]->_id : ''; ?>" id="hMC999999999" name="media[999999999]">
|
| 1962 |
+
<input type="hidden" value="<?php echo isset( $mediaType[999999999] ) ? $mediaType[999999999] : ''; ?>" id="hMT999999999" name="mediaType[999999999]">
|
| 1963 |
+
|
| 1964 |
+
</td>
|
| 1965 |
+
</tr>
|
| 1966 |
+
</table>
|
| 1967 |
+
|
| 1968 |
+
<?php if ( isset( $poll->_id ) && !isset( $_GET['iframe']) ): ?>
|
| 1969 |
+
<div class="inside">
|
| 1970 |
+
<div id="edit-slug-box" style="margin-bottom:30px;">
|
| 1971 |
+
<strong><?php _e( 'WordPress Shortcode:', 'polldaddy' ); ?></strong>
|
| 1972 |
+
<input type="text" style="color:#999;" value="[polldaddy poll=<?php echo $poll->_id; ?>]" id="shortcode-field" readonly="readonly" />
|
| 1973 |
+
<span><a href="post-new.php?content=[polldaddy poll=<?php echo $poll->_id; ?>]" class="button"><?php _e( 'Embed Poll in New Post' ); ?></a></span>
|
| 1974 |
+
</div>
|
| 1975 |
+
</div>
|
| 1976 |
+
<?php endif; ?>
|
| 1977 |
+
|
| 1978 |
+
</div>
|
| 1979 |
+
</div>
|
| 1980 |
+
|
| 1981 |
+
<div id="answersdiv" class="postbox">
|
| 1982 |
+
<h3><?php _e( 'Answers', 'polldaddy' ); ?></h3>
|
| 1983 |
+
|
| 1984 |
+
<div id="answerswrap" class="inside">
|
| 1985 |
+
<ul id="answers">
|
| 1986 |
+
<?php
|
| 1987 |
+
$a = 0;
|
| 1988 |
+
foreach ( $answers as $answer_id => $answer ) :
|
| 1989 |
+
$a++;
|
| 1990 |
+
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-answer', 'poll' => $poll_id, 'answer' => $answer_id, 'message' => false ) ), "delete-answer_$answer_id" ) );
|
| 1991 |
+
?>
|
| 1992 |
+
|
| 1993 |
+
<li>
|
| 1994 |
+
|
| 1995 |
+
|
| 1996 |
+
<table class="answer">
|
| 1997 |
+
|
| 1998 |
+
<tr>
|
| 1999 |
+
<th>
|
| 2000 |
+
<span class="handle" title="<?php echo esc_attr( __( 'click and drag to reorder' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-reorder.png" alt="click and drag to reorder" width="6" height="9" /></span>
|
| 2001 |
+
</th>
|
| 2002 |
+
<td class="answer-input">
|
| 2003 |
+
<input type="text" autocomplete="off" placeholder="<?php echo esc_attr( __( 'Enter an answer here', 'polldaddy' ) ); ?>" id="answer-<?php echo $answer_id; ?>" value="<?php echo $answer; ?>" tabindex="2" size="30" name="answer[<?php echo $answer_id; ?>]" />
|
| 2004 |
+
</td>
|
| 2005 |
+
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
| 2006 |
+
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
| 2007 |
+
<?php if ( isset( $mediaType[$answer_id] ) && $mediaType[$answer_id] == 2 ) { ?>
|
| 2008 |
+
<li class="media-preview image-added" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo $this->base_url; ?>img/icon-report-ip-analysis.png" alt="Video Embed"><?php echo $delete_media_link;?></li>
|
| 2009 |
+
<?php } else {
|
| 2010 |
+
$url = '';
|
| 2011 |
+
if ( isset($media[$answer_id]) ) {
|
| 2012 |
+
$url = urldecode( $media[$answer_id]->img_small );
|
| 2013 |
+
|
| 2014 |
+
if ( is_ssl() )
|
| 2015 |
+
$url = preg_replace( '/http\:/', 'https:', $url );
|
| 2016 |
+
}?>
|
| 2017 |
+
<li class="media-preview <?php echo !empty( $url ) ? 'image-added' : ''; ?>" style="width: 20px; height: 16px; padding-left: 5px;"><?php echo $url; ?><?php echo $delete_media_link;?></li>
|
| 2018 |
+
<?php }
|
| 2019 |
+
|
| 2020 |
+
if ( !isset( $_GET['iframe'] ) ) : ?>
|
| 2021 |
+
<li><a title="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" class="thickbox media image" id="add_poll_image<?php echo $answer_id; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" src="images/media-button-image.gif"></a></li>
|
| 2022 |
+
<li><a title="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" class="thickbox media video" id="add_poll_video<?php echo $answer_id; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" src="images/media-button-video.gif"></a></li>
|
| 2023 |
+
<li><a title="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" class="thickbox media audio" id="add_poll_audio<?php echo $answer_id; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" src="images/media-button-music.gif"></a></li>
|
| 2024 |
+
<?php endif; ?>
|
| 2025 |
+
<li><a href="<?php echo $delete_link; ?>" class="delete-answer delete" title="<?php echo esc_attr( __( 'delete this answer' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-clear-search.png" width="16" height="16" /></a></li>
|
| 2026 |
+
|
| 2027 |
+
</ul>
|
| 2028 |
+
|
| 2029 |
+
<input type="hidden" value="<?php echo isset( $media[$answer_id] ) ? $media[$answer_id]->_id : ''; ?>" id="hMC<?php echo $answer_id; ?>" name="media[<?php echo $answer_id; ?>]">
|
| 2030 |
+
<input type="hidden" value="<?php echo isset( $mediaType[$answer_id] ) ? $mediaType[$answer_id] : ''; ?>" id="hMT<?php echo $answer_id; ?>" name="mediaType[<?php echo $answer_id; ?>]">
|
| 2031 |
+
|
| 2032 |
+
</td>
|
| 2033 |
+
</tr>
|
| 2034 |
+
</table>
|
| 2035 |
+
|
| 2036 |
+
|
| 2037 |
+
</li>
|
| 2038 |
+
|
| 2039 |
+
<?php
|
| 2040 |
+
endforeach;
|
| 2041 |
+
|
| 2042 |
+
while ( 3 - $a > 0 ) :
|
| 2043 |
+
$a++;
|
| 2044 |
+
?>
|
| 2045 |
+
|
| 2046 |
+
<li>
|
| 2047 |
+
<table class="answer">
|
| 2048 |
+
|
| 2049 |
+
<tr>
|
| 2050 |
+
<th>
|
| 2051 |
+
<span class="handle" title="<?php echo esc_attr( __( 'click and drag to reorder' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-reorder.png" alt="click and drag to reorder" width="6" height="9" /></span>
|
| 2052 |
+
</th>
|
| 2053 |
+
<td class="answer-input">
|
| 2054 |
+
<input type="text" autocomplete="off" placeholder="<?php echo esc_attr( __( 'Enter an answer here', 'polldaddy' ) ); ?>" value="" tabindex="2" size="30" name="answer[new<?php echo $a; ?>]" />
|
| 2055 |
+
</td>
|
| 2056 |
+
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width:55px !important;"' : '';?>>
|
| 2057 |
+
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
| 2058 |
+
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"></li>
|
| 2059 |
+
<?php
|
| 2060 |
+
if ( !isset( $_GET['iframe'] ) ) : ?>
|
| 2061 |
+
<li><a title="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" class="thickbox media image" id="add_poll_image<?php echo $a; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>" src="images/media-button-image.gif"></a></a></li>
|
| 2062 |
+
<li><a title="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" class="thickbox media video" id="add_poll_video<?php echo $a; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>" src="images/media-button-video.gif"></a></a></li>
|
| 2063 |
+
<li><a title="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" class="thickbox media audio" id="add_poll_audio<?php echo $a; ?>" href="#"><img style="vertical-align:middle;" alt="<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>" src="images/media-button-music.gif"></a></li>
|
| 2064 |
+
<?php endif; ?>
|
| 2065 |
+
<li><a href="#" class="delete-answer delete" title="<?php echo esc_attr( __( 'delete this answer' ) ); ?>"><img src="<?php echo $this->base_url; ?>img/icon-clear-search.png" width="16" height="16" /></a></li>
|
| 2066 |
+
</ul>
|
| 2067 |
+
|
| 2068 |
+
<input type="hidden" value="" id="hMC<?php echo $a; ?>" name="media[<?php echo $a; ?>]">
|
| 2069 |
+
<input type="hidden" value="" id="hMT<?php echo $a; ?>" name="mediaType[<?php echo $a; ?>]">
|
| 2070 |
+
|
| 2071 |
+
</td>
|
| 2072 |
+
</tr>
|
| 2073 |
+
|
| 2074 |
+
|
| 2075 |
+
</table>
|
| 2076 |
+
|
| 2077 |
+
|
| 2078 |
+
|
| 2079 |
+
|
| 2080 |
+
|
| 2081 |
+
</li>
|
| 2082 |
+
|
| 2083 |
+
<?php
|
| 2084 |
+
endwhile;
|
| 2085 |
+
?>
|
| 2086 |
+
|
| 2087 |
+
</ul>
|
| 2088 |
+
|
| 2089 |
+
<p id="add-answer-holder" class="<?php echo $this->base_url; ?>">
|
| 2090 |
+
<button class="button"><?php echo esc_html( __( 'Add New Answer', 'polldaddy' ) ); ?></button>
|
| 2091 |
+
</p>
|
| 2092 |
+
|
| 2093 |
+
</div>
|
| 2094 |
+
</div>
|
| 2095 |
+
|
| 2096 |
+
<div class="hidden-links"><div class="delete-media-link"><?php echo $delete_media_link;?></div></div>
|
| 2097 |
+
|
| 2098 |
+
<div id="design" class="postbox">
|
| 2099 |
+
|
| 2100 |
+
<?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID );
|
| 2101 |
+
|
| 2102 |
+
$iframe_view = false;
|
| 2103 |
+
if ( isset( $_GET['iframe'] ) )
|
| 2104 |
+
$iframe_view = true;
|
| 2105 |
+
|
| 2106 |
+
$options = array(
|
| 2107 |
+
101 => __( 'Aluminum Narrow', 'polldaddy' ),
|
| 2108 |
+
102 => __( 'Aluminum Medium', 'polldaddy' ),
|
| 2109 |
+
103 => __( 'Aluminum Wide', 'polldaddy' ),
|
| 2110 |
+
104 => __( 'Plain White Narrow', 'polldaddy' ),
|
| 2111 |
+
105 => __( 'Plain White Medium', 'polldaddy' ),
|
| 2112 |
+
106 => __( 'Plain White Wide', 'polldaddy' ),
|
| 2113 |
+
107 => __( 'Plain Black Narrow', 'polldaddy' ),
|
| 2114 |
+
108 => __( 'Plain Black Medium', 'polldaddy' ),
|
| 2115 |
+
109 => __( 'Plain Black Wide', 'polldaddy' ),
|
| 2116 |
+
110 => __( 'Paper Narrow', 'polldaddy' ),
|
| 2117 |
+
111 => __( 'Paper Medium', 'polldaddy' ),
|
| 2118 |
+
112 => __( 'Paper Wide', 'polldaddy' ),
|
| 2119 |
+
113 => __( 'Skull Dark Narrow', 'polldaddy' ),
|
| 2120 |
+
114 => __( 'Skull Dark Medium', 'polldaddy' ),
|
| 2121 |
+
115 => __( 'Skull Dark Wide', 'polldaddy' ),
|
| 2122 |
+
116 => __( 'Skull Light Narrow', 'polldaddy' ),
|
| 2123 |
+
117 => __( 'Skull Light Medium', 'polldaddy' ),
|
| 2124 |
+
118 => __( 'Skull Light Wide', 'polldaddy' ),
|
| 2125 |
+
157 => __( 'Micro', 'polldaddy' ),
|
| 2126 |
+
119 => __( 'Plastic White Narrow', 'polldaddy' ),
|
| 2127 |
+
120 => __( 'Plastic White Medium', 'polldaddy' ),
|
| 2128 |
+
121 => __( 'Plastic White Wide', 'polldaddy' ),
|
| 2129 |
+
122 => __( 'Plastic Grey Narrow', 'polldaddy' ),
|
| 2130 |
+
123 => __( 'Plastic Grey Medium', 'polldaddy' ),
|
| 2131 |
+
124 => __( 'Plastic Grey Wide', 'polldaddy' ),
|
| 2132 |
+
125 => __( 'Plastic Black Narrow', 'polldaddy' ),
|
| 2133 |
+
126 => __( 'Plastic Black Medium', 'polldaddy' ),
|
| 2134 |
+
127 => __( 'Plastic Black Wide', 'polldaddy' ),
|
| 2135 |
+
128 => __( 'Manga Narrow', 'polldaddy' ),
|
| 2136 |
+
129 => __( 'Manga Medium', 'polldaddy' ),
|
| 2137 |
+
130 => __( 'Manga Wide', 'polldaddy' ),
|
| 2138 |
+
131 => __( 'Tech Dark Narrow', 'polldaddy' ),
|
| 2139 |
+
132 => __( 'Tech Dark Medium', 'polldaddy' ),
|
| 2140 |
+
133 => __( 'Tech Dark Wide', 'polldaddy' ),
|
| 2141 |
+
134 => __( 'Tech Grey Narrow', 'polldaddy' ),
|
| 2142 |
+
135 => __( 'Tech Grey Medium', 'polldaddy' ),
|
| 2143 |
+
136 => __( 'Tech Grey Wide', 'polldaddy' ),
|
| 2144 |
+
137 => __( 'Tech Light Narrow', 'polldaddy' ),
|
| 2145 |
+
138 => __( 'Tech Light Medium', 'polldaddy' ),
|
| 2146 |
+
139 => __( 'Tech Light Wide', 'polldaddy' ),
|
| 2147 |
+
140 => __( 'Working Male Narrow', 'polldaddy' ),
|
| 2148 |
+
141 => __( 'Working Male Medium', 'polldaddy' ),
|
| 2149 |
+
142 => __( 'Working Male Wide', 'polldaddy' ),
|
| 2150 |
+
143 => __( 'Working Female Narrow', 'polldaddy' ),
|
| 2151 |
+
144 => __( 'Working Female Medium', 'polldaddy' ),
|
| 2152 |
+
145 => __( 'Working Female Wide', 'polldaddy' ),
|
| 2153 |
+
146 => __( 'Thinking Male Narrow', 'polldaddy' ),
|
| 2154 |
+
147 => __( 'Thinking Male Medium', 'polldaddy' ),
|
| 2155 |
+
148 => __( 'Thinking Male Wide', 'polldaddy' ),
|
| 2156 |
+
149 => __( 'Thinking Female Narrow', 'polldaddy' ),
|
| 2157 |
+
150 => __( 'Thinking Female Medium', 'polldaddy' ),
|
| 2158 |
+
151 => __( 'Thinking Female Wide', 'polldaddy' ),
|
| 2159 |
+
152 => __( 'Sunset Narrow', 'polldaddy' ),
|
| 2160 |
+
153 => __( 'Sunset Medium', 'polldaddy' ),
|
| 2161 |
+
154 => __( 'Sunset Wide', 'polldaddy' ),
|
| 2162 |
+
155 => __( 'Music Medium', 'polldaddy' ),
|
| 2163 |
+
156 => __( 'Music Wide', 'polldaddy' )
|
| 2164 |
+
);
|
| 2165 |
+
|
| 2166 |
+
$polldaddy->reset();
|
| 2167 |
+
$styles = $polldaddy->get_styles();
|
| 2168 |
+
|
| 2169 |
+
$show_custom = false;
|
| 2170 |
+
if ( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ) {
|
| 2171 |
+
foreach ( (array) $styles->style as $style ) {
|
| 2172 |
+
$options[ (int) $style->_id ] = $style->title;
|
| 2173 |
+
}
|
| 2174 |
+
$show_custom = true;
|
| 2175 |
+
}
|
| 2176 |
+
|
| 2177 |
+
if ( $style_ID > 18 ) {
|
| 2178 |
+
$standard_style_ID = 0;
|
| 2179 |
+
$custom_style_ID = $style_ID;
|
| 2180 |
+
}
|
| 2181 |
+
else {
|
| 2182 |
+
$standard_style_ID = $style_ID;
|
| 2183 |
+
$custom_style_ID = 0;
|
| 2184 |
+
}
|
| 2185 |
+
?>
|
| 2186 |
+
<h3><?php _e( 'Poll Style', 'polldaddy' ); ?></h3>
|
| 2187 |
+
<input type="hidden" name="styleID" id="styleID" value="<?php echo $style_ID ?>">
|
| 2188 |
+
<div class="inside">
|
| 2189 |
+
|
| 2190 |
+
<ul class="pd-tabs">
|
| 2191 |
+
<li class="selected" id="pd-styles"><a href="#"><?php _e( 'Polldaddy Styles', 'polldaddy' ); ?></a><input type="checkbox" style="display:none;" id="regular"/></li>
|
| 2192 |
+
<?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
|
| 2193 |
+
<li id="pd-custom-styles" <?php echo $hide; ?>><a href="#"><?php _e( 'Custom Styles', 'polldaddy' ); ?></a><input type="checkbox" style="display:none;" id="custom"/></li>
|
| 2194 |
+
|
| 2195 |
+
</ul>
|
| 2196 |
+
|
| 2197 |
+
<div class="pd-tab-panel show" id="pd-styles-panel">
|
| 2198 |
+
|
| 2199 |
+
|
| 2200 |
+
<?php if ( $iframe_view ) { ?>
|
| 2201 |
+
<div id="design_standard" style="padding:0px;padding-top:10px;">
|
| 2202 |
+
<div class="hide-if-no-js">
|
| 2203 |
+
<table class="pollStyle">
|
| 2204 |
+
<thead>
|
| 2205 |
+
<tr>
|
| 2206 |
+
<th>
|
| 2207 |
+
<div style="display:none;">
|
| 2208 |
+
<input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
|
| 2209 |
+
</div>
|
| 2210 |
+
</th>
|
| 2211 |
+
</tr>
|
| 2212 |
+
</thead>
|
| 2213 |
+
<tr>
|
| 2214 |
+
<td class="selector" style="width:120px;">
|
| 2215 |
+
<table class="st_selector">
|
| 2216 |
+
<tr>
|
| 2217 |
+
<td class="dir_left" style="padding:0px;width:30px;">
|
| 2218 |
+
<a href="javascript:pd_move('prev');" style="display: block;font-size: 3.2em;text-decoration: none;">«</a>
|
| 2219 |
+
</td>
|
| 2220 |
+
<td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
|
| 2221 |
+
<td class="dir_right" style="padding:0px;width:30px;">
|
| 2222 |
+
<a href="javascript:pd_move('next');" style="display: block;padding-left:20px;font-size: 3.2em;text-decoration: none;">»</a>
|
| 2223 |
+
</td>
|
| 2224 |
+
</tr>
|
| 2225 |
+
<tr>
|
| 2226 |
+
<td></td>
|
| 2227 |
+
<td class="counter">
|
| 2228 |
+
<div id="st_number"></div>
|
| 2229 |
+
</td>
|
| 2230 |
+
<td></td>
|
| 2231 |
+
</tr>
|
| 2232 |
+
<tr>
|
| 2233 |
+
<td></td>
|
| 2234 |
+
<td class="title">
|
| 2235 |
+
<div id="st_name"></div>
|
| 2236 |
+
</td>
|
| 2237 |
+
<td></td>
|
| 2238 |
+
</tr>
|
| 2239 |
+
<tr>
|
| 2240 |
+
<td></td>
|
| 2241 |
+
<td>
|
| 2242 |
+
<div id="st_sizes"></div>
|
| 2243 |
+
</td>
|
| 2244 |
+
<td></td>
|
| 2245 |
+
</tr>
|
| 2246 |
+
<tr>
|
| 2247 |
+
<td colspan="3">
|
| 2248 |
+
<div style="width:230px;" id="st_description"></div>
|
| 2249 |
+
</td>
|
| 2250 |
+
</tr>
|
| 2251 |
+
</table>
|
| 2252 |
+
</td>
|
| 2253 |
+
</tr>
|
| 2254 |
+
</table>
|
| 2255 |
+
</div>
|
| 2256 |
+
|
| 2257 |
+
<p class="empty-if-js" id="no-js-styleID">
|
| 2258 |
+
<select id="styleID" name="styleID">
|
| 2259 |
+
|
| 2260 |
+
<?php foreach ( $options as $styleID => $label ) :
|
| 2261 |
+
$selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
|
| 2262 |
+
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo esc_html( $label ); ?></option>
|
| 2263 |
+
<?php endforeach; ?>
|
| 2264 |
+
|
| 2265 |
+
</select>
|
| 2266 |
+
</p>
|
| 2267 |
+
</div>
|
| 2268 |
+
<?php } else {?>
|
| 2269 |
+
|
| 2270 |
+
<div class="design_standard">
|
| 2271 |
+
<div class="hide-if-no-js">
|
| 2272 |
+
<table class="pollStyle">
|
| 2273 |
+
<thead>
|
| 2274 |
+
<tr style="display:none;">
|
| 2275 |
+
<th class="cb">
|
| 2276 |
+
|
| 2277 |
+
<input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
|
| 2278 |
+
<label for="skin" onclick="javascript:pd_build_styles( 0 );"><?php _e( 'Polldaddy Style', 'polldaddy' ); ?></label>
|
| 2279 |
+
|
| 2280 |
+
<?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
|
| 2281 |
+
|
| 2282 |
+
<input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style(_$('customSelect').value);" <?php echo $disabled; ?> />
|
| 2283 |
+
|
| 2284 |
+
<label onclick="javascript:pd_change_style(_$('customSelect').value);"><?php _e( 'Custom Style', 'polldaddy' ); ?></label>
|
| 2285 |
+
|
| 2286 |
+
<th>
|
| 2287 |
+
</tr>
|
| 2288 |
+
</thead>
|
| 2289 |
+
<tbody>
|
| 2290 |
+
<tr>
|
| 2291 |
+
<td style="text-align:center">
|
| 2292 |
+
<table class="st_selector" style="margin:20px auto;">
|
| 2293 |
+
<tr>
|
| 2294 |
+
<td class="dir_left">
|
| 2295 |
+
<a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">«</a>
|
| 2296 |
+
</td>
|
| 2297 |
+
<td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
|
| 2298 |
+
<td class="dir_right">
|
| 2299 |
+
<a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">»</a>
|
| 2300 |
+
</td>
|
| 2301 |
+
</tr>
|
| 2302 |
+
<tr>
|
| 2303 |
+
<td></td>
|
| 2304 |
+
<td class="counter">
|
| 2305 |
+
<div id="st_number"></div>
|
| 2306 |
+
</td>
|
| 2307 |
+
<td></td>
|
| 2308 |
+
</tr>
|
| 2309 |
+
<tr>
|
| 2310 |
+
<td></td>
|
| 2311 |
+
<td class="title">
|
| 2312 |
+
<div id="st_name"></div>
|
| 2313 |
+
</td>
|
| 2314 |
+
<td></td>
|
| 2315 |
+
</tr>
|
| 2316 |
+
<tr>
|
| 2317 |
+
<td></td>
|
| 2318 |
+
<td>
|
| 2319 |
+
<div id="st_sizes"></div>
|
| 2320 |
+
</td>
|
| 2321 |
+
<td></td>
|
| 2322 |
+
</tr>
|
| 2323 |
+
<tr>
|
| 2324 |
+
<td colspan="3">
|
| 2325 |
+
<div id="st_description"></div>
|
| 2326 |
+
</td>
|
| 2327 |
+
</tr>
|
| 2328 |
+
</table>
|
| 2329 |
+
</td>
|
| 2330 |
+
|
| 2331 |
+
</tr>
|
| 2332 |
+
</tbody>
|
| 2333 |
+
</table>
|
| 2334 |
+
</div>
|
| 2335 |
+
<p class="empty-if-js" id="no-js-styleID">
|
| 2336 |
+
<select id="styleID" name="styleID">
|
| 2337 |
+
|
| 2338 |
+
<?php foreach ( $options as $styleID => $label ) :
|
| 2339 |
+
$selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
|
| 2340 |
+
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo esc_html( $label ); ?></option>
|
| 2341 |
+
<?php endforeach; ?>
|
| 2342 |
+
|
| 2343 |
+
</select>
|
| 2344 |
+
</p>
|
| 2345 |
+
</div>
|
| 2346 |
+
<?php } ?>
|
| 2347 |
+
|
| 2348 |
+
|
| 2349 |
+
|
| 2350 |
+
|
| 2351 |
+
</div>
|
| 2352 |
+
|
| 2353 |
+
|
| 2354 |
+
<div class="pd-tab-panel" id="pd-custom-styles-panel">
|
| 2355 |
+
<div style="padding:20px;">
|
| 2356 |
+
<?php if ( $show_custom ) : ?>
|
| 2357 |
+
<p><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'list-styles', 'poll' => false, 'style' => false, 'message' => false, 'preload' => false ) ) );?>" class="add-new-h2">All Styles</a></p>
|
| 2358 |
+
<select id="customSelect" name="customSelect" onchange="javascript:pd_change_style(this.value);">
|
| 2359 |
+
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
| 2360 |
+
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style…', 'polldaddy' ); ?></option>
|
| 2361 |
+
<?php foreach ( (array)$styles->style as $style ) :
|
| 2362 |
+
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
| 2363 |
+
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo esc_html( $style->title ); ?></option>
|
| 2364 |
+
<?php endforeach; ?>
|
| 2365 |
+
</select>
|
| 2366 |
+
<div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.', 'polldaddy' ); ?></div>
|
| 2367 |
+
<?php else : ?>
|
| 2368 |
+
<p><?php _e( 'You currently have no custom styles created.', 'polldaddy' ); ?> <a href="/wp-admin/edit.php?page=polls&action=create-style" class="add-new-h2"><?php _e( 'New Style', 'polldaddy');?></a></p>
|
| 2369 |
+
<p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
|
| 2370 |
+
<?php endif; ?>
|
| 2371 |
+
</div>
|
| 2372 |
+
|
| 2373 |
+
|
| 2374 |
+
|
| 2375 |
+
|
| 2376 |
+
</div>
|
| 2377 |
+
|
| 2378 |
+
|
| 2379 |
+
|
| 2380 |
+
|
| 2381 |
+
<script language="javascript">
|
| 2382 |
+
jQuery( document ).ready(function(){
|
| 2383 |
+
plugin = new Plugin( {
|
| 2384 |
+
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 2385 |
+
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 2386 |
+
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 2387 |
+
new_answer_test: '<?php echo esc_attr( __( 'Enter an answer here', 'polldaddy' ) ); ?>',
|
| 2388 |
+
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 2389 |
+
reorder_answer_title: '<?php echo esc_attr( __( 'click and drag to reorder', 'polldaddy' ) ); ?>',
|
| 2390 |
+
add_image_title: '<?php echo esc_attr( __( 'Add an Image', 'polldaddy' ) ); ?>',
|
| 2391 |
+
add_audio_title: '<?php echo esc_attr( __( 'Add Audio', 'polldaddy' ) ); ?>',
|
| 2392 |
+
add_video_title: '<?php echo esc_attr( __( 'Add Video', 'polldaddy' ) ); ?>',
|
| 2393 |
+
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 2394 |
+
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>',
|
| 2395 |
+
base_url: '<?php echo esc_attr( $this->base_url ); ?>'
|
| 2396 |
+
} );
|
| 2397 |
+
});
|
| 2398 |
+
</script>
|
| 2399 |
+
<script language="javascript">
|
| 2400 |
+
current_pos = 0;
|
| 2401 |
+
|
| 2402 |
+
for( var key in styles_array ) {
|
| 2403 |
+
var name = styles_array[key].name;
|
| 2404 |
+
|
| 2405 |
+
switch( name ){
|
| 2406 |
+
case 'Aluminum':
|
| 2407 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Aluminum', 'polldaddy' ) ); ?>';
|
| 2408 |
+
break;
|
| 2409 |
+
case 'Plain White':
|
| 2410 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Plain White', 'polldaddy' ) ); ?>';
|
| 2411 |
+
break;
|
| 2412 |
+
case 'Plain Black':
|
| 2413 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Plain Black', 'polldaddy' ) ); ?>';
|
| 2414 |
+
break;
|
| 2415 |
+
case 'Paper':
|
| 2416 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Paper', 'polldaddy' ) ); ?>';
|
| 2417 |
+
break;
|
| 2418 |
+
case 'Skull Dark':
|
| 2419 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Skull Dark', 'polldaddy' ) ); ?>';
|
| 2420 |
+
break;
|
| 2421 |
+
case 'Skull Light':
|
| 2422 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Skull Light', 'polldaddy' ) ); ?>';
|
| 2423 |
+
break;
|
| 2424 |
+
case 'Micro':
|
| 2425 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Micro', 'polldaddy' ) ); ?>';
|
| 2426 |
+
styles_array[key].n_desc = '<?php echo esc_attr( __( 'Width 150px, the micro style is useful when space is tight.', 'polldaddy' ) ); ?>';
|
| 2427 |
+
break;
|
| 2428 |
+
case 'Plastic White':
|
| 2429 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Plastic White', 'polldaddy' ) ); ?>';
|
| 2430 |
+
break;
|
| 2431 |
+
case 'Plastic Grey':
|
| 2432 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Plastic Grey', 'polldaddy' ) ); ?>';
|
| 2433 |
+
break;
|
| 2434 |
+
case 'Plastic Black':
|
| 2435 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Plastic Black', 'polldaddy' ) ); ?>';
|
| 2436 |
+
break;
|
| 2437 |
+
case 'Manga':
|
| 2438 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Manga', 'polldaddy' ) ); ?>';
|
| 2439 |
+
break;
|
| 2440 |
+
case 'Tech Dark':
|
| 2441 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Tech Dark', 'polldaddy' ) ); ?>';
|
| 2442 |
+
break;
|
| 2443 |
+
case 'Tech Grey':
|
| 2444 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Tech Grey', 'polldaddy' ) ); ?>';
|
| 2445 |
+
break;
|
| 2446 |
+
case 'Tech Light':
|
| 2447 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Tech Light', 'polldaddy' ) ); ?>';
|
| 2448 |
+
break;
|
| 2449 |
+
case 'Working Male':
|
| 2450 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Working Male', 'polldaddy' ) ); ?>';
|
| 2451 |
+
break;
|
| 2452 |
+
case 'Working Female':
|
| 2453 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Working Female', 'polldaddy' ) ); ?>';
|
| 2454 |
+
break;
|
| 2455 |
+
case 'Thinking Male':
|
| 2456 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Thinking Male', 'polldaddy' ) ); ?>';
|
| 2457 |
+
break;
|
| 2458 |
+
case 'Thinking Female':
|
| 2459 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Thinking Female', 'polldaddy' ) ); ?>';
|
| 2460 |
+
break;
|
| 2461 |
+
case 'Sunset':
|
| 2462 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Sunset', 'polldaddy' ) ); ?>';
|
| 2463 |
+
break;
|
| 2464 |
+
case 'Music':
|
| 2465 |
+
styles_array[key].name = '<?php echo esc_attr( __( 'Music', 'polldaddy' ) ); ?>';
|
| 2466 |
+
break;
|
| 2467 |
+
}
|
| 2468 |
+
}
|
| 2469 |
+
pd_map = {
|
| 2470 |
+
wide : '<?php echo esc_attr( __( 'Wide', 'polldaddy' ) ); ?>',
|
| 2471 |
+
medium : '<?php echo esc_attr( __( 'Medium', 'polldaddy' ) ); ?>',
|
| 2472 |
+
narrow : '<?php echo esc_attr( __( 'Narrow', 'polldaddy' ) ); ?>',
|
| 2473 |
+
style_desc_wide : '<?php echo esc_attr( __( 'Width: 630px, the wide style is good for blog posts.', 'polldaddy' ) ); ?>',
|
| 2474 |
+
style_desc_medium : '<?php echo esc_attr( __( 'Width: 300px, the medium style is good for general use.', 'polldaddy' ) ); ?>',
|
| 2475 |
+
style_desc_narrow : '<?php echo esc_attr( __( 'Width 150px, the narrow style is good for sidebars etc.', 'polldaddy' ) ); ?>',
|
| 2476 |
+
style_desc_micro : '<?php echo esc_attr( __( 'Width 150px, the micro style is useful when space is tight.', 'polldaddy' ) ); ?>',
|
| 2477 |
+
image_path : '<?php echo plugins_url( 'img', __FILE__ );?>'
|
| 2478 |
+
}
|
| 2479 |
+
pd_build_styles( current_pos );
|
| 2480 |
+
<?php if ( $style_ID > 0 && $style_ID <= 1000 ) { ?>
|
| 2481 |
+
pd_pick_style( <?php echo $style_ID ?> );
|
| 2482 |
+
<?php }else { ?>
|
| 2483 |
+
pd_change_style( <?php echo $style_ID ?> );
|
| 2484 |
+
<?php } ?>
|
| 2485 |
+
</script>
|
| 2486 |
+
</div>
|
| 2487 |
+
|
| 2488 |
+
</div>
|
| 2489 |
+
|
| 2490 |
+
</div>
|
| 2491 |
+
</div></div>
|
| 2492 |
+
</form>
|
| 2493 |
+
<br class="clear" />
|
| 2494 |
+
|
| 2495 |
+
<?php
|
| 2496 |
+
}
|
| 2497 |
+
|
| 2498 |
+
function poll_results_page( $poll_id ) {
|
| 2499 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 2500 |
+
$polldaddy->reset();
|
| 2501 |
+
|
| 2502 |
+
$results = $polldaddy->get_poll_results( $poll_id );
|
| 2503 |
+
$poll = $polldaddy->get_poll( $poll_id );
|
| 2504 |
+
|
| 2505 |
+
?>
|
| 2506 |
+
<h3 style="line-height:21px;"><?php echo $poll->question; ?></h3>
|
| 2507 |
+
<table class="poll-results widefat">
|
| 2508 |
+
<thead>
|
| 2509 |
+
<tr>
|
| 2510 |
+
<th scope="col" class="column-title" style="width:40%;"><?php _e( 'Answer', 'polldaddy' ); ?></th>
|
| 2511 |
+
<th scope="col" class="column-vote" style="width:10%;text-align:center;"><?php _e( 'Votes', 'polldaddy' ); ?></th>
|
| 2512 |
+
<th scope="col" class="column-vote" style="width:10%;text-align:center;"><?php _e( 'Percent', 'polldaddy' ); ?></th>
|
| 2513 |
+
<th scope="col" class="column-vote" style="width:40%;"> </th>
|
| 2514 |
+
</tr>
|
| 2515 |
+
</thead>
|
| 2516 |
+
<tbody>
|
| 2517 |
+
|
| 2518 |
+
<?php
|
| 2519 |
+
$class = '';
|
| 2520 |
+
foreach ( $results->answers as $answer ) :
|
| 2521 |
+
$answer->text = trim( strip_tags( $answer->text ) );
|
| 2522 |
+
if ( strlen( $answer->text ) == 0 ) {
|
| 2523 |
+
$answer->text = '-- empty HTML tag --';
|
| 2524 |
+
}
|
| 2525 |
+
|
| 2526 |
+
$class = $class ? '' : ' class="alternate"';
|
| 2527 |
+
$content = $results->others && 'Other answer…' === $answer->text ? sprintf( __( 'Other (<a href="%s">see below</a>)', 'polldaddy' ), '#other-answers-results' ) : esc_html( $answer->text );
|
| 2528 |
+
|
| 2529 |
+
?>
|
| 2530 |
+
|
| 2531 |
+
<tr<?php echo $class; ?>>
|
| 2532 |
+
<th scope="row" style="vertical-align:bottom" class="column-title"><?php echo $content; ?></th>
|
| 2533 |
+
<td class="column-vote" style="text-align:center;vertical-align:middle;">
|
| 2534 |
+
<?php echo number_format_i18n( $answer->_total ); ?>
|
| 2535 |
+
</td>
|
| 2536 |
+
<td style="text-align:center;vertical-align:middle;">
|
| 2537 |
+
<?php echo number_format_i18n( $answer->_percent ); ?>%
|
| 2538 |
+
</td>
|
| 2539 |
+
<td style="vertical-align:middle;">
|
| 2540 |
+
<span class="result-bar" style="width: <?php echo number_format( $answer->_percent, 2 ); ?>%;"> </span>
|
| 2541 |
+
</td>
|
| 2542 |
+
</tr>
|
| 2543 |
+
<?php
|
| 2544 |
+
endforeach;
|
| 2545 |
+
?>
|
| 2546 |
+
|
| 2547 |
+
</tbody>
|
| 2548 |
+
</table>
|
| 2549 |
+
|
| 2550 |
+
<?php
|
| 2551 |
+
|
| 2552 |
+
if ( !$results->others )
|
| 2553 |
+
return;
|
| 2554 |
+
?>
|
| 2555 |
+
|
| 2556 |
+
<table id="other-answers-results" class="poll-others widefat">
|
| 2557 |
+
<thead>
|
| 2558 |
+
<tr>
|
| 2559 |
+
<th scope="col" class="column-title"><?php _e( 'Other Answer', 'polldaddy' ); ?></th>
|
| 2560 |
+
<th scope="col" class="column-vote"><?php _e( 'Votes', 'polldaddy' ); ?></th>
|
| 2561 |
+
</tr>
|
| 2562 |
+
</thead>
|
| 2563 |
+
<tbody>
|
| 2564 |
+
|
| 2565 |
+
<?php
|
| 2566 |
+
$class = '';
|
| 2567 |
+
$others = array_count_values( $results->others );
|
| 2568 |
+
arsort( $others );
|
| 2569 |
+
foreach ( $others as $other => $freq ) :
|
| 2570 |
+
$class = $class ? '' : ' class="alternate"';
|
| 2571 |
+
?>
|
| 2572 |
+
|
| 2573 |
+
<tr<?php echo $class; ?>>
|
| 2574 |
+
<th scope="row" class="column-title"><?php echo esc_html( $other ); ?></th>
|
| 2575 |
+
<td class="column-vote"><?php echo number_format_i18n( $freq ); ?></td>
|
| 2576 |
+
</tr>
|
| 2577 |
+
<?php
|
| 2578 |
+
endforeach;
|
| 2579 |
+
?>
|
| 2580 |
+
|
| 2581 |
+
</tbody>
|
| 2582 |
+
</table>
|
| 2583 |
+
|
| 2584 |
+
<?php
|
| 2585 |
+
}
|
| 2586 |
+
|
| 2587 |
+
function styles_table() {
|
| 2588 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 2589 |
+
$polldaddy->reset();
|
| 2590 |
+
|
| 2591 |
+
$styles_object = $polldaddy->get_styles();
|
| 2592 |
+
|
| 2593 |
+
$this->parse_errors( $polldaddy );
|
| 2594 |
+
$this->print_errors();
|
| 2595 |
+
$styles = & $styles_object->style;
|
| 2596 |
+
$class = '';
|
| 2597 |
+
$styles_exist = false;
|
| 2598 |
+
|
| 2599 |
+
foreach ( (array)$styles as $style ) :
|
| 2600 |
+
if ( (int) $style->_type == 1 ):
|
| 2601 |
+
$styles_exist = true;
|
| 2602 |
+
break;
|
| 2603 |
+
endif;
|
| 2604 |
+
endforeach;
|
| 2605 |
+
?>
|
| 2606 |
+
|
| 2607 |
+
<form method="post" action="">
|
| 2608 |
+
<div class="tablenav">
|
| 2609 |
+
<div class="alignleft">
|
| 2610 |
+
<select name="action">
|
| 2611 |
+
<option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
|
| 2612 |
+
<option value="delete-style"><?php _e( 'Delete', 'polldaddy' ); ?></option>
|
| 2613 |
+
</select>
|
| 2614 |
+
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
|
| 2615 |
+
<?php wp_nonce_field( 'action-style_bulk' ); ?>
|
| 2616 |
+
</div>
|
| 2617 |
+
<div class="tablenav-pages"></div>
|
| 2618 |
+
</div>
|
| 2619 |
+
|
| 2620 |
+
<table class="widefat">
|
| 2621 |
+
<thead>
|
| 2622 |
+
<tr>
|
| 2623 |
+
<th id="cb" class="manage-column column-cb check-column" scope="col"><input type="checkbox" /></th>
|
| 2624 |
+
<th id="title" class="manage-column column-title" scope="col"><?php _e( 'Style', 'polldaddy' ); ?></th>
|
| 2625 |
+
<th id="date" class="manage-column column-date" scope="col"><?php _e( 'Last Modified', 'polldaddy' ); ?></th>
|
| 2626 |
+
</tr>
|
| 2627 |
+
</thead>
|
| 2628 |
+
<tbody>
|
| 2629 |
+
|
| 2630 |
+
<?php
|
| 2631 |
+
if ( $styles_exist ) :
|
| 2632 |
+
foreach ( $styles as $style ) :
|
| 2633 |
+
if ( (int) $style->_type == 1 ):
|
| 2634 |
+
$style_id = (int) $style->_id;
|
| 2635 |
+
|
| 2636 |
+
$class = $class ? '' : ' class="alternate"';
|
| 2637 |
+
$edit_link = esc_url( add_query_arg( array( 'action' => 'edit-style', 'style' => $style_id, 'message' => false ) ) );
|
| 2638 |
+
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-style', 'style' => $style_id, 'message' => false ) ), "delete-style_$style_id" ) );
|
| 2639 |
+
list( $style_time ) = explode( '.', $style->date );
|
| 2640 |
+
$style_time = strtotime( $style_time );
|
| 2641 |
+
?>
|
| 2642 |
+
|
| 2643 |
+
<tr<?php echo $class; ?>>
|
| 2644 |
+
<th class="check-column" scope="row"><input type="checkbox" value="<?php echo (int) $style_id; ?>" name="style[]" /></th>
|
| 2645 |
+
<td class="post-title column-title">
|
| 2646 |
+
<?php if ( $edit_link ) : ?>
|
| 2647 |
+
<strong><a class="row-title" href="<?php echo $edit_link; ?>"><?php echo esc_html( $style->title ); ?></a></strong>
|
| 2648 |
+
<div class="row-actions">
|
| 2649 |
+
<span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a> | </span>
|
| 2650 |
+
<?php else : ?>
|
| 2651 |
+
<strong><?php echo esc_html( $style->title ); ?></strong>
|
| 2652 |
+
<?php endif; ?>
|
| 2653 |
+
|
| 2654 |
+
<span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
|
| 2655 |
+
</div>
|
| 2656 |
+
</td>
|
| 2657 |
+
<td class="date column-date"><abbr title="<?php echo date( __( 'Y/m/d g:i:s A', 'polldaddy' ), $style_time ); ?>"><?php echo date( __( 'Y/m/d', 'polldaddy' ), $style_time ); ?></abbr></td>
|
| 2658 |
+
</tr>
|
| 2659 |
+
|
| 2660 |
+
<?php
|
| 2661 |
+
endif;
|
| 2662 |
+
endforeach;
|
| 2663 |
+
else : // $styles
|
| 2664 |
+
?>
|
| 2665 |
+
|
| 2666 |
+
<tr>
|
| 2667 |
+
<td colspan="4" id="empty-set">
|
| 2668 |
+
|
| 2669 |
+
<h3 style="margin-bottom:0px;"><?php _e( 'You haven\'t used our fancy style editor to create any custom styles!', 'polldaddy');?> </h3>
|
| 2670 |
+
<p style="margin-bottom:20px;"><?php _e( 'Why don\'t you go ahead and get started on that?', 'polldaddy' ); ?></p>
|
| 2671 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'create-style' ) ) ); ?>" class="button-primary"><?php _e( 'Create a Custom Style Now', 'polldaddy' ); ?></a>
|
| 2672 |
+
|
| 2673 |
+
</td>
|
| 2674 |
+
</tr>
|
| 2675 |
+
<?php endif; // $styles ?>
|
| 2676 |
+
|
| 2677 |
+
</tbody>
|
| 2678 |
+
</table>
|
| 2679 |
+
</form>
|
| 2680 |
+
<div class="tablenav">
|
| 2681 |
+
<div class="tablenav-pages"></div>
|
| 2682 |
+
</div>
|
| 2683 |
+
<br class="clear" />
|
| 2684 |
+
|
| 2685 |
+
<?php
|
| 2686 |
+
}
|
| 2687 |
+
|
| 2688 |
+
function style_edit_form( $style_id = 105 ) {
|
| 2689 |
+
$style_id = (int) $style_id;
|
| 2690 |
+
|
| 2691 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 2692 |
+
$polldaddy->reset();
|
| 2693 |
+
|
| 2694 |
+
$is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
|
| 2695 |
+
|
| 2696 |
+
if ( $style_id ) {
|
| 2697 |
+
$style = $polldaddy->get_style( $style_id );
|
| 2698 |
+
$this->parse_errors( $polldaddy );
|
| 2699 |
+
} else {
|
| 2700 |
+
$style = polldaddy_style( array(), null, false );
|
| 2701 |
+
}
|
| 2702 |
+
|
| 2703 |
+
$style->css = trim( urldecode( $style->css ) );
|
| 2704 |
+
|
| 2705 |
+
$direction = 'ltr';
|
| 2706 |
+
if ( in_array( $style->_direction, array( 'ltr', 'rtl') ) )
|
| 2707 |
+
$direction = $style->_direction;
|
| 2708 |
+
|
| 2709 |
+
if ( $start = stripos( $style->css, '<data>' ) )
|
| 2710 |
+
$style->css = substr( $style->css, $start );
|
| 2711 |
+
|
| 2712 |
+
$style->css = addslashes( $style->css );
|
| 2713 |
+
|
| 2714 |
+
$preload_style_id = 0;
|
| 2715 |
+
$preload_style = null;
|
| 2716 |
+
|
| 2717 |
+
if ( isset ( $_REQUEST['preload'] ) ) {
|
| 2718 |
+
$preload_style_id = (int) $_REQUEST['preload'];
|
| 2719 |
+
|
| 2720 |
+
if ( $preload_style_id > 1000 || $preload_style_id < 100 )
|
| 2721 |
+
$preload_style_id = 0;
|
| 2722 |
+
|
| 2723 |
+
if ( $preload_style_id > 0 ) {
|
| 2724 |
+
$polldaddy->reset();
|
| 2725 |
+
$preload_style = $polldaddy->get_style( $preload_style_id );
|
| 2726 |
+
$this->parse_errors( $polldaddy );
|
| 2727 |
+
}
|
| 2728 |
+
|
| 2729 |
+
$preload_style->css = trim( urldecode( $preload_style->css ) );
|
| 2730 |
+
|
| 2731 |
+
if ( $start = stripos( $preload_style->css, '<data>' ) )
|
| 2732 |
+
$preload_style->css = substr( $preload_style->css, $start );
|
| 2733 |
+
|
| 2734 |
+
$style->css = addslashes( $preload_style->css );
|
| 2735 |
+
}
|
| 2736 |
+
|
| 2737 |
+
$this->print_errors();
|
| 2738 |
+
|
| 2739 |
+
echo '<script language="javascript">var CSSXMLString = "' . $style->css .'";</script>';
|
| 2740 |
+
?>
|
| 2741 |
+
|
| 2742 |
+
<form action="" method="post">
|
| 2743 |
+
<div id="poststuff">
|
| 2744 |
+
<div id="post-body">
|
| 2745 |
+
<br/>
|
| 2746 |
+
<table>
|
| 2747 |
+
<tr>
|
| 2748 |
+
<td class="pd-editor-label">
|
| 2749 |
+
<label class="CSSE_title_label"><?php _e( 'Style Name', 'polldaddy' ); ?></label>
|
| 2750 |
+
</td>
|
| 2751 |
+
<td>
|
| 2752 |
+
<div id="titlediv" style="margin:0px;">
|
| 2753 |
+
<div id="titlewrap">
|
| 2754 |
+
<input type="text" autocomplete="off" value="<?php echo $style_id > 1000 ? $style->title : ''; ?>" tabindex="1" style="width:25em;" name="style-title" />
|
| 2755 |
+
</div>
|
| 2756 |
+
</div>
|
| 2757 |
+
</td>
|
| 2758 |
+
</tr>
|
| 2759 |
+
<tr>
|
| 2760 |
+
<td class="pd-editor-label">
|
| 2761 |
+
<label class="CSSE_title_label"><?php _e( 'Preload Basic Style', 'polldaddy' ); ?></label>
|
| 2762 |
+
</td>
|
| 2763 |
+
<td>
|
| 2764 |
+
<div class="CSSE_preload">
|
| 2765 |
+
<select id="preload_value">
|
| 2766 |
+
<option value="0"></option>
|
| 2767 |
+
<option value="102"><?php _e( 'Aluminum', 'polldaddy' ); ?></option>
|
| 2768 |
+
<option value="105"><?php _e( 'Plain White', 'polldaddy' ); ?></option>
|
| 2769 |
+
<option value="108"><?php _e( 'Plain Black', 'polldaddy' ); ?></option>
|
| 2770 |
+
<option value="111"><?php _e( 'Paper', 'polldaddy' ); ?></option>
|
| 2771 |
+
<option value="114"><?php _e( 'Skull Dark', 'polldaddy' ); ?></option>
|
| 2772 |
+
<option value="117"><?php _e( 'Skull Light', 'polldaddy' ); ?></option>
|
| 2773 |
+
<option value="157"><?php _e( 'Micro', 'polldaddy' ); ?></option>
|
| 2774 |
+
</select>
|
| 2775 |
+
<a tabindex="4" id="style-preload" href="javascript:preload_style();" class="button"><?php echo esc_attr( __( 'Load Style', 'polldaddy' ) ); ?></a>
|
| 2776 |
+
</div>
|
| 2777 |
+
</td>
|
| 2778 |
+
</tr>
|
| 2779 |
+
<tr>
|
| 2780 |
+
<td class="pd-editor-label">
|
| 2781 |
+
<label class="CSSE_title_label"><?php _e( 'Text Direction', 'polldaddy' ); ?></label>
|
| 2782 |
+
</td>
|
| 2783 |
+
<td>
|
| 2784 |
+
<div class="CSSE_rtl_ltr">
|
| 2785 |
+
<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>
|
| 2786 |
+
<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>
|
| 2787 |
+
</div>
|
| 2788 |
+
</td>
|
| 2789 |
+
</tr>
|
| 2790 |
+
</table>
|
| 2791 |
+
|
| 2792 |
+
<h3><?php _e( 'Style Editor', 'polldaddy' ); ?></h3>
|
| 2793 |
+
|
| 2794 |
+
<table>
|
| 2795 |
+
<tr>
|
| 2796 |
+
<td class="pd-editor-label"><label for="styleName"><?php _e( 'Select a template part to edit:' ); ?></label></td>
|
| 2797 |
+
<td>
|
| 2798 |
+
<select id="styleName" onchange="renderStyleEdit(this.value);">
|
| 2799 |
+
<option value="pds-box" selected="selected"><?php _e( 'Poll Box', 'polldaddy' ); ?></option>
|
| 2800 |
+
<option value="pds-question-top"><?php _e( 'Question', 'polldaddy' ); ?></option>
|
| 2801 |
+
<option value="pds-answer-group"><?php _e( 'Answer Group', 'polldaddy' ); ?></option>
|
| 2802 |
+
<option value="pds-answer-input"><?php _e( 'Answer Check', 'polldaddy' ); ?></option>
|
| 2803 |
+
<option value="pds-answer"><?php _e( 'Answers', 'polldaddy' ); ?></option>
|
| 2804 |
+
<option value="pds-textfield"><?php _e( 'Other Input', 'polldaddy' ); ?></option>
|
| 2805 |
+
<option value="pds-vote-button"><?php _e( 'Vote Button', 'polldaddy' ); ?></option>
|
| 2806 |
+
<option value="pds-link"><?php _e( 'Links', 'polldaddy' ); ?></option>
|
| 2807 |
+
<option value="pds-feedback-group"><?php _e( 'Feedback Group', 'polldaddy' ); ?></option>
|
| 2808 |
+
<option value="pds-feedback-result"><?php _e( 'Results Group', 'polldaddy' ); ?></option>
|
| 2809 |
+
<option value="pds-feedback-per"><?php _e( 'Results Percent', 'polldaddy' ); ?></option>
|
| 2810 |
+
<option value="pds-feedback-votes"><?php _e( 'Results Votes', 'polldaddy' ); ?></option>
|
| 2811 |
+
<option value="pds-answer-text"><?php _e( 'Results Text', 'polldaddy' ); ?></option>
|
| 2812 |
+
<option value="pds-answer-feedback"><?php _e( 'Results Background', 'polldaddy' ); ?></option>
|
| 2813 |
+
<option value="pds-answer-feedback-bar"><?php _e( 'Results Bar', 'polldaddy' ); ?></option>
|
| 2814 |
+
<option value="pds-totalvotes-inner"><?php _e( 'Total Votes', 'polldaddy' ); ?></option>
|
| 2815 |
+
</select>
|
| 2816 |
+
|
| 2817 |
+
</td>
|
| 2818 |
+
</tr>
|
| 2819 |
+
|
| 2820 |
+
</table>
|
| 2821 |
+
|
| 2822 |
+
|
| 2823 |
+
<table width="100%">
|
| 2824 |
+
<tr>
|
| 2825 |
+
<td valign="top">
|
| 2826 |
+
<table class="CSSE_main">
|
| 2827 |
+
<tr>
|
| 2828 |
+
<td class="CSSE_main_l" valign="top">
|
| 2829 |
+
<div class="off" id="D_Font">
|
| 2830 |
+
<a href="javascript:CSSE_changeView('Font');" id="A_Font" class="Aoff"><?php _e( 'Font', 'polldaddy' ); ?></a>
|
| 2831 |
+
</div>
|
| 2832 |
+
<div class="on" id="D_Background">
|
| 2833 |
+
<a href="javascript:CSSE_changeView('Background');" id="A_Background" class="Aon"><?php _e( 'Background', 'polldaddy' ); ?></a>
|
| 2834 |
+
</div>
|
| 2835 |
+
<div class="off" id="D_Border">
|
| 2836 |
+
<a href="javascript:CSSE_changeView('Border');" id="A_Border" class="Aoff"><?php _e( 'Border', 'polldaddy' ); ?></a>
|
| 2837 |
+
</div>
|
| 2838 |
+
<div class="off" id="D_Margin">
|
| 2839 |
+
<a href="javascript:CSSE_changeView('Margin');" id="A_Margin" class="Aoff"><?php _e( 'Margin', 'polldaddy' ); ?></a>
|
| 2840 |
+
</div>
|
| 2841 |
+
<div class="off" id="D_Padding">
|
| 2842 |
+
<a href="javascript:CSSE_changeView('Padding');" id="A_Padding" class="Aoff"><?php _e( 'Padding', 'polldaddy' ); ?></a>
|
| 2843 |
+
</div>
|
| 2844 |
+
<div class="off" id="D_Scale">
|
| 2845 |
+
<a href="javascript:CSSE_changeView('Scale');" id="A_Scale" class="Aoff"><?php _e( 'Width', 'polldaddy' ); ?></a>
|
| 2846 |
+
</div>
|
| 2847 |
+
<div class="off" id="D_Height">
|
| 2848 |
+
<a href="javascript:CSSE_changeView('Height');" id="A_Height" class="Aoff"><?php _e( 'Height', 'polldaddy' ); ?></a>
|
| 2849 |
+
</div>
|
| 2850 |
+
<div class="off" id="D_Position">
|
| 2851 |
+
<a href="javascript:CSSE_changeView('Position');" id="A_Position" class="Aoff"><?php _e( 'Position', 'polldaddy' ); ?></a>
|
| 2852 |
+
</div>
|
| 2853 |
+
</td>
|
| 2854 |
+
<td class="CSSE_main_r" valign="top">
|
| 2855 |
+
<table class="CSSE_sub">
|
| 2856 |
+
<tr>
|
| 2857 |
+
<td class="top"/>
|
| 2858 |
+
</tr>
|
| 2859 |
+
<tr>
|
| 2860 |
+
<td class="mid">
|
| 2861 |
+
<!-- Font Table -->
|
| 2862 |
+
<table class="CSSE_edit" id="editFont" style="display:none;">
|
| 2863 |
+
<tr>
|
| 2864 |
+
<td width="85"><?php _e( 'Font Size', 'polldaddy' ); ?>:</td>
|
| 2865 |
+
<td>
|
| 2866 |
+
<select id="font-size" onchange="bind(this);">
|
| 2867 |
+
<option value="6px">6px</option>
|
| 2868 |
+
<option value="8px">8px</option>
|
| 2869 |
+
<option value="9px">9px</option>
|
| 2870 |
+
<option value="10px">10px</option>
|
| 2871 |
+
<option value="11px">11px</option>
|
| 2872 |
+
<option value="12px">12px</option>
|
| 2873 |
+
<option value="13px">13px</option>
|
| 2874 |
+
<option value="14px">14px</option>
|
| 2875 |
+
<option value="15px">15px</option>
|
| 2876 |
+
<option value="16px">16px</option>
|
| 2877 |
+
<option value="18px">18px</option>
|
| 2878 |
+
<option value="20px">20px</option>
|
| 2879 |
+
<option value="24px">24px</option>
|
| 2880 |
+
<option value="30px">30px</option>
|
| 2881 |
+
<option value="36px">36px</option>
|
| 2882 |
+
</select>
|
| 2883 |
+
</td>
|
| 2884 |
+
</tr>
|
| 2885 |
+
<tr>
|
| 2886 |
+
<td><?php _e( 'Font Size', 'polldaddy' ); ?></td>
|
| 2887 |
+
<td>
|
| 2888 |
+
<select id="font-family" onchange="bind(this);">
|
| 2889 |
+
<option value="Arial">Arial</option>
|
| 2890 |
+
<option value="Comic Sans MS">Comic Sans MS</option>
|
| 2891 |
+
<option value="Courier">Courier</option>
|
| 2892 |
+
<option value="Georgia">Georgia</option>
|
| 2893 |
+
<option value="Lucida Grande">Lucida Grande</option>
|
| 2894 |
+
<option value="Trebuchet MS">Trebuchet MS</option>
|
| 2895 |
+
<option value="Times">Times</option>
|
| 2896 |
+
<option value="Verdana">Verdana</option>
|
| 2897 |
+
</select>
|
| 2898 |
+
</td>
|
| 2899 |
+
</tr>
|
| 2900 |
+
<tr>
|
| 2901 |
+
<td><?php _e( 'Color', 'polldaddy' ); ?> (#hex):</td>
|
| 2902 |
+
<td>
|
| 2903 |
+
<input type="text" maxlength="11" id="color" class="elmColor jscolor-picker" onblur="bind(this);" style="float:left;"/>
|
| 2904 |
+
</td>
|
| 2905 |
+
</tr>
|
| 2906 |
+
<tr>
|
| 2907 |
+
<td><?php _e( 'Bold', 'polldaddy' ); ?>:</td>
|
| 2908 |
+
<td>
|
| 2909 |
+
<input type="checkbox" id="font-weight" value="bold" onclick="bind(this);"/>
|
| 2910 |
+
</td>
|
| 2911 |
+
</tr>
|
| 2912 |
+
<tr>
|
| 2913 |
+
<td><?php _e( 'Italic', 'polldaddy' ); ?>:</td>
|
| 2914 |
+
<td>
|
| 2915 |
+
<input type="checkbox" id="font-style" value="italic" onclick="bind(this);"/>
|
| 2916 |
+
</td>
|
| 2917 |
+
</tr>
|
| 2918 |
+
<tr>
|
| 2919 |
+
<td><?php _e( 'Underline', 'polldaddy' ); ?>:</td>
|
| 2920 |
+
<td>
|
| 2921 |
+
<input type="checkbox" id="text-decoration" value="underline" onclick="bind(this);"/>
|
| 2922 |
+
</td>
|
| 2923 |
+
</tr>
|
| 2924 |
+
<tr>
|
| 2925 |
+
<td><?php _e( 'Line Height', 'polldaddy' ); ?>:</td>
|
| 2926 |
+
<td>
|
| 2927 |
+
<select id="line-height" onchange="bind(this);">
|
| 2928 |
+
<option value="6px">6px</option>
|
| 2929 |
+
<option value="8px">8px</option>
|
| 2930 |
+
<option value="9px">9px</option>
|
| 2931 |
+
<option value="10px">10px</option>
|
| 2932 |
+
<option value="11px">11px</option>
|
| 2933 |
+
<option value="12px">12px</option>
|
| 2934 |
+
<option value="13px">13px</option>
|
| 2935 |
+
<option value="14px">14px</option>
|
| 2936 |
+
<option value="15px">15px</option>
|
| 2937 |
+
<option value="16px">16px</option>
|
| 2938 |
+
<option value="18px">18px</option>
|
| 2939 |
+
<option value="20px">20px</option>
|
| 2940 |
+
<option value="24px">24px</option>
|
| 2941 |
+
<option value="30px">30px</option>
|
| 2942 |
+
<option value="36px">36px</option>
|
| 2943 |
+
</select>
|
| 2944 |
+
</td>
|
| 2945 |
+
</tr>
|
| 2946 |
+
<tr>
|
| 2947 |
+
<td><?php _e( 'Align', 'polldaddy' ); ?>:</td>
|
| 2948 |
+
<td>
|
| 2949 |
+
<select id="text-align" onchange="bind(this);">
|
| 2950 |
+
<option value="left"><?php _e( 'Left', 'polldaddy' ); ?></option>
|
| 2951 |
+
<option value="center"><?php _e( 'Center', 'polldaddy' ); ?></option>
|
| 2952 |
+
<option value="right"><?php _e( 'Right', 'polldaddy' ); ?></option>
|
| 2953 |
+
</select>
|
| 2954 |
+
</td>
|
| 2955 |
+
</tr>
|
| 2956 |
+
</table>
|
| 2957 |
+
<!-- Background Table -->
|
| 2958 |
+
<table class="CSSE_edit" id="editBackground" style="display:none;">
|
| 2959 |
+
<tr>
|
| 2960 |
+
<td width="85"><?php _e( 'Color', 'polldaddy' ); ?> (#hex):</td>
|
| 2961 |
+
<td>
|
| 2962 |
+
<input type="text" maxlength="11" id="background-color" class="elmColor jscolor-picker" onblur="bind(this);"/>
|
| 2963 |
+
</td>
|
| 2964 |
+
</tr>
|
| 2965 |
+
<tr>
|
| 2966 |
+
<td><?php _e( 'Image URL', 'polldaddy' ); ?>: <a href="http://support.polldaddy.com/custom-poll-styles/" class="noteLink" title="<?php _e( 'Click here for more information', 'polldaddy' ); ?>">(?)</a></td>
|
| 2967 |
+
<td>
|
| 2968 |
+
<input type="text" id="background-image" onblur="bind(this);"/>
|
| 2969 |
+
</td>
|
| 2970 |
+
</tr>
|
| 2971 |
+
<tr>
|
| 2972 |
+
<td><?php _e( 'Image Repeat', 'polldaddy' ); ?>:</td>
|
| 2973 |
+
<td>
|
| 2974 |
+
<select id="background-repeat" onchange="bind(this);">
|
| 2975 |
+
<option value="repeat"><?php _e( 'repeat', 'polldaddy' ); ?></option>
|
| 2976 |
+
<option value="no-repeat"><?php _e( 'no-repeat', 'polldaddy' ); ?></option>
|
| 2977 |
+
<option value="repeat-x"><?php _e( 'repeat-x', 'polldaddy' ); ?></option>
|
| 2978 |
+
<option value="repeat-y"><?php _e( 'repeat-y', 'polldaddy' ); ?></option>
|
| 2979 |
+
</select>
|
| 2980 |
+
</td>
|
| 2981 |
+
</tr>
|
| 2982 |
+
<tr>
|
| 2983 |
+
<td><?php _e( 'Image Position', 'polldaddy' ); ?>:</td>
|
| 2984 |
+
<td>
|
| 2985 |
+
<select id="background-position" onchange="bind(this);">
|
| 2986 |
+
<option value="left top"><?php _e( 'left top', 'polldaddy' ); ?></option>
|
| 2987 |
+
<option value="left center"><?php _e( 'left center', 'polldaddy' ); ?></option>
|
| 2988 |
+
<option value="left bottom"><?php _e( 'left bottom', 'polldaddy' ); ?></option>
|
| 2989 |
+
<option value="center top"><?php _e( 'center top', 'polldaddy' ); ?></option>
|
| 2990 |
+
<option value="center center"><?php _e( 'center center', 'polldaddy' ); ?></option>
|
| 2991 |
+
<option value="center bottom"><?php _e( 'center bottom', 'polldaddy' ); ?></option>
|
| 2992 |
+
<option value="right top"><?php _e( 'right top', 'polldaddy' ); ?></option>
|
| 2993 |
+
<option value="right center"><?php _e( 'right center', 'polldaddy' ); ?></option>
|
| 2994 |
+
<option value="right bottom"><?php _e( 'right bottom', 'polldaddy' ); ?></option>
|
| 2995 |
+
</select>
|
| 2996 |
+
</td>
|
| 2997 |
+
</tr>
|
| 2998 |
+
</table>
|
| 2999 |
+
<!-- Border Table -->
|
| 3000 |
+
<table class="CSSE_edit" id="editBorder" style="display:none;">
|
| 3001 |
+
<tr>
|
| 3002 |
+
<td width="85"><?php _e( 'Width', 'polldaddy' ); ?>:</td>
|
| 3003 |
+
<td>
|
| 3004 |
+
<select id="border-width" onchange="bind(this);">
|
| 3005 |
+
<option value="0px">0px</option>
|
| 3006 |
+
<option value="1px">1px</option>
|
| 3007 |
+
<option value="2px">2px</option>
|
| 3008 |
+
<option value="3px">3px</option>
|
| 3009 |
+
<option value="4px">4px</option>
|
| 3010 |
+
<option value="5px">5px</option>
|
| 3011 |
+
<option value="6px">6px</option>
|
| 3012 |
+
<option value="7px">7px</option>
|
| 3013 |
+
<option value="8px">8px</option>
|
| 3014 |
+
<option value="9px">9px</option>
|
| 3015 |
+
<option value="10px">10px</option>
|
| 3016 |
+
<option value="11px">11px</option>
|
| 3017 |
+
<option value="12px">12px</option>
|
| 3018 |
+
<option value="13px">13px</option>
|
| 3019 |
+
<option value="14px">14px</option>
|
| 3020 |
+
<option value="15px">15px</option>
|
| 3021 |
+
<option value="16px">16px</option>
|
| 3022 |
+
<option value="17px">17px</option>
|
| 3023 |
+
<option value="18px">18px</option>
|
| 3024 |
+
<option value="19px">19px</option>
|
| 3025 |
+
<option value="20px">20px</option>
|
| 3026 |
+
<option value="21px">21px</option>
|
| 3027 |
+
<option value="22px">22px</option>
|
| 3028 |
+
<option value="23px">23px</option>
|
| 3029 |
+
<option value="24px">24px</option>
|
| 3030 |
+
<option value="25px">25px</option>
|
| 3031 |
+
<option value="26px">26px</option>
|
| 3032 |
+
<option value="27px">27px</option>
|
| 3033 |
+
<option value="28px">28px</option>
|
| 3034 |
+
<option value="29px">29px</option>
|
| 3035 |
+
<option value="30px">30px</option>
|
| 3036 |
+
</select>
|
| 3037 |
+
</td>
|
| 3038 |
+
</tr>
|
| 3039 |
+
<tr>
|
| 3040 |
+
<td><?php _e( 'Style', 'polldaddy' ); ?>:</td>
|
| 3041 |
+
<td>
|
| 3042 |
+
<select id="border-style" onchange="bind(this);">
|
| 3043 |
+
<option value="none"><?php _e( 'none', 'polldaddy' ); ?></option>
|
| 3044 |
+
<option value="solid"><?php _e( 'solid', 'polldaddy' ); ?></option>
|
| 3045 |
+
<option value="dotted"><?php _e( 'dotted', 'polldaddy' ); ?></option>
|
| 3046 |
+
<option value="dashed"><?php _e( 'dashed', 'polldaddy' ); ?></option>
|
| 3047 |
+
<option value="double"><?php _e( 'double', 'polldaddy' ); ?></option>
|
| 3048 |
+
<option value="groove"><?php _e( 'groove', 'polldaddy' ); ?></option>
|
| 3049 |
+
<option value="inset"><?php _e( 'inset', 'polldaddy' ); ?></option>
|
| 3050 |
+
<option value="outset"><?php _e( 'outset', 'polldaddy' ); ?></option>
|
| 3051 |
+
<option value="ridge"><?php _e( 'ridge', 'polldaddy' ); ?></option>
|
| 3052 |
+
<option value="hidden"><?php _e( 'hidden', 'polldaddy' ); ?></option>
|
| 3053 |
+
</select>
|
| 3054 |
+
</td>
|
| 3055 |
+
</tr>
|
| 3056 |
+
<tr>
|
| 3057 |
+
<td><?php _e( 'Color', 'polldaddy' ); ?> (#hex):</td>
|
| 3058 |
+
<td>
|
| 3059 |
+
<input type="text" maxlength="11" class="elmColor jscolor-picker" id="border-color" onblur="bind(this);"/>
|
| 3060 |
+
</td>
|
| 3061 |
+
</tr>
|
| 3062 |
+
<tr>
|
| 3063 |
+
<td width="85"><?php _e( 'Rounded Corners', 'polldaddy' ); ?>:</td>
|
| 3064 |
+
<td>
|
| 3065 |
+
<select id="border-radius" onchange="bind(this);">
|
| 3066 |
+
<option value="0px">0px</option>
|
| 3067 |
+
<option value="1px">1px</option>
|
| 3068 |
+
<option value="2px">2px</option>
|
| 3069 |
+
<option value="3px">3px</option>
|
| 3070 |
+
<option value="4px">4px</option>
|
| 3071 |
+
<option value="5px">5px</option>
|
| 3072 |
+
<option value="6px">6px</option>
|
| 3073 |
+
<option value="7px">7px</option>
|
| 3074 |
+
<option value="8px">8px</option>
|
| 3075 |
+
<option value="9px">9px</option>
|
| 3076 |
+
<option value="10px">10px</option>
|
| 3077 |
+
<option value="11px">11px</option>
|
| 3078 |
+
<option value="12px">12px</option>
|
| 3079 |
+
<option value="13px">13px</option>
|
| 3080 |
+
<option value="14px">14px</option>
|
| 3081 |
+
<option value="15px">15px</option>
|
| 3082 |
+
<option value="16px">16px</option>
|
| 3083 |
+
<option value="17px">17px</option>
|
| 3084 |
+
<option value="18px">18px</option>
|
| 3085 |
+
<option value="19px">19px</option>
|
| 3086 |
+
<option value="20px">20px</option>
|
| 3087 |
+
<option value="21px">21px</option>
|
| 3088 |
+
<option value="22px">22px</option>
|
| 3089 |
+
<option value="23px">23px</option>
|
| 3090 |
+
<option value="24px">24px</option>
|
| 3091 |
+
<option value="25px">25px</option>
|
| 3092 |
+
<option value="26px">26px</option>
|
| 3093 |
+
<option value="27px">27px</option>
|
| 3094 |
+
<option value="28px">28px</option>
|
| 3095 |
+
<option value="29px">29px</option>
|
| 3096 |
+
<option value="30px">30px</option>
|
| 3097 |
+
</select>
|
| 3098 |
+
<br/>
|
| 3099 |
+
<?php _e( 'Not supported in Internet Explorer.', 'polldaddy' ); ?>
|
| 3100 |
+
</td>
|
| 3101 |
+
</tr>
|
| 3102 |
+
</table>
|
| 3103 |
+
<!-- Margin Table -->
|
| 3104 |
+
<table class="CSSE_edit" id="editMargin" style="display:none;">
|
| 3105 |
+
<tr>
|
| 3106 |
+
<td width="85"><?php _e( 'Top', 'polldaddy' ); ?>: </td>
|
| 3107 |
+
<td>
|
| 3108 |
+
<select id="margin-top" onchange="bind(this);">
|
| 3109 |
+
<option value="0px">0px</option>
|
| 3110 |
+
<option value="1px">1px</option>
|
| 3111 |
+
<option value="2px">2px</option>
|
| 3112 |
+
<option value="3px">3px</option>
|
| 3113 |
+
<option value="4px">4px</option>
|
| 3114 |
+
<option value="5px">5px</option>
|
| 3115 |
+
<option value="6px">6px</option>
|
| 3116 |
+
<option value="7px">7px</option>
|
| 3117 |
+
<option value="8px">8px</option>
|
| 3118 |
+
<option value="9px">9px</option>
|
| 3119 |
+
<option value="10px">10px</option>
|
| 3120 |
+
<option value="11px">11px</option>
|
| 3121 |
+
<option value="12px">12px</option>
|
| 3122 |
+
<option value="13px">13px</option>
|
| 3123 |
+
<option value="14px">14px</option>
|
| 3124 |
+
<option value="15px">15px</option>
|
| 3125 |
+
<option value="16px">16px</option>
|
| 3126 |
+
<option value="17px">17px</option>
|
| 3127 |
+
<option value="18px">18px</option>
|
| 3128 |
+
<option value="19px">19px</option>
|
| 3129 |
+
<option value="20px">20px</option>
|
| 3130 |
+
<option value="21px">21px</option>
|
| 3131 |
+
<option value="22px">22px</option>
|
| 3132 |
+
<option value="23px">23px</option>
|
| 3133 |
+
<option value="24px">24px</option>
|
| 3134 |
+
<option value="25px">25px</option>
|
| 3135 |
+
<option value="26px">26px</option>
|
| 3136 |
+
<option value="27px">27px</option>
|
| 3137 |
+
<option value="28px">28px</option>
|
| 3138 |
+
<option value="29px">29px</option>
|
| 3139 |
+
<option value="30px">30px</option>
|
| 3140 |
+
</select>
|
| 3141 |
+
</td>
|
| 3142 |
+
</tr>
|
| 3143 |
+
<tr>
|
| 3144 |
+
<td><?php _e( 'Right', 'polldaddy' ); ?>:</td>
|
| 3145 |
+
<td>
|
| 3146 |
+
<select id="margin-right" onchange="bind(this);">
|
| 3147 |
+
<option value="0px">0px</option>
|
| 3148 |
+
<option value="1px">1px</option>
|
| 3149 |
+
<option value="2px">2px</option>
|
| 3150 |
+
<option value="3px">3px</option>
|
| 3151 |
+
<option value="4px">4px</option>
|
| 3152 |
+
<option value="5px">5px</option>
|
| 3153 |
+
<option value="6px">6px</option>
|
| 3154 |
+
<option value="7px">7px</option>
|
| 3155 |
+
<option value="8px">8px</option>
|
| 3156 |
+
<option value="9px">9px</option>
|
| 3157 |
+
<option value="10px">10px</option>
|
| 3158 |
+
<option value="11px">11px</option>
|
| 3159 |
+
<option value="12px">12px</option>
|
| 3160 |
+
<option value="13px">13px</option>
|
| 3161 |
+
<option value="14px">14px</option>
|
| 3162 |
+
<option value="15px">15px</option>
|
| 3163 |
+
<option value="16px">16px</option>
|
| 3164 |
+
<option value="17px">17px</option>
|
| 3165 |
+
<option value="18px">18px</option>
|
| 3166 |
+
<option value="19px">19px</option>
|
| 3167 |
+
<option value="20px">20px</option>
|
| 3168 |
+
<option value="21px">21px</option>
|
| 3169 |
+
<option value="22px">22px</option>
|
| 3170 |
+
<option value="23px">23px</option>
|
| 3171 |
+
<option value="24px">24px</option>
|
| 3172 |
+
<option value="25px">25px</option>
|
| 3173 |
+
<option value="26px">26px</option>
|
| 3174 |
+
<option value="27px">27px</option>
|
| 3175 |
+
<option value="28px">28px</option>
|
| 3176 |
+
<option value="29px">29px</option>
|
| 3177 |
+
<option value="30px">30px</option>
|
| 3178 |
+
</select>
|
| 3179 |
+
</td>
|
| 3180 |
+
</tr>
|
| 3181 |
+
<tr>
|
| 3182 |
+
<td><?php _e( 'Bottom', 'polldaddy' ); ?>:</td>
|
| 3183 |
+
<td>
|
| 3184 |
+
<select id="margin-bottom" onchange="bind(this);">
|
| 3185 |
+
<option value="0px">0px</option>
|
| 3186 |
+
<option value="1px">1px</option>
|
| 3187 |
+
<option value="2px">2px</option>
|
| 3188 |
+
<option value="3px">3px</option>
|
| 3189 |
+
<option value="4px">4px</option>
|
| 3190 |
+
<option value="5px">5px</option>
|
| 3191 |
+
<option value="6px">6px</option>
|
| 3192 |
+
<option value="7px">7px</option>
|
| 3193 |
+
<option value="8px">8px</option>
|
| 3194 |
+
<option value="9px">9px</option>
|
| 3195 |
+
<option value="10px">10px</option>
|
| 3196 |
+
<option value="11px">11px</option>
|
| 3197 |
+
<option value="12px">12px</option>
|
| 3198 |
+
<option value="13px">13px</option>
|
| 3199 |
+
<option value="14px">14px</option>
|
| 3200 |
+
<option value="15px">15px</option>
|
| 3201 |
+
<option value="16px">16px</option>
|
| 3202 |
+
<option value="17px">17px</option>
|
| 3203 |
+
<option value="18px">18px</option>
|
| 3204 |
+
<option value="19px">19px</option>
|
| 3205 |
+
<option value="20px">20px</option>
|
| 3206 |
+
<option value="21px">21px</option>
|
| 3207 |
+
<option value="22px">22px</option>
|
| 3208 |
+
<option value="23px">23px</option>
|
| 3209 |
+
<option value="24px">24px</option>
|
| 3210 |
+
<option value="25px">25px</option>
|
| 3211 |
+
<option value="26px">26px</option>
|
| 3212 |
+
<option value="27px">27px</option>
|
| 3213 |
+
<option value="28px">28px</option>
|
| 3214 |
+
<option value="29px">29px</option>
|
| 3215 |
+
<option value="30px">30px</option>
|
| 3216 |
+
</select>
|
| 3217 |
+
</td>
|
| 3218 |
+
</tr>
|
| 3219 |
+
<tr>
|
| 3220 |
+
<td><?php _e( 'Left', 'polldaddy' ); ?>:</td>
|
| 3221 |
+
<td>
|
| 3222 |
+
<select id="margin-left" onchange="bind(this);">
|
| 3223 |
+
<option value="0px">0px</option>
|
| 3224 |
+
<option value="1px">1px</option>
|
| 3225 |
+
<option value="2px">2px</option>
|
| 3226 |
+
<option value="3px">3px</option>
|
| 3227 |
+
<option value="4px">4px</option>
|
| 3228 |
+
<option value="5px">5px</option>
|
| 3229 |
+
<option value="6px">6px</option>
|
| 3230 |
+
<option value="7px">7px</option>
|
| 3231 |
+
<option value="8px">8px</option>
|
| 3232 |
+
<option value="9px">9px</option>
|
| 3233 |
+
<option value="10px">10px</option>
|
| 3234 |
+
<option value="11px">11px</option>
|
| 3235 |
+
<option value="12px">12px</option>
|
| 3236 |
+
<option value="13px">13px</option>
|
| 3237 |
+
<option value="14px">14px</option>
|
| 3238 |
+
<option value="15px">15px</option>
|
| 3239 |
+
<option value="16px">16px</option>
|
| 3240 |
+
<option value="17px">17px</option>
|
| 3241 |
+
<option value="18px">18px</option>
|
| 3242 |
+
<option value="19px">19px</option>
|
| 3243 |
+
<option value="20px">20px</option>
|
| 3244 |
+
<option value="21px">21px</option>
|
| 3245 |
+
<option value="22px">22px</option>
|
| 3246 |
+
<option value="23px">23px</option>
|
| 3247 |
+
<option value="24px">24px</option>
|
| 3248 |
+
<option value="25px">25px</option>
|
| 3249 |
+
<option value="26px">26px</option>
|
| 3250 |
+
<option value="27px">27px</option>
|
| 3251 |
+
<option value="28px">28px</option>
|
| 3252 |
+
<option value="29px">29px</option>
|
| 3253 |
+
<option value="30px">30px</option>
|
| 3254 |
+
</select>
|
| 3255 |
+
</td>
|
| 3256 |
+
</tr>
|
| 3257 |
+
</table>
|
| 3258 |
+
<!-- Padding Table -->
|
| 3259 |
+
<table class="CSSE_edit" id="editPadding" style="display:none;">
|
| 3260 |
+
<tr>
|
| 3261 |
+
<td width="85"><?php _e( 'Top', 'polldaddy' ); ?>:</td>
|
| 3262 |
+
<td>
|
| 3263 |
+
<select id="padding-top" onchange="bind(this);">
|
| 3264 |
+
<option value="0px">0px</option>
|
| 3265 |
+
<option value="1px">1px</option>
|
| 3266 |
+
<option value="2px">2px</option>
|
| 3267 |
+
<option value="3px">3px</option>
|
| 3268 |
+
<option value="4px">4px</option>
|
| 3269 |
+
<option value="5px">5px</option>
|
| 3270 |
+
<option value="6px">6px</option>
|
| 3271 |
+
<option value="7px">7px</option>
|
| 3272 |
+
<option value="8px">8px</option>
|
| 3273 |
+
<option value="9px">9px</option>
|
| 3274 |
+
<option value="10px">10px</option>
|
| 3275 |
+
<option value="11px">11px</option>
|
| 3276 |
+
<option value="12px">12px</option>
|
| 3277 |
+
<option value="13px">13px</option>
|
| 3278 |
+
<option value="14px">14px</option>
|
| 3279 |
+
<option value="15px">15px</option>
|
| 3280 |
+
<option value="16px">16px</option>
|
| 3281 |
+
<option value="17px">17px</option>
|
| 3282 |
+
<option value="18px">18px</option>
|
| 3283 |
+
<option value="19px">19px</option>
|
| 3284 |
+
<option value="20px">20px</option>
|
| 3285 |
+
<option value="21px">21px</option>
|
| 3286 |
+
<option value="22px">22px</option>
|
| 3287 |
+
<option value="23px">23px</option>
|
| 3288 |
+
<option value="24px">24px</option>
|
| 3289 |
+
<option value="25px">25px</option>
|
| 3290 |
+
<option value="26px">26px</option>
|
| 3291 |
+
<option value="27px">27px</option>
|
| 3292 |
+
<option value="28px">28px</option>
|
| 3293 |
+
<option value="29px">29px</option>
|
| 3294 |
+
<option value="30px">30px</option>
|
| 3295 |
+
</select>
|
| 3296 |
+
</td>
|
| 3297 |
+
</tr>
|
| 3298 |
+
<tr>
|
| 3299 |
+
<td><?php _e( 'Right', 'polldaddy' ); ?>:</td>
|
| 3300 |
+
<td>
|
| 3301 |
+
<select id="padding-right" onchange="bind(this);">
|
| 3302 |
+
<option value="0px">0px</option>
|
| 3303 |
+
<option value="1px">1px</option>
|
| 3304 |
+
<option value="2px">2px</option>
|
| 3305 |
+
<option value="3px">3px</option>
|
| 3306 |
+
<option value="4px">4px</option>
|
| 3307 |
+
<option value="5px">5px</option>
|
| 3308 |
+
<option value="6px">6px</option>
|
| 3309 |
+
<option value="7px">7px</option>
|
| 3310 |
+
<option value="8px">8px</option>
|
| 3311 |
+
<option value="9px">9px</option>
|
| 3312 |
+
<option value="10px">10px</option>
|
| 3313 |
+
<option value="11px">11px</option>
|
| 3314 |
+
<option value="12px">12px</option>
|
| 3315 |
+
<option value="13px">13px</option>
|
| 3316 |
+
<option value="14px">14px</option>
|
| 3317 |
+
<option value="15px">15px</option>
|
| 3318 |
+
<option value="16px">16px</option>
|
| 3319 |
+
<option value="17px">17px</option>
|
| 3320 |
+
<option value="18px">18px</option>
|
| 3321 |
+
<option value="19px">19px</option>
|
| 3322 |
+
<option value="20px">20px</option>
|
| 3323 |
+
<option value="21px">21px</option>
|
| 3324 |
+
<option value="22px">22px</option>
|
| 3325 |
+
<option value="23px">23px</option>
|
| 3326 |
+
<option value="24px">24px</option>
|
| 3327 |
+
<option value="25px">25px</option>
|
| 3328 |
+
<option value="26px">26px</option>
|
| 3329 |
+
<option value="27px">27px</option>
|
| 3330 |
+
<option value="28px">28px</option>
|
| 3331 |
+
<option value="29px">29px</option>
|
| 3332 |
+
<option value="30px">30px</option>
|
| 3333 |
+
</select>
|
| 3334 |
+
</td>
|
| 3335 |
+
</tr>
|
| 3336 |
+
<tr>
|
| 3337 |
+
<td><?php _e( 'Bottom', 'polldaddy' ); ?>:</td>
|
| 3338 |
+
<td>
|
| 3339 |
+
<select id="padding-bottom" onchange="bind(this);">
|
| 3340 |
+
<option value="0px">0px</option>
|
| 3341 |
+
<option value="1px">1px</option>
|
| 3342 |
+
<option value="2px">2px</option>
|
| 3343 |
+
<option value="3px">3px</option>
|
| 3344 |
+
<option value="4px">4px</option>
|
| 3345 |
+
<option value="5px">5px</option>
|
| 3346 |
+
<option value="6px">6px</option>
|
| 3347 |
+
<option value="7px">7px</option>
|
| 3348 |
+
<option value="8px">8px</option>
|
| 3349 |
+
<option value="9px">9px</option>
|
| 3350 |
+
<option value="10px">10px</option>
|
| 3351 |
+
<option value="11px">11px</option>
|
| 3352 |
+
<option value="12px">12px</option>
|
| 3353 |
+
<option value="13px">13px</option>
|
| 3354 |
+
<option value="14px">14px</option>
|
| 3355 |
+
<option value="15px">15px</option>
|
| 3356 |
+
<option value="16px">16px</option>
|
| 3357 |
+
<option value="17px">17px</option>
|
| 3358 |
+
<option value="18px">18px</option>
|
| 3359 |
+
<option value="19px">19px</option>
|
| 3360 |
+
<option value="20px">20px</option>
|
| 3361 |
+
<option value="21px">21px</option>
|
| 3362 |
+
<option value="22px">22px</option>
|
| 3363 |
+
<option value="23px">23px</option>
|
| 3364 |
+
<option value="24px">24px</option>
|
| 3365 |
+
<option value="25px">25px</option>
|
| 3366 |
+
<option value="26px">26px</option>
|
| 3367 |
+
<option value="27px">27px</option>
|
| 3368 |
+
<option value="28px">28px</option>
|
| 3369 |
+
<option value="29px">29px</option>
|
| 3370 |
+
<option value="30px">30px</option>
|
| 3371 |
+
</select>
|
| 3372 |
+
</td>
|
| 3373 |
+
</tr>
|
| 3374 |
+
<tr>
|
| 3375 |
+
<td><?php _e( 'Left', 'polldaddy' ); ?>:</td>
|
| 3376 |
+
<td>
|
| 3377 |
+
<select id="padding-left" onchange="bind(this);">
|
| 3378 |
+
<option value="0px">0px</option>
|
| 3379 |
+
<option value="1px">1px</option>
|
| 3380 |
+
<option value="2px">2px</option>
|
| 3381 |
+
<option value="3px">3px</option>
|
| 3382 |
+
<option value="4px">4px</option>
|
| 3383 |
+
<option value="5px">5px</option>
|
| 3384 |
+
<option value="6px">6px</option>
|
| 3385 |
+
<option value="7px">7px</option>
|
| 3386 |
+
<option value="8px">8px</option>
|
| 3387 |
+
<option value="9px">9px</option>
|
| 3388 |
+
<option value="10px">10px</option>
|
| 3389 |
+
<option value="11px">11px</option>
|
| 3390 |
+
<option value="12px">12px</option>
|
| 3391 |
+
<option value="13px">13px</option>
|
| 3392 |
+
<option value="14px">14px</option>
|
| 3393 |
+
<option value="15px">15px</option>
|
| 3394 |
+
<option value="16px">16px</option>
|
| 3395 |
+
<option value="17px">17px</option>
|
| 3396 |
+
<option value="18px">18px</option>
|
| 3397 |
+
<option value="19px">19px</option>
|
| 3398 |
+
<option value="20px">20px</option>
|
| 3399 |
+
<option value="21px">21px</option>
|
| 3400 |
+
<option value="22px">22px</option>
|
| 3401 |
+
<option value="23px">23px</option>
|
| 3402 |
+
<option value="24px">24px</option>
|
| 3403 |
+
<option value="25px">25px</option>
|
| 3404 |
+
<option value="26px">26px</option>
|
| 3405 |
+
<option value="27px">27px</option>
|
| 3406 |
+
<option value="28px">28px</option>
|
| 3407 |
+
<option value="29px">29px</option>
|
| 3408 |
+
<option value="30px">30px</option>
|
| 3409 |
+
</select>
|
| 3410 |
+
</td>
|
| 3411 |
+
</tr>
|
| 3412 |
+
</table>
|
| 3413 |
+
<!-- Scale Table -->
|
| 3414 |
+
<table class="CSSE_edit" id="editScale" style="display:none;">
|
| 3415 |
+
<tr>
|
| 3416 |
+
<td width="85"><?php _e( 'Width', 'polldaddy' ); ?> (px): <a href="http://support.polldaddy.com/custom-poll-styles/" class="noteLink" title="<?php _e( 'Click here for more information', 'polldaddy' ); ?>">(?)</a></td>
|
| 3417 |
+
<td>
|
| 3418 |
+
<input type="text" maxlength="4" class="elmColor" id="width" onblur="bind(this);"/>
|
| 3419 |
+
</td>
|
| 3420 |
+
</tr>
|
| 3421 |
+
<tr>
|
| 3422 |
+
<td width="85"></td>
|
| 3423 |
+
<td>
|
| 3424 |
+
<?php _e( 'If you change the width of the<br/> poll you may also need to change<br/> the width of your answers.', 'polldaddy' ); ?>
|
| 3425 |
+
</td>
|
| 3426 |
+
</tr>
|
| 3427 |
+
</table>
|
| 3428 |
+
|
| 3429 |
+
<!-- Height Table -->
|
| 3430 |
+
<table class="CSSE_edit" id="editHeight" style="display:none;">
|
| 3431 |
+
<tr>
|
| 3432 |
+
<td width="85"><?php _e( 'Height', 'polldaddy' ); ?> (px):</td>
|
| 3433 |
+
<td>
|
| 3434 |
+
<input type="text" maxlength="4" class="elmColor" id="height" onblur="bind(this);"/>
|
| 3435 |
+
</td>
|
| 3436 |
+
</tr>
|
| 3437 |
+
</table>
|
| 3438 |
+
|
| 3439 |
+
<table class="CSSE_edit" id="editPosition" style="display:none;">
|
| 3440 |
+
<tr>
|
| 3441 |
+
<td width="85"><?php _e( 'Position', 'polldaddy' ); ?> (px):</td>
|
| 3442 |
+
<td>
|
| 3443 |
+
<select class="set-width" id="float" onchange="bind(this);">
|
| 3444 |
+
<option value="left">Left</option>
|
| 3445 |
+
<option value="right">Right</option>
|
| 3446 |
+
</select>
|
| 3447 |
+
<input type="hidden" id="position" />
|
| 3448 |
+
<input type="hidden" id="direction" />
|
| 3449 |
+
</td>
|
| 3450 |
+
</tr>
|
| 3451 |
+
</table>
|
| 3452 |
+
</td>
|
| 3453 |
+
</tr>
|
| 3454 |
+
<tr>
|
| 3455 |
+
<td class="btm"/>
|
| 3456 |
+
</tr>
|
| 3457 |
+
</table>
|
| 3458 |
+
</td>
|
| 3459 |
+
</tr>
|
| 3460 |
+
</table>
|
| 3461 |
+
</td>
|
| 3462 |
+
<td width="10"> </td>
|
| 3463 |
+
<td valign="top">
|
| 3464 |
+
<div style="overflow-x:auto;">
|
| 3465 |
+
<!-- POLL XHTML START -->
|
| 3466 |
+
<div class="pds-box" id="pds-box">
|
| 3467 |
+
<div class="pds-box-outer">
|
| 3468 |
+
<div class="pds-box-inner">
|
| 3469 |
+
<div class="pds-box-top">
|
| 3470 |
+
<div class="pds-question">
|
| 3471 |
+
<div class="pds-question-outer">
|
| 3472 |
+
<div class="pds-question-inner">
|
| 3473 |
+
<div class="pds-question-top" id="pds-question-top"><?php _e( 'Do you mostly use the internet at work, in school or at home?', 'polldaddy' ); ?></div>
|
| 3474 |
+
</div>
|
| 3475 |
+
</div>
|
| 3476 |
+
</div>
|
| 3477 |
+
<div>
|
| 3478 |
+
<!-- divAnswers -->
|
| 3479 |
+
<div id="divAnswers">
|
| 3480 |
+
<span id="pds-answer143974">
|
| 3481 |
+
|
| 3482 |
+
<span class="pds-answer-group" id="pds-answer-group">
|
| 3483 |
+
<span class="pds-answer-input" id="pds-answer-input">
|
| 3484 |
+
<input type="radio" name="PDI_answer" value="1" id="p1" class="pds-checkbox"/>
|
| 3485 |
+
</span>
|
| 3486 |
+
<label for="p1" class="pds-answer" id="pds-answer"><span class="pds-answer-span"><?php _e( 'I use it in school.', 'polldaddy' ); ?></span></label>
|
| 3487 |
+
<span class="pds-clear"></span>
|
| 3488 |
+
</span>
|
| 3489 |
+
|
| 3490 |
+
<span class="pds-answer-group" id="pds-answer-group1">
|
| 3491 |
+
<span class="pds-answer-input" id="pds-answer-input1">
|
| 3492 |
+
<input type="radio" name="PDI_answer" value="2" id="p2" class="pds-checkbox"/>
|
| 3493 |
+
</span>
|
| 3494 |
+
<label for="p2" class="pds-answer" id="pds-answer1"><span class="pds-answer-span"><?php _e( 'I use it at home.', 'polldaddy' ); ?></span></label>
|
| 3495 |
+
<span class="pds-clear"></span>
|
| 3496 |
+
</span>
|
| 3497 |
+
|
| 3498 |
+
<span class="pds-answer-group" id="pds-answer-group2">
|
| 3499 |
+
<span class="pds-answer-input" id="pds-answer-input2">
|
| 3500 |
+
<input type="radio" name="PDI_answer" value="3" id="p3" class="pds-checkbox"/>
|
| 3501 |
+
</span>
|
| 3502 |
+
<label for="p3" class="pds-answer" id="pds-answer2"><span class="pds-answer-span"><?php _e( 'I use it every where I go, at work and home and anywhere else that I can!', 'polldaddy' ); ?></span></label>
|
| 3503 |
+
<span class="pds-clear"></span>
|
| 3504 |
+
</span>
|
| 3505 |
+
|
| 3506 |
+
<span class="pds-answer-group" id="pds-answer-group3">
|
| 3507 |
+
<span class="pds-answer-input" id="pds-answer-input3">
|
| 3508 |
+
<input type="radio" name="PDI_answer" value="4" id="p4" class="pds-checkbox"/>
|
| 3509 |
+
</span>
|
| 3510 |
+
<label for="p4" class="pds-answer" id="pds-answer3"><span class="pds-answer-span"><?php _e( 'Other', 'polldaddy' ); ?>:</span></label>
|
| 3511 |
+
<span class="pds-clear"></span>
|
| 3512 |
+
<span class="pds-answer-other">
|
| 3513 |
+
<input type="text" name="PDI_OtherText1761982" id="pds-textfield" maxlength="80" class="pds-textfield"/>
|
| 3514 |
+
</span>
|
| 3515 |
+
<span class="pds-clear"></span>
|
| 3516 |
+
</span>
|
| 3517 |
+
|
| 3518 |
+
</span>
|
| 3519 |
+
<br/>
|
| 3520 |
+
<div class="pds-vote" id="pds-links">
|
| 3521 |
+
<div class="pds-votebutton-outer">
|
| 3522 |
+
<a href="javascript:renderStyleEdit('pds-answer-feedback');" id="pds-vote-button" style="display:block;float:left;" class="pds-vote-button"><span><?php _e( 'Vote', 'polldaddy' ); ?></span></a>
|
| 3523 |
+
<span class="pds-links">
|
| 3524 |
+
<div style="padding: 0px 0px 0px 15px; float:left;"><a href="javascript:renderStyleEdit('pds-answer-feedback');" class="pds-link" id="pds-link"><?php _e( 'View Results', 'polldaddy' ); ?></a></div>
|
| 3525 |
+
<span class="pds-clear"></span>
|
| 3526 |
+
</span>
|
| 3527 |
+
<span class="pds-clear"></span>
|
| 3528 |
+
</div>
|
| 3529 |
+
</div>
|
| 3530 |
+
|
| 3531 |
+
</div>
|
| 3532 |
+
<!-- End divAnswers -->
|
| 3533 |
+
<!-- divResults -->
|
| 3534 |
+
<div id="divResults">
|
| 3535 |
+
|
| 3536 |
+
<div class="pds-feedback-group" id="pds-feedback-group" >
|
| 3537 |
+
<label class="pds-feedback-label" id="pds-feedback-label">
|
| 3538 |
+
<span class="pds-answer-text" id="pds-answer-text"><?php _e( 'I use it in school!', 'polldaddy' ); ?></span>
|
| 3539 |
+
<span class="pds-feedback-result" id="pds-feedback-result">
|
| 3540 |
+
<span class="pds-feedback-per" id="pds-feedback-per"> 46%</span> <span class="pds-feedback-votes" id="pds-feedback-votes"> <?php printf( __( '(%d votes)', 'polldaddy' ), 620 ); ?></span>
|
| 3541 |
+
</span>
|
| 3542 |
+
</label>
|
| 3543 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3544 |
+
<div class="pds-answer-feedback" id="pds-answer-feedback">
|
| 3545 |
+
<div style="width:46%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar"></div>
|
| 3546 |
+
</div>
|
| 3547 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3548 |
+
</div>
|
| 3549 |
+
|
| 3550 |
+
<div class="pds-feedback-group" id="pds-feedback-group1">
|
| 3551 |
+
<label class="pds-feedback-label" id="pds-feedback-label1">
|
| 3552 |
+
<span class="pds-answer-text" id="pds-answer-text1"><?php _e( 'I use it at home.', 'polldaddy' ); ?></span>
|
| 3553 |
+
<span class="pds-feedback-result" id="pds-feedback-result1">
|
| 3554 |
+
<span class="pds-feedback-per" id="pds-feedback-per1"> 30%</span> <span class="pds-feedback-votes" id="pds-feedback-votes1"> <?php printf( __( '(%d votes)', 'polldaddy' ), 400 ); ?></span>
|
| 3555 |
+
</span>
|
| 3556 |
+
</label>
|
| 3557 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3558 |
+
<div class="pds-answer-feedback" id="pds-answer-feedback1">
|
| 3559 |
+
<div style="width:30%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar1"></div>
|
| 3560 |
+
</div>
|
| 3561 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3562 |
+
</div>
|
| 3563 |
+
|
| 3564 |
+
<div class="pds-feedback-group" id="pds-feedback-group2">
|
| 3565 |
+
<label class="pds-feedback-label" id="pds-feedback-label2">
|
| 3566 |
+
<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>
|
| 3567 |
+
<span class="pds-feedback-result" id="pds-feedback-result2">
|
| 3568 |
+
<span class="pds-feedback-per" id="pds-feedback-per2"> 16%</span> <span class="pds-feedback-votes" id="pds-feedback-votes2"> <?php printf( __( '(%d votes)', 'polldaddy' ), 220 ); ?></span>
|
| 3569 |
+
</span>
|
| 3570 |
+
</label>
|
| 3571 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3572 |
+
<div class="pds-answer-feedback" id="pds-answer-feedback2">
|
| 3573 |
+
<div style="width:16%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar2"></div>
|
| 3574 |
+
</div>
|
| 3575 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3576 |
+
</div>
|
| 3577 |
+
|
| 3578 |
+
<div class="pds-feedback-group" id="pds-feedback-group3">
|
| 3579 |
+
<label class="pds-feedback-label" id="pds-feedback-label3">
|
| 3580 |
+
<span class="pds-answer-text" id="pds-answer-text3"><?php _e( 'Other', 'polldaddy' ); ?></span>
|
| 3581 |
+
<span class="pds-feedback-result" id="pds-feedback-result3">
|
| 3582 |
+
<span class="pds-feedback-per" id="pds-feedback-per3"> 8%</span> <span class="pds-feedback-votes" id="pds-feedback-votes3"> <?php printf( __( '(%d votes)', 'polldaddy' ), 110 ); ?></span>
|
| 3583 |
+
</span>
|
| 3584 |
+
</label>
|
| 3585 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3586 |
+
<div class="pds-answer-feedback" id="pds-answer-feedback3">
|
| 3587 |
+
<div style="width:8%" class="pds-answer-feedback-bar" id="pds-answer-feedback-bar3"></div>
|
| 3588 |
+
</div>
|
| 3589 |
+
<span style="display: block;clear: both;height:1px;line-height:1px;" class="pds-clear"> </span>
|
| 3590 |
+
</div>
|
| 3591 |
+
|
| 3592 |
+
</div>
|
| 3593 |
+
<!-- End divResults -->
|
| 3594 |
+
<span class="pds-clear"></span>
|
| 3595 |
+
<div style="height: 10px;"></div>
|
| 3596 |
+
<div id="pds-totalvotes-inner"><?php _e( 'Total Votes', 'polldaddy' ); ?>: <strong>1,350</strong></div>
|
| 3597 |
+
</div>
|
| 3598 |
+
<div class="pds-vote" id="pds-links-back">
|
| 3599 |
+
<div class="pds-totalvotes-outer">
|
| 3600 |
+
<span class="pds-links-back">
|
| 3601 |
+
<br/>
|
| 3602 |
+
<a href="javascript:" class="pds-link" id="pds-link1"><?php _e( 'Comments', 'polldaddy' ); ?> <strong>(19)</strong></a>
|
| 3603 |
+
<xsl:text> </xsl:text>
|
| 3604 |
+
<a href="javascript:renderStyleEdit('pds-box');" class="pds-link" id="pds-link2"><?php _e( 'Return To Poll', 'polldaddy' ); ?></a>
|
| 3605 |
+
<span class="pds-clear"></span>
|
| 3606 |
+
</span>
|
| 3607 |
+
<span class="pds-clear"></span>
|
| 3608 |
+
</div>
|
| 3609 |
+
</div>
|
| 3610 |
+
</div>
|
| 3611 |
+
</div>
|
| 3612 |
+
</div>
|
| 3613 |
+
</div>
|
| 3614 |
+
<!-- POLL XHTML END -->
|
| 3615 |
+
</div>
|
| 3616 |
+
</td>
|
| 3617 |
+
</tr>
|
| 3618 |
+
</table>
|
| 3619 |
+
<div id="editBox"></div>
|
| 3620 |
+
<p class="pds-clear"></p>
|
| 3621 |
+
<p>
|
| 3622 |
+
<?php wp_nonce_field( $style_id > 1000 ? "edit-style$style_id" : 'create-style' ); ?>
|
| 3623 |
+
<input type="hidden" name="action" value="<?php echo $style_id > 1000 ? 'edit-style' : 'create-style'; ?>" />
|
| 3624 |
+
<input type="hidden" class="polldaddy-style-id" name="style" value="<?php echo $style_id; ?>" />
|
| 3625 |
+
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Save Style', 'polldaddy' ) ); ?>" />
|
| 3626 |
+
<?php if ( $style_id > 1000 ) { ?>
|
| 3627 |
+
<input name="updatePollCheck" id="updatePollCheck" type="checkbox"> <label for="updatePollCheck"><?php _e( 'Check this box if you wish to update the polls that use this style.', 'polldaddy' ); ?></label>
|
| 3628 |
+
<?php } ?>
|
| 3629 |
+
</p>
|
| 3630 |
+
</div>
|
| 3631 |
+
</div>
|
| 3632 |
+
<textarea id="S_www" name="CSSXML" style="display:none;width: 1000px; height: 500px;" rows="10" cols="10"> </textarea>
|
| 3633 |
+
</form>
|
| 3634 |
+
<script language="javascript">
|
| 3635 |
+
jQuery( document ).ready(function(){
|
| 3636 |
+
plugin = new Plugin( {
|
| 3637 |
+
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 3638 |
+
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 3639 |
+
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 3640 |
+
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 3641 |
+
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 3642 |
+
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 3643 |
+
} );
|
| 3644 |
+
});
|
| 3645 |
+
pd_map = {
|
| 3646 |
+
thankyou : '<?php echo esc_attr( __( 'Thank you for voting!', 'polldaddy' ) ); ?>',
|
| 3647 |
+
question : '<?php echo esc_attr( __( 'Do you mostly use the internet at work, in school or at home?', 'polldaddy' ) ); ?>'
|
| 3648 |
+
}
|
| 3649 |
+
</script>
|
| 3650 |
+
<script type="text/javascript" language="javascript">window.onload = function() {
|
| 3651 |
+
var CSSXML;
|
| 3652 |
+
loadStyle();
|
| 3653 |
+
showResults( false );
|
| 3654 |
+
renderStyleEdit( _$('styleName').value );
|
| 3655 |
+
}</script>
|
| 3656 |
+
<br class="clear" />
|
| 3657 |
+
|
| 3658 |
+
<?php
|
| 3659 |
+
}
|
| 3660 |
+
|
| 3661 |
+
function rating_settings() {
|
| 3662 |
+
global $action, $rating;
|
| 3663 |
+
$rich_snippets = $show_posts = $show_posts_index = $show_pages = $show_comments = $pos_posts = $pos_posts_index = $pos_pages = $pos_comments = 0;
|
| 3664 |
+
$show_settings = $rating_updated = ( $action == 'update-rating' ? true : false );
|
| 3665 |
+
$error = false;
|
| 3666 |
+
|
| 3667 |
+
$settings_style = 'display: none;';
|
| 3668 |
+
if ( $show_settings )
|
| 3669 |
+
$settings_style = 'display: block;';
|
| 3670 |
+
|
| 3671 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 3672 |
+
$report_type = 'posts';
|
| 3673 |
+
$updated = false;
|
| 3674 |
+
|
| 3675 |
+
if ( isset( $rating ) ) {
|
| 3676 |
+
switch ( $rating ) {
|
| 3677 |
+
case 'pages':
|
| 3678 |
+
$report_type = 'pages';
|
| 3679 |
+
$rating_id = (int) get_option( 'pd-rating-pages-id' );
|
| 3680 |
+
break;
|
| 3681 |
+
case 'comments':
|
| 3682 |
+
$report_type = 'comments';
|
| 3683 |
+
$rating_id = (int) get_option( 'pd-rating-comments-id' );
|
| 3684 |
+
break;
|
| 3685 |
+
case 'posts':
|
| 3686 |
+
$report_type = 'posts';
|
| 3687 |
+
$rating_id = (int) get_option( 'pd-rating-posts-id' );
|
| 3688 |
+
break;
|
| 3689 |
+
}//end switch
|
| 3690 |
+
}
|
| 3691 |
+
|
| 3692 |
+
$new_type = 0;
|
| 3693 |
+
if ( $report_type == 'comments' )
|
| 3694 |
+
$new_type = 1;
|
| 3695 |
+
|
| 3696 |
+
$blog_name = get_option( 'blogname' );
|
| 3697 |
+
|
| 3698 |
+
if ( empty( $blog_name ) )
|
| 3699 |
+
$blog_name = 'WordPress Blog';
|
| 3700 |
+
$blog_name .= ' - ' . $report_type;
|
| 3701 |
+
|
| 3702 |
+
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) )
|
| 3703 |
+
return false;
|
| 3704 |
+
|
| 3705 |
+
if ( $this->rating_user_code == '' )
|
| 3706 |
+
die();
|
| 3707 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 3708 |
+
$polldaddy->reset();
|
| 3709 |
+
|
| 3710 |
+
$error = false;
|
| 3711 |
+
$rating_errors = array();
|
| 3712 |
+
if ( empty( $rating_id ) ) {
|
| 3713 |
+
$pd_rating = $polldaddy->create_rating( $blog_name , $new_type );
|
| 3714 |
+
if ( !empty( $pd_rating ) ) {
|
| 3715 |
+
$rating_id = (int) $pd_rating->_id;
|
| 3716 |
+
update_option ( 'pd-rating-' . $report_type . '-id', $rating_id );
|
| 3717 |
+
update_option ( 'pd-rating-' . $report_type, 0 );
|
| 3718 |
+
} else {
|
| 3719 |
+
$rating_errors[] = $polldaddy->errors;
|
| 3720 |
+
}
|
| 3721 |
+
} else
|
| 3722 |
+
$pd_rating = $polldaddy->get_rating( $rating_id );
|
| 3723 |
+
|
| 3724 |
+
if ( empty( $pd_rating ) || (int) $pd_rating->_id == 0 ) {
|
| 3725 |
+
|
| 3726 |
+
$this->log( 'rating_settings: unable to get rating id - '.$rating_id );
|
| 3727 |
+
|
| 3728 |
+
if ( $polldaddy->errors ) {
|
| 3729 |
+
if ( array_key_exists( 4, $polldaddy->errors ) ) { //Obsolete key
|
| 3730 |
+
$this->log( 'rating_settings: obsolete key - '.$this->rating_user_code );
|
| 3731 |
+
$this->rating_user_code = '';
|
| 3732 |
+
update_option( 'pd-rating-usercode', '' );
|
| 3733 |
+
$this->set_api_user_code(); // get latest key
|
| 3734 |
+
|
| 3735 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 3736 |
+
$polldaddy->reset();
|
| 3737 |
+
$pd_rating = $polldaddy->get_rating( $rating_id ); //see it exists
|
| 3738 |
+
$rating_errors[] = $polldaddy->errors;
|
| 3739 |
+
|
| 3740 |
+
if ( empty( $pd_rating ) || (int) $pd_rating->_id == 0 ) { //if not then create a rating for blog
|
| 3741 |
+
$polldaddy->reset();
|
| 3742 |
+
$pd_rating = $polldaddy->create_rating( $blog_name , $new_type );
|
| 3743 |
+
$rating_errors[] = $polldaddy->errors;
|
| 3744 |
+
}
|
| 3745 |
+
} elseif ( isset( $polldaddy->errors[ -1 ] ) && $polldaddy->errors[ -1 ] == "Can't connect" ) {
|
| 3746 |
+
$this->contact_support_message( __( 'Could not connect to the Polldaddy API' ), $rating_errors );
|
| 3747 |
+
$error = true;
|
| 3748 |
+
} elseif ( isset( $polldaddy->errors[ -1 ] ) && $polldaddy->errors[ -1 ] == "Invalid API URL" ) {
|
| 3749 |
+
$this->contact_support_message( __( 'The API URL is incorrect' ), $rating_errors );
|
| 3750 |
+
$error = true;
|
| 3751 |
+
} elseif ( isset( $polldaddy->errors[ -2 ] ) && $polldaddy->errors[ -2 ] == "No Data" ) {
|
| 3752 |
+
$this->contact_support_message( __( 'Your API request did not return any data' ), $rating_errors );
|
| 3753 |
+
$error = true;
|
| 3754 |
+
}
|
| 3755 |
+
}
|
| 3756 |
+
|
| 3757 |
+
if ( $error == false && empty( $pd_rating ) ) { //something's up!
|
| 3758 |
+
$this->contact_support_message( __( 'There was an error creating your rating widget' ), $rating_errors );
|
| 3759 |
+
$error = true;
|
| 3760 |
+
} else {
|
| 3761 |
+
$rating_id = (int) $pd_rating->_id;
|
| 3762 |
+
update_option ( 'pd-rating-' . $report_type . '-id', $rating_id );
|
| 3763 |
+
update_option ( 'pd-rating-' . $report_type, 0 );
|
| 3764 |
+
|
| 3765 |
+
switch ( $report_type ) {
|
| 3766 |
+
case 'posts':
|
| 3767 |
+
$show_posts = 0;
|
| 3768 |
+
break;
|
| 3769 |
+
case 'pages':
|
| 3770 |
+
$show_pages = 0;
|
| 3771 |
+
break;
|
| 3772 |
+
case 'comments':
|
| 3773 |
+
$show_comments = 0;
|
| 3774 |
+
break;
|
| 3775 |
+
}//end switch
|
| 3776 |
+
}
|
| 3777 |
+
}
|
| 3778 |
+
|
| 3779 |
+
if ( isset( $_POST[ 'pd_rating_action_type' ] ) ) {
|
| 3780 |
+
check_admin_referer( 'action-rating_settings_' . $_POST[ 'pd_rating_action_type' ] );
|
| 3781 |
+
|
| 3782 |
+
switch ( $_POST[ 'pd_rating_action_type' ] ) {
|
| 3783 |
+
case 'posts' :
|
| 3784 |
+
if ( isset( $_POST[ 'pd_rich_snippets' ] ) && (int) $_POST[ 'pd_rich_snippets' ] == 1 )
|
| 3785 |
+
$rich_snippets = 1;
|
| 3786 |
+
|
| 3787 |
+
update_option( 'pd-rich-snippets', $rich_snippets );
|
| 3788 |
+
|
| 3789 |
+
if ( isset( $_POST[ 'pd_show_posts' ] ) && (int) $_POST[ 'pd_show_posts' ] == 1 )
|
| 3790 |
+
$show_posts = get_option( 'pd-rating-posts-id' );
|
| 3791 |
+
|
| 3792 |
+
update_option( 'pd-rating-posts', $show_posts );
|
| 3793 |
+
|
| 3794 |
+
if ( isset( $_POST[ 'pd_show_posts_index' ] ) && (int) $_POST[ 'pd_show_posts_index' ] == 1 )
|
| 3795 |
+
$show_posts_index = get_option( 'pd-rating-posts-id' );
|
| 3796 |
+
|
| 3797 |
+
update_option( 'pd-rating-posts-index', $show_posts_index );
|
| 3798 |
+
|
| 3799 |
+
if ( isset( $_POST[ 'posts_pos' ] ) && (int) $_POST[ 'posts_pos' ] == 1 )
|
| 3800 |
+
$pos_posts = 1;
|
| 3801 |
+
|
| 3802 |
+
update_option( 'pd-rating-posts-pos', $pos_posts );
|
| 3803 |
+
|
| 3804 |
+
if ( isset( $_POST[ 'posts_index_pos' ] ) && (int) $_POST[ 'posts_index_pos' ] == 1 )
|
| 3805 |
+
$pos_posts_index = 1;
|
| 3806 |
+
|
| 3807 |
+
update_option( 'pd-rating-posts-index-pos', $pos_posts_index );
|
| 3808 |
+
$rating_updated = true;
|
| 3809 |
+
break;
|
| 3810 |
+
|
| 3811 |
+
case 'pages';
|
| 3812 |
+
if ( isset( $_POST[ 'pd_show_pages' ] ) && (int) $_POST[ 'pd_show_pages' ] == 1 )
|
| 3813 |
+
$show_pages = get_option( 'pd-rating-pages-id' );
|
| 3814 |
+
|
| 3815 |
+
update_option( 'pd-rating-pages', $show_pages );
|
| 3816 |
+
|
| 3817 |
+
if ( isset( $_POST[ 'pages_pos' ] ) && (int) $_POST[ 'pages_pos' ] == 1 )
|
| 3818 |
+
$pos_pages = 1;
|
| 3819 |
+
|
| 3820 |
+
update_option( 'pd-rating-pages-pos', $pos_pages );
|
| 3821 |
+
$rating_updated = true;
|
| 3822 |
+
break;
|
| 3823 |
+
|
| 3824 |
+
case 'comments':
|
| 3825 |
+
if ( isset( $_POST[ 'pd_show_comments' ] ) && (int) $_POST[ 'pd_show_comments' ] == 1 )
|
| 3826 |
+
$show_comments = get_option( 'pd-rating-comments-id' );
|
| 3827 |
+
|
| 3828 |
+
update_option( 'pd-rating-comments', $show_comments );
|
| 3829 |
+
|
| 3830 |
+
if ( isset( $_POST[ 'comments_pos' ] ) && (int) $_POST[ 'comments_pos' ] == 1 )
|
| 3831 |
+
$pos_comments = 1;
|
| 3832 |
+
|
| 3833 |
+
update_option( 'pd-rating-comments-pos', $pos_comments );
|
| 3834 |
+
|
| 3835 |
+
$rating_updated = true;
|
| 3836 |
+
break;
|
| 3837 |
+
}//end switch
|
| 3838 |
+
}
|
| 3839 |
+
|
| 3840 |
+
$rich_snippets = (int) get_option( 'pd-rich-snippets', 1 );
|
| 3841 |
+
$show_posts = (int) get_option( 'pd-rating-posts' );
|
| 3842 |
+
$show_pages = (int) get_option( 'pd-rating-pages' );
|
| 3843 |
+
$show_comments = (int) get_option( 'pd-rating-comments' );
|
| 3844 |
+
$show_posts_index = (int) get_option( 'pd-rating-posts-index' );
|
| 3845 |
+
|
| 3846 |
+
$pos_posts = (int) get_option( 'pd-rating-posts-pos' );
|
| 3847 |
+
$pos_pages = (int) get_option( 'pd-rating-pages-pos' );
|
| 3848 |
+
$pos_comments = (int) get_option( 'pd-rating-comments-pos' );
|
| 3849 |
+
$pos_posts_index = (int) get_option( 'pd-rating-posts-index-pos' );
|
| 3850 |
+
|
| 3851 |
+
if ( !empty( $pd_rating ) ) {
|
| 3852 |
+
$settings_text = $pd_rating->settings;
|
| 3853 |
+
$settings = json_decode( $settings_text );
|
| 3854 |
+
|
| 3855 |
+
$popup_disabled = ( isset( $settings->popup ) && $settings->popup == 'off' );
|
| 3856 |
+
|
| 3857 |
+
$rating_type = 0;
|
| 3858 |
+
|
| 3859 |
+
if ( $settings->type == 'stars' )
|
| 3860 |
+
$rating_type = 0;
|
| 3861 |
+
else
|
| 3862 |
+
$rating_type = 1;
|
| 3863 |
+
|
| 3864 |
+
if ( empty( $settings->font_color ) )
|
| 3865 |
+
$settings->font_color = '#000000';
|
| 3866 |
+
}?>
|
| 3867 |
+
<div class="wrap">
|
| 3868 |
+
<div class="icon32" id="icon-options-general"><br/></div>
|
| 3869 |
+
<h2>
|
| 3870 |
+
<?php _e( 'Rating Settings', 'polldaddy' ); ?>
|
| 3871 |
+
</h2>
|
| 3872 |
+
<?php if ( $rating_updated )
|
| 3873 |
+
echo '<div class="updated"><p>'.__( 'Rating updated', 'polldaddy' ).'</p></div>';
|
| 3874 |
+
|
| 3875 |
+
if ( !$error ) { ?>
|
| 3876 |
+
<div id="side-sortables">
|
| 3877 |
+
<div id="categorydiv" class="categorydiv">
|
| 3878 |
+
<ul id="category-tabs" class="category-tabs wp-tab-bar"><?php
|
| 3879 |
+
$this_class = '';
|
| 3880 |
+
$posts_link = esc_url( add_query_arg( array( 'rating' => 'posts', 'message' => false ) ) );
|
| 3881 |
+
$pages_link = esc_url( add_query_arg( array( 'rating' => 'pages', 'message' => false ) ) );
|
| 3882 |
+
$comments_link = esc_url( add_query_arg( array( 'rating' => 'comments', 'message' => false ) ) );
|
| 3883 |
+
if ( $report_type == 'posts' )
|
| 3884 |
+
$this_class = ' class="tabs"';?>
|
| 3885 |
+
<li <?php echo $this_class; ?>><a tabindex="3" href="<?php echo $posts_link; ?>"><?php _e( 'Posts', 'polldaddy' );?></a></li><?php
|
| 3886 |
+
$this_class = '';
|
| 3887 |
+
if ( $report_type == 'pages' )
|
| 3888 |
+
$this_class = ' class="tabs"'; ?>
|
| 3889 |
+
<li <?php echo $this_class; ?>><a tabindex="3" href="<?php echo $pages_link; ?>"><?php _e( 'Pages', 'polldaddy' );?></a></li><?php
|
| 3890 |
+
$this_class = '';
|
| 3891 |
+
if ( $report_type == 'comments' )
|
| 3892 |
+
$this_class = ' class="tabs"'; ?>
|
| 3893 |
+
<li <?php echo $this_class; ?>><a href="<?php echo $comments_link; ?>"><?php _e( 'Comments', 'polldaddy' );?></a></li>
|
| 3894 |
+
</ul>
|
| 3895 |
+
<div class="tabs-panel" id="categories-all" style="background: #FFFFFF;height: auto; overflow: visible;max-height:500px;">
|
| 3896 |
+
<form action="" method="post">
|
| 3897 |
+
<input type="hidden" name="pd_rating_action_type" value="<?php echo $report_type; ?>" />
|
| 3898 |
+
<?php wp_nonce_field( 'action-rating_settings_' . $report_type ); ?>
|
| 3899 |
+
<table class="form-table" style="width: normal;">
|
| 3900 |
+
<tbody>
|
| 3901 |
+
<?php if ( $report_type == 'posts' ) { ?>
|
| 3902 |
+
<tr valign="top">
|
| 3903 |
+
<th scope="row"><label><?php _e( 'Rich Snippets in Search Results', 'polldaddy' );?></label></th>
|
| 3904 |
+
<td>
|
| 3905 |
+
<label><input type="checkbox" name="pd_rich_snippets" id="pd_rich_snippets" <?php if ( $rich_snippets == 1 ) echo ' checked="checked" '; ?> value="1" /> <?php printf( __( 'Display rich snippets in search results using post and page ratings (<a href="%s">documentation</a> and <a href="">page tester</a>)', 'polldaddy' ), 'https://support.google.com/webmasters/answer/99170', 'http://www.google.com/webmasters/tools/richsnippets' );?></label>
|
| 3906 |
+
<p><?php _e( 'Once activated, it may take several weeks before the snippets show up in Google search results.', 'polldaddy' );?></p>
|
| 3907 |
+
</td>
|
| 3908 |
+
</tr>
|
| 3909 |
+
<tr valign="top">
|
| 3910 |
+
<th scope="row"><label><?php _e( 'Show Ratings on', 'polldaddy' );?></label></th>
|
| 3911 |
+
<td>
|
| 3912 |
+
<label><input type="checkbox" name="pd_show_posts_index" id="pd_show_posts_index" <?php if ( $show_posts_index > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Front Page, Archive Pages, and Search Results', 'polldaddy' );?></label>
|
| 3913 |
+
<br><label><input type="checkbox" name="pd_show_posts" id="pd_show_posts" <?php if ( $show_posts > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Posts', 'polldaddy' );?></label>
|
| 3914 |
+
</td>
|
| 3915 |
+
</tr>
|
| 3916 |
+
<tr valign="top">
|
| 3917 |
+
<th scope="row"><label><?php _e( 'Position Front Page, Archive Pages, and Search Results Ratings', 'polldaddy' );?></label></th>
|
| 3918 |
+
<td>
|
| 3919 |
+
<select name="posts_index_pos"><?php
|
| 3920 |
+
$select = array( __( 'Above each blog post', 'polldaddy' ) => '0', __( 'Below each blog post', 'polldaddy' ) => '1' );
|
| 3921 |
+
foreach ( $select as $option => $value ) :
|
| 3922 |
+
$selected = '';
|
| 3923 |
+
if ( $value == $pos_posts_index )
|
| 3924 |
+
$selected = ' selected="selected"';
|
| 3925 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3926 |
+
endforeach;?>
|
| 3927 |
+
</select>
|
| 3928 |
+
</td>
|
| 3929 |
+
</tr>
|
| 3930 |
+
<tr valign="top">
|
| 3931 |
+
<th scope="row"><label><?php _e( 'Position Post Ratings', 'polldaddy' );?></label></th>
|
| 3932 |
+
<td>
|
| 3933 |
+
<select name="posts_pos"><?php
|
| 3934 |
+
$select = array( __( 'Above each blog post', 'polldaddy' ) => '0', __( 'Below each blog post', 'polldaddy' ) => '1' );
|
| 3935 |
+
foreach ( $select as $option => $value ) :
|
| 3936 |
+
$selected = '';
|
| 3937 |
+
if ( $value == $pos_posts )
|
| 3938 |
+
$selected = ' selected="selected"';
|
| 3939 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3940 |
+
endforeach;?>
|
| 3941 |
+
</select>
|
| 3942 |
+
</td>
|
| 3943 |
+
</tr><?php
|
| 3944 |
+
}
|
| 3945 |
+
if ( $report_type == 'pages' ) {?>
|
| 3946 |
+
<tr valign="top">
|
| 3947 |
+
<th scope="row"><label><?php _e( 'Show Ratings on', 'polldaddy' );?></label></th>
|
| 3948 |
+
<td>
|
| 3949 |
+
<label><input type="checkbox" name="pd_show_pages" id="pd_show_pages" <?php if ( $show_pages > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Pages', 'polldaddy' );?></label>
|
| 3950 |
+
</td>
|
| 3951 |
+
</tr>
|
| 3952 |
+
<tr valign="top">
|
| 3953 |
+
<th scope="row"><label><?php _e( 'Position Page Ratings', 'polldaddy' );?></label></th>
|
| 3954 |
+
<td>
|
| 3955 |
+
<select name="pages_pos"><?php
|
| 3956 |
+
$select = array( __( 'Above each blog page', 'polldaddy' ) => '0', __( 'Below each blog page', 'polldaddy' ) => '1' );
|
| 3957 |
+
foreach ( $select as $option => $value ) :
|
| 3958 |
+
$selected = '';
|
| 3959 |
+
if ( $value == $pos_pages )
|
| 3960 |
+
$selected = ' selected="selected"';
|
| 3961 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3962 |
+
endforeach;?>
|
| 3963 |
+
</select>
|
| 3964 |
+
</td>
|
| 3965 |
+
</tr><?php
|
| 3966 |
+
}
|
| 3967 |
+
if ( $report_type == 'comments' ) {?>
|
| 3968 |
+
<tr valign="top">
|
| 3969 |
+
<th scope="row"><label><?php _e( 'Show Ratings on', 'polldaddy' );?></label></th>
|
| 3970 |
+
<td>
|
| 3971 |
+
<label><input type="checkbox" name="pd_show_comments" id="pd_show_comments" <?php if ( $show_comments > 0 ) echo ' checked="checked" '; ?> value="1" /> <?php _e( 'Comments', 'polldaddy' );?></label>
|
| 3972 |
+
</td>
|
| 3973 |
+
</tr>
|
| 3974 |
+
<tr valign="top">
|
| 3975 |
+
<th scope="row"><label><?php _e( 'Position Comment Ratings', 'polldaddy' );?></label></th>
|
| 3976 |
+
<td>
|
| 3977 |
+
<select name="comments_pos"><?php
|
| 3978 |
+
$select = array( __( 'Above each comment', 'polldaddy' ) => '0', __( 'Below each comment', 'polldaddy' ) => '1' );
|
| 3979 |
+
foreach ( $select as $option => $value ) :
|
| 3980 |
+
$selected = '';
|
| 3981 |
+
if ( $value == $pos_comments )
|
| 3982 |
+
$selected = ' selected="selected"';
|
| 3983 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 3984 |
+
endforeach;?>
|
| 3985 |
+
</select>
|
| 3986 |
+
</td>
|
| 3987 |
+
</tr><?php
|
| 3988 |
+
} ?>
|
| 3989 |
+
<tr valign="top">
|
| 3990 |
+
<td height="30"><input class="button-primary" type="submit" value="<?php esc_attr_e( 'Save Changes', 'polldaddy' );?>" name="Submit" /></td>
|
| 3991 |
+
</tr>
|
| 3992 |
+
</tbody>
|
| 3993 |
+
</table>
|
| 3994 |
+
</form>
|
| 3995 |
+
<?php // check for previous settings
|
| 3996 |
+
$previous_settings = get_option( 'polldaddy_settings' );
|
| 3997 |
+
if ( get_option( 'pd-rating-posts-id' ) && get_option( 'pd-rating-posts-id' ) != $previous_settings[ 'pd-rating-posts-id' ] ) {
|
| 3998 |
+
echo "<p>" . sprintf( __( "Previous settings for ratings on this site discovered. You can restore them on the <a href='%s'>poll settings page</a> if your site is missing ratings after resetting your connection settings.", 'polldaddy' ), "options-general.php?page=polls&action=options" ) . "</p>";
|
| 3999 |
+
}
|
| 4000 |
+
?>
|
| 4001 |
+
</div>
|
| 4002 |
+
|
| 4003 |
+
<div style="padding:20px 0px 0px 0px"><?php
|
| 4004 |
+
if ( $report_type == 'posts' ) {
|
| 4005 |
+
if ( $show_posts > 0 || $show_posts_index > 0 )
|
| 4006 |
+
$show_settings = true;
|
| 4007 |
+
}
|
| 4008 |
+
if ( $report_type == 'pages' && $show_pages > 0 )
|
| 4009 |
+
$show_settings = true;
|
| 4010 |
+
if ( $report_type == 'comments' && $show_comments > 0 )
|
| 4011 |
+
$show_settings = true;
|
| 4012 |
+
if ( $show_settings == true )
|
| 4013 |
+
echo '<a href="javascript:" onclick="show_settings();">'.__( 'Advanced Settings', 'polldaddy' ).'</a>';?></div>
|
| 4014 |
+
</div>
|
| 4015 |
+
</div>
|
| 4016 |
+
|
| 4017 |
+
<?php if ( $show_settings == true ) { ?>
|
| 4018 |
+
<br />
|
| 4019 |
+
<form method="post" action="">
|
| 4020 |
+
<div id="poststuff" style="<?php echo $settings_style; ?>">
|
| 4021 |
+
<div class="has-sidebar has-right-sidebar">
|
| 4022 |
+
<div class="inner-sidebar-ratings">
|
| 4023 |
+
<div id="submitdiv" class="postbox ">
|
| 4024 |
+
<h3 class="hndle"><span><?php _e( 'Save Advanced Settings', 'polldaddy' );?></span></h3>
|
| 4025 |
+
|
| 4026 |
+
<div class="inside">
|
| 4027 |
+
<div class="submitbox" id="submitpost">
|
| 4028 |
+
<div id="minor-publishing" style="padding:10px;">
|
| 4029 |
+
<input type="submit" name="save_menu" id="save_menu_header" class="button button-primary menu-save" value="<?php echo esc_attr( __( 'Save Changes', 'polldaddy' ) );?>">
|
| 4030 |
+
<input type="hidden" name="type" value="<?php echo $report_type; ?>" />
|
| 4031 |
+
<input type="hidden" name="rating_id" value="<?php echo $rating_id; ?>" />
|
| 4032 |
+
<input type="hidden" name="action" value="update-rating" />
|
| 4033 |
+
</div>
|
| 4034 |
+
</div>
|
| 4035 |
+
</div>
|
| 4036 |
+
</div>
|
| 4037 |
+
<div class="postbox">
|
| 4038 |
+
<h3><?php _e( 'Preview', 'polldaddy' );?></h3>
|
| 4039 |
+
<div class="inside">
|
| 4040 |
+
<p><?php _e( 'This is a demo of what your rating widget will look like', 'polldaddy' ); ?>.</p>
|
| 4041 |
+
<p>
|
| 4042 |
+
<div id="pd_rating_holder_1"></div>
|
| 4043 |
+
</p>
|
| 4044 |
+
</div>
|
| 4045 |
+
</div>
|
| 4046 |
+
<div class="postbox">
|
| 4047 |
+
<h3><?php _e( 'Customize Labels', 'polldaddy' );?></h3>
|
| 4048 |
+
<div class="inside">
|
| 4049 |
+
<table width="99.5%">
|
| 4050 |
+
<tr>
|
| 4051 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Vote', 'polldaddy' );?></p></td>
|
| 4052 |
+
</tr>
|
| 4053 |
+
<tr>
|
| 4054 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_vote" id="text_vote" value="<?php echo empty( $settings->text_vote ) ? 'Vote' : esc_html( $settings->text_vote ); ?>" maxlength="20" />
|
| 4055 |
+
</tr>
|
| 4056 |
+
<tr>
|
| 4057 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Votes', 'polldaddy' );?></p></td>
|
| 4058 |
+
</tr>
|
| 4059 |
+
<tr>
|
| 4060 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_votes" id="text_votes" value="<?php echo empty( $settings->text_votes ) ? 'Votes' : esc_html( $settings->text_votes ); ?>" maxlength="20" />
|
| 4061 |
+
</tr>
|
| 4062 |
+
<tr>
|
| 4063 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Rate This', 'polldaddy' );?></p></td>
|
| 4064 |
+
</tr>
|
| 4065 |
+
<tr>
|
| 4066 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rate_this" id="text_rate_this" value="<?php echo empty( $settings->text_rate_this ) ? 'Rate This' : esc_html( $settings->text_rate_this ); ?>" maxlength="20" />
|
| 4067 |
+
</tr>
|
| 4068 |
+
<tr>
|
| 4069 |
+
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d star', 'polldaddy' ), 1 );?></p></td>
|
| 4070 |
+
</tr>
|
| 4071 |
+
<tr>
|
| 4072 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_1_star" id="text_1_star" value="<?php echo empty( $settings->text_1_star ) ? '1 star' : esc_html( $settings->text_1_star ); ?>" maxlength="20" />
|
| 4073 |
+
</tr>
|
| 4074 |
+
<tr>
|
| 4075 |
+
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 2 );?></p></td>
|
| 4076 |
+
</tr>
|
| 4077 |
+
<tr>
|
| 4078 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_2_star" id="text_2_star" value="<?php echo empty( $settings->text_2_star ) ? '2 stars' : esc_html( $settings->text_2_star ); ?>" maxlength="20" />
|
| 4079 |
+
</tr>
|
| 4080 |
+
<tr>
|
| 4081 |
+
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 3 );?></p></td>
|
| 4082 |
+
</tr>
|
| 4083 |
+
<tr>
|
| 4084 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_3_star" id="text_3_star" value="<?php echo empty( $settings->text_3_star ) ? '3 stars' : esc_html( $settings->text_3_star ); ?>" maxlength="20" />
|
| 4085 |
+
</tr>
|
| 4086 |
+
<tr>
|
| 4087 |
+
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 4 );?></p></td>
|
| 4088 |
+
</tr>
|
| 4089 |
+
<tr>
|
| 4090 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_4_star" id="text_4_star" value="<?php echo empty( $settings->text_4_star ) ? '4 stars' : esc_html( $settings->text_4_star ); ?>" maxlength="20" />
|
| 4091 |
+
</tr>
|
| 4092 |
+
<tr>
|
| 4093 |
+
<td><p style="margin-bottom: 0px;"><?php printf( __( '%d stars', 'polldaddy' ), 5 );?></p></td>
|
| 4094 |
+
</tr>
|
| 4095 |
+
<tr>
|
| 4096 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_5_star" id="text_5_star" value="<?php echo empty( $settings->text_5_star ) ? '5 stars' : esc_html( $settings->text_5_star ); ?>" maxlength="20" />
|
| 4097 |
+
</tr>
|
| 4098 |
+
<tr>
|
| 4099 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Thank You', 'polldaddy' );?></p></td>
|
| 4100 |
+
</tr>
|
| 4101 |
+
<tr>
|
| 4102 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_thank_you" id="text_thank_you" value="<?php echo empty( $settings->text_thank_you ) ? 'Thank You' : esc_html( $settings->text_thank_you ); ?>" maxlength="20" />
|
| 4103 |
+
</tr>
|
| 4104 |
+
<tr>
|
| 4105 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Rate Up', 'polldaddy' );?></p></td>
|
| 4106 |
+
</tr>
|
| 4107 |
+
<tr>
|
| 4108 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rate_up" id="text_rate_up" value="<?php echo empty( $settings->text_rate_up ) ? 'Rate Up' : esc_html( $settings->text_rate_up ); ?>" maxlength="20" />
|
| 4109 |
+
</tr>
|
| 4110 |
+
<tr>
|
| 4111 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Rate Down', 'polldaddy' );?></p></td>
|
| 4112 |
+
</tr>
|
| 4113 |
+
<tr>
|
| 4114 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rate_down" id="text_rate_down" value="<?php echo empty( $settings->text_rate_down ) ? 'Rate Down' : esc_html( $settings->text_rate_down ); ?>" maxlength="20" />
|
| 4115 |
+
</tr>
|
| 4116 |
+
<tr>
|
| 4117 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Most Popular Content', 'polldaddy' );?></p></td>
|
| 4118 |
+
</tr>
|
| 4119 |
+
<tr>
|
| 4120 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_popcontent" id="text_popcontent" value="<?php echo empty( $settings->text_popcontent ) ? 'Most Popular Content' : esc_html( $settings->text_popcontent ); ?>" maxlength="20" />
|
| 4121 |
+
</tr>
|
| 4122 |
+
<tr>
|
| 4123 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Close', 'polldaddy' );?></p></td>
|
| 4124 |
+
</tr>
|
| 4125 |
+
<tr>
|
| 4126 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_close" id="text_close" value="<?php echo empty( $settings->text_close ) ? 'Close' : esc_html( $settings->text_close ); ?>" maxlength="20" />
|
| 4127 |
+
</tr>
|
| 4128 |
+
<tr>
|
| 4129 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'All', 'polldaddy' );?></p></td>
|
| 4130 |
+
</tr>
|
| 4131 |
+
<tr>
|
| 4132 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_all" id="text_all" value="<?php echo empty( $settings->text_all ) ? 'All' : esc_html( $settings->text_all ); ?>" maxlength="20" />
|
| 4133 |
+
</tr>
|
| 4134 |
+
<tr>
|
| 4135 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Today', 'polldaddy' );?></p></td>
|
| 4136 |
+
</tr>
|
| 4137 |
+
<tr>
|
| 4138 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_today" id="text_today" value="<?php echo empty( $settings->text_today ) ? 'Today' : esc_html( $settings->text_today ); ?>" maxlength="20" />
|
| 4139 |
+
</tr>
|
| 4140 |
+
<tr>
|
| 4141 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'This Week', 'polldaddy' );?></p></td>
|
| 4142 |
+
</tr>
|
| 4143 |
+
<tr>
|
| 4144 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_thisweek" id="text_thisweek" value="<?php echo empty( $settings->text_thisweek ) ? 'This Week' : esc_html( $settings->text_thisweek ); ?>" maxlength="20" />
|
| 4145 |
+
</tr>
|
| 4146 |
+
<tr>
|
| 4147 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'This Month', 'polldaddy' );?></p></td>
|
| 4148 |
+
</tr>
|
| 4149 |
+
<tr>
|
| 4150 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_thismonth" id="text_thismonth" value="<?php echo empty( $settings->text_thismonth ) ? 'This Month' : esc_html( $settings->text_thismonth ); ?>" maxlength="20" />
|
| 4151 |
+
</tr>
|
| 4152 |
+
<tr>
|
| 4153 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'Rated', 'polldaddy' );?></p></td>
|
| 4154 |
+
</tr>
|
| 4155 |
+
<tr>
|
| 4156 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_rated" id="text_rated" value="<?php echo empty( $settings->text_rated ) ? 'Rated' : esc_html( $settings->text_rated ); ?>" maxlength="20" />
|
| 4157 |
+
</tr>
|
| 4158 |
+
<tr>
|
| 4159 |
+
<td><p style="margin-bottom: 0px;"><?php _e( 'There are no rated items for this period', 'polldaddy' );?></p></td>
|
| 4160 |
+
</tr>
|
| 4161 |
+
<tr>
|
| 4162 |
+
<td><input onblur="pd_bind(this);" type="text" style="width: 100%;" name="text_noratings" id="text_noratings" value="<?php echo empty( $settings->text_noratings ) ? 'There are no rated items for this period' : esc_html( $settings->text_noratings ); ?>" maxlength="50" />
|
| 4163 |
+
</tr>
|
| 4164 |
+
</table>
|
| 4165 |
+
</div>
|
| 4166 |
+
</div>
|
| 4167 |
+
</div>
|
| 4168 |
+
<div id="post-body-content" class="has-sidebar-content">
|
| 4169 |
+
<div class="postbox">
|
| 4170 |
+
<h3><?php _e( 'Rating Type', 'polldaddy' );?></h3>
|
| 4171 |
+
<div class="inside">
|
| 4172 |
+
<p><?php _e( 'Here you can choose how you want your rating to display. The 5 star rating is the most commonly used. The Nero rating is useful for keeping it simple.', 'polldaddy' ); ?></p>
|
| 4173 |
+
<ul>
|
| 4174 |
+
<li style="display: inline;margin-right: 10px;">
|
| 4175 |
+
<label for="stars"><?php
|
| 4176 |
+
$checked = '';
|
| 4177 |
+
if ( $settings->type == 'stars' )
|
| 4178 |
+
$checked = ' checked="checked"';?>
|
| 4179 |
+
<input type="radio" onchange="pd_change_type( 0 );" <?php echo $checked; ?> value="stars" id="stars" name="rating_type" />
|
| 4180 |
+
<?php printf( __( '%d Star Rating', 'polldaddy' ), 5 );?>
|
| 4181 |
+
</label>
|
| 4182 |
+
</li>
|
| 4183 |
+
<li style="display: inline;">
|
| 4184 |
+
<label><?php
|
| 4185 |
+
$checked = '';
|
| 4186 |
+
if ( $settings->type == 'nero' )
|
| 4187 |
+
$checked = ' checked="checked"';?>
|
| 4188 |
+
<input type="radio" onchange="pd_change_type( 1 );" <?php echo $checked; ?> value="nero" id="nero" name="rating_type" />
|
| 4189 |
+
<?php _e( 'Nero Rating', 'polldaddy' );?>
|
| 4190 |
+
</label>
|
| 4191 |
+
</li>
|
| 4192 |
+
</ul>
|
| 4193 |
+
</div>
|
| 4194 |
+
</div>
|
| 4195 |
+
<div class="postbox">
|
| 4196 |
+
<h3><?php _e( 'Rating Style', 'polldaddy' );?></h3>
|
| 4197 |
+
<div class="inside">
|
| 4198 |
+
<table>
|
| 4199 |
+
<tr>
|
| 4200 |
+
<td height="30" width="100" id="editor_star_size_text"><?php _e( 'Star Size', 'polldaddy' );?></td>
|
| 4201 |
+
<td>
|
| 4202 |
+
<select name="size" id="size" onchange="pd_bind(this);"><?php
|
| 4203 |
+
$select = array( __( 'Small', 'polldaddy' )." (16px)" => "sml", __( 'Medium', 'polldaddy' )." (20px)" => "med", __( 'Large', 'polldaddy' )." (24px)" => "lrg" );
|
| 4204 |
+
foreach ( $select as $option => $value ) :
|
| 4205 |
+
$selected = '';
|
| 4206 |
+
if ( $settings->size == $value )
|
| 4207 |
+
$selected = ' selected="selected"';
|
| 4208 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4209 |
+
endforeach;?>
|
| 4210 |
+
</select>
|
| 4211 |
+
</td>
|
| 4212 |
+
</tr>
|
| 4213 |
+
<tr>
|
| 4214 |
+
<td height="30" id="editor_star_color_text"><?php echo 'bubu'; _e( 'Star Color', 'polldaddy' );?></td>
|
| 4215 |
+
<td>
|
| 4216 |
+
<select name="star_color" id="star_color" onchange="pd_bind(this);" style="display: none;"><?php
|
| 4217 |
+
$select = array( __( 'Yellow', 'polldaddy' ) => "yellow", __( 'Red', 'polldaddy' ) => "red", __( 'Blue', 'polldaddy' ) => "blue", __( 'Green', 'polldaddy' ) => "green", __( 'Grey', 'polldaddy' ) => "grey" );
|
| 4218 |
+
foreach ( $select as $option => $value ) :
|
| 4219 |
+
$selected = '';
|
| 4220 |
+
if ( $settings->star_color == $value )
|
| 4221 |
+
$selected = ' selected="selected"';
|
| 4222 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4223 |
+
endforeach;?>
|
| 4224 |
+
</select>
|
| 4225 |
+
<select name="nero_style" id="nero_style" onchange="pd_bind(this);" style="display: none;"><?php
|
| 4226 |
+
$select = array( __( 'Hand', 'polldaddy' ) => "hand" );
|
| 4227 |
+
foreach ( $select as $option => $value ) :
|
| 4228 |
+
$selected = '';
|
| 4229 |
+
if ( $settings->star_color == $value )
|
| 4230 |
+
$selected = ' selected="selected"';
|
| 4231 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4232 |
+
endforeach;?>
|
| 4233 |
+
</select>
|
| 4234 |
+
</td>
|
| 4235 |
+
</tr>
|
| 4236 |
+
<tr>
|
| 4237 |
+
<td height="30"><?php _e( 'Custom Image', 'polldaddy' );?></td>
|
| 4238 |
+
<td><input type="text" onblur="pd_bind(this);" name="custom_star" id="custom_star" value="<?php echo esc_url( $settings->custom_star ); ?>" maxlength="200" />
|
| 4239 |
+
</tr>
|
| 4240 |
+
</table>
|
| 4241 |
+
</div>
|
| 4242 |
+
</div>
|
| 4243 |
+
<div class="postbox">
|
| 4244 |
+
<h3><?php _e( 'Text Layout & Font', 'polldaddy' );?></h3>
|
| 4245 |
+
<div class="inside">
|
| 4246 |
+
<table>
|
| 4247 |
+
<tr>
|
| 4248 |
+
<td width="100" height="30"><?php _e( 'Align', 'polldaddy' );?></td>
|
| 4249 |
+
<td>
|
| 4250 |
+
<select id="font_align" onchange="pd_bind(this);" name="font_align"><?php
|
| 4251 |
+
$select = array( __( 'Left', 'polldaddy' ) => "left", __( 'Center', 'polldaddy' ) => "center", __( 'Right', 'polldaddy' ) => "right" );
|
| 4252 |
+
foreach ( $select as $option => $value ):
|
| 4253 |
+
$selected = '';
|
| 4254 |
+
if ( $settings->font_align == $value )
|
| 4255 |
+
$selected = ' selected="selected"';
|
| 4256 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 4257 |
+
endforeach;?>
|
| 4258 |
+
</select>
|
| 4259 |
+
</td>
|
| 4260 |
+
</tr>
|
| 4261 |
+
<tr>
|
| 4262 |
+
<td height="30"><?php _e( 'Position', 'polldaddy' );?></td>
|
| 4263 |
+
<td>
|
| 4264 |
+
<select name="font_position" onchange="pd_bind(this);" id="font_position"><?php
|
| 4265 |
+
$select = array( __( 'Top', 'polldaddy' ) => "top", __( 'Right', 'polldaddy' ) => "right", __( 'Bottom', 'polldaddy' ) => "bottom" );
|
| 4266 |
+
foreach ( $select as $option => $value ) :
|
| 4267 |
+
$selected = '';
|
| 4268 |
+
if ( $settings->font_position == $value )
|
| 4269 |
+
$selected = ' selected="selected"';
|
| 4270 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 4271 |
+
endforeach;?>
|
| 4272 |
+
</select>
|
| 4273 |
+
</td>
|
| 4274 |
+
</tr>
|
| 4275 |
+
<tr>
|
| 4276 |
+
<td height="30"><?php _e( 'Font', 'polldaddy' );?></td>
|
| 4277 |
+
<td>
|
| 4278 |
+
<select name="font_family" id="font_family" onchange="pd_bind(this);"><?php
|
| 4279 |
+
$select = array( __( 'Inherit', 'polldaddy' ) => "", "Arial" => "arial", "Comic Sans MS" => "comic sans ms", "Courier" => "courier", "Georgia" => "georgia", "Lucida Grande" => "lucida grande", "Tahoma" => "tahoma", "Times" => "times", "Trebuchet MS" => "trebuchet ms", "Verdana" => "verdana" );
|
| 4280 |
+
foreach ( $select as $option => $value ) :
|
| 4281 |
+
$selected = '';
|
| 4282 |
+
if ( $settings->font_family == $value )
|
| 4283 |
+
$selected = ' selected="selected"';
|
| 4284 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>';
|
| 4285 |
+
endforeach;?>
|
| 4286 |
+
</select>
|
| 4287 |
+
</td>
|
| 4288 |
+
</tr>
|
| 4289 |
+
<tr>
|
| 4290 |
+
<td height="30"><?php _e( 'Color', 'polldaddy' );?></td>
|
| 4291 |
+
<td><input type="text" onblur="pd_bind(this);" class="elmColor jscolor-picker" name="font_color" id="font_color" value="<?php echo esc_html( $settings->font_color ); ?>" maxlength="11" autocomplete="off"/>
|
| 4292 |
+
</td>
|
| 4293 |
+
</tr>
|
| 4294 |
+
<tr>
|
| 4295 |
+
<td><?php _e( 'Size', 'polldaddy' );?></td>
|
| 4296 |
+
<td>
|
| 4297 |
+
<select name="font_size" id="font_size" onchange="pd_bind(this);"><?php
|
| 4298 |
+
$select = array( __( 'Inherit', 'polldaddy' ) => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
|
| 4299 |
+
foreach ( $select as $option => $value ) :
|
| 4300 |
+
$selected = '';
|
| 4301 |
+
if ( $settings->font_size == $value )
|
| 4302 |
+
$selected = ' selected="selected"';
|
| 4303 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4304 |
+
endforeach;?>
|
| 4305 |
+
</select>
|
| 4306 |
+
</td>
|
| 4307 |
+
</tr>
|
| 4308 |
+
<tr>
|
| 4309 |
+
<td height="30"><?php _e( 'Line Height', 'polldaddy' );?></td>
|
| 4310 |
+
<td>
|
| 4311 |
+
<select name="font_line_height" id="font_line_height" onchange="pd_bind(this);"><?php
|
| 4312 |
+
$select = array( __( 'Inherit', 'polldaddy' ) => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
|
| 4313 |
+
foreach ( $select as $option => $value ) :
|
| 4314 |
+
$selected = '';
|
| 4315 |
+
if ( $settings->font_line_height == $value )
|
| 4316 |
+
$selected = ' selected="selected"';
|
| 4317 |
+
echo '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n";
|
| 4318 |
+
endforeach; ?>
|
| 4319 |
+
</select>
|
| 4320 |
+
</td>
|
| 4321 |
+
</tr>
|
| 4322 |
+
<tr>
|
| 4323 |
+
<td height="30"><?php _e( 'Bold', 'polldaddy' );?></td>
|
| 4324 |
+
<td><?php
|
| 4325 |
+
$checked = '';
|
| 4326 |
+
if ( $settings->font_bold == 'bold' )
|
| 4327 |
+
$checked = ' checked="checked"';?>
|
| 4328 |
+
<input type="checkbox" name="font_bold" onclick="pd_bind(this);" id="font_bold" value="bold" <?php echo $checked; ?> />
|
| 4329 |
+
</td>
|
| 4330 |
+
</tr>
|
| 4331 |
+
<tr>
|
| 4332 |
+
<td height="30"><?php _e( 'Italic', 'polldaddy' );?></td><?php
|
| 4333 |
+
$checked = '';
|
| 4334 |
+
if ( $settings->font_italic == 'italic' )
|
| 4335 |
+
$checked = ' checked="checked"';?>
|
| 4336 |
+
<td><input type="checkbox" name="font_italic" onclick="pd_bind(this);" id="font_italic" value="italic" <?php echo $checked; ?>/></td>
|
| 4337 |
+
</tr>
|
| 4338 |
+
</table>
|
| 4339 |
+
</div>
|
| 4340 |
+
</div>
|
| 4341 |
+
<?php
|
| 4342 |
+
if ( $this->is_admin ) { ?>
|
| 4343 |
+
<div class="postbox">
|
| 4344 |
+
<h3><?php _e( 'Extra Settings', 'polldaddy' );?></h3>
|
| 4345 |
+
<div class="inside">
|
| 4346 |
+
<table>
|
| 4347 |
+
<tr>
|
| 4348 |
+
<td width="100" height="30"><?php _e( 'Results Popup', 'polldaddy' );?></td>
|
| 4349 |
+
<td>
|
| 4350 |
+
<input type="checkbox" onchange="pd_bind(this);" value="on" name="polldaddy-rating-popup" id="polldaddy-rating-popup" <?php echo !$popup_disabled ? 'checked="checked"' : ''; ?> />
|
| 4351 |
+
</td>
|
| 4352 |
+
<td>
|
| 4353 |
+
<span class="description">
|
| 4354 |
+
<label for="polldaddy-rating-popup"><?php _e( 'Uncheck this box to disable the results popup', 'polldaddy' ); ?></label>
|
| 4355 |
+
</span>
|
| 4356 |
+
</td>
|
| 4357 |
+
</tr><?php
|
| 4358 |
+
if ( $report_type == 'posts' ) {
|
| 4359 |
+
$exclude_post_ids = esc_html( get_option( 'pd-rating-exclude-post-ids' ) ); ?>
|
| 4360 |
+
<tr>
|
| 4361 |
+
<td width="100" height="30"><?php _e( 'Rating ID', 'polldaddy' );?></td>
|
| 4362 |
+
<td>
|
| 4363 |
+
<input type="text" name="polldaddy-post-rating-id" id="polldaddy-post-rating-id" value="<?php echo $rating_id; ?>" />
|
| 4364 |
+
</td>
|
| 4365 |
+
<td>
|
| 4366 |
+
<span class="description">
|
| 4367 |
+
<label for="polldaddy-post-rating-id"><?php _e( 'This is the rating ID used in posts', 'polldaddy' ); ?></label>
|
| 4368 |
+
</span>
|
| 4369 |
+
</td>
|
| 4370 |
+
</tr>
|
| 4371 |
+
<tr>
|
| 4372 |
+
<td width="100" height="30"><?php _e( 'Exclude Posts', 'polldaddy' );?></td>
|
| 4373 |
+
<td>
|
| 4374 |
+
<input type="text" name="exclude-post-ids" id="exclude-post-ids" value="<?php echo $exclude_post_ids; ?>" />
|
| 4375 |
+
</td>
|
| 4376 |
+
<td>
|
| 4377 |
+
<span class="description">
|
| 4378 |
+
<label for="exclude-post-ids"><?php _e( 'Enter the Post IDs where you want to exclude ratings from. Please use a comma-delimited list, eg. 1,2,3', 'polldaddy' ); ?></label>
|
| 4379 |
+
</span>
|
| 4380 |
+
</td>
|
| 4381 |
+
</tr><?php
|
| 4382 |
+
} elseif ( $report_type == 'pages' ) {
|
| 4383 |
+
$exclude_page_ids = esc_html( get_option( 'pd-rating-exclude-page-ids' ) ); ?>
|
| 4384 |
+
<tr>
|
| 4385 |
+
<td width="100" height="30"><?php _e( 'Rating ID', 'polldaddy' );?></td>
|
| 4386 |
+
<td>
|
| 4387 |
+
<input type="text" name="polldaddy-page-rating-id" id="polldaddy-page-rating-id" value="<?php echo $rating_id; ?>" />
|
| 4388 |
+
</td>
|
| 4389 |
+
<td>
|
| 4390 |
+
<span class="description">
|
| 4391 |
+
<label for="polldaddy-page-rating-id"><?php _e( 'This is the rating ID used in pages', 'polldaddy' ); ?></label>
|
| 4392 |
+
</span>
|
| 4393 |
+
</td>
|
| 4394 |
+
</tr>
|
| 4395 |
+
<tr>
|
| 4396 |
+
<td width="100" height="30"><?php _e( 'Exclude Pages', 'polldaddy' );?></td>
|
| 4397 |
+
<td>
|
| 4398 |
+
<input type="text" name="exclude-page-ids" id="exclude-page-ids" value="<?php echo $exclude_page_ids; ?>" />
|
| 4399 |
+
</td>
|
| 4400 |
+
<td>
|
| 4401 |
+
<span class="description">
|
| 4402 |
+
<label for="exclude-page-ids"><?php _e( 'Enter the Page IDs where you want to exclude ratings from. Please use a comma-delimited list, eg. 1,2,3', 'polldaddy' ); ?></label>
|
| 4403 |
+
</span>
|
| 4404 |
+
</td>
|
| 4405 |
+
</tr><?php
|
| 4406 |
+
} elseif ( $report_type == 'comments' ) { ?>
|
| 4407 |
+
<tr>
|
| 4408 |
+
<td width="100" height="30"><?php _e( 'Rating ID', 'polldaddy' );?></td>
|
| 4409 |
+
<td>
|
| 4410 |
+
<input type="text" name="polldaddy-comment-rating-id" id="polldaddy-comment-rating-id" value="<?php echo $rating_id; ?>" />
|
| 4411 |
+
</td>
|
| 4412 |
+
<td>
|
| 4413 |
+
<span class="description">
|
| 4414 |
+
<label for="polldaddy-comment-rating-id"><?php _e( 'This is the rating ID used in comments', 'polldaddy' ); ?></label>
|
| 4415 |
+
</span>
|
| 4416 |
+
</td>
|
| 4417 |
+
</tr><?php
|
| 4418 |
+
} ?>
|
| 4419 |
+
</table>
|
| 4420 |
+
</div>
|
| 4421 |
+
</div>
|
| 4422 |
+
<?php } ?>
|
| 4423 |
+
</div>
|
| 4424 |
+
</div>
|
| 4425 |
+
</form>
|
| 4426 |
+
<script language="javascript">
|
| 4427 |
+
jQuery( document ).ready(function(){
|
| 4428 |
+
plugin = new Plugin( {
|
| 4429 |
+
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 4430 |
+
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 4431 |
+
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 4432 |
+
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 4433 |
+
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 4434 |
+
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 4435 |
+
} );
|
| 4436 |
+
});
|
| 4437 |
+
pd_map = { image_path : '<?php echo plugins_url( 'img', __FILE__ );?>' };
|
| 4438 |
+
</script>
|
| 4439 |
+
<script type="text/javascript">
|
| 4440 |
+
PDRTJS_settings = <?php echo $settings_text; ?>;
|
| 4441 |
+
PDRTJS_settings.id = "1";
|
| 4442 |
+
PDRTJS_settings.unique_id = "xxx";
|
| 4443 |
+
PDRTJS_settings.title = "";
|
| 4444 |
+
PDRTJS_settings.override = "<?php echo esc_attr( $rating_id ); ?>";
|
| 4445 |
+
PDRTJS_settings.permalink = "";
|
| 4446 |
+
PDRTJS_1 = new PDRTJS_RATING( PDRTJS_settings );
|
| 4447 |
+
pd_change_type( <?php echo $rating_type?> );
|
| 4448 |
+
</script><?php
|
| 4449 |
+
} ?>
|
| 4450 |
+
</div><?php
|
| 4451 |
+
} // from if !error ?>
|
| 4452 |
+
</div><?php
|
| 4453 |
+
}
|
| 4454 |
+
|
| 4455 |
+
function update_rating() {
|
| 4456 |
+
$rating_type = 0;
|
| 4457 |
+
$rating_id = 0;
|
| 4458 |
+
$new_rating_id = 0;
|
| 4459 |
+
$type = 'post';
|
| 4460 |
+
$set = null;
|
| 4461 |
+
|
| 4462 |
+
if ( isset( $_REQUEST['rating_id'] ) )
|
| 4463 |
+
$rating_id = (int) $_REQUEST['rating_id'];
|
| 4464 |
+
|
| 4465 |
+
if ( isset( $_REQUEST['polldaddy-post-rating-id'] ) ) {
|
| 4466 |
+
$new_rating_id = (int) $_REQUEST['polldaddy-post-rating-id'];
|
| 4467 |
+
$type = 'posts';
|
| 4468 |
+
}
|
| 4469 |
+
elseif ( isset( $_REQUEST['polldaddy-page-rating-id'] ) ) {
|
| 4470 |
+
$new_rating_id = (int) $_REQUEST['polldaddy-page-rating-id'];
|
| 4471 |
+
$type = 'pages';
|
| 4472 |
+
}
|
| 4473 |
+
elseif ( isset( $_REQUEST['polldaddy-comment-rating-id'] ) ) {
|
| 4474 |
+
$new_rating_id = (int) $_REQUEST['polldaddy-comment-rating-id'];
|
| 4475 |
+
$type = 'comments';
|
| 4476 |
+
} else {
|
| 4477 |
+
$new_rating_id = $rating_id;
|
| 4478 |
+
}
|
| 4479 |
+
|
| 4480 |
+
if ( $rating_id > 0 && $rating_id == $new_rating_id ) {
|
| 4481 |
+
if ( isset( $_REQUEST['rating_type'] ) && $_REQUEST['rating_type'] == 'stars' ) {
|
| 4482 |
+
$set->type = 'stars';
|
| 4483 |
+
$rating_type = 0;
|
| 4484 |
+
if ( isset( $_REQUEST['star_color'] ) )
|
| 4485 |
+
$set->star_color = esc_attr( $_REQUEST['star_color'] );
|
| 4486 |
+
} else {
|
| 4487 |
+
$set->type = 'nero';
|
| 4488 |
+
$rating_type = 1;
|
| 4489 |
+
if ( isset( $_REQUEST['nero_style'] ) )
|
| 4490 |
+
$set->star_color = esc_attr( $_REQUEST['nero_style'] );
|
| 4491 |
+
}
|
| 4492 |
+
|
| 4493 |
+
$set->size = esc_html( $_REQUEST['size'], 1 );
|
| 4494 |
+
$set->custom_star = esc_html( esc_url( $_REQUEST['custom_star'] ) , 1 );
|
| 4495 |
+
$set->font_align = esc_html( $_REQUEST['font_align'], 1 );
|
| 4496 |
+
$set->font_position = esc_html( $_REQUEST['font_position'], 1 );
|
| 4497 |
+
$set->font_family = esc_html( $_REQUEST['font_family'], 1 );
|
| 4498 |
+
$set->font_size = esc_html( $_REQUEST['font_size'], 1 );
|
| 4499 |
+
$set->font_line_height = esc_html( $_REQUEST['font_line_height'], 1 );
|
| 4500 |
+
|
| 4501 |
+
if ( isset( $_REQUEST['font_bold'] ) && $_REQUEST['font_bold'] == 'bold' )
|
| 4502 |
+
$set->font_bold = 'bold';
|
| 4503 |
+
else
|
| 4504 |
+
$set->font_bold = 'normal';
|
| 4505 |
+
|
| 4506 |
+
if ( isset( $_REQUEST['font_italic'] ) && $_REQUEST['font_italic'] == 'italic' )
|
| 4507 |
+
$set->font_italic = 'italic';
|
| 4508 |
+
else
|
| 4509 |
+
$set->font_italic = 'normal';
|
| 4510 |
+
|
| 4511 |
+
$set->text_vote = rawurlencode( stripslashes( esc_html( $_REQUEST['text_vote'], 1 ) ) );
|
| 4512 |
+
$set->text_votes = rawurlencode( stripslashes( esc_html( $_REQUEST['text_votes'], 1 ) ) );
|
| 4513 |
+
$set->text_rate_this = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rate_this'], 1 ) ) );
|
| 4514 |
+
$set->text_1_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_1_star'], 1 ) ) );
|
| 4515 |
+
$set->text_2_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_2_star'], 1 ) ) );
|
| 4516 |
+
$set->text_3_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_3_star'], 1 ) ) );
|
| 4517 |
+
$set->text_4_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_4_star'], 1 ) ) );
|
| 4518 |
+
$set->text_5_star = rawurlencode( stripslashes( esc_html( $_REQUEST['text_5_star'], 1 ) ) );
|
| 4519 |
+
$set->text_thank_you = rawurlencode( stripslashes( esc_html( $_REQUEST['text_thank_you'], 1 ) ) );
|
| 4520 |
+
$set->text_rate_up = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rate_up'], 1 ) ) );
|
| 4521 |
+
$set->text_rate_down = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rate_down'], 1 ) ) );
|
| 4522 |
+
$set->font_color = rawurlencode( stripslashes( esc_html( $_REQUEST['font_color'], 1 ) ) );
|
| 4523 |
+
|
| 4524 |
+
$set->text_popcontent= rawurlencode( stripslashes( esc_html( $_REQUEST['text_popcontent'], 1 ) ) );
|
| 4525 |
+
$set->text_close = rawurlencode( stripslashes( esc_html( $_REQUEST['text_close'], 1 ) ) );
|
| 4526 |
+
$set->text_all = rawurlencode( stripslashes( esc_html( $_REQUEST['text_all'], 1 ) ) );
|
| 4527 |
+
$set->text_today = rawurlencode( stripslashes( esc_html( $_REQUEST['text_today'], 1 ) ) );
|
| 4528 |
+
$set->text_thisweek = rawurlencode( stripslashes( esc_html( $_REQUEST['text_thisweek'], 1 ) ) );
|
| 4529 |
+
$set->text_thismonth = rawurlencode( stripslashes( esc_html( $_REQUEST['text_thismonth'], 1 ) ) );
|
| 4530 |
+
$set->text_rated = rawurlencode( stripslashes( esc_html( $_REQUEST['text_rated'], 1 ) ) );
|
| 4531 |
+
$set->text_noratings = rawurlencode( stripslashes( esc_html( $_REQUEST['text_noratings'], 1 ) ) );
|
| 4532 |
+
|
| 4533 |
+
$set->popup = 'off';
|
| 4534 |
+
if ( isset( $_REQUEST['polldaddy-rating-popup'] ) )
|
| 4535 |
+
$set->popup = ( $_REQUEST['polldaddy-rating-popup'] == 'on' ? 'on' : 'off' );
|
| 4536 |
+
|
| 4537 |
+
$settings_text = json_encode( $set );
|
| 4538 |
+
|
| 4539 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 4540 |
+
$polldaddy->reset();
|
| 4541 |
+
$rating = $polldaddy->update_rating( $rating_id, $settings_text, $rating_type );
|
| 4542 |
+
} elseif ( $this->is_admin && $new_rating_id > 0 ) {
|
| 4543 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 4544 |
+
$pd_rating = $polldaddy->get_rating( $new_rating_id );
|
| 4545 |
+
if ( false !== $pd_rating ) {
|
| 4546 |
+
switch ( $type ) {
|
| 4547 |
+
case 'pages':
|
| 4548 |
+
update_option( 'pd-rating-pages-id', $new_rating_id );
|
| 4549 |
+
if ( (int) get_option( 'pd-rating-pages' ) > 0 )
|
| 4550 |
+
update_option( 'pd-rating-pages', $new_rating_id );
|
| 4551 |
+
break;
|
| 4552 |
+
case 'comments':
|
| 4553 |
+
update_option( 'pd-rating-comments-id', $new_rating_id );
|
| 4554 |
+
if ( (int) get_option( 'pd-rating-comments' ) > 0 )
|
| 4555 |
+
update_option( 'pd-rating-comments', $new_rating_id );
|
| 4556 |
+
break;
|
| 4557 |
+
case 'posts':
|
| 4558 |
+
update_option( 'pd-rating-posts-id', $new_rating_id );
|
| 4559 |
+
if ( (int) get_option( 'pd-rating-posts' ) > 0 )
|
| 4560 |
+
update_option( 'pd-rating-posts', $new_rating_id );
|
| 4561 |
+
}
|
| 4562 |
+
}
|
| 4563 |
+
}
|
| 4564 |
+
|
| 4565 |
+
if ( $this->is_admin ) {
|
| 4566 |
+
if ( $type=='posts' && isset( $_REQUEST['exclude-post-ids'] ) ) {
|
| 4567 |
+
$exclude_post_ids = $_REQUEST['exclude-post-ids'];
|
| 4568 |
+
if ( empty( $exclude_post_ids ) ) {
|
| 4569 |
+
update_option( 'pd-rating-exclude-post-ids', '' );
|
| 4570 |
+
} else {
|
| 4571 |
+
$post_ids = array();
|
| 4572 |
+
$ids = explode( ',', $exclude_post_ids );
|
| 4573 |
+
if ( !empty( $ids ) ) {
|
| 4574 |
+
foreach ( (array) $ids as $id ) {
|
| 4575 |
+
if ( (int) $id > 0 )
|
| 4576 |
+
$post_ids[] = (int) $id;
|
| 4577 |
+
}
|
| 4578 |
+
}
|
| 4579 |
+
if ( !empty( $post_ids ) ) {
|
| 4580 |
+
$exclude_post_ids = implode( ',', $post_ids );
|
| 4581 |
+
update_option( 'pd-rating-exclude-post-ids', $exclude_post_ids );
|
| 4582 |
+
}
|
| 4583 |
+
}
|
| 4584 |
+
}
|
| 4585 |
+
|
| 4586 |
+
if ( $type=='pages' && isset( $_REQUEST['exclude-page-ids'] ) ) {
|
| 4587 |
+
$exclude_page_ids = $_REQUEST['exclude-page-ids'];
|
| 4588 |
+
if ( empty( $exclude_page_ids ) ) {
|
| 4589 |
+
update_option( 'pd-rating-exclude-page-ids', '' );
|
| 4590 |
+
} else {
|
| 4591 |
+
$page_ids = array();
|
| 4592 |
+
$ids = explode( ',', $exclude_page_ids );
|
| 4593 |
+
if ( !empty( $ids ) ) {
|
| 4594 |
+
foreach ( (array) $ids as $id ) {
|
| 4595 |
+
if ( (int) $id > 0 )
|
| 4596 |
+
$page_ids[] = (int) $id;
|
| 4597 |
+
}
|
| 4598 |
+
}
|
| 4599 |
+
if ( !empty( $page_ids ) ) {
|
| 4600 |
+
$exclude_page_ids = implode( ',', $page_ids );
|
| 4601 |
+
update_option( 'pd-rating-exclude-page-ids', $exclude_page_ids );
|
| 4602 |
+
}
|
| 4603 |
+
}
|
| 4604 |
+
}
|
| 4605 |
+
}
|
| 4606 |
+
}
|
| 4607 |
+
function rating_reports() {
|
| 4608 |
+
if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) || WP_POLLDADDY__PARTNERGUID == false )
|
| 4609 |
+
return false;
|
| 4610 |
+
|
| 4611 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
| 4612 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 4613 |
+
|
| 4614 |
+
$report_type = 'posts';
|
| 4615 |
+
$period = '7';
|
| 4616 |
+
$show_rating = 0;
|
| 4617 |
+
|
| 4618 |
+
if ( isset( $_REQUEST['change-report-to'] ) ) {
|
| 4619 |
+
switch ( $_REQUEST['change-report-to'] ) {
|
| 4620 |
+
case 'pages':
|
| 4621 |
+
$report_type = 'pages';
|
| 4622 |
+
$rating_id = (int) get_option( 'pd-rating-pages-id' );
|
| 4623 |
+
break;
|
| 4624 |
+
|
| 4625 |
+
case 'comments':
|
| 4626 |
+
$report_type = 'comments';
|
| 4627 |
+
$rating_id = get_option( 'pd-rating-comments-id' );
|
| 4628 |
+
break;
|
| 4629 |
+
|
| 4630 |
+
case 'posts':
|
| 4631 |
+
$report_type = 'posts';
|
| 4632 |
+
$rating_id = get_option( 'pd-rating-posts-id' );
|
| 4633 |
+
break;
|
| 4634 |
+
}//end switch
|
| 4635 |
+
}
|
| 4636 |
+
|
| 4637 |
+
if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] ) {
|
| 4638 |
+
switch ( $_REQUEST['filter'] ) {
|
| 4639 |
+
case '1':
|
| 4640 |
+
$period = '1';
|
| 4641 |
+
break;
|
| 4642 |
+
|
| 4643 |
+
case '7':
|
| 4644 |
+
$period = '7';
|
| 4645 |
+
break;
|
| 4646 |
+
|
| 4647 |
+
case '31':
|
| 4648 |
+
$period = '31';
|
| 4649 |
+
break;
|
| 4650 |
+
|
| 4651 |
+
case '90':
|
| 4652 |
+
$period = '90';
|
| 4653 |
+
break;
|
| 4654 |
+
|
| 4655 |
+
case '365':
|
| 4656 |
+
$period = '365';
|
| 4657 |
+
break;
|
| 4658 |
+
|
| 4659 |
+
case 'all':
|
| 4660 |
+
$period = 'all';
|
| 4661 |
+
break;
|
| 4662 |
+
}//end switch
|
| 4663 |
+
}
|
| 4664 |
+
|
| 4665 |
+
$page_size = 15;
|
| 4666 |
+
$current_page = 1;
|
| 4667 |
+
|
| 4668 |
+
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'change-report' ) {
|
| 4669 |
+
$current_page = 1;
|
| 4670 |
+
} else {
|
| 4671 |
+
if ( isset( $_REQUEST['paged'] ) ) {
|
| 4672 |
+
$current_page = (int) $_REQUEST['paged'];
|
| 4673 |
+
if ( $current_page == 0 )
|
| 4674 |
+
$current_page = 1;
|
| 4675 |
+
}
|
| 4676 |
+
}
|
| 4677 |
+
|
| 4678 |
+
$start = ( $current_page * $page_size ) - $page_size;
|
| 4679 |
+
$end = $page_size;
|
| 4680 |
+
|
| 4681 |
+
$response = $polldaddy->get_rating_results( $rating_id, $period, $start, $end );
|
| 4682 |
+
|
| 4683 |
+
$total = $total_pages = 0;
|
| 4684 |
+
$ratings = null;
|
| 4685 |
+
|
| 4686 |
+
if ( !empty( $response ) ) {
|
| 4687 |
+
$ratings = $response->rating;
|
| 4688 |
+
$total = (int) $response->_total;
|
| 4689 |
+
$total_pages = ceil( $total / $page_size );
|
| 4690 |
+
}
|
| 4691 |
+
|
| 4692 |
+
$page_links = paginate_links( array(
|
| 4693 |
+
'base' => add_query_arg( array ( 'paged' => '%#%', 'change-report-to' => $report_type, 'filter' => $period ) ),
|
| 4694 |
+
'format' => '',
|
| 4695 |
+
'prev_text' => __( '«', 'polldaddy' ),
|
| 4696 |
+
'next_text' => __( '»', 'polldaddy' ),
|
| 4697 |
+
'total' => $total_pages,
|
| 4698 |
+
'current' => $current_page,
|
| 4699 |
+
'prev_text' => '«',
|
| 4700 |
+
'next_text' => '»'
|
| 4701 |
+
) );
|
| 4702 |
+
?>
|
| 4703 |
+
<div class="wrap">
|
| 4704 |
+
<?php if ( $this->is_admin ) : ?>
|
| 4705 |
+
<h2 id="polldaddy-header"><?php printf( __( 'Rating Results <a href="%s" class="add-new-h2">Settings</a>', 'polldaddy' ), esc_url( 'options-general.php?page=ratings&action=options' ) ); ?></h2>
|
| 4706 |
+
<?php else : ?>
|
| 4707 |
+
<h2 id="polldaddy-header"><?php _e( 'Rating Results', 'polldaddy' ); ?></h2>
|
| 4708 |
+
<?php endif; ?>
|
| 4709 |
+
<div class="clear"></div>
|
| 4710 |
+
<form method="post" action="">
|
| 4711 |
+
<div class="tablenav">
|
| 4712 |
+
<div class="alignleft actions">
|
| 4713 |
+
<?php if ( $this->is_editor ) { ?>
|
| 4714 |
+
<select name="action">
|
| 4715 |
+
<option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
|
| 4716 |
+
<option value="delete"><?php _e( 'Delete', 'polldaddy' ); ?></option>
|
| 4717 |
+
</select>
|
| 4718 |
+
<input type="hidden" name="id" id="id" value="<?php echo (int) $rating_id; ?>" />
|
| 4719 |
+
<input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
|
| 4720 |
+
<?php wp_nonce_field( 'action-rating_bulk' ); ?>
|
| 4721 |
+
<?php } ?>
|
| 4722 |
+
<select name="change-report-to"><?php
|
| 4723 |
+
$select = array( __( 'Posts', 'polldaddy' ) => "posts", __( 'Pages', 'polldaddy' ) => "pages", __( 'Comments', 'polldaddy' ) => "comments" );
|
| 4724 |
+
foreach ( $select as $option => $value ) :
|
| 4725 |
+
$selected = '';
|
| 4726 |
+
if ( $value == $report_type )
|
| 4727 |
+
$selected = ' selected="selected"';?>
|
| 4728 |
+
<option value="<?php echo $value; ?>" <?php echo $selected; ?>><?php echo $option; ?></option>
|
| 4729 |
+
<?php endforeach; ?>
|
| 4730 |
+
</select>
|
| 4731 |
+
<select name="filter"><?php
|
| 4732 |
+
$select = array( __( 'Last 24 hours', 'polldaddy' ) => "1", __( 'Last 7 days', 'polldaddy' ) => "7", __( 'Last 31 days', 'polldaddy' ) => "31", __( 'Last 3 months', 'polldaddy' ) => "90", __( 'Last 12 months', 'polldaddy' ) => "365", __( 'All time', 'polldaddy' ) => "all" );
|
| 4733 |
+
foreach ( $select as $option => $value ) :
|
| 4734 |
+
$selected = '';
|
| 4735 |
+
if ( $value == $period )
|
| 4736 |
+
$selected = ' selected="selected"';?>
|
| 4737 |
+
<option value="<?php echo $value; ?>" <?php echo $selected; ?>><?php echo $option; ?></option>
|
| 4738 |
+
<?php endforeach; ?>
|
| 4739 |
+
</select>
|
| 4740 |
+
<input class="button-secondary action" type="submit" value="<?php _e( 'Filter', 'polldaddy' );?>" />
|
| 4741 |
+
<?php if ( in_array( $period, array( 1, 7 ) ) ) : ?>
|
| 4742 |
+
<label><?php _e( '* The results are cached and are updated every hour' ); ?></label>
|
| 4743 |
+
<?php elseif ( $period == 31 ) : ?>
|
| 4744 |
+
<label><?php _e( '* The results are cached and are updated every day' ); ?></label>
|
| 4745 |
+
<?php else : ?>
|
| 4746 |
+
<label><?php _e( '* The results are cached and are updated every 3 days' ); ?></label>
|
| 4747 |
+
<?php endif; ?>
|
| 4748 |
+
</div>
|
| 4749 |
+
<div class="alignright">
|
| 4750 |
+
<div class="tablenav-pages">
|
| 4751 |
+
<?php echo $page_links; ?>
|
| 4752 |
+
</div>
|
| 4753 |
+
</div>
|
| 4754 |
+
</div>
|
| 4755 |
+
|
| 4756 |
+
<table class="widefat"><?php
|
| 4757 |
+
if ( empty( $ratings ) ) { ?>
|
| 4758 |
+
<tbody>
|
| 4759 |
+
<tr>
|
| 4760 |
+
<td colspan="4"><?php printf( __( 'No ratings have been collected for your %s yet.', 'polldaddy' ), $report_type ); ?></td>
|
| 4761 |
+
</tr>
|
| 4762 |
+
</tbody><?php
|
| 4763 |
+
} else {
|
| 4764 |
+
polldaddy_update_ratings_cache( $ratings );
|
| 4765 |
+
?>
|
| 4766 |
+
<thead>
|
| 4767 |
+
<tr>
|
| 4768 |
+
<?php if ( $this->is_editor ) { ?>
|
| 4769 |
+
<th scope="col" class="manage-column column-cb check-column" id="cb"><input type="checkbox"></th>
|
| 4770 |
+
<?php } else { ?>
|
| 4771 |
+
<th scope="col" class="manage-column column-cb check-column" id="cb"></th>
|
| 4772 |
+
<?php } ?>
|
| 4773 |
+
<th scope="col" class="manage-column column-title" id="title"><?php _e( 'Title', 'polldaddy' );?></th>
|
| 4774 |
+
<th scope="col" class="manage-column column-id" id="id"><?php _e( 'Unique ID', 'polldaddy' );?></th>
|
| 4775 |
+
<th scope="col" class="manage-column column-date" id="date"><?php _e( 'Start Date', 'polldaddy' );?></th>
|
| 4776 |
+
<th scope="col" class="manage-column column-vote num" id="votes"><?php _e( 'Votes', 'polldaddy' );?></th>
|
| 4777 |
+
<th scope="col" class="manage-column column-rating num" id="rating"><?php _e( 'Average Rating', 'polldaddy' );?></th>
|
| 4778 |
+
</tr>
|
| 4779 |
+
</thead>
|
| 4780 |
+
<tbody><?php
|
| 4781 |
+
$alt_counter = 0;
|
| 4782 |
+
$alt = '';
|
| 4783 |
+
|
| 4784 |
+
foreach ( $ratings as $rating ) :
|
| 4785 |
+
$delete_link = esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $rating_id, 'rating' => $rating->uid, 'change-report-to' => $report_type, 'message' => false ) ), "delete-rating_$rating->uid" ) );
|
| 4786 |
+
$alt_counter++;?>
|
| 4787 |
+
<tr <?php echo ( $alt_counter & 1 ) ? ' class="alternate"' : ''; ?>>
|
| 4788 |
+
<th class="check-column" scope="row"><input type="checkbox" value="<?php echo esc_html( $rating->uid ); ?>" name="rating[]" /></th>
|
| 4789 |
+
<td class="post-title column-title">
|
| 4790 |
+
<strong><a href="<?php echo esc_url( $rating->permalink ); ?>"><?php echo strlen( esc_html( $rating->title ) ) > 75 ? substr( esc_html( $rating->title ), 0, 72 ) . '&hellip' : esc_html( $rating->title ); ?></a></strong>
|
| 4791 |
+
<div class="row-actions">
|
| 4792 |
+
<?php if ( $this->is_editor && $delete_link ) { ?>
|
| 4793 |
+
<span class="delete"><a class="delete-rating delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
|
| 4794 |
+
<?php } ?>
|
| 4795 |
+
</div>
|
| 4796 |
+
</td>
|
| 4797 |
+
<td class="column-id">
|
| 4798 |
+
<?php echo esc_html( $rating->uid ); ?>
|
| 4799 |
+
</td>
|
| 4800 |
+
<td class="date column-date">
|
| 4801 |
+
<abbr title="<?php echo date( __( 'Y/m/d g:i:s A', 'polldaddy' ), $rating->date ); ?>"><?php echo str_replace( '-', '/', substr( esc_html( $rating->date ), 0, 10 ) ); ?></abbr>
|
| 4802 |
+
</td>
|
| 4803 |
+
<td class="column-vote num"><?php echo number_format( $rating->_votes ); ?></td>
|
| 4804 |
+
<td class="column-rating num"><table width="100%"><tr align="center"><td style="border:none;"><?php
|
| 4805 |
+
if ( $rating->_type == 0 ) {
|
| 4806 |
+
$avg_rating = $this->round( $rating->average_rating, 0.5 );?>
|
| 4807 |
+
<div style="width:100px"><?php
|
| 4808 |
+
$image_pos = '';
|
| 4809 |
+
|
| 4810 |
+
for ( $c = 1; $c <= 5; $c++ ) :
|
| 4811 |
+
if ( $avg_rating > 0 ) {
|
| 4812 |
+
if ( $avg_rating < $c )
|
| 4813 |
+
$image_pos = 'bottom left';
|
| 4814 |
+
if ( $avg_rating == ( $c - 1 + 0.5 ) )
|
| 4815 |
+
$image_pos = 'center left';
|
| 4816 |
+
} ?>
|
| 4817 |
+
<div style="width: 20px; height: 20px; background: url(<?php echo plugins_url( 'img/star-yellow-med.png', __FILE__ ); ?>) <?php echo $image_pos; ?>; float: left;"></div><?php
|
| 4818 |
+
endfor; ?>
|
| 4819 |
+
<br class="clear" />
|
| 4820 |
+
</div><?php
|
| 4821 |
+
} else { ?>
|
| 4822 |
+
<div>
|
| 4823 |
+
<div style="margin: 0px 0px 0px 20px; background: transparent url(<?php echo plugins_url( 'img/rate-graph-up.png', __FILE__ ); ?>); width: 20px; height: 20px; float: left;"></div>
|
| 4824 |
+
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total1 );?></div>
|
| 4825 |
+
<div style="margin: 0px; background: transparent url(<?php echo plugins_url( 'img/rate-graph-dn.png', __FILE__ ); ?>); width: 20px; height: 20px; float: left;"></div>
|
| 4826 |
+
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total2 );?></div>
|
| 4827 |
+
<br class="clear" />
|
| 4828 |
+
</div><?php
|
| 4829 |
+
} ?>
|
| 4830 |
+
</td></tr></table>
|
| 4831 |
+
</td>
|
| 4832 |
+
</tr><?php
|
| 4833 |
+
endforeach;
|
| 4834 |
+
?>
|
| 4835 |
+
</tbody><?php
|
| 4836 |
+
} ?>
|
| 4837 |
+
</table>
|
| 4838 |
+
<div class="tablenav">
|
| 4839 |
+
<div class="alignright">
|
| 4840 |
+
<div class="tablenav-pages">
|
| 4841 |
+
<?php echo $page_links; ?>
|
| 4842 |
+
</div>
|
| 4843 |
+
</div>
|
| 4844 |
+
</div>
|
| 4845 |
+
</form>
|
| 4846 |
+
</div>
|
| 4847 |
+
<p></p>
|
| 4848 |
+
<script language="javascript">
|
| 4849 |
+
jQuery( document ).ready(function(){
|
| 4850 |
+
plugin = new Plugin( {
|
| 4851 |
+
delete_rating: '<?php echo esc_attr( __( 'Are you sure you want to delete the rating for "%s"?', 'polldaddy' ) ); ?>',
|
| 4852 |
+
delete_poll: '<?php echo esc_attr( __( 'Are you sure you want to delete "%s"?', 'polldaddy' ) ); ?>',
|
| 4853 |
+
delete_answer: '<?php echo esc_attr( __( 'Are you sure you want to delete this answer?', 'polldaddy' ) ); ?>',
|
| 4854 |
+
delete_answer_title: '<?php echo esc_attr( __( 'delete this answer', 'polldaddy' ) ); ?>',
|
| 4855 |
+
standard_styles: '<?php echo esc_attr( __( 'Standard Styles', 'polldaddy' ) ); ?>',
|
| 4856 |
+
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 4857 |
+
} );
|
| 4858 |
+
});
|
| 4859 |
+
</script><?php
|
| 4860 |
+
}
|
| 4861 |
+
|
| 4862 |
+
function plugin_options() {
|
| 4863 |
+
if ( isset( $_POST['polldaddy_email'] ) ) {
|
| 4864 |
+
$account_email = false;
|
| 4865 |
+
} else {
|
| 4866 |
+
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
| 4867 |
+
$account = $polldaddy->get_account();
|
| 4868 |
+
|
| 4869 |
+
if ( !empty( $account ) )
|
| 4870 |
+
$account_email = esc_attr( $account->email );
|
| 4871 |
+
|
| 4872 |
+
$polldaddy->reset();
|
| 4873 |
+
$poll = $polldaddy->get_poll( 1 );
|
| 4874 |
+
|
| 4875 |
+
$options = array(
|
| 4876 |
+
101 => __( 'Aluminum Narrow', 'polldaddy' ),
|
| 4877 |
+
102 => __( 'Aluminum Medium', 'polldaddy' ),
|
| 4878 |
+
103 => __( 'Aluminum Wide', 'polldaddy' ),
|
| 4879 |
+
104 => __( 'Plain White Narrow', 'polldaddy' ),
|
| 4880 |
+
105 => __( 'Plain White Medium', 'polldaddy' ),
|
| 4881 |
+
106 => __( 'Plain White Wide', 'polldaddy' ),
|
| 4882 |
+
107 => __( 'Plain Black Narrow', 'polldaddy' ),
|
| 4883 |
+
108 => __( 'Plain Black Medium', 'polldaddy' ),
|
| 4884 |
+
109 => __( 'Plain Black Wide', 'polldaddy' ),
|
| 4885 |
+
110 => __( 'Paper Narrow', 'polldaddy' ),
|
| 4886 |
+
111 => __( 'Paper Medium', 'polldaddy' ),
|
| 4887 |
+
112 => __( 'Paper Wide', 'polldaddy' ),
|
| 4888 |
+
113 => __( 'Skull Dark Narrow', 'polldaddy' ),
|
| 4889 |
+
114 => __( 'Skull Dark Medium', 'polldaddy' ),
|
| 4890 |
+
115 => __( 'Skull Dark Wide', 'polldaddy' ),
|
| 4891 |
+
116 => __( 'Skull Light Narrow', 'polldaddy' ),
|
| 4892 |
+
117 => __( 'Skull Light Medium', 'polldaddy' ),
|
| 4893 |
+
118 => __( 'Skull Light Wide', 'polldaddy' ),
|
| 4894 |
+
157 => __( 'Micro', 'polldaddy' ),
|
| 4895 |
+
119 => __( 'Plastic White Narrow', 'polldaddy' ),
|
| 4896 |
+
120 => __( 'Plastic White Medium', 'polldaddy' ),
|
| 4897 |
+
121 => __( 'Plastic White Wide', 'polldaddy' ),
|
| 4898 |
+
122 => __( 'Plastic Grey Narrow', 'polldaddy' ),
|
| 4899 |
+
123 => __( 'Plastic Grey Medium', 'polldaddy' ),
|
| 4900 |
+
124 => __( 'Plastic Grey Wide', 'polldaddy' ),
|
| 4901 |
+
125 => __( 'Plastic Black Narrow', 'polldaddy' ),
|
| 4902 |
+
126 => __( 'Plastic Black Medium', 'polldaddy' ),
|
| 4903 |
+
127 => __( 'Plastic Black Wide', 'polldaddy' ),
|
| 4904 |
+
128 => __( 'Manga Narrow', 'polldaddy' ),
|
| 4905 |
+
129 => __( 'Manga Medium', 'polldaddy' ),
|
| 4906 |
+
130 => __( 'Manga Wide', 'polldaddy' ),
|
| 4907 |
+
131 => __( 'Tech Dark Narrow', 'polldaddy' ),
|
| 4908 |
+
132 => __( 'Tech Dark Medium', 'polldaddy' ),
|
| 4909 |
+
133 => __( 'Tech Dark Wide', 'polldaddy' ),
|
| 4910 |
+
134 => __( 'Tech Grey Narrow', 'polldaddy' ),
|
| 4911 |
+
135 => __( 'Tech Grey Medium', 'polldaddy' ),
|
| 4912 |
+
136 => __( 'Tech Grey Wide', 'polldaddy' ),
|
| 4913 |
+
137 => __( 'Tech Light Narrow', 'polldaddy' ),
|
| 4914 |
+
138 => __( 'Tech Light Medium', 'polldaddy' ),
|
| 4915 |
+
139 => __( 'Tech Light Wide', 'polldaddy' ),
|
| 4916 |
+
140 => __( 'Working Male Narrow', 'polldaddy' ),
|
| 4917 |
+
141 => __( 'Working Male Medium', 'polldaddy' ),
|
| 4918 |
+
142 => __( 'Working Male Wide', 'polldaddy' ),
|
| 4919 |
+
143 => __( 'Working Female Narrow', 'polldaddy' ),
|
| 4920 |
+
144 => __( 'Working Female Medium', 'polldaddy' ),
|
| 4921 |
+
145 => __( 'Working Female Wide', 'polldaddy' ),
|
| 4922 |
+
146 => __( 'Thinking Male Narrow', 'polldaddy' ),
|
| 4923 |
+
147 => __( 'Thinking Male Medium', 'polldaddy' ),
|
| 4924 |
+
148 => __( 'Thinking Male Wide', 'polldaddy' ),
|
| 4925 |
+
149 => __( 'Thinking Female Narrow', 'polldaddy' ),
|
| 4926 |
+
150 => __( 'Thinking Female Medium', 'polldaddy' ),
|
| 4927 |
+
151 => __( 'Thinking Female Wide', 'polldaddy' ),
|
| 4928 |
+
152 => __( 'Sunset Narrow', 'polldaddy' ),
|
| 4929 |
+
153 => __( 'Sunset Medium', 'polldaddy' ),
|
| 4930 |
+
154 => __( 'Sunset Wide', 'polldaddy' ),
|
| 4931 |
+
155 => __( 'Music Medium', 'polldaddy' ),
|
| 4932 |
+
156 => __( 'Music Wide', 'polldaddy' )
|
| 4933 |
+
);
|
| 4934 |
+
|
| 4935 |
+
$polldaddy->reset();
|
| 4936 |
+
$styles = $polldaddy->get_styles();
|
| 4937 |
+
|
| 4938 |
+
if ( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ) {
|
| 4939 |
+
foreach ( (array) $styles->style as $style ) {
|
| 4940 |
+
$options[ (int) $style->_id ] = $style->title;
|
| 4941 |
+
}
|
| 4942 |
+
}
|
| 4943 |
+
}
|
| 4944 |
+
$this->print_errors();
|
| 4945 |
+
?>
|
| 4946 |
+
<div id="options-page" class="wrap">
|
| 4947 |
+
<div class="icon32" id="icon-options-general"><br/></div>
|
| 4948 |
+
<h2>
|
| 4949 |
+
<?php _e( 'Poll Settings', 'polldaddy' ); ?>
|
| 4950 |
+
</h2>
|
| 4951 |
+
<?php if ( $this->is_admin || $this->multiple_accounts ) { ?>
|
| 4952 |
+
<h3>
|
| 4953 |
+
<?php _e( 'Polldaddy Account Info', 'polldaddy' ); ?>
|
| 4954 |
+
</h3>
|
| 4955 |
+
<p><?php _e( '<em>Polldaddy</em> and <em>WordPress.com</em> are now connected using <a href="http://en.support.wordpress.com/wpcc-faq/">WordPress.com Connect</a>. If you have a WordPress.com account you can use it to login to <a href="http://polldaddy.com/">Polldaddy.com</a>. Click on the Polldaddy "sign in" button, authorize the connection and create your new Polldaddy account.', 'polldaddy' ); ?></p>
|
| 4956 |
+
<p><?php _e( 'Login to the Polldaddy website and scroll to the end of your <a href="http://polldaddy.com/account/#apikey">account page</a> to create or retrieve an API key.', 'polldaddy' ); ?></p>
|
| 4957 |
+
<?php if ( isset( $account_email ) && $account_email != false ) { ?>
|
| 4958 |
+
<p><?php printf( __( 'Your account is currently linked to this API key: <strong>%s</strong>', 'polldaddy' ), WP_POLLDADDY__PARTNERGUID ); ?></p>
|
| 4959 |
+
<br />
|
| 4960 |
+
<h3><?php _e( 'Link to a different Polldaddy account', 'polldaddy' ); ?></h3>
|
| 4961 |
+
<?php } else { ?>
|
| 4962 |
+
<br />
|
| 4963 |
+
<h3><?php _e( 'Link to your Polldaddy account', 'polldaddy' ); ?></h3>
|
| 4964 |
+
<?php } ?>
|
| 4965 |
+
<form action="" method="post">
|
| 4966 |
+
<table class="form-table">
|
| 4967 |
+
<tbody>
|
| 4968 |
+
<tr class="form-field form-required">
|
| 4969 |
+
<th valign="top" scope="row">
|
| 4970 |
+
<label for="polldaddy-key">
|
| 4971 |
+
<?php _e( 'Polldaddy.com API Key', 'polldaddy' ); ?>
|
| 4972 |
+
</label>
|
| 4973 |
+
</th>
|
| 4974 |
+
<td>
|
| 4975 |
+
<input type="text" name="polldaddy_key" id="polldaddy-key" aria-required="true" size="20" value="<?php if ( isset( $_POST[ 'polldaddy_key' ] ) ) echo esc_attr( $_POST[ 'polldaddy_key' ] ); ?>" />
|
| 4976 |
+
</td>
|
| 4977 |
+
</tr>
|
| 4978 |
+
</tbody>
|
| 4979 |
+
</table>
|
| 4980 |
+
<p class="submit">
|
| 4981 |
+
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 4982 |
+
<input type="hidden" name="action" value="import-account" />
|
| 4983 |
+
<input type="hidden" name="account" value="import" />
|
| 4984 |
+
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Link Account', 'polldaddy' ) ); ?>" />
|
| 4985 |
+
</p>
|
| 4986 |
+
</form>
|
| 4987 |
+
|
| 4988 |
+
<?php
|
| 4989 |
+
} ?>
|
| 4990 |
+
<?php
|
| 4991 |
+
// if not connected to a Polldaddy account can't save defaults so don't show the form.
|
| 4992 |
+
if ( false == is_object( $poll ) ) {
|
| 4993 |
+
echo "</div>";
|
| 4994 |
+
} else {
|
| 4995 |
+
?>
|
| 4996 |
+
<h3>
|
| 4997 |
+
<?php _e( 'General Settings', 'polldaddy' ); ?>
|
| 4998 |
+
</h3>
|
| 4999 |
+
<form action="" method="post">
|
| 5000 |
+
<table class="form-table">
|
| 5001 |
+
<tbody>
|
| 5002 |
+
<tr valign="top">
|
| 5003 |
+
<th valign="top" scope="row">
|
| 5004 |
+
<label>
|
| 5005 |
+
<?php _e( 'Default poll settings', 'polldaddy' ); ?>
|
| 5006 |
+
</label>
|
| 5007 |
+
</th>
|
| 5008 |
+
<td>
|
| 5009 |
+
<fieldset>
|
| 5010 |
+
<legend class="screen-reader-text"><span>poll-defaults</span></legend><?php
|
| 5011 |
+
foreach ( array( 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), 'multipleChoice' => __( 'Multiple choice', 'polldaddy' ), 'sharing' => __( 'Sharing', 'polldaddy' ) ) as $option => $label ) :
|
| 5012 |
+
$checked = 'yes' === $poll->$option ? ' checked="checked"' : '';
|
| 5013 |
+
?>
|
| 5014 |
+
<label for="<?php echo $option; ?>"><input type="checkbox"<?php echo $checked; ?> value="1" id="<?php echo $option; ?>" name="<?php echo $option; ?>" /> <?php echo esc_html( $label ); ?></label><br />
|
| 5015 |
+
|
| 5016 |
+
<?php endforeach; ?>
|
| 5017 |
+
<br class="clear" />
|
| 5018 |
+
<br class="clear" />
|
| 5019 |
+
<div class="field">
|
| 5020 |
+
<label for="resultsType" class="pd-label">
|
| 5021 |
+
<?php _e( 'Results Display', 'polldaddy' ); ?></label>
|
| 5022 |
+
<select id="resultsType" name="resultsType">
|
| 5023 |
+
<option <?php echo $poll->resultsType == 'show' ? 'selected="selected"':''; ?> value="show"><?php _e( 'Show', 'polldaddy' ); ?></option>
|
| 5024 |
+
<option <?php echo $poll->resultsType == 'hide' ? 'selected="selected"':''; ?> value="hide"><?php _e( 'Hide', 'polldaddy' ); ?></option>
|
| 5025 |
+
<option <?php echo $poll->resultsType == 'percent' ? 'selected="selected"':''; ?> value="percent"><?php _e( 'Percentages', 'polldaddy' ); ?></option>
|
| 5026 |
+
</select>
|
| 5027 |
+
</div>
|
| 5028 |
+
<br class="clear" />
|
| 5029 |
+
<div class="field">
|
| 5030 |
+
<label for="styleID" class="pd-label">
|
| 5031 |
+
<?php _e( 'Poll style', 'polldaddy' ); ?></label>
|
| 5032 |
+
<select id="styleID" name="styleID"><?php
|
| 5033 |
+
foreach ( (array) $options as $styleID => $label ) :
|
| 5034 |
+
$selected = $styleID == $poll->styleID ? ' selected="selected"' : ''; ?>
|
| 5035 |
+
<option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo esc_html( $label ); ?></option><?php
|
| 5036 |
+
endforeach;?>
|
| 5037 |
+
</select>
|
| 5038 |
+
</div>
|
| 5039 |
+
</div>
|
| 5040 |
+
<br class="clear" />
|
| 5041 |
+
<div class="field">
|
| 5042 |
+
<label for="blockRepeatVotersType" class="pd-label">
|
| 5043 |
+
<?php _e( 'Repeat Voting', 'polldaddy' ); ?></label>
|
| 5044 |
+
<select id="poll-block-repeat" name="blockRepeatVotersType">
|
| 5045 |
+
<option <?php echo $poll->blockRepeatVotersType == 'off' ? 'selected="selected"':''; ?> value="off"><?php _e( 'Off', 'polldaddy' ); ?></option>
|
| 5046 |
+
<option <?php echo $poll->blockRepeatVotersType == 'cookie' ? 'selected="selected"':''; ?> value="cookie"><?php _e( 'Cookie', 'polldaddy' ); ?></option>
|
| 5047 |
+
<option <?php echo $poll->blockRepeatVotersType == 'cookieip' ? 'selected="selected"':''; ?> value="cookieip"><?php _e( 'Cookie & IP address', 'polldaddy' ); ?></option>
|
| 5048 |
+
</select>
|
| 5049 |
+
</div>
|
| 5050 |
+
<br class="clear" />
|
| 5051 |
+
<div class="field">
|
| 5052 |
+
|
| 5053 |
+
<label for="blockExpiration" class="pd-label"><?php _e( 'Block expiration limit', 'polldaddy' ); ?></label>
|
| 5054 |
+
|
| 5055 |
+
|
| 5056 |
+
<select id="blockExpiration" name="blockExpiration">
|
| 5057 |
+
<option value="3600" <?php echo $poll->blockExpiration == 3600 ? 'selected="selected"':''; ?>><?php printf( __( '%d hour', 'polldaddy' ), 1 ); ?></option>
|
| 5058 |
+
<option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 3 ); ?></option>
|
| 5059 |
+
<option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 6 ); ?></option>
|
| 5060 |
+
<option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d hours', 'polldaddy' ), 12 ); ?></option>
|
| 5061 |
+
<option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d day', 'polldaddy' ), 1 ); ?></option>
|
| 5062 |
+
<option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected="selected"' : ''; ?>><?php printf( __( '%d week', 'polldaddy' ), 1 ); ?></option>
|
| 5063 |
+
</select>
|
| 5064 |
+
</div>
|
| 5065 |
+
</div>
|
| 5066 |
+
<br class="clear" />
|
| 5067 |
+
</fieldset>
|
| 5068 |
+
</td>
|
| 5069 |
+
</tr>
|
| 5070 |
+
<?php $this->plugin_options_add(); ?>
|
| 5071 |
+
</tbody>
|
| 5072 |
+
</table>
|
| 5073 |
+
<p class="submit">
|
| 5074 |
+
<?php wp_nonce_field( 'polldaddy-account' ); ?>
|
| 5075 |
+
<input type="hidden" name="action" value="update-options" />
|
| 5076 |
+
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Save Options', 'polldaddy' ) ); ?>" />
|
| 5077 |
+
</p>
|
| 5078 |
+
</form>
|
| 5079 |
+
</div>
|
| 5080 |
+
<?php
|
| 5081 |
+
} // is_object( $poll )
|
| 5082 |
+
global $current_user;
|
| 5083 |
+
$fields = array( 'polldaddy_api_key', 'pd-rating-comments', 'pd-rating-comments-id', 'pd-rating-comments-pos', 'pd-rating-exclude-post-ids', 'pd-rating-pages', 'pd-rating-pages-id', 'pd-rating-posts', 'pd-rating-posts-id', 'pd-rating-posts-index', 'pd-rating-posts-index-id', 'pd-rating-posts-index-pos', 'pd-rating-posts-pos', 'pd-rating-title-filter', 'pd-rating-usercode', 'pd-rich-snippets', 'pd-usercode-' . $current_user->ID );
|
| 5084 |
+
$show_reset_form = false;
|
| 5085 |
+
foreach( $fields as $field ) {
|
| 5086 |
+
$value = get_option( $field );
|
| 5087 |
+
if ( $value != false )
|
| 5088 |
+
$show_reset_form = true;
|
| 5089 |
+
$settings[ $field ] = $value;
|
| 5090 |
+
}
|
| 5091 |
+
if ( $show_reset_form ) {
|
| 5092 |
+
echo "<h3>" . __( 'Reset Connection Settings', 'polldaddy' ) . "</h3>";
|
| 5093 |
+
echo "<p>" . __( 'If you are experiencing problems connecting to the Polldaddy website resetting your connection settings may help. A backup will be made. After resetting, link your account again with the same API key.', 'polldaddy' ) . "</p>";
|
| 5094 |
+
echo "<p>" . __( 'The following settings will be reset:', 'polldaddy' ) . "</p>";
|
| 5095 |
+
echo "<table>";
|
| 5096 |
+
foreach( $settings as $key => $value ) {
|
| 5097 |
+
if ( $value != '' ) {
|
| 5098 |
+
if ( strpos( $key, 'usercode' ) )
|
| 5099 |
+
$value = "***********" . substr( $value, -4 );
|
| 5100 |
+
elseif ( in_array( $key, array( 'pd-rating-pages-id', 'pd-rating-comments-id', 'pd-rating-posts-id' ) ) )
|
| 5101 |
+
$value = "$value (<a href='http://polldaddy.com/ratings/{$value}/edit/'>" . __( 'Edit', 'polldaddy' ) . "</a>)";
|
| 5102 |
+
echo "<tr><th style='text-align: right'>$key:</th><td>$value</td></tr>\n";
|
| 5103 |
+
}
|
| 5104 |
+
}
|
| 5105 |
+
echo "</table>";
|
| 5106 |
+
echo "<p>" . __( "* The usercode is like a password, keep it secret.", 'polldaddy' ) . "</p>";
|
| 5107 |
+
?>
|
| 5108 |
+
<form action="" method="post">
|
| 5109 |
+
<p class="submit">
|
| 5110 |
+
<?php wp_nonce_field( 'polldaddy-reset' . $current_user->ID ); ?>
|
| 5111 |
+
<input type="hidden" name="action" value="reset-account" />
|
| 5112 |
+
<input type="hidden" name="account" value="import" />
|
| 5113 |
+
<p><input type="checkbox" name="email" value="1" /> <?php _e( 'Send me an email with the connection settings for future reference' ); ?></p>
|
| 5114 |
+
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Reset', 'polldaddy' ) ); ?>" />
|
| 5115 |
+
</p>
|
| 5116 |
+
</form>
|
| 5117 |
+
<br />
|
| 5118 |
+
<?php
|
| 5119 |
+
}
|
| 5120 |
+
$previous_settings = get_option( 'polldaddy_settings' );
|
| 5121 |
+
if ( is_array( $previous_settings ) && !empty( $previous_settings ) ) {
|
| 5122 |
+
echo "<h3>" . __( 'Restore Previous Settings', 'polldaddy' ) . "</h3>";
|
| 5123 |
+
echo "<p>" . __( 'The connection settings for this site were reset but a backup was made. The following settings can be restored:', 'polldaddy' ) . "</p>";
|
| 5124 |
+
echo "<table>";
|
| 5125 |
+
foreach( $previous_settings as $key => $value ) {
|
| 5126 |
+
if ( $value != '' ) {
|
| 5127 |
+
if ( strpos( $key, 'usercode' ) )
|
| 5128 |
+
$value = "***********" . substr( $value, -4 );
|
| 5129 |
+
elseif ( in_array( $key, array( 'pd-rating-pages-id', 'pd-rating-comments-id', 'pd-rating-posts-id' ) ) )
|
| 5130 |
+
$value = "$value (<a href='http://polldaddy.com/ratings/{$value}/edit/'>" . __( 'Edit', 'polldaddy' ) . "</a>)";
|
| 5131 |
+
echo "<tr><th style='text-align: right'>$key:</th><td>$value</td></tr>\n";
|
| 5132 |
+
}
|
| 5133 |
+
}
|
| 5134 |
+
echo "</table>";
|
| 5135 |
+
echo "<p>" . __( "* The usercode is like a password, keep it secret.", 'polldaddy' ) . "</p>";
|
| 5136 |
+
?>
|
| 5137 |
+
<form action="" method="post">
|
| 5138 |
+
<p class="submit">
|
| 5139 |
+
<?php wp_nonce_field( 'polldaddy-restore' . $current_user->ID ); ?>
|
| 5140 |
+
<input type="hidden" name="action" value="restore-account" />
|
| 5141 |
+
<input type="hidden" name="account" value="import" />
|
| 5142 |
+
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Restore', 'polldaddy' ) ); ?>" />
|
| 5143 |
+
</p>
|
| 5144 |
+
</form>
|
| 5145 |
+
<br />
|
| 5146 |
+
<?php
|
| 5147 |
+
if ( $show_reset_form && isset( $settings[ 'pd-rating-posts-id' ] ) && $settings[ 'pd-rating-posts-id' ] != $previous_settings[ 'pd-rating-posts-id' ] ) {
|
| 5148 |
+
echo "<h3>" . __( 'Restore Ratings Settings', 'polldaddy' ) . "</h3>";
|
| 5149 |
+
echo "<p>" . __( 'Different rating settings detected. If you are missing ratings on your posts, pages or comments you can restore the original rating settings by clicking the button below.', 'polldaddy' ) . "</p>";
|
| 5150 |
+
echo "<p>" . __( 'This tells the plugin to look for this data in a different rating in your Polldaddy account.', 'polldaddy' ) . "</p>";
|
| 5151 |
+
?>
|
| 5152 |
+
<form action="" method="post">
|
| 5153 |
+
<p class="submit">
|
| 5154 |
+
<?php wp_nonce_field( 'polldaddy-restore-ratings' . $current_user->ID ); ?>
|
| 5155 |
+
<input type="hidden" name="action" value="restore-ratings" />
|
| 5156 |
+
<input type="hidden" name="account" value="import" />
|
| 5157 |
+
<input type="submit" class="button-primary" value="<?php echo esc_attr( __( 'Restore Ratings Only', 'polldaddy' ) ); ?>" />
|
| 5158 |
+
</p>
|
| 5159 |
+
</form>
|
| 5160 |
+
<br />
|
| 5161 |
+
<?php
|
| 5162 |
+
}
|
| 5163 |
+
}
|
| 5164 |
+
}
|
| 5165 |
+
|
| 5166 |
+
function plugin_options_add() {}
|
| 5167 |
+
|
| 5168 |
+
function round( $number, $increments ) {
|
| 5169 |
+
$increments = 1 / $increments;
|
| 5170 |
+
return round( $number * $increments ) / $increments;
|
| 5171 |
+
}
|
| 5172 |
+
|
| 5173 |
+
function signup() {
|
| 5174 |
+
return $this->api_key_page();
|
| 5175 |
+
}
|
| 5176 |
+
|
| 5177 |
+
function can_edit( &$poll ) {
|
| 5178 |
+
if ( empty( $poll->_owner ) ) {
|
| 5179 |
+
$this->log( 'can_edit: poll owner is empty.' );
|
| 5180 |
+
return true;
|
| 5181 |
+
}
|
| 5182 |
+
|
| 5183 |
+
if ( $this->id == $poll->_owner ) {
|
| 5184 |
+
$this->log( 'can_edit: poll owner equals id.' );
|
| 5185 |
+
return true;
|
| 5186 |
+
}
|
| 5187 |
+
|
| 5188 |
+
if ( $poll->parentID == (int) $GLOBALS['blog_id'] && current_user_can( 'edit_others_posts' ) ) {
|
| 5189 |
+
$this->log( 'can_edit: poll was created on this blog and current user can edit_others_posts' );
|
| 5190 |
+
return true;
|
| 5191 |
+
}
|
| 5192 |
+
|
| 5193 |
+
//check to see if poll owner is a member of this blog
|
| 5194 |
+
if ( function_exists( 'get_users' ) ) {
|
| 5195 |
+
$user = get_users( array( 'include' => $poll->_owner ) );
|
| 5196 |
+
if ( empty( $user ) ) {
|
| 5197 |
+
$this->log( 'can_edit: poll owner is not a member of this blog.' );
|
| 5198 |
+
return false;
|
| 5199 |
+
}
|
| 5200 |
+
}
|
| 5201 |
+
|
| 5202 |
+
if ( false == (bool) current_user_can( 'edit_others_posts' ) )
|
| 5203 |
+
$this->log( 'can_edit: current user cannot edit_others_posts.' );
|
| 5204 |
+
|
| 5205 |
+
return (bool) current_user_can( 'edit_others_posts' );
|
| 5206 |
+
}
|
| 5207 |
+
|
| 5208 |
+
function log( $message ) {}
|
| 5209 |
+
|
| 5210 |
+
function contact_support_message( $message, $errors ) {
|
| 5211 |
+
global $current_user;
|
| 5212 |
+
echo '<div class="error" id="polldaddy">';
|
| 5213 |
+
echo '<h1>' . $message . '</h1>';
|
| 5214 |
+
echo '<p>' . __( "There are a few things you can do:" );
|
| 5215 |
+
echo "<ul><ol>" . __( "Press reload on your browser and reload this page. There may have been a temporary problem communicating with Polldaddy.com", "polldaddy" ) . "</ol>";
|
| 5216 |
+
echo "<ol>" . sprintf( __( "Go to the <a href='%s'>poll settings page</a>, scroll to the end of the page and reset your connection settings. Link your account again with the same API key.", "polldaddy" ), 'options-general.php?page=polls&action=options' ) . "</ol>";
|
| 5217 |
+
echo "<ol>" . sprintf( __( 'Contact <a href="%1$s" %2$s>Polldaddy support</a> and tell them your rating usercode is %3$s', 'polldaddy' ), 'http://polldaddy.com/feedback/', 'target="_blank"', $this->rating_user_code ) . '<br />' . __( 'Also include the following information when contacting support to help us resolve your problem as quickly as possible:', 'polldaddy' ) . '';
|
| 5218 |
+
echo "<ul><li> API Key: " . get_option( 'polldaddy_api_key' ) . "</li>";
|
| 5219 |
+
echo "<li> ID Usercode: " . get_option( 'pd-usercode-' . $current_user->ID ) . "</li>";
|
| 5220 |
+
echo "<li> pd-rating-usercode: " . get_option( 'pd-rating-usercode' ) . "</li>";
|
| 5221 |
+
echo "<li> pd-rating-posts-id: " . get_option( 'pd-rating-posts-id' ) . "</li>";
|
| 5222 |
+
echo "<li> Errors: " . print_r( $errors, 1 ) . "</li></ul>";
|
| 5223 |
+
echo "</ol></ul></div>";
|
| 5224 |
+
}
|
| 5225 |
+
}
|
| 5226 |
+
|
| 5227 |
+
require dirname( __FILE__ ).'/rating.php';
|
| 5228 |
+
require dirname( __FILE__ ).'/ajax.php';
|
| 5229 |
+
require dirname( __FILE__ ).'/popups.php';
|
| 5230 |
+
require dirname( __FILE__ ).'/polldaddy-org.php';
|
| 5231 |
+
|
| 5232 |
+
$GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: eoigal, mdawaffe, donncha, johnny5, panosktn
|
| 3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
| 4 |
Requires at least: 3.3
|
| 5 |
-
Tested up to: 4.
|
| 6 |
-
Stable tag: 2.0.
|
| 7 |
|
| 8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
| 9 |
|
|
@@ -120,6 +120,11 @@ Fixed a class constructor warning, and a rating comments PHP notice
|
|
| 120 |
|
| 121 |
== Changelog ==
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
= 2.0.34 =
|
| 124 |
* Renamed class constructors so they don't become a problem in a future version of PHP
|
| 125 |
* Checked the type of $comment in rating.php to avoid PHP notices
|
| 2 |
Contributors: eoigal, mdawaffe, donncha, johnny5, panosktn
|
| 3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
| 4 |
Requires at least: 3.3
|
| 5 |
+
Tested up to: 4.8
|
| 6 |
+
Stable tag: 2.0.35
|
| 7 |
|
| 8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
| 9 |
|
| 120 |
|
| 121 |
== Changelog ==
|
| 122 |
|
| 123 |
+
= 2.0.35 =
|
| 124 |
+
* Minor fix for remaining legacy class constructor with PHP 7.
|
| 125 |
+
* Fixed some minor PHP notices when accessing nonexistent array values.
|
| 126 |
+
* Fixed deprecated usage of `mktime()`.
|
| 127 |
+
|
| 128 |
= 2.0.34 =
|
| 129 |
* Renamed class constructors so they don't become a problem in a future version of PHP
|
| 130 |
* Checked the type of $comment in rating.php to avoid PHP notices
|
