Version Description
- Added a template tag to allow themes to place the rating wherever they want by echoing the function polldaddy_get_rating_html()
- Added shortcodes to text widget, so now all Polldaddy shortcodes will work in the text widget.
- Added an option to synchronize the ratings account API key, useful if key in blog database is out of date or invalidated.
Download this release
Release Info
Developer | eoigal |
Plugin | Crowdsignal Dashboard – Polls, Surveys & more |
Version | 1.8.1 |
Comparing to | |
See all releases |
Code changes from version 1.8.0 to 1.8.1
- polldaddy-org.php +42 -19
- polldaddy.php +3 -3
- polldaddy.pot +29 -21
- rating.php +61 -56
- readme.txt +14 -1
polldaddy-org.php
CHANGED
@@ -11,7 +11,7 @@ class WPORG_PollDaddy extends WP_PollDaddy {
|
|
11 |
|
12 |
function __construct() {
|
13 |
parent::__construct();
|
14 |
-
$this->version = '1.8.
|
15 |
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
16 |
$this->polldaddy_client_class = 'WPORG_PollDaddy_Client';
|
17 |
$this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
|
@@ -29,18 +29,19 @@ class WPORG_PollDaddy extends WP_PollDaddy {
|
|
29 |
$polldaddy->reset();
|
30 |
|
31 |
if( $this->multiple_accounts ){
|
32 |
-
//need to retrieve initial admin user code to use as ratings user code
|
33 |
-
|
34 |
-
|
35 |
-
$polldaddy->update_partner_account( $partner );
|
36 |
-
update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
|
37 |
}
|
38 |
|
39 |
-
$this->rating_user_code = $polldaddy->get_usercode( $this->id );
|
40 |
-
|
41 |
-
if ( !empty( $this->rating_user_code ) ){
|
42 |
update_option( 'pd-rating-usercode', $this->rating_user_code );
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
}
|
46 |
parent::set_api_user_code();
|
@@ -67,15 +68,24 @@ class WPORG_PollDaddy extends WP_PollDaddy {
|
|
67 |
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
68 |
$polldaddy->reset();
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
$polldaddy_multiple_accounts = 0;
|
71 |
|
72 |
if( isset( $_POST['polldaddy-multiple-accounts'] ) )
|
73 |
$polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
$polldaddy->update_partner_account( $partner );
|
78 |
-
|
79 |
update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
|
80 |
}
|
81 |
break;
|
@@ -271,6 +281,19 @@ class WPORG_PollDaddy extends WP_PollDaddy {
|
|
271 |
<label for="polldaddy-multiple-accounts"><?php _e( 'This setting will allow each blog user to import a PollDaddy account.', 'polldaddy' ); ?></label>
|
272 |
</span>
|
273 |
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
</tr><?php }
|
275 |
return parent::plugin_options_add();
|
276 |
}
|
@@ -343,7 +366,7 @@ function polldaddy_loader() {
|
|
343 |
add_action( 'admin_menu', array( &$polldaddy_object, 'admin_menu' ) );
|
344 |
}
|
345 |
|
346 |
-
function
|
347 |
extract( shortcode_atts( array(
|
348 |
'survey' => null,
|
349 |
'link_text' => 'View Survey',
|
@@ -416,8 +439,8 @@ function polldaddy_add_rating_js() {
|
|
416 |
}
|
417 |
|
418 |
add_action( 'init', 'polldaddy_loader' );
|
419 |
-
add_shortcode('polldaddy', '
|
420 |
-
|
421 |
|
422 |
/**
|
423 |
* PollDaddy Top Rated Widget
|
@@ -525,5 +548,5 @@ class PD_Top_Rated extends WP_Widget {
|
|
525 |
|
526 |
}
|
527 |
|
528 |
-
add_action('widgets_init', create_function('', 'return register_widget("PD_Top_Rated");'));
|
529 |
?>
|
11 |
|
12 |
function __construct() {
|
13 |
parent::__construct();
|
14 |
+
$this->version = '1.8.2';
|
15 |
$this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
|
16 |
$this->polldaddy_client_class = 'WPORG_PollDaddy_Client';
|
17 |
$this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
|
29 |
$polldaddy->reset();
|
30 |
|
31 |
if( $this->multiple_accounts ){
|
32 |
+
//need to retrieve initial admin user code to use as ratings user code
|
33 |
+
$polldaddy->update_partner_account( array( 'role' => 0 ) );
|
34 |
+
update_option( 'polldaddy_multiple_accounts', 0 );
|
|
|
|
|
35 |
}
|
36 |
|
37 |
+
$this->rating_user_code = $polldaddy->get_usercode( $this->id );
|
38 |
+
if ( !empty( $this->rating_user_code ) )
|
|
|
39 |
update_option( 'pd-rating-usercode', $this->rating_user_code );
|
40 |
+
|
41 |
+
if( $this->multiple_accounts ){
|
42 |
+
$polldaddy->update_partner_account( array( 'role' => 1 ) );
|
43 |
+
update_option( 'polldaddy_multiple_accounts', 1 );
|
44 |
+
}
|
45 |
}
|
46 |
}
|
47 |
parent::set_api_user_code();
|
68 |
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
|
69 |
$polldaddy->reset();
|
70 |
|
71 |
+
$polldaddy_sync_account = 0;
|
72 |
+
|
73 |
+
if( isset( $_POST['polldaddy-sync-account'] ) )
|
74 |
+
$polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
|
75 |
+
|
76 |
+
if( $polldaddy_sync_account > 0 ){
|
77 |
+
$this->rating_user_code = '';
|
78 |
+
update_option( 'pd-rating-usercode', '' );
|
79 |
+
$this->set_api_user_code();
|
80 |
+
}
|
81 |
+
|
82 |
$polldaddy_multiple_accounts = 0;
|
83 |
|
84 |
if( isset( $_POST['polldaddy-multiple-accounts'] ) )
|
85 |
$polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
|
86 |
+
|
87 |
+
$partner = array( 'role' => $polldaddy_multiple_accounts );
|
88 |
+
$polldaddy->update_partner_account( $partner );
|
|
|
|
|
89 |
update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
|
90 |
}
|
91 |
break;
|
281 |
<label for="polldaddy-multiple-accounts"><?php _e( 'This setting will allow each blog user to import a PollDaddy account.', 'polldaddy' ); ?></label>
|
282 |
</span>
|
283 |
</td>
|
284 |
+
</tr>
|
285 |
+
<tr class="form-field form-required">
|
286 |
+
<th valign="top" scope="row">
|
287 |
+
<label for="polldaddy-sync-account">
|
288 |
+
<?php _e( 'Sync Ratings Account', 'polldaddy' ); ?>
|
289 |
+
</label>
|
290 |
+
</th>
|
291 |
+
<td>
|
292 |
+
<input type="checkbox" name="polldaddy-sync-account" id="polldaddy-sync-account" value="1" style="width: auto" />
|
293 |
+
<span class="description">
|
294 |
+
<label for="polldaddy-sync-account"><?php _e( 'This will syncronize your ratings PollDaddy account.', 'polldaddy' ); ?></label>
|
295 |
+
</span>
|
296 |
+
</td>
|
297 |
</tr><?php }
|
298 |
return parent::plugin_options_add();
|
299 |
}
|
366 |
add_action( 'admin_menu', array( &$polldaddy_object, 'admin_menu' ) );
|
367 |
}
|
368 |
|
369 |
+
function polldaddy_shortcode_handler( $atts, $content=null ) {
|
370 |
extract( shortcode_atts( array(
|
371 |
'survey' => null,
|
372 |
'link_text' => 'View Survey',
|
439 |
}
|
440 |
|
441 |
add_action( 'init', 'polldaddy_loader' );
|
442 |
+
add_shortcode( 'polldaddy', 'polldaddy_shortcode_handler' );
|
443 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
444 |
|
445 |
/**
|
446 |
* PollDaddy Top Rated Widget
|
548 |
|
549 |
}
|
550 |
|
551 |
+
add_action('widgets_init', create_function('', 'return register_widget("PD_Top_Rated");'));
|
552 |
?>
|
polldaddy.php
CHANGED
@@ -5,7 +5,7 @@ Plugin Name: PollDaddy Polls
|
|
5 |
Description: Create and manage PollDaddy polls and ratings in WordPress
|
6 |
Author: Automattic, Inc.
|
7 |
Author URL: http://automattic.com/
|
8 |
-
Version: 1.8.
|
9 |
*/
|
10 |
|
11 |
// You can hardcode your PollDaddy PartnerGUID (API Key) here
|
@@ -33,7 +33,7 @@ class WP_PollDaddy {
|
|
33 |
global $current_user;
|
34 |
$this->errors = new WP_Error;
|
35 |
$this->scheme = 'https';
|
36 |
-
$this->version = '1.8.
|
37 |
$this->multiple_accounts = true;
|
38 |
$this->polldaddy_client_class = 'api_client';
|
39 |
$this->polldaddy_clients = array();
|
@@ -3034,7 +3034,7 @@ class WP_PollDaddy {
|
|
3034 |
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
3035 |
$polldaddy->reset();
|
3036 |
|
3037 |
-
$response = $polldaddy->get_rating( $rating_id );
|
3038 |
|
3039 |
if ( empty( $response ) || (int) $response->_id == 0 ) {
|
3040 |
$polldaddy->reset();
|
5 |
Description: Create and manage PollDaddy polls and ratings in WordPress
|
6 |
Author: Automattic, Inc.
|
7 |
Author URL: http://automattic.com/
|
8 |
+
Version: 1.8.1
|
9 |
*/
|
10 |
|
11 |
// You can hardcode your PollDaddy PartnerGUID (API Key) here
|
33 |
global $current_user;
|
34 |
$this->errors = new WP_Error;
|
35 |
$this->scheme = 'https';
|
36 |
+
$this->version = '1.8.1';
|
37 |
$this->multiple_accounts = true;
|
38 |
$this->polldaddy_client_class = 'api_client';
|
39 |
$this->polldaddy_clients = array();
|
3034 |
$polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
|
3035 |
$polldaddy->reset();
|
3036 |
|
3037 |
+
$response = $polldaddy->get_rating( $rating_id );
|
3038 |
|
3039 |
if ( empty( $response ) || (int) $response->_id == 0 ) {
|
3040 |
$polldaddy->reset();
|
polldaddy.pot
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Translation of the WordPress plugin PollDaddy Polls 1.8.
|
2 |
# Copyright (C) 2010 Automattic, Inc.
|
3 |
# This file is distributed under the same license as the PollDaddy Polls package.
|
4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
@@ -6,9 +6,9 @@
|
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
-
"Project-Id-Version: PollDaddy Polls 1.8.
|
10 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/polldaddy\n"
|
11 |
-
"POT-Creation-Date: 2010-02-
|
12 |
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -17,86 +17,94 @@ msgstr ""
|
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
19 |
|
20 |
-
#: polldaddy-org.php:
|
21 |
msgid "Email address required"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: polldaddy-org.php:
|
25 |
msgid "Password required"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: polldaddy-org.php:
|
29 |
msgid "Could not connect to PollDaddy API Key service"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: polldaddy-org.php:
|
33 |
msgid "Can't connect to PollDaddy.com"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: polldaddy-org.php:
|
37 |
msgid ""
|
38 |
"Login to PollDaddy failed. Double check your email address and password."
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: polldaddy-org.php:
|
42 |
msgid ""
|
43 |
"If your email address and password are correct, your host may not support "
|
44 |
"secure logins."
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: polldaddy-org.php:
|
48 |
msgid ""
|
49 |
"In that case, you may be able to log in to PollDaddy by unchecking the \"Use "
|
50 |
"SSL to Log in\" checkbox."
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: polldaddy-org.php:
|
54 |
msgid ""
|
55 |
"Account could not be accessed. Are your email address and password correct?"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: polldaddy-org.php:
|
59 |
msgid "PollDaddy Account"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: polldaddy-org.php:
|
63 |
#, php-format
|
64 |
msgid ""
|
65 |
"Before you can use the PollDaddy plugin, you need to enter your <a href=\"%s"
|
66 |
"\">PollDaddy.com</a> account details."
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: polldaddy-org.php:
|
70 |
msgid "PollDaddy Email Address"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: polldaddy-org.php:
|
74 |
msgid "PollDaddy Password"
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: polldaddy-org.php:
|
78 |
msgid "Use SSL to Log in"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: polldaddy-org.php:
|
82 |
msgid ""
|
83 |
"This ensures a secure login to your PollDaddy account. Only uncheck if you "
|
84 |
"are having problems logging in."
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: polldaddy-org.php:
|
88 |
msgid "Submit"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: polldaddy-org.php:
|
92 |
msgid "Multiple PollDaddy Accounts"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: polldaddy-org.php:
|
96 |
msgid "This setting will allow each blog user to import a PollDaddy account."
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: polldaddy-org.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
msgid "How many items would you like to display?"
|
101 |
msgstr ""
|
102 |
|
1 |
+
# Translation of the WordPress plugin PollDaddy Polls 1.8.1 by Automattic, Inc..
|
2 |
# Copyright (C) 2010 Automattic, Inc.
|
3 |
# This file is distributed under the same license as the PollDaddy Polls package.
|
4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
+
"Project-Id-Version: PollDaddy Polls 1.8.1\n"
|
10 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/polldaddy\n"
|
11 |
+
"POT-Creation-Date: 2010-02-09 15:26+0000\n"
|
12 |
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
19 |
|
20 |
+
#: polldaddy-org.php:108 polldaddy.php:128 polldaddy.php:892
|
21 |
msgid "Email address required"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: polldaddy-org.php:111 polldaddy.php:131 polldaddy.php:895
|
25 |
msgid "Password required"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: polldaddy-org.php:143
|
29 |
msgid "Could not connect to PollDaddy API Key service"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: polldaddy-org.php:157 polldaddy.php:161
|
33 |
msgid "Can't connect to PollDaddy.com"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: polldaddy-org.php:187
|
37 |
msgid ""
|
38 |
"Login to PollDaddy failed. Double check your email address and password."
|
39 |
msgstr ""
|
40 |
|
41 |
+
#: polldaddy-org.php:189
|
42 |
msgid ""
|
43 |
"If your email address and password are correct, your host may not support "
|
44 |
"secure logins."
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: polldaddy-org.php:190
|
48 |
msgid ""
|
49 |
"In that case, you may be able to log in to PollDaddy by unchecking the \"Use "
|
50 |
"SSL to Log in\" checkbox."
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: polldaddy-org.php:201 polldaddy.php:198
|
54 |
msgid ""
|
55 |
"Account could not be accessed. Are your email address and password correct?"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: polldaddy-org.php:215 polldaddy.php:249
|
59 |
msgid "PollDaddy Account"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: polldaddy-org.php:217 polldaddy.php:251
|
63 |
#, php-format
|
64 |
msgid ""
|
65 |
"Before you can use the PollDaddy plugin, you need to enter your <a href=\"%s"
|
66 |
"\">PollDaddy.com</a> account details."
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: polldaddy-org.php:224 polldaddy.php:258 polldaddy.php:3857
|
70 |
msgid "PollDaddy Email Address"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: polldaddy-org.php:232 polldaddy.php:266 polldaddy.php:3867
|
74 |
msgid "PollDaddy Password"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: polldaddy-org.php:245
|
78 |
msgid "Use SSL to Log in"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: polldaddy-org.php:249
|
82 |
msgid ""
|
83 |
"This ensures a secure login to your PollDaddy account. Only uncheck if you "
|
84 |
"are having problems logging in."
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: polldaddy-org.php:259 polldaddy.php:278
|
88 |
msgid "Submit"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: polldaddy-org.php:275
|
92 |
msgid "Multiple PollDaddy Accounts"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: polldaddy-org.php:281
|
96 |
msgid "This setting will allow each blog user to import a PollDaddy account."
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: polldaddy-org.php:288
|
100 |
+
msgid "Sync Ratings Account"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#: polldaddy-org.php:294
|
104 |
+
msgid "This will syncronize your ratings PollDaddy account."
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: polldaddy-org.php:537
|
108 |
msgid "How many items would you like to display?"
|
109 |
msgstr ""
|
110 |
|
rating.php
CHANGED
@@ -34,63 +34,65 @@ function polldaddy_show_rating_comments( $content ){
|
|
34 |
|
35 |
function polldaddy_show_rating( $content ) {
|
36 |
if ( !is_feed() && !is_attachment() ) {
|
37 |
-
if ( is_single() || is_page() || is_home() ) {
|
38 |
-
|
39 |
-
|
40 |
-
if ( $
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
$item_id = '';
|
48 |
-
|
49 |
-
if ( is_page() ) {
|
50 |
-
if ( (int) get_option( 'pd-rating-pages' ) > 0 ) {
|
51 |
-
$rating_id = (int) get_option( 'pd-rating-pages' );
|
52 |
-
$unique_id = 'wp-page-' . $post->ID;
|
53 |
-
$rating_pos = (int) get_option( 'pd-rating-pages-pos' );
|
54 |
-
$item_id = '_page_' . $post->ID;
|
55 |
-
}
|
56 |
-
} else if( is_home() ) {
|
57 |
-
if ( (int) get_option( 'pd-rating-posts-index' ) > 0 ) {
|
58 |
-
$rating_id = (int) get_option( 'pd-rating-posts-index' );
|
59 |
-
$unique_id = 'wp-post-' . $post->ID;
|
60 |
-
$rating_pos = (int) get_option( 'pd-rating-posts-index-pos' );
|
61 |
-
$item_id = '_post_' . $post->ID;
|
62 |
-
}
|
63 |
} else {
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
if ( $rating_id > 0 ) {
|
73 |
-
$title = $post->post_title;
|
74 |
-
$permalink = get_permalink( $post->ID );
|
75 |
-
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id );
|
76 |
-
|
77 |
-
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
78 |
-
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
79 |
-
}
|
80 |
-
|
81 |
-
if ( $rating_pos == 0 )
|
82 |
-
$content = $html . $content;
|
83 |
-
else
|
84 |
-
$content .= $html;
|
85 |
-
}
|
86 |
}
|
87 |
}
|
88 |
return $content;
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
|
92 |
$html = "\n".'<p><div class="pd-rating" id="pd_rating_holder_' . $rating_id . $item_id . '"></div></p>
|
93 |
-
<script type="text/javascript">
|
94 |
PDRTJS_settings_' . (int)$rating_id . $item_id . ' = {
|
95 |
"id" : "' . (int)$rating_id . '",
|
96 |
"unique_id" : "' . urlencode( $unique_id ) . '",
|
@@ -107,16 +109,19 @@ function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink,
|
|
107 |
}
|
108 |
|
109 |
function polldaddy_show_rating_excerpt( $content ) {
|
110 |
-
|
111 |
-
|
112 |
}
|
113 |
|
114 |
function polldaddy_show_rating_excerpt_for_real( $content ) {
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
-
add_filter( 'the_content', 'polldaddy_show_rating', 5 );
|
119 |
-
add_filter( 'get_the_excerpt', 'polldaddy_show_rating_excerpt', 5 );
|
120 |
-
add_filter( 'the_excerpt', 'polldaddy_show_rating_excerpt_for_real' );
|
121 |
add_filter( 'comment_text', 'polldaddy_show_rating_comments', 50 );
|
122 |
-
?>
|
34 |
|
35 |
function polldaddy_show_rating( $content ) {
|
36 |
if ( !is_feed() && !is_attachment() ) {
|
37 |
+
if ( is_single() || is_page() || is_home() ) {
|
38 |
+
$html = polldaddy_get_rating_html();
|
39 |
+
|
40 |
+
if( !empty( $html ) ) {
|
41 |
+
$rating_pos = 0;
|
42 |
+
|
43 |
+
if ( is_page() ) {
|
44 |
+
$rating_pos = (int) get_option( 'pd-rating-pages-pos' );
|
45 |
+
} else if( is_home() ) {
|
46 |
+
$rating_pos = (int) get_option( 'pd-rating-posts-index-pos' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
} else {
|
48 |
+
$rating_pos = (int) get_option( 'pd-rating-posts-pos' );
|
49 |
+
}
|
50 |
+
|
51 |
+
if ( $rating_pos == 0 )
|
52 |
+
$content = $html . $content;
|
53 |
+
else
|
54 |
+
$content .= $html;
|
55 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
}
|
58 |
return $content;
|
59 |
}
|
60 |
|
61 |
+
function polldaddy_get_rating_html(){
|
62 |
+
global $post;
|
63 |
+
$html = '';
|
64 |
+
|
65 |
+
if ( $post->ID > 0 ) {
|
66 |
+
$unique_id = '';
|
67 |
+
$title = '';
|
68 |
+
$permalink = '';
|
69 |
+
$rating_id = 0;
|
70 |
+
$item_id = '';
|
71 |
+
|
72 |
+
if ( is_page() ) {
|
73 |
+
$rating_id = (int) get_option( 'pd-rating-pages-id' );
|
74 |
+
$unique_id = 'wp-page-' . $post->ID;
|
75 |
+
$item_id = '_page_' . $post->ID;
|
76 |
+
} else {
|
77 |
+
$rating_id = (int) get_option( 'pd-rating-posts-id' );
|
78 |
+
$unique_id = 'wp-post-' . $post->ID;
|
79 |
+
$item_id = '_post_' . $post->ID;
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( $rating_id > 0 ) {
|
83 |
+
$title = $post->post_title;
|
84 |
+
$permalink = get_permalink( $post->ID );
|
85 |
+
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id );
|
86 |
+
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
87 |
+
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
return $html;
|
91 |
+
}
|
92 |
+
|
93 |
function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
|
94 |
$html = "\n".'<p><div class="pd-rating" id="pd_rating_holder_' . $rating_id . $item_id . '"></div></p>
|
95 |
+
<script type="text/javascript" charset="utf-8">
|
96 |
PDRTJS_settings_' . (int)$rating_id . $item_id . ' = {
|
97 |
"id" : "' . (int)$rating_id . '",
|
98 |
"unique_id" : "' . urlencode( $unique_id ) . '",
|
109 |
}
|
110 |
|
111 |
function polldaddy_show_rating_excerpt( $content ) {
|
112 |
+
remove_filter( 'the_content', 'polldaddy_show_rating', 5 );
|
113 |
+
return $content;
|
114 |
}
|
115 |
|
116 |
function polldaddy_show_rating_excerpt_for_real( $content ) {
|
117 |
+
return polldaddy_show_rating( $content );
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( (int) get_option( 'pd-rating-pages' ) > 0 || (int) get_option( 'pd-rating-posts-index' ) > 0 || (int) get_option( 'pd-rating-posts' ) > 0 ) {
|
121 |
+
add_filter( 'the_content', 'polldaddy_show_rating', 5 );
|
122 |
+
add_filter( 'get_the_excerpt', 'polldaddy_show_rating_excerpt', 5 );
|
123 |
+
add_filter( 'the_excerpt', 'polldaddy_show_rating_excerpt_for_real' );
|
124 |
}
|
125 |
|
|
|
|
|
|
|
126 |
add_filter( 'comment_text', 'polldaddy_show_rating_comments', 50 );
|
127 |
+
?>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mdawaffe, eoigal
|
|
3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
4 |
Requires at least: 2.6
|
5 |
Tested up to: 2.9.1
|
6 |
-
Stable tag: 1.8.
|
7 |
|
8 |
Create and manage PollDaddy polls and ratings from within WordPress.
|
9 |
|
@@ -46,7 +46,20 @@ Yes. You'll be able to edit the polls they create from your blog. (You won't be
|
|
46 |
|
47 |
Nope. The permissions are the same as for posts. So Editors and Administrators can edit anyone's polls for that blog. Authors can only edit their own.
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
== Change Log ==
|
|
|
|
|
|
|
|
|
|
|
50 |
= 1.8.0 =
|
51 |
* Added option to Rating settings to allow ratings on the front page.
|
52 |
* Added more phrases to the pot file.
|
3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
4 |
Requires at least: 2.6
|
5 |
Tested up to: 2.9.1
|
6 |
+
Stable tag: 1.8.1
|
7 |
|
8 |
Create and manage PollDaddy polls and ratings from within WordPress.
|
9 |
|
46 |
|
47 |
Nope. The permissions are the same as for posts. So Editors and Administrators can edit anyone's polls for that blog. Authors can only edit their own.
|
48 |
|
49 |
+
= Where are my ratings? =
|
50 |
+
|
51 |
+
Check your theme's footer.php calls wp_footer. The rating javascript is loaded on this action. More here - http://codex.wordpress.org/Theme_Development#Plugin_API_Hooks
|
52 |
+
|
53 |
+
= I cannot access my ratings settings, I am getting a "Sorry! There was an error creating your rating widget. Please contact PollDaddy support to fix this." message. =
|
54 |
+
|
55 |
+
You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
|
56 |
+
|
57 |
== Change Log ==
|
58 |
+
= 1.8.1 =
|
59 |
+
* Added a template tag to allow themes to place the rating wherever they want by echoing the function polldaddy_get_rating_html()
|
60 |
+
* Added shortcodes to text widget, so now all Polldaddy shortcodes will work in the text widget.
|
61 |
+
* Added an option to synchronize the ratings account API key, useful if key in blog database is out of date or invalidated.
|
62 |
+
|
63 |
= 1.8.0 =
|
64 |
* Added option to Rating settings to allow ratings on the front page.
|
65 |
* Added more phrases to the pot file.
|