Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Markus Hermann
wp-polls
Commits
fbdc7a76
Unverified
Commit
fbdc7a76
authored
Dec 23, 2018
by
Lester Chan
Browse files
Fixed Division by zero
parent
fc948921
Changes
1
Hide whitespace changes
Inline
Side-by-side
wp-polls.php
View file @
fbdc7a76
...
...
@@ -470,23 +470,23 @@ function display_pollvote($poll_id, $display_loading = true) {
}
// Print Out Voting Form Header Template
$temp_pollvote
.
=
"
\t\t
$template_question
\n
"
;
foreach
(
$poll_answers
as
$poll_answer
)
{
foreach
(
$poll_answers
as
$poll_answer
)
{
// Poll Answer Variables
$poll_answer_id
=
(
int
)
$poll_answer
->
polla_aid
;
$poll_answer_text
=
wp_kses_post
(
removeslashes
(
$poll_answer
->
polla_answers
)
);
$poll_answer_votes
=
(
int
)
$poll_answer
->
polla_votes
;
$poll_answer_percentage
=
$poll_question_totalvotes
>
0
?
round
(
(
$poll_answer_votes
/
$poll_question_totalvotes
)
*
100
)
:
0
;
$poll_multiple_answer_percentage
=
round
(
(
$poll_answer_votes
/
$poll_question_totalvoters
)
*
100
);
$template_answer
=
removeslashes
(
get_option
(
'poll_template_votebody'
)
);
$poll_multiple_answer_percentage
=
$poll_question_totalvoters
>
0
?
round
(
(
$poll_answer_votes
/
$poll_question_totalvoters
)
*
100
)
:
0
;
$template_answer
=
removeslashes
(
get_option
(
'poll_template_votebody'
)
);
$template_answer
=
apply_filters
(
'poll_template_votebody_markup'
,
$template_answer
,
$poll_answer
,
array
(
$template_answer
=
apply_filters
(
'poll_template_votebody_markup'
,
$template_answer
,
$poll_answer
,
array
(
'%POLL_ID%'
=>
$poll_question_id
,
'%POLL_ANSWER_ID%'
=>
$poll_answer_id
,
'%POLL_ANSWER%'
=>
$poll_answer_text
,
'%POLL_ANSWER_VOTES%'
=>
number_format_i18n
(
$poll_answer_votes
),
'%POLL_ANSWER_VOTES%'
=>
number_format_i18n
(
$poll_answer_votes
),
'%POLL_ANSWER_PERCENTAGE%'
=>
$poll_answer_percentage
,
'%POLL_MULTIPLE_ANSWER_PERCENTAGE%'
=>
$poll_multiple_answer_percentage
,
"
%POLL_CHECKBOX_RADIO%
"
=>
$poll_multiple_ans
>
0
?
'checkbox'
:
'radio'
'
%POLL_CHECKBOX_RADIO%
'
=>
$poll_multiple_ans
>
0
?
'checkbox'
:
'radio'
));
// Print Out Voting Form Body Template
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment