Version Description
Tidy plugins menus to only use one Top-level menu for Polls and Ratings, also includes better integration with Jetpack
=
Download this release
Release Info
| Developer | donncha |
| Plugin | |
| Version | 2.0.16 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.15 to 2.0.16
- polldaddy-client.php +6 -4
- polldaddy-org.php +48 -1
- polldaddy.php +75 -89
- readme.txt +9 -4
polldaddy-client.php
CHANGED
|
@@ -1170,9 +1170,11 @@ function &polldaddy_poll( $args = null, $id = null, $_require_data = true ) {
|
|
| 1170 |
}
|
| 1171 |
|
| 1172 |
global $wpdb;
|
| 1173 |
-
|
| 1174 |
-
|
| 1175 |
-
$
|
|
|
|
|
|
|
| 1176 |
|
| 1177 |
foreach ( array( 'styleID', 'packID', 'folderID', 'languageID', 'choices', 'blockExpiration' ) as $int )
|
| 1178 |
if ( !is_numeric( $args[$int] ) )
|
|
@@ -1365,4 +1367,4 @@ function stripslashes_deep($value) {
|
|
| 1365 |
return $value;
|
| 1366 |
}
|
| 1367 |
endif;
|
| 1368 |
-
?>
|
| 1170 |
}
|
| 1171 |
|
| 1172 |
global $wpdb;
|
| 1173 |
+
if ( isset( $wpdb->blogs ) ) { // single hosted WordPress sites don't have a blogs table.
|
| 1174 |
+
$public = (int) $wpdb->get_var( $wpdb->prepare( "SELECT public FROM {$wpdb->blogs} WHERE blog_id = %d", $wpdb->blogid ) );
|
| 1175 |
+
if( $public == -1 )
|
| 1176 |
+
$args['makePublic'] = 'no';
|
| 1177 |
+
}
|
| 1178 |
|
| 1179 |
foreach ( array( 'styleID', 'packID', 'folderID', 'languageID', 'choices', 'blockExpiration' ) as $int )
|
| 1180 |
if ( !is_numeric( $args[$int] ) )
|
| 1367 |
return $value;
|
| 1368 |
}
|
| 1369 |
endif;
|
| 1370 |
+
?>
|
polldaddy-org.php
CHANGED
|
@@ -15,7 +15,7 @@ class WPORG_Polldaddy extends WP_Polldaddy {
|
|
| 15 |
function __construct() {
|
| 16 |
parent::__construct();
|
| 17 |
$this->log( 'Created WPORG_Polldaddy Object: constructor' );
|
| 18 |
-
$this->version = '2.0.
|
| 19 |
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
| 20 |
$this->polldaddy_client_class = 'WPORG_Polldaddy_Client';
|
| 21 |
$this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
|
|
@@ -58,6 +58,30 @@ class WPORG_Polldaddy extends WP_Polldaddy {
|
|
| 58 |
}
|
| 59 |
parent::set_api_user_code();
|
| 60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
function management_page_load() {
|
| 63 |
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
|
@@ -114,6 +138,29 @@ class WPORG_Polldaddy extends WP_Polldaddy {
|
|
| 114 |
break;
|
| 115 |
} //end switch
|
| 116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
parent::management_page_load();
|
| 119 |
}
|
| 15 |
function __construct() {
|
| 16 |
parent::__construct();
|
| 17 |
$this->log( 'Created WPORG_Polldaddy Object: constructor' );
|
| 18 |
+
$this->version = '2.0.16';
|
| 19 |
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
| 20 |
$this->polldaddy_client_class = 'WPORG_Polldaddy_Client';
|
| 21 |
$this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
|
| 58 |
}
|
| 59 |
parent::set_api_user_code();
|
| 60 |
}
|
| 61 |
+
|
| 62 |
+
function admin_title( $admin_title ) {
|
| 63 |
+
global $page;
|
| 64 |
+
if ( $page == 'polls' )
|
| 65 |
+
return __( "Polls", "polldaddy" ).$admin_title;
|
| 66 |
+
else
|
| 67 |
+
return __( "Ratings", "polldaddy" ).$admin_title;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
function admin_menu() {
|
| 71 |
+
parent::admin_menu();
|
| 72 |
+
|
| 73 |
+
if ( class_exists( 'Jetpack' ) ) {
|
| 74 |
+
add_submenu_page( 'edit.php?post_type=feedback', __( 'Feedbacks', 'polldaddy' ), __( 'Feedbacks', 'polldaddy' ), 'edit_pages', 'edit.php?post_type=feedback' );
|
| 75 |
+
|
| 76 |
+
foreach( array( 'polls' => __( 'Polls', 'polldaddy' ), 'ratings' => __( 'Ratings', 'polldaddy' ) ) as $menu_slug => $menu_title ) {
|
| 77 |
+
remove_menu_page( $menu_slug );
|
| 78 |
+
add_submenu_page( 'edit.php?post_type=feedback', $menu_title, $menu_title, 'edit_posts', 'edit.php?page='.$menu_slug );
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
else {
|
| 82 |
+
remove_menu_page( 'ratings' );
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
|
| 86 |
function management_page_load() {
|
| 87 |
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
| 138 |
break;
|
| 139 |
} //end switch
|
| 140 |
}
|
| 141 |
+
|
| 142 |
+
global $parent_file, $submenu_file, $typenow;
|
| 143 |
+
|
| 144 |
+
//need to set this to make sure that menus behave properly
|
| 145 |
+
if ( in_array( $action, array( 'options', 'update-rating' ) ) ) {
|
| 146 |
+
$parent_file = 'options-general.php';
|
| 147 |
+
$submenu_file = $page.'&action=options';
|
| 148 |
+
}
|
| 149 |
+
else {
|
| 150 |
+
if ( class_exists( 'Jetpack' ) ) {
|
| 151 |
+
//need to fix admin title when viewing polls and rating pages
|
| 152 |
+
add_filter( 'admin_title', array( &$this, 'admin_title' ) );
|
| 153 |
+
|
| 154 |
+
$parent_file = 'edit.php?post_type=feedback';
|
| 155 |
+
$typenow = 'feedback';
|
| 156 |
+
$submenu_file = 'edit.php?page='.$page;
|
| 157 |
+
remove_submenu_page( $page, $page );
|
| 158 |
+
}
|
| 159 |
+
elseif ( $page == 'ratings' ) {
|
| 160 |
+
add_filter( 'admin_title', array( &$this, 'admin_title' ) );
|
| 161 |
+
$submenu_file = 'ratings';
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
|
| 165 |
parent::management_page_load();
|
| 166 |
}
|
polldaddy.php
CHANGED
|
@@ -6,7 +6,7 @@ Plugin URI: http://wordpress.org/extend/plugins/polldaddy/
|
|
| 6 |
Description: Create and manage Polldaddy polls and ratings in WordPress
|
| 7 |
Author: Automattic, Inc.
|
| 8 |
Author URL: http://automattic.com/
|
| 9 |
-
Version: 2.0.
|
| 10 |
*/
|
| 11 |
|
| 12 |
// You can hardcode your Polldaddy PartnerGUID (API Key) here
|
|
@@ -35,12 +35,12 @@ class WP_Polldaddy {
|
|
| 35 |
$this->log( 'Created WP_Polldaddy Object: constructor' );
|
| 36 |
$this->errors = new WP_Error;
|
| 37 |
$this->scheme = 'https';
|
| 38 |
-
$this->version = '2.0.
|
| 39 |
$this->multiple_accounts = true;
|
| 40 |
$this->polldaddy_client_class = 'api_client';
|
| 41 |
$this->polldaddy_clients = array();
|
| 42 |
$this->is_admin = (bool) current_user_can( 'manage_options' );
|
| 43 |
-
$this->is_author =
|
| 44 |
$this->user_code = null;
|
| 45 |
$this->rating_user_code = null;
|
| 46 |
$this->id = ($current_user instanceof WP_User) ? intval( $current_user->ID ): 0;
|
|
@@ -72,63 +72,42 @@ class WP_Polldaddy {
|
|
| 72 |
define( 'WP_POLLDADDY__PARTNERGUID', $guid );
|
| 73 |
|
| 74 |
}
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
if ( !WP_POLLDADDY__PARTNERGUID ) {
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
$hook = add_management_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ) );
|
| 82 |
-
|
| 83 |
-
add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
|
| 84 |
-
|
| 85 |
-
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
| 86 |
-
$hook = add_object_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'api_key_page' ), "{$this->base_url}img/pd-wp-icon-gray.png" );
|
| 87 |
-
else
|
| 88 |
-
$hook = add_management_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'api_key_page' ) );
|
| 89 |
-
|
| 90 |
-
add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
|
| 91 |
-
|
| 92 |
return false;
|
| 93 |
-
|
| 94 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
else
|
| 100 |
-
$hook = add_management_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
|
| 101 |
-
|
| 102 |
-
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
| 103 |
-
|
| 104 |
-
if ( function_exists( 'add_object_page' ) ) // WP 2.7+
|
| 105 |
-
$hook = add_object_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ), "{$this->base_url}img/pd-wp-icon-gray.png" );
|
| 106 |
-
else
|
| 107 |
-
$hook = add_management_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
|
| 108 |
-
|
| 109 |
-
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
if ( $this->is_admin ) {
|
| 113 |
-
add_submenu_page( 'ratings', __( 'Ratings – Settings', 'polldaddy' ), __( 'All Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
|
| 114 |
-
add_submenu_page( 'ratings', __( 'Ratings – Reports', 'polldaddy' ), __( 'Reports', 'polldaddy' ), 'edit_posts', 'ratings&action=reports', array( &$this, 'management_page' ) );
|
| 115 |
-
}
|
| 116 |
-
else {
|
| 117 |
-
add_submenu_page( 'ratings', __( 'Ratings – Reports', 'polldaddy' ), __( 'Reports', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
add_submenu_page( 'polls', __( 'Polls', 'polldaddy' ), __( 'All Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
|
| 121 |
-
|
| 122 |
-
if ( $this->is_author ) {
|
| 123 |
-
add_submenu_page( 'polls', __( 'Add New Poll', 'polldaddy' ), __( 'Add New', 'polldaddy' ), 'edit_posts', 'polls&action=create-poll', array( &$this, 'management_page' ) );
|
| 124 |
-
add_submenu_page( 'polls', __( 'Custom Styles', 'polldaddy' ), __( 'Custom Styles', 'polldaddy' ), 'edit_posts', 'polls&action=list-styles', array( &$this, 'management_page' ) );
|
| 125 |
-
add_options_page( __( 'Polls & Ratings', 'polldaddy' ), __( 'Polls & Ratings', 'polldaddy' ), 'edit_posts', 'polls&action=options', array( &$this, 'management_page' ) );
|
| 126 |
}
|
| 127 |
|
| 128 |
-
add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
|
| 129 |
}
|
| 130 |
|
| 131 |
-
|
| 132 |
function do_admin_css() {
|
| 133 |
|
| 134 |
$scheme = get_user_option( 'admin_color' );
|
|
@@ -361,7 +340,7 @@ class WP_Polldaddy {
|
|
| 361 |
wp_enqueue_script( 'polls-style', "{$this->base_url}js/poll-style-picker.js", array( 'polls', 'polls-common' ), $this->version );
|
| 362 |
|
| 363 |
if ( $action == 'create-poll' )
|
| 364 |
-
$plugin_page = 'polls&
|
| 365 |
|
| 366 |
break;
|
| 367 |
case 'edit-style' :
|
|
@@ -369,32 +348,32 @@ class WP_Polldaddy {
|
|
| 369 |
wp_enqueue_script( 'polls-style', "{$this->base_url}js/style-editor.js", array( 'polls', 'polls-common' ), $this->version );
|
| 370 |
wp_enqueue_script( 'polls-style-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 371 |
wp_enqueue_style( 'polls', "{$this->base_url}css/style-editor.css", array(), $this->version );
|
| 372 |
-
$plugin_page = 'polls&
|
| 373 |
break;
|
| 374 |
case 'list-styles' :
|
| 375 |
-
$plugin_page = 'polls&
|
| 376 |
break;
|
| 377 |
case 'options' :
|
| 378 |
case 'update-options' :
|
| 379 |
case 'import-account' :
|
| 380 |
-
$plugin_page = 'polls&
|
| 381 |
break;
|
| 382 |
}//end switch
|
| 383 |
} elseif ( $page == 'ratings' ) {
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
case 'delete' :
|
| 389 |
-
case 'reports' :
|
| 390 |
-
$plugin_page = 'ratings&action=reports';
|
| 391 |
-
break;
|
| 392 |
-
default :
|
| 393 |
wp_enqueue_script( 'rating-text-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 394 |
wp_enqueue_script( 'ratings', "{$this->base_url}js/rating.js", array(), $this->version );
|
| 395 |
wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
|
| 396 |
'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
|
| 397 |
'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
}//end switch
|
| 399 |
}
|
| 400 |
|
|
@@ -1191,7 +1170,7 @@ class WP_Polldaddy {
|
|
| 1191 |
<h2 id="poll-list-header"><?php _e( 'Polldaddy Polls', 'polldaddy' ); ?></h2>
|
| 1192 |
<?php
|
| 1193 |
} else { ?>
|
| 1194 |
-
<h2 id="poll-list-header"><?php printf( __( 'Preview Poll <a href="%s" class="
|
| 1195 |
<?php
|
| 1196 |
}
|
| 1197 |
endif;
|
|
@@ -1203,7 +1182,7 @@ class WP_Polldaddy {
|
|
| 1203 |
case 'results' :
|
| 1204 |
?>
|
| 1205 |
|
| 1206 |
-
<h2 id="poll-list-header"><?php printf( __( 'Poll Results <a href="%s" class="
|
| 1207 |
|
| 1208 |
<?php
|
| 1209 |
$this->poll_results_page( $poll );
|
|
@@ -1212,7 +1191,7 @@ class WP_Polldaddy {
|
|
| 1212 |
case 'edit-poll' :
|
| 1213 |
?>
|
| 1214 |
|
| 1215 |
-
<h2 id="poll-list-header"><?php printf( __( 'Edit Poll <a href="%s" class="
|
| 1216 |
|
| 1217 |
<?php
|
| 1218 |
|
|
@@ -1221,7 +1200,7 @@ class WP_Polldaddy {
|
|
| 1221 |
case 'create-poll' :
|
| 1222 |
?>
|
| 1223 |
|
| 1224 |
-
<h2 id="poll-list-header"><?php printf( __( 'Add New Poll <a href="%s" class="
|
| 1225 |
|
| 1226 |
<?php
|
| 1227 |
$this->poll_edit_form();
|
|
@@ -1231,7 +1210,7 @@ class WP_Polldaddy {
|
|
| 1231 |
|
| 1232 |
<h2 id="polldaddy-header"><?php
|
| 1233 |
if ( $this->is_author )
|
| 1234 |
-
printf( __( 'Custom Styles <a href="%s" class="
|
| 1235 |
else
|
| 1236 |
_e( 'Custom Styles', 'polldaddy' ); ?></h2>
|
| 1237 |
|
|
@@ -1241,7 +1220,7 @@ class WP_Polldaddy {
|
|
| 1241 |
case 'edit-style' :
|
| 1242 |
?>
|
| 1243 |
|
| 1244 |
-
<h2 id="polldaddy-header"><?php printf( __( 'Edit Style <a href="%s" class="
|
| 1245 |
|
| 1246 |
<?php
|
| 1247 |
|
|
@@ -1250,7 +1229,7 @@ class WP_Polldaddy {
|
|
| 1250 |
case 'create-style' :
|
| 1251 |
?>
|
| 1252 |
|
| 1253 |
-
<h2 id="polldaddy-header"><?php printf( __( 'Create Style <a href="%s" class="
|
| 1254 |
|
| 1255 |
<?php
|
| 1256 |
$this->style_edit_form();
|
|
@@ -1266,7 +1245,7 @@ class WP_Polldaddy {
|
|
| 1266 |
|
| 1267 |
<h2 id="poll-list-header"><?php
|
| 1268 |
if ( $this->is_author )
|
| 1269 |
-
printf( __( 'Polldaddy Polls <a href="%s" class="
|
| 1270 |
else
|
| 1271 |
_e( 'Polldaddy Polls ', 'polldaddy' ); ?></h2>
|
| 1272 |
|
|
@@ -1290,7 +1269,7 @@ class WP_Polldaddy {
|
|
| 1290 |
break;
|
| 1291 |
case 'update-rating' :
|
| 1292 |
$this->update_rating();
|
| 1293 |
-
$this->rating_settings(
|
| 1294 |
break;
|
| 1295 |
default :
|
| 1296 |
$this->rating_settings();
|
|
@@ -1685,7 +1664,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
| 1685 |
<ul id="answer-options">
|
| 1686 |
|
| 1687 |
<?php
|
| 1688 |
-
foreach ( array( 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), '
|
| 1689 |
if ( $is_POST )
|
| 1690 |
$checked = 'yes' === $_POST[$option] ? ' checked="checked"' : '';
|
| 1691 |
else
|
|
@@ -2269,18 +2248,21 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
| 2269 |
|
| 2270 |
<div class="pd-tab-panel" id="pd-custom-styles-panel">
|
| 2271 |
<div style="padding:20px;">
|
|
|
|
|
|
|
| 2272 |
<select id="customSelect" name="customSelect" onchange="javascript:pd_change_style(this.value);">
|
| 2273 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
| 2274 |
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style…', 'polldaddy' ); ?></option>
|
| 2275 |
-
<?php
|
| 2276 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
| 2277 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo esc_html( $style->title ); ?></option>
|
| 2278 |
-
<?php endforeach;
|
| 2279 |
</select>
|
| 2280 |
<div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.', 'polldaddy' ); ?></div>
|
| 2281 |
-
<?php
|
| 2282 |
-
<p><?php
|
| 2283 |
<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>
|
|
|
|
| 2284 |
</div>
|
| 2285 |
|
| 2286 |
|
|
@@ -3750,8 +3732,11 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
| 3750 |
$settings->font_color = '#000000';
|
| 3751 |
}?>
|
| 3752 |
<div class="wrap">
|
| 3753 |
-
<
|
| 3754 |
-
|
|
|
|
|
|
|
|
|
|
| 3755 |
echo '<div class="updated"><p>'.__( 'Rating updated', 'polldaddy' ).'</p></div>';
|
| 3756 |
|
| 3757 |
if ( !$error ) { ?>
|
|
@@ -4297,6 +4282,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
| 4297 |
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 4298 |
} );
|
| 4299 |
});
|
|
|
|
| 4300 |
</script>
|
| 4301 |
<script type="text/javascript">
|
| 4302 |
PDRTJS_settings = <?php echo $settings_text; ?>;
|
|
@@ -4555,9 +4541,13 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
| 4555 |
) );
|
| 4556 |
?>
|
| 4557 |
<div class="wrap">
|
| 4558 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4559 |
<div class="clear"></div>
|
| 4560 |
-
<form method="post" action="
|
| 4561 |
<div class="tablenav">
|
| 4562 |
<div class="alignleft actions">
|
| 4563 |
<select name="action">
|
|
@@ -4789,7 +4779,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
| 4789 |
<div id="options-page" class="wrap">
|
| 4790 |
<div class="icon32" id="icon-options-general"><br/></div>
|
| 4791 |
<h2>
|
| 4792 |
-
<?php _e( '
|
| 4793 |
</h2>
|
| 4794 |
<?php if ( $this->is_admin || $this->multiple_accounts ) {?>
|
| 4795 |
<h3>
|
|
@@ -4861,11 +4851,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
| 4861 |
if ( $poll->otherAnswer == 'yes' )
|
| 4862 |
$selected = 'checked="checked"';?>
|
| 4863 |
<label for="otherAnswer"><input type="checkbox" <?php echo $selected; ?> value="1" id="otherAnswer" name="otherAnswer"> <?php _e( 'Other Answer', 'polldaddy' ); ?></label>
|
| 4864 |
-
<br
|
| 4865 |
-
$selected = '';
|
| 4866 |
-
if ( $poll->sharing == 'yes' )
|
| 4867 |
-
$selected = 'checked="checked"';?>
|
| 4868 |
-
<label for="sharing"><input type="checkbox" <?php echo $selected; ?> value="1" id="sharing" name="sharing"> <?php _e( 'Sharing', 'polldaddy' ); ?></label>
|
| 4869 |
<br class="clear" />
|
| 4870 |
<div class="field">
|
| 4871 |
<label for="resultsType" class="pd-label">
|
| 6 |
Description: Create and manage Polldaddy polls and ratings in WordPress
|
| 7 |
Author: Automattic, Inc.
|
| 8 |
Author URL: http://automattic.com/
|
| 9 |
+
Version: 2.0.16
|
| 10 |
*/
|
| 11 |
|
| 12 |
// You can hardcode your Polldaddy PartnerGUID (API Key) here
|
| 35 |
$this->log( 'Created WP_Polldaddy Object: constructor' );
|
| 36 |
$this->errors = new WP_Error;
|
| 37 |
$this->scheme = 'https';
|
| 38 |
+
$this->version = '2.0.16';
|
| 39 |
$this->multiple_accounts = true;
|
| 40 |
$this->polldaddy_client_class = 'api_client';
|
| 41 |
$this->polldaddy_clients = array();
|
| 42 |
$this->is_admin = (bool) current_user_can( 'manage_options' );
|
| 43 |
+
$this->is_author = (bool) current_user_can( 'edit_posts' );
|
| 44 |
$this->user_code = null;
|
| 45 |
$this->rating_user_code = null;
|
| 46 |
$this->id = ($current_user instanceof WP_User) ? intval( $current_user->ID ): 0;
|
| 72 |
define( 'WP_POLLDADDY__PARTNERGUID', $guid );
|
| 73 |
|
| 74 |
}
|
| 75 |
+
|
| 76 |
+
$capability = 'edit_posts';
|
| 77 |
+
$icon = "{$this->base_url}img/pd-wp-icon-gray.png";
|
| 78 |
+
$function = array( &$this, 'management_page' );
|
| 79 |
+
|
| 80 |
if ( !WP_POLLDADDY__PARTNERGUID ) {
|
| 81 |
+
foreach( array( 'polls' => __( 'Polls', 'polldaddy' ), 'ratings' => __( 'Ratings', 'polldaddy' ) ) as $menu_slug => $menu_title ) {
|
| 82 |
+
$hook = add_object_page( $menu_title, $menu_title, $capability, $menu_slug, array( &$this, 'api_key_page' ), $icon );
|
| 83 |
+
add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
|
| 84 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
return false;
|
|
|
|
| 86 |
}
|
| 87 |
+
|
| 88 |
+
foreach( array( 'polls' => __( 'Polls', 'polldaddy' ), 'ratings' => __( 'Ratings', 'polldaddy' ) ) as $menu_slug => $page_title ) {
|
| 89 |
+
$menu_title = $page_title;
|
| 90 |
+
$parent_slug = $menu_slug;
|
| 91 |
+
|
| 92 |
+
if ( !class_exists( 'Jetpack' ) ) {
|
| 93 |
+
//Create a Feedback Top level menu, like with Jetpack, to hold the Polls and Ratings submenus.
|
| 94 |
+
if ( $menu_slug == 'polls' )
|
| 95 |
+
$menu_title = __( 'Feedback', 'polldaddy' );
|
| 96 |
+
|
| 97 |
+
$parent_slug = 'polls';
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
$hook = add_object_page( $page_title, $menu_title, $capability, $menu_slug, array( &$this, 'management_page' ), $icon );
|
| 101 |
+
add_action( "load-$hook", array( &$this, 'management_page_load' ) );
|
| 102 |
|
| 103 |
+
add_submenu_page( $parent_slug, $page_title, $page_title, $capability, $menu_slug, $function );
|
| 104 |
+
|
| 105 |
+
add_options_page( $page_title, $page_title, $menu_slug == 'ratings' ? 'manage_options' : $capability, $menu_slug.'&action=options', $function );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
+
add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
|
| 109 |
}
|
| 110 |
|
|
|
|
| 111 |
function do_admin_css() {
|
| 112 |
|
| 113 |
$scheme = get_user_option( 'admin_color' );
|
| 340 |
wp_enqueue_script( 'polls-style', "{$this->base_url}js/poll-style-picker.js", array( 'polls', 'polls-common' ), $this->version );
|
| 341 |
|
| 342 |
if ( $action == 'create-poll' )
|
| 343 |
+
$plugin_page = 'polls&action=create-poll';
|
| 344 |
|
| 345 |
break;
|
| 346 |
case 'edit-style' :
|
| 348 |
wp_enqueue_script( 'polls-style', "{$this->base_url}js/style-editor.js", array( 'polls', 'polls-common' ), $this->version );
|
| 349 |
wp_enqueue_script( 'polls-style-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 350 |
wp_enqueue_style( 'polls', "{$this->base_url}css/style-editor.css", array(), $this->version );
|
| 351 |
+
$plugin_page = 'polls&action=list-styles';
|
| 352 |
break;
|
| 353 |
case 'list-styles' :
|
| 354 |
+
$plugin_page = 'polls&action=list-styles';
|
| 355 |
break;
|
| 356 |
case 'options' :
|
| 357 |
case 'update-options' :
|
| 358 |
case 'import-account' :
|
| 359 |
+
$plugin_page = 'polls&action=options';
|
| 360 |
break;
|
| 361 |
}//end switch
|
| 362 |
} elseif ( $page == 'ratings' ) {
|
| 363 |
+
switch ( $action ) {
|
| 364 |
+
case 'update-rating' :
|
| 365 |
+
case 'options':
|
| 366 |
+
$plugin_page = 'ratings&action=options';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
wp_enqueue_script( 'rating-text-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
| 368 |
wp_enqueue_script( 'ratings', "{$this->base_url}js/rating.js", array(), $this->version );
|
| 369 |
wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
|
| 370 |
'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
|
| 371 |
'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
|
| 372 |
+
break;
|
| 373 |
+
default :
|
| 374 |
+
if ( empty( $action ) )
|
| 375 |
+
$action = 'reports';
|
| 376 |
+
$plugin_page = 'ratings&action=reports';
|
| 377 |
}//end switch
|
| 378 |
}
|
| 379 |
|
| 1170 |
<h2 id="poll-list-header"><?php _e( 'Polldaddy Polls', 'polldaddy' ); ?></h2>
|
| 1171 |
<?php
|
| 1172 |
} else { ?>
|
| 1173 |
+
<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>
|
| 1174 |
<?php
|
| 1175 |
}
|
| 1176 |
endif;
|
| 1182 |
case 'results' :
|
| 1183 |
?>
|
| 1184 |
|
| 1185 |
+
<h2 id="poll-list-header"><?php printf( __( 'Poll Results <a href="%s" class="add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
|
| 1186 |
|
| 1187 |
<?php
|
| 1188 |
$this->poll_results_page( $poll );
|
| 1191 |
case 'edit-poll' :
|
| 1192 |
?>
|
| 1193 |
|
| 1194 |
+
<h2 id="poll-list-header"><?php printf( __( 'Edit 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>
|
| 1195 |
|
| 1196 |
<?php
|
| 1197 |
|
| 1200 |
case 'create-poll' :
|
| 1201 |
?>
|
| 1202 |
|
| 1203 |
+
<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>
|
| 1204 |
|
| 1205 |
<?php
|
| 1206 |
$this->poll_edit_form();
|
| 1210 |
|
| 1211 |
<h2 id="polldaddy-header"><?php
|
| 1212 |
if ( $this->is_author )
|
| 1213 |
+
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 ) ) ) );
|
| 1214 |
else
|
| 1215 |
_e( 'Custom Styles', 'polldaddy' ); ?></h2>
|
| 1216 |
|
| 1220 |
case 'edit-style' :
|
| 1221 |
?>
|
| 1222 |
|
| 1223 |
+
<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>
|
| 1224 |
|
| 1225 |
<?php
|
| 1226 |
|
| 1229 |
case 'create-style' :
|
| 1230 |
?>
|
| 1231 |
|
| 1232 |
+
<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>
|
| 1233 |
|
| 1234 |
<?php
|
| 1235 |
$this->style_edit_form();
|
| 1245 |
|
| 1246 |
<h2 id="poll-list-header"><?php
|
| 1247 |
if ( $this->is_author )
|
| 1248 |
+
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 ) ) ) );
|
| 1249 |
else
|
| 1250 |
_e( 'Polldaddy Polls ', 'polldaddy' ); ?></h2>
|
| 1251 |
|
| 1269 |
break;
|
| 1270 |
case 'update-rating' :
|
| 1271 |
$this->update_rating();
|
| 1272 |
+
$this->rating_settings();
|
| 1273 |
break;
|
| 1274 |
default :
|
| 1275 |
$this->rating_settings();
|
| 1664 |
<ul id="answer-options">
|
| 1665 |
|
| 1666 |
<?php
|
| 1667 |
+
foreach ( array( 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), 'multipleChoice' => __( 'Multiple choice', 'polldaddy' ) ) as $option => $label ) :
|
| 1668 |
if ( $is_POST )
|
| 1669 |
$checked = 'yes' === $_POST[$option] ? ' checked="checked"' : '';
|
| 1670 |
else
|
| 2248 |
|
| 2249 |
<div class="pd-tab-panel" id="pd-custom-styles-panel">
|
| 2250 |
<div style="padding:20px;">
|
| 2251 |
+
<?php if ( $show_custom ) : ?>
|
| 2252 |
+
<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>
|
| 2253 |
<select id="customSelect" name="customSelect" onchange="javascript:pd_change_style(this.value);">
|
| 2254 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
| 2255 |
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style…', 'polldaddy' ); ?></option>
|
| 2256 |
+
<?php foreach ( (array)$styles->style as $style ) :
|
| 2257 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
| 2258 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo esc_html( $style->title ); ?></option>
|
| 2259 |
+
<?php endforeach; ?>
|
| 2260 |
</select>
|
| 2261 |
<div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.', 'polldaddy' ); ?></div>
|
| 2262 |
+
<?php else : ?>
|
| 2263 |
+
<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>
|
| 2264 |
<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>
|
| 2265 |
+
<?php endif; ?>
|
| 2266 |
</div>
|
| 2267 |
|
| 2268 |
|
| 3732 |
$settings->font_color = '#000000';
|
| 3733 |
}?>
|
| 3734 |
<div class="wrap">
|
| 3735 |
+
<div class="icon32" id="icon-options-general"><br/></div>
|
| 3736 |
+
<h2>
|
| 3737 |
+
<?php _e( 'Rating Settings', 'polldaddy' ); ?>
|
| 3738 |
+
</h2>
|
| 3739 |
+
<?php if ( $rating_updated )
|
| 3740 |
echo '<div class="updated"><p>'.__( 'Rating updated', 'polldaddy' ).'</p></div>';
|
| 3741 |
|
| 3742 |
if ( !$error ) { ?>
|
| 4282 |
custom_styles: '<?php echo esc_attr( __( 'Custom Styles', 'polldaddy' ) ); ?>'
|
| 4283 |
} );
|
| 4284 |
});
|
| 4285 |
+
pd_map = { image_path : '<?php echo plugins_url( 'img', __FILE__ );?>' };
|
| 4286 |
</script>
|
| 4287 |
<script type="text/javascript">
|
| 4288 |
PDRTJS_settings = <?php echo $settings_text; ?>;
|
| 4541 |
) );
|
| 4542 |
?>
|
| 4543 |
<div class="wrap">
|
| 4544 |
+
<?php if ( $this->is_admin ) : ?>
|
| 4545 |
+
<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>
|
| 4546 |
+
<?php else : ?>
|
| 4547 |
+
<h2 id="polldaddy-header"><?php _e( 'Rating Results', 'polldaddy' ); ?></h2>
|
| 4548 |
+
<?php endif; ?>
|
| 4549 |
<div class="clear"></div>
|
| 4550 |
+
<form method="post" action="">
|
| 4551 |
<div class="tablenav">
|
| 4552 |
<div class="alignleft actions">
|
| 4553 |
<select name="action">
|
| 4779 |
<div id="options-page" class="wrap">
|
| 4780 |
<div class="icon32" id="icon-options-general"><br/></div>
|
| 4781 |
<h2>
|
| 4782 |
+
<?php _e( 'Poll Settings', 'polldaddy' ); ?>
|
| 4783 |
</h2>
|
| 4784 |
<?php if ( $this->is_admin || $this->multiple_accounts ) {?>
|
| 4785 |
<h3>
|
| 4851 |
if ( $poll->otherAnswer == 'yes' )
|
| 4852 |
$selected = 'checked="checked"';?>
|
| 4853 |
<label for="otherAnswer"><input type="checkbox" <?php echo $selected; ?> value="1" id="otherAnswer" name="otherAnswer"> <?php _e( 'Other Answer', 'polldaddy' ); ?></label>
|
| 4854 |
+
<br class="clear" />
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4855 |
<br class="clear" />
|
| 4856 |
<div class="field">
|
| 4857 |
<label for="resultsType" class="pd-label">
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: eoigal, alternatekev, mdawaffe, donncha, johnny5
|
| 3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
| 4 |
Requires at least: 3.2
|
| 5 |
-
Tested up to: 3.
|
| 6 |
-
Stable tag: 2.0.
|
| 7 |
|
| 8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
| 9 |
|
|
@@ -104,10 +104,15 @@ Your theme is getting the post content, without necessarily showing it. If the p
|
|
| 104 |
|
| 105 |
|
| 106 |
== Upgrade Notice ==
|
| 107 |
-
= 2.0.
|
| 108 |
-
|
| 109 |
|
| 110 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
= 2.0.15 =
|
| 112 |
* Fix for conflict with jetpack plugin. When both plugins were installed, conflict with older jetpack implementation of shortcode handler and redeclaration of polldaddy plugin function 'polldaddy_link()'
|
| 113 |
* Updated translations to use latest from glotpress and removed a lot of untranslated text, making plugin a much smaller download.
|
| 2 |
Contributors: eoigal, alternatekev, mdawaffe, donncha, johnny5
|
| 3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
| 4 |
Requires at least: 3.2
|
| 5 |
+
Tested up to: 3.5
|
| 6 |
+
Stable tag: 2.0.16
|
| 7 |
|
| 8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
| 9 |
|
| 104 |
|
| 105 |
|
| 106 |
== Upgrade Notice ==
|
| 107 |
+
= 2.0.16 =
|
| 108 |
+
Tidy plugins menus to only use one Top-level menu for Polls and Ratings, also includes better integration with Jetpack
|
| 109 |
|
| 110 |
== Changelog ==
|
| 111 |
+
= 2.0.16 =
|
| 112 |
+
* Updated menus to only use one Top level menu - Feedback
|
| 113 |
+
* Updated Settings->Polls & Ratings menu to break into 2 separate menu items - Settings->Polls / Settings->Ratings
|
| 114 |
+
* Updated menus to work with Feedbacks Top level menu item that comes with Jetpack plugin
|
| 115 |
+
|
| 116 |
= 2.0.15 =
|
| 117 |
* Fix for conflict with jetpack plugin. When both plugins were installed, conflict with older jetpack implementation of shortcode handler and redeclaration of polldaddy plugin function 'polldaddy_link()'
|
| 118 |
* Updated translations to use latest from glotpress and removed a lot of untranslated text, making plugin a much smaller download.
|
