WP-Polls - Version 2.75.5

Version Description

Download this release

Release Info

Developer GamerZ
Plugin Icon WP-Polls
Version 2.75.5
Comparing to
See all releases

Code changes from version 2.75.4 to 2.75.5

Files changed (3) hide show
  1. polls-manager.php +0 -10
  2. readme.txt +5 -2
  3. wp-polls.php +45 -62
polls-manager.php CHANGED
@@ -381,12 +381,6 @@ switch($mode) {
381
  <tbody id="manage_polls">
382
  <?php
383
  if($polls) {
384
- if(function_exists('dynamic_sidebar')) {
385
- $options = get_option('widget_polls');
386
- $multiple_polls = explode(',', $options['multiple_polls']);
387
- } else {
388
- $multiple_polls = array();
389
- }
390
  $i = 0;
391
  $current_poll = (int) get_option('poll_currentpoll');
392
  $latest_poll = (int) get_option('poll_latestpoll');
@@ -416,8 +410,6 @@ switch($mode) {
416
  if($poll_id === $latest_poll) {
417
  $style = 'class="highlight"';
418
  }
419
- } else if(in_array($poll_id, $multiple_polls, true)) {
420
- $style = 'class="highlight"';
421
  }
422
  echo "<tr id=\"poll-$poll_id\" $style>\n";
423
  echo '<td><strong>'.number_format_i18n($poll_id).'</strong></td>'."\n";
@@ -430,8 +422,6 @@ switch($mode) {
430
  if($poll_id === $latest_poll) {
431
  echo '<strong>'.__('Displayed:', 'wp-polls').'</strong> ';
432
  }
433
- } else if(in_array($poll_id, $multiple_polls, true)) {
434
- echo '<strong>'.__('Displayed:', 'wp-polls').'</strong> ';
435
  }
436
  echo wp_kses_post( $poll_question )."</td>\n";
437
  echo '<td>'.number_format_i18n($poll_totalvoters)."</td>\n";
381
  <tbody id="manage_polls">
382
  <?php
383
  if($polls) {
 
 
 
 
 
 
384
  $i = 0;
385
  $current_poll = (int) get_option('poll_currentpoll');
386
  $latest_poll = (int) get_option('poll_latestpoll');
410
  if($poll_id === $latest_poll) {
411
  $style = 'class="highlight"';
412
  }
 
 
413
  }
414
  echo "<tr id=\"poll-$poll_id\" $style>\n";
415
  echo '<td><strong>'.number_format_i18n($poll_id).'</strong></td>'."\n";
422
  if($poll_id === $latest_poll) {
423
  echo '<strong>'.__('Displayed:', 'wp-polls').'</strong> ';
424
  }
 
 
425
  }
426
  echo wp_kses_post( $poll_question )."</td>\n";
427
  echo '<td>'.number_format_i18n($poll_totalvoters)."</td>\n";
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: GamerZ
3
  Donate link: https://lesterchan.net/site/donation/
4
  Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
5
  Requires at least: 4.9.6
6
- Tested up to: 5.3
7
- Stable tag: 2.75.4
8
 
9
  Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
10
 
@@ -24,6 +24,9 @@ WP-Polls is extremely customizable via templates and css styles and there are to
24
  I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
25
 
26
  ## Changelog
 
 
 
27
  ### Version 2.75.4
28
  * FIXED: Unable to edit poll because of class-wp-block-parser.php.
29
 
3
  Donate link: https://lesterchan.net/site/donation/
4
  Tags: poll, polls, polling, vote, booth, democracy, ajax, survey, post, widget
5
  Requires at least: 4.9.6
6
+ Tested up to: 5.4
7
+ Stable tag: 2.75.5
8
 
9
  Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
10
 
24
  I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
25
 
26
  ## Changelog
27
+ ### Version 2.75.5
28
+ * NEW: New filter for templates: wp_polls_template_resultheader_markup, wp_polls_template_resultbody_markup, wp_polls_template_resultbody2_markup, wp_polls_template_resultfooter_markup, wp_polls_template_resultfooter2_markup. Props @Jaska.
29
+
30
  ### Version 2.75.4
31
  * FIXED: Unable to edit poll because of class-wp-block-parser.php.
32
 
wp-polls.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Polls
4
  Plugin URI: https://lesterchan.net/portfolio/programming/php/
5
  Description: Adds an AJAX poll system to your WordPress blog. You can easily include a poll into your WordPress's blog post/page. WP-Polls is extremely customizable via templates and css styles and there are tons of options for you to choose to ensure that WP-Polls runs the way you wanted. It now supports multiple selection of answers.
6
- Version: 2.75.4
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: https://lesterchan.net
9
  Text Domain: wp-polls
@@ -29,7 +29,7 @@ Text Domain: wp-polls
29
  */
30
 
31
  ### Version
32
- define( 'WP_POLLS_VERSION', '2.75.4' );
33
 
34
 
35
  ### Create Text Domain For Translations
@@ -409,6 +409,11 @@ function check_voted_username($poll_id) {
409
  add_filter( 'wp_polls_template_voteheader_markup', 'poll_template_vote_markup', 10, 3 );
410
  add_filter( 'wp_polls_template_votebody_markup', 'poll_template_vote_markup', 10, 3 );
411
  add_filter( 'wp_polls_template_votefooter_markup', 'poll_template_vote_markup', 10, 3) ;
 
 
 
 
 
412
 
413
  function poll_template_vote_markup( $template, $object, $variables ) {
414
  return str_replace( array_keys( $variables ), array_values( $variables ), $template ) ;
@@ -571,21 +576,17 @@ function display_pollresult( $poll_id, $user_voted = array(), $display_loading =
571
  }
572
  $poll_multiple_ans = (int) $poll_question->pollq_multiple;
573
  $template_question = removeslashes( get_option( 'poll_template_resultheader' ) );
574
- $template_question = str_replace( array(
575
- '%POLL_QUESTION%',
576
- '%POLL_ID%',
577
- '%POLL_TOTALVOTES%',
578
- '%POLL_TOTALVOTERS%',
579
- '%POLL_START_DATE%',
580
- '%POLL_END_DATE%'
581
- ), array(
582
- $poll_question_text,
583
- $poll_question_id,
584
- $poll_question_totalvotes,
585
- $poll_question_totalvoters,
586
- $poll_start_date,
587
- $poll_end_date
588
- ), $template_question );
589
  if($poll_multiple_ans > 0) {
590
  $template_question = str_replace( '%POLL_MULTIPLE_ANS_MAX%', $poll_multiple_ans, $template_question );
591
  } else {
@@ -634,35 +635,27 @@ function display_pollresult( $poll_id, $user_voted = array(), $display_loading =
634
  }
635
  }
636
 
 
 
 
 
 
 
 
 
 
 
637
  // Let User See What Options They Voted
638
  if ( in_array( $poll_answer_id, $user_voted, true ) ) {
639
  // Results Body Variables
640
  $template_answer = removeslashes( get_option( 'poll_template_resultbody2' ) );
 
641
  } else {
642
  // Results Body Variables
643
  $template_answer = removeslashes (get_option( 'poll_template_resultbody' ) );
 
644
  }
645
 
646
- $template_answer = str_replace( array(
647
- '%POLL_ID%',
648
- '%POLL_ANSWER_ID%',
649
- '%POLL_ANSWER%',
650
- '%POLL_ANSWER_TEXT%',
651
- '%POLL_ANSWER_VOTES%',
652
- '%POLL_ANSWER_PERCENTAGE%',
653
- '%POLL_MULTIPLE_ANSWER_PERCENTAGE%',
654
- '%POLL_ANSWER_IMAGEWIDTH%'
655
- ), array(
656
- $poll_question_id,
657
- $poll_answer_id,
658
- $poll_answer_text,
659
- htmlspecialchars( wp_strip_all_tags( $poll_answer_text ) ),
660
- number_format_i18n( $poll_answer_votes ),
661
- $poll_answer_percentage,
662
- $poll_multiple_answer_percentage,
663
- $poll_answer_imagewidth
664
- ), $template_answer );
665
-
666
  // Print Out Results Body Template
667
  $temp_pollresult .= "\t\t$template_answer\n";
668
 
@@ -683,36 +676,26 @@ function display_pollresult( $poll_id, $user_voted = array(), $display_loading =
683
  }
684
  }
685
  // Results Footer Variables
 
 
 
 
 
 
 
 
 
 
 
 
 
686
  if ( ! empty( $user_voted ) || $poll_question_active === 0 || ! check_allowtovote() ) {
687
  $template_footer = removeslashes( get_option( 'poll_template_resultfooter' ) );
 
688
  } else {
689
  $template_footer = removeslashes( get_option( 'poll_template_resultfooter2' ) );
 
690
  }
691
- $template_footer = str_replace( array(
692
- '%POLL_START_DATE%',
693
- '%POLL_END_DATE%',
694
- '%POLL_ID%',
695
- '%POLL_TOTALVOTES%',
696
- '%POLL_TOTALVOTERS%',
697
- '%POLL_MOST_ANSWER%',
698
- '%POLL_MOST_VOTES%',
699
- '%POLL_MOST_PERCENTAGE%',
700
- '%POLL_LEAST_ANSWER%',
701
- '%POLL_LEAST_VOTES%',
702
- '%POLL_LEAST_PERCENTAGE%'
703
- ), array(
704
- $poll_start_date,
705
- $poll_end_date,
706
- $poll_question_id,
707
- number_format_i18n( $poll_question_totalvotes ),
708
- number_format_i18n( $poll_question_totalvoters ),
709
- $poll_most_answer,
710
- number_format_i18n( $poll_most_votes ),
711
- $poll_most_percentage,
712
- $poll_least_answer,
713
- number_format_i18n( $poll_least_votes ),
714
- $poll_least_percentage
715
- ), $template_footer );
716
  if ( $poll_multiple_ans > 0 ) {
717
  $template_footer = str_replace( '%POLL_MULTIPLE_ANS_MAX%', $poll_multiple_ans, $template_footer );
718
  } else {
3
  Plugin Name: WP-Polls
4
  Plugin URI: https://lesterchan.net/portfolio/programming/php/
5
  Description: Adds an AJAX poll system to your WordPress blog. You can easily include a poll into your WordPress's blog post/page. WP-Polls is extremely customizable via templates and css styles and there are tons of options for you to choose to ensure that WP-Polls runs the way you wanted. It now supports multiple selection of answers.
6
+ Version: 2.75.5
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: https://lesterchan.net
9
  Text Domain: wp-polls
29
  */
30
 
31
  ### Version
32
+ define( 'WP_POLLS_VERSION', '2.75.5' );
33
 
34
 
35
  ### Create Text Domain For Translations
409
  add_filter( 'wp_polls_template_voteheader_markup', 'poll_template_vote_markup', 10, 3 );
410
  add_filter( 'wp_polls_template_votebody_markup', 'poll_template_vote_markup', 10, 3 );
411
  add_filter( 'wp_polls_template_votefooter_markup', 'poll_template_vote_markup', 10, 3) ;
412
+ add_filter( 'wp_polls_template_resultheader_markup', 'poll_template_vote_markup', 10, 3) ;
413
+ add_filter( 'wp_polls_template_resultbody_markup', 'poll_template_vote_markup', 10, 3) ;
414
+ add_filter( 'wp_polls_template_resultbody2_markup', 'poll_template_vote_markup', 10, 3) ;
415
+ add_filter( 'wp_polls_template_resultfooter_markup', 'poll_template_vote_markup', 10, 3) ;
416
+ add_filter( 'wp_polls_template_resultfooter2_markup', 'poll_template_vote_markup', 10, 3) ;
417
 
418
  function poll_template_vote_markup( $template, $object, $variables ) {
419
  return str_replace( array_keys( $variables ), array_values( $variables ), $template ) ;
576
  }
577
  $poll_multiple_ans = (int) $poll_question->pollq_multiple;
578
  $template_question = removeslashes( get_option( 'poll_template_resultheader' ) );
579
+ $template_variables = array(
580
+ '%POLL_QUESTION%' => $poll_question_text,
581
+ '%POLL_ID%' => $poll_question_id,
582
+ '%POLL_TOTALVOTES%' => $poll_question_totalvotes,
583
+ '%POLL_TOTALVOTERS%' => $poll_question_totalvoters,
584
+ '%POLL_START_DATE%' => $poll_start_date,
585
+ '%POLL_END_DATE%' => $poll_end_date
586
+ );
587
+
588
+ $template_question = apply_filters('wp_polls_template_resultheader_markup', $template_question, $poll_question, $template_variables);
589
+
 
 
 
 
590
  if($poll_multiple_ans > 0) {
591
  $template_question = str_replace( '%POLL_MULTIPLE_ANS_MAX%', $poll_multiple_ans, $template_question );
592
  } else {
635
  }
636
  }
637
 
638
+ $template_variables = array(
639
+ '%POLL_ID%' => $poll_question_id,
640
+ '%POLL_ANSWER_ID%' => $poll_answer_id,
641
+ '%POLL_ANSWER%' => $poll_answer_text,
642
+ '%POLL_ANSWER_TEXT%' => htmlspecialchars( wp_strip_all_tags( $poll_answer_text ) ),
643
+ '%POLL_ANSWER_VOTES%' => number_format_i18n( $poll_answer_votes ),
644
+ '%POLL_ANSWER_PERCENTAGE%' => $poll_answer_percentage,
645
+ '%POLL_MULTIPLE_ANSWER_PERCENTAGE%' => $poll_multiple_answer_percentage,
646
+ '%POLL_ANSWER_IMAGEWIDTH%' => $poll_answer_imagewidth
647
+ );
648
  // Let User See What Options They Voted
649
  if ( in_array( $poll_answer_id, $user_voted, true ) ) {
650
  // Results Body Variables
651
  $template_answer = removeslashes( get_option( 'poll_template_resultbody2' ) );
652
+ $template_answer = apply_filters('wp_polls_template_resultbody2_markup', $template_answer, $poll_answer, $template_variables);
653
  } else {
654
  // Results Body Variables
655
  $template_answer = removeslashes (get_option( 'poll_template_resultbody' ) );
656
+ $template_answer = apply_filters('wp_polls_template_resultbody_markup', $template_answer, $poll_answer, $template_variables);
657
  }
658
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  // Print Out Results Body Template
660
  $temp_pollresult .= "\t\t$template_answer\n";
661
 
676
  }
677
  }
678
  // Results Footer Variables
679
+ $template_variables = array(
680
+ '%POLL_START_DATE%' => $poll_start_date,
681
+ '%POLL_END_DATE%' => $poll_end_date,
682
+ '%POLL_ID%' => $poll_question_id,
683
+ '%POLL_TOTALVOTES%' => number_format_i18n( $poll_question_totalvotes ),
684
+ '%POLL_TOTALVOTERS%' => number_format_i18n( $poll_question_totalvoters ),
685
+ '%POLL_MOST_ANSWER%' => $poll_most_answer,
686
+ '%POLL_MOST_VOTES%' => number_format_i18n( $poll_most_votes ),
687
+ '%POLL_MOST_PERCENTAGE%' => $poll_most_percentage,
688
+ '%POLL_LEAST_ANSWER%' => $poll_least_answer,
689
+ '%POLL_LEAST_VOTES%' => number_format_i18n( $poll_least_votes ),
690
+ '%POLL_LEAST_PERCENTAGE%' => $poll_least_percentage
691
+ );
692
  if ( ! empty( $user_voted ) || $poll_question_active === 0 || ! check_allowtovote() ) {
693
  $template_footer = removeslashes( get_option( 'poll_template_resultfooter' ) );
694
+ $template_footer = apply_filters('wp_polls_template_resultfooter_markup', $template_footer, $poll_answer, $template_variables);
695
  } else {
696
  $template_footer = removeslashes( get_option( 'poll_template_resultfooter2' ) );
697
+ $template_footer = apply_filters('wp_polls_template_resultfooter2_markup', $template_footer, $poll_answer, $template_variables);
698
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
699
  if ( $poll_multiple_ans > 0 ) {
700
  $template_footer = str_replace( '%POLL_MULTIPLE_ANS_MAX%', $poll_multiple_ans, $template_footer );
701
  } else {