Version Description
- Tidy up shortcodes - remove keywords from no script tags, inline javascript is now xhtml compatible, load survey and poll javascript files in the footer to assist page load speeds
Download this release
Release Info
Developer | eoigal |
Plugin | Crowdsignal Dashboard – Polls, Surveys & more |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- img/pd-wp-icon-blue.png +0 -0
- img/pd-wp-icon-gray.png +0 -0
- img/pd-wp-icon-hover.png +0 -0
- img/pd-wp-icon.png +0 -0
- polldaddy-org.php +82 -101
- polldaddy.php +4 -2
- rating.php +15 -8
- readme.txt +4 -1
img/pd-wp-icon-blue.png
ADDED
Binary file
|
img/pd-wp-icon-gray.png
ADDED
Binary file
|
img/pd-wp-icon-hover.png
ADDED
Binary file
|
img/pd-wp-icon.png
ADDED
Binary file
|
polldaddy-org.php
CHANGED
@@ -11,7 +11,7 @@ class WPORG_PollDaddy extends WP_PollDaddy {
|
|
11 |
|
12 |
function __construct() {
|
13 |
parent::__construct();
|
14 |
-
$this->version = '2.0.
|
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' );
|
@@ -375,30 +375,17 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
|
375 |
[polldaddy poll="139742"]
|
376 |
*/
|
377 |
|
378 |
-
function polldaddy_shortcode_handler_set_data() {
|
379 |
-
$resource = wp_remote_get( 'http://polldaddy.com/xml/keywords.xml' );
|
380 |
-
$body = wp_remote_retrieve_body( $resource );
|
381 |
-
$keywords_xml = false;
|
382 |
-
$keywords = array();
|
383 |
-
|
384 |
-
if( function_exists( 'simplexml_load_string' ) )
|
385 |
-
$keywords_xml = simplexml_load_string( $body );
|
386 |
-
|
387 |
-
if ( $keywords_xml !== false ) {
|
388 |
-
$keywords['generated'] = time();
|
389 |
-
|
390 |
-
foreach ( $keywords_xml->keyword as $keyword_xml ) {
|
391 |
-
$keywords[] = array( 'keyword' => (string) $keyword_xml, 'url' => (string) $keyword_xml['url'] );
|
392 |
-
}
|
393 |
-
wp_cache_set( 'pd-keywords', $keywords, 'site-options', 864000 );
|
394 |
-
}
|
395 |
-
|
396 |
-
return $keywords;
|
397 |
-
}
|
398 |
-
|
399 |
function polldaddy_add_rating_js() {
|
400 |
wp_print_scripts( 'polldaddy-rating-js' );
|
401 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
|
403 |
function polldaddy_shortcode_handler( $atts, $content = null ) {
|
404 |
global $post;
|
@@ -415,6 +402,7 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
|
415 |
'poll' => 'empty',
|
416 |
'rating' => 'empty',
|
417 |
'unique_id' => null,
|
|
|
418 |
'title' => null,
|
419 |
'permalink' => null,
|
420 |
'cb' => 0,
|
@@ -456,41 +444,47 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
|
456 |
$style = preg_replace( '/&(\w*);/', '&$1;', esc_js( esc_attr( $style ) ) );
|
457 |
|
458 |
if ( $no_script ) {
|
459 |
-
return "<a href='http://polldaddy.com/s
|
460 |
} else {
|
461 |
if ( $type == 'inline' ) {
|
462 |
return <<<EOD
|
463 |
-
<iframe src="$survey?iframe=1" frameborder="0" width="$width" height="$height" scrolling="auto" marginheight="0" marginwidth="0"><a href=
|
464 |
EOD;
|
465 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
-
return
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
body: '$body',
|
475 |
-
button: '$button',
|
476 |
-
text_color: '$text_color',
|
477 |
-
back_color: '$back_color',
|
478 |
-
align: '$align',
|
479 |
-
style: '$style',
|
480 |
-
id: '$survey'
|
481 |
-
} );
|
482 |
-
</script>
|
483 |
-
";
|
484 |
}
|
485 |
} else {
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
|
|
|
|
|
|
494 |
}
|
495 |
}
|
496 |
|
@@ -499,53 +493,33 @@ EOD;
|
|
499 |
$cb = (int) $cb;
|
500 |
|
501 |
if ( !$no_script && $rating > 0 ) {
|
502 |
-
if ( null != $unique_id )
|
503 |
-
$unique_id =
|
504 |
-
|
505 |
-
$unique_id = is_page() ? 'wp-page-' : 'wp-post-';
|
506 |
-
|
507 |
-
|
|
|
|
|
|
|
508 |
|
509 |
if ( null != $title )
|
510 |
-
$title =
|
511 |
else
|
512 |
-
$title =
|
513 |
|
514 |
if ( null != $permalink )
|
515 |
$permalink = clean_url( $permalink );
|
516 |
else
|
517 |
-
$permalink =
|
518 |
|
519 |
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
520 |
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
|
|
|
|
521 |
|
522 |
-
return '<div id="pd_rating_holder_' . $rating . '"></div>
|
523 |
-
<script language="javascript">
|
524 |
-
PDRTJS_settings_' . $rating . ' = {
|
525 |
-
"id" : "' . $rating . '",
|
526 |
-
"unique_id" : "' . $unique_id . '",
|
527 |
-
"title" : "' . $title . '",
|
528 |
-
"permalink" : "' . $permalink . '"
|
529 |
-
};
|
530 |
-
</script>';
|
531 |
} elseif ( $poll > 0 ) {
|
532 |
-
$cb = ( $cb == 1 ?
|
533 |
-
$keywords = wp_cache_get( 'pd-keywords', 'site-options' );
|
534 |
-
$keywords_link = '<a href="http://polldaddy.com/features-surveys/">survey software</a>';
|
535 |
-
if ( ! $keywords || $keywords['generated'] <= ( time() - 300 ) ) {
|
536 |
-
if ( ! wp_cache_get( 'pd-keywords-fetching', 'site-options' ) ) {
|
537 |
-
wp_cache_set( 'pd-keywords-fetching', 1, 'site-options', 30 );
|
538 |
-
$keywords = polldaddy_shortcode_handler_set_data();
|
539 |
-
}
|
540 |
-
}
|
541 |
-
|
542 |
-
if ( !$keywords )
|
543 |
-
$keywords = array();
|
544 |
-
|
545 |
-
if ( is_array( $keywords ) && count( $keywords ) > 0 ) {
|
546 |
-
$mod = ( $poll % ( count( $keywords ) - 1 ) );
|
547 |
-
$keywords_link = '<a href="' . $keywords[ $mod ][ 'url' ] . '">' . $keywords[ $mod ][ 'keyword' ] . '</a>';
|
548 |
-
}
|
549 |
|
550 |
if( isset( $align ) )
|
551 |
$float = "float:" . $align .";";
|
@@ -560,12 +534,17 @@ EOD;
|
|
560 |
$margins = null;
|
561 |
|
562 |
if ( $no_script )
|
563 |
-
return '<a href="http://polldaddy.com/poll/' . $poll . '/">View This Poll</a
|
564 |
-
else
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
|
|
|
|
|
|
|
|
|
|
569 |
}
|
570 |
|
571 |
return '<!-- no polldaddy output -->';
|
@@ -604,20 +583,22 @@ if ( class_exists( 'WP_Widget' ) ) {
|
|
604 |
|
605 |
extract($args, EXTR_SKIP);
|
606 |
|
607 |
-
echo $before_widget;
|
608 |
$title = empty( $instance['title'] ) ? __( 'Top Rated', 'polldaddy' ) : apply_filters( 'widget_title', $instance['title'] );
|
609 |
$posts_rating_id = (int) get_option( 'pd-rating-posts-id' );
|
610 |
$pages_rating_id = (int) get_option( 'pd-rating-pages-id' );
|
611 |
$comments_rating_id = (int) get_option( 'pd-rating-comments-id' );
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
|
|
|
|
|
|
621 |
echo $after_widget;
|
622 |
}
|
623 |
|
@@ -690,4 +671,4 @@ if ( class_exists( 'WP_Widget' ) ) {
|
|
690 |
}
|
691 |
add_action('widgets_init', create_function('', 'return register_widget("PD_Top_Rated");'));
|
692 |
}
|
693 |
-
?>
|
11 |
|
12 |
function __construct() {
|
13 |
parent::__construct();
|
14 |
+
$this->version = '2.0.6';
|
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' );
|
375 |
[polldaddy poll="139742"]
|
376 |
*/
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
function polldaddy_add_rating_js() {
|
379 |
wp_print_scripts( 'polldaddy-rating-js' );
|
380 |
}
|
381 |
+
|
382 |
+
function polldaddy_add_poll_js() {
|
383 |
+
wp_print_scripts( 'polldaddy-poll-js' );
|
384 |
+
}
|
385 |
+
|
386 |
+
function polldaddy_add_survey_js() {
|
387 |
+
wp_print_scripts( 'polldaddy-survey-js' );
|
388 |
+
}
|
389 |
|
390 |
function polldaddy_shortcode_handler( $atts, $content = null ) {
|
391 |
global $post;
|
402 |
'poll' => 'empty',
|
403 |
'rating' => 'empty',
|
404 |
'unique_id' => null,
|
405 |
+
'item_id' => null,
|
406 |
'title' => null,
|
407 |
'permalink' => null,
|
408 |
'cb' => 0,
|
444 |
$style = preg_replace( '/&(\w*);/', '&$1;', esc_js( esc_attr( $style ) ) );
|
445 |
|
446 |
if ( $no_script ) {
|
447 |
+
return "<a href='http://polldaddy.com/s/{$survey}'>{$title}</a>";
|
448 |
} else {
|
449 |
if ( $type == 'inline' ) {
|
450 |
return <<<EOD
|
451 |
+
<iframe src="{$survey}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" marginheight="0" marginwidth="0"><a href="{$survey}">{$link_text}</a></iframe>
|
452 |
EOD;
|
453 |
}
|
454 |
+
|
455 |
+
$settings = json_encode( array(
|
456 |
+
'title' => $title,
|
457 |
+
'type' => $type,
|
458 |
+
'body' => $body,
|
459 |
+
'button' => $button,
|
460 |
+
'body' => $body,
|
461 |
+
'text_color' => $text_color,
|
462 |
+
'back_color' => $back_color,
|
463 |
+
'align' => $align,
|
464 |
+
'style' => $style,
|
465 |
+
'id' => $survey
|
466 |
+
) );
|
467 |
|
468 |
+
return <<<EOD
|
469 |
+
<script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
|
470 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
471 |
+
polldaddy.add( {$settings} );
|
472 |
+
//--><!]]></script>
|
473 |
+
<noscript><a href="http://polldaddy.com/s/{$survey}">{$title}</a></noscript>
|
474 |
+
EOD;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
}
|
476 |
} else {
|
477 |
+
|
478 |
+
wp_register_script( 'polldaddy-survey-js', 'http://i0.poll.fm/s.js' );
|
479 |
+
add_filter( 'wp_footer', 'polldaddy_add_survey_js' );
|
480 |
+
|
481 |
+
return <<<EOD
|
482 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
483 |
+
var PDF_surveyID = "{$survey}";
|
484 |
+
var PDF_openText = "{$link_text}";
|
485 |
+
//--><!]]></script>
|
486 |
+
<noscript><a href="http://polldaddy.com/s/{$survey}/">{$link_text}</a></noscript>
|
487 |
+
EOD;
|
488 |
}
|
489 |
}
|
490 |
|
493 |
$cb = (int) $cb;
|
494 |
|
495 |
if ( !$no_script && $rating > 0 ) {
|
496 |
+
if ( null != $unique_id )
|
497 |
+
$unique_id = esc_html( $unique_id );
|
498 |
+
else
|
499 |
+
$unique_id = is_page() ? 'wp-page-'.$post->ID : 'wp-post-'.$post->ID;
|
500 |
+
|
501 |
+
if ( null != $item_id )
|
502 |
+
$item_id = esc_html( $item_id );
|
503 |
+
else
|
504 |
+
$item_id = is_page() ? '_page_'.$post->ID : '_post_'.$post->ID;
|
505 |
|
506 |
if ( null != $title )
|
507 |
+
$title = esc_html( $title );
|
508 |
else
|
509 |
+
$title = apply_filters( 'wp_title', $post->post_title );
|
510 |
|
511 |
if ( null != $permalink )
|
512 |
$permalink = clean_url( $permalink );
|
513 |
else
|
514 |
+
$permalink = get_permalink( $post->ID );
|
515 |
|
516 |
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
517 |
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
518 |
+
|
519 |
+
return polldaddy_get_rating_code( $rating, $unique_id, $title, $permalink, $item_id );
|
520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
} elseif ( $poll > 0 ) {
|
522 |
+
$cb = ( $cb == 1 ? mktime() : false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
|
524 |
if( isset( $align ) )
|
525 |
$float = "float:" . $align .";";
|
534 |
$margins = null;
|
535 |
|
536 |
if ( $no_script )
|
537 |
+
return '<a href="http://polldaddy.com/poll/' . $poll . '/">View This Poll</a>';
|
538 |
+
else {
|
539 |
+
|
540 |
+
wp_register_script( 'polldaddy-poll-js', "http://static.polldaddy.com/p/{$poll}.js", array(), $cb, true );
|
541 |
+
add_filter( 'wp_footer', 'polldaddy_add_poll_js' );
|
542 |
+
|
543 |
+
return <<<EOD
|
544 |
+
<a name="pd_a_{$poll}"></a><div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div><div id="PD_superContainer"></div>
|
545 |
+
<noscript><a href="http://polldaddy.com/poll/{$poll}/">View This Poll</a></noscript>
|
546 |
+
EOD;
|
547 |
+
}
|
548 |
}
|
549 |
|
550 |
return '<!-- no polldaddy output -->';
|
583 |
|
584 |
extract($args, EXTR_SKIP);
|
585 |
|
|
|
586 |
$title = empty( $instance['title'] ) ? __( 'Top Rated', 'polldaddy' ) : apply_filters( 'widget_title', $instance['title'] );
|
587 |
$posts_rating_id = (int) get_option( 'pd-rating-posts-id' );
|
588 |
$pages_rating_id = (int) get_option( 'pd-rating-pages-id' );
|
589 |
$comments_rating_id = (int) get_option( 'pd-rating-comments-id' );
|
590 |
+
$rating_seq = $instance['show_posts'] . $instance['show_pages'] . $instance['show_comments'];
|
591 |
+
|
592 |
+
$widget = <<<EOD
|
593 |
+
{$before_title}{$title}{$after_title}
|
594 |
+
<div id="pd_top_rated_holder"></div>
|
595 |
+
<script language="javascript" charset="UTF-8" src="http://i.polldaddy.com/ratings/rating-top.js"></script>
|
596 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
597 |
+
PDRTJS_TOP = new PDRTJS_RATING_TOP( {$posts_rating_id}, {$pages_rating_id}, {$comments_rating_id}, '{$rating_seq}', {$instance['item_count']} );
|
598 |
+
//--><!]]></script>
|
599 |
+
EOD;
|
600 |
+
echo $before_widget;
|
601 |
+
echo $widget;
|
602 |
echo $after_widget;
|
603 |
}
|
604 |
|
671 |
}
|
672 |
add_action('widgets_init', create_function('', 'return register_widget("PD_Top_Rated");'));
|
673 |
}
|
674 |
+
?>
|
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
|
@@ -34,7 +34,7 @@ class WP_PollDaddy {
|
|
34 |
global $current_user;
|
35 |
$this->errors = new WP_Error;
|
36 |
$this->scheme = 'https';
|
37 |
-
$this->version = '2.0.
|
38 |
$this->multiple_accounts = true;
|
39 |
$this->polldaddy_client_class = 'api_client';
|
40 |
$this->polldaddy_clients = array();
|
@@ -1191,6 +1191,8 @@ class WP_PollDaddy {
|
|
1191 |
endif;
|
1192 |
|
1193 |
echo do_shortcode( "[polldaddy poll=$poll cb=1]" );
|
|
|
|
|
1194 |
break;
|
1195 |
case 'results' :
|
1196 |
?>
|
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.6
|
10 |
*/
|
11 |
|
12 |
// You can hardcode your PollDaddy PartnerGUID (API Key) here
|
34 |
global $current_user;
|
35 |
$this->errors = new WP_Error;
|
36 |
$this->scheme = 'https';
|
37 |
+
$this->version = '2.0.6';
|
38 |
$this->multiple_accounts = true;
|
39 |
$this->polldaddy_client_class = 'api_client';
|
40 |
$this->polldaddy_clients = array();
|
1191 |
endif;
|
1192 |
|
1193 |
echo do_shortcode( "[polldaddy poll=$poll cb=1]" );
|
1194 |
+
|
1195 |
+
wp_print_scripts( 'polldaddy-poll-js' );
|
1196 |
break;
|
1197 |
case 'results' :
|
1198 |
?>
|
rating.php
CHANGED
@@ -129,18 +129,25 @@ function polldaddy_get_rating_html( $condition = '' ) {
|
|
129 |
*/
|
130 |
function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
|
131 |
$rating_id = absint( $rating_id );
|
132 |
-
|
133 |
$settings = array(
|
134 |
-
'id'
|
135 |
-
'unique_id'
|
136 |
-
'title'=>trim( $title ),
|
137 |
-
'permalink'=>esc_url_raw( $permalink )
|
138 |
);
|
|
|
139 |
if ( !empty( $item_id ) )
|
140 |
$settings['item_id'] = $item_id;
|
141 |
-
|
142 |
-
$
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
return $html;
|
146 |
}
|
129 |
*/
|
130 |
function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
|
131 |
$rating_id = absint( $rating_id );
|
132 |
+
|
133 |
$settings = array(
|
134 |
+
'id' => $rating_id,
|
135 |
+
'unique_id' => $unique_id,
|
136 |
+
'title' => trim( $title ),
|
137 |
+
'permalink' => esc_url_raw( $permalink )
|
138 |
);
|
139 |
+
|
140 |
if ( !empty( $item_id ) )
|
141 |
$settings['item_id'] = $item_id;
|
142 |
+
|
143 |
+
$settings = json_encode( $settings );
|
144 |
+
|
145 |
+
$html = <<<EOD
|
146 |
+
<div class="pd-rating" id="pd_rating_holder_{$rating_id}{$item_id}"></div>
|
147 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
148 |
+
PDRTJS_settings_{$rating_id}{$item_id}={$settings};
|
149 |
+
//--><!]]></script>
|
150 |
+
EOD;
|
151 |
|
152 |
return $html;
|
153 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: eoigal, alternatekev, mdawaffe
|
|
3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
4 |
Requires at least: 2.6
|
5 |
Tested up to: 3.2
|
6 |
-
Stable tag: 2.0.
|
7 |
|
8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
9 |
|
@@ -67,6 +67,9 @@ More info here - http://codex.wordpress.org/Theme_Development#Plugin_API_Hooks
|
|
67 |
You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
|
68 |
|
69 |
== Change Log ==
|
|
|
|
|
|
|
70 |
= 2.0.5 =
|
71 |
* Tested with version 3.2
|
72 |
* Added extra shortcode handler for inline surveys
|
3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
4 |
Requires at least: 2.6
|
5 |
Tested up to: 3.2
|
6 |
+
Stable tag: 2.0.6
|
7 |
|
8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
9 |
|
67 |
You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
|
68 |
|
69 |
== Change Log ==
|
70 |
+
= 2.0.6 =
|
71 |
+
* Tidy up shortcodes - remove keywords from no script tags, inline javascript is now xhtml compatible, load survey and poll javascript files in the footer to assist page load speeds
|
72 |
+
|
73 |
= 2.0.5 =
|
74 |
* Tested with version 3.2
|
75 |
* Added extra shortcode handler for inline surveys
|